blob_id large_string | repo_name large_string | path large_string | src_encoding large_string | length_bytes int64 | score float64 | int_score int64 | detected_licenses large list | license_type large_string | text string | download_success bool |
|---|---|---|---|---|---|---|---|---|---|---|
b6bee2edb63eaebd09ab8d774ca49d3b35541f4c | AlexGascon/diabetelegram | /diabetelegram/actions/url2pdf_action.py | UTF-8 | 982 | 2.609375 | 3 | [] | no_license | import logging
import os
import re
import requests
from urllib.parse import urlparse, urlunparse
logger = logging.getLogger()
logger.setLevel(logging.INFO)
class Url2PdfAction(BaseAction):
# Matches messages starting with 'http://' or 'https://'
URL_REGEX = r"^(https?://).*"
def matches(self):
r... | true |
1941960d9e28278a99098f21d4de5e0fe4d5e586 | pedrotari7/euler | /050-059/53.py | UTF-8 | 162 | 2.6875 | 3 | [] | no_license | from math import factorial
print len( [(n,r) for n in xrange(23,101) for r in [r for r in xrange(2,n+1) if factorial(n) > (10**6)*factorial(r)*factorial(n-r)]])
| true |
f1d90754323ac398285f08d26cbfaf7599ac00f7 | riskaamalia/python-project | /src/ScrapingLearning/ScapingGetCss.py | UTF-8 | 630 | 3.109375 | 3 | [] | no_license | # just get from this one : https://github.com/REMitchell/python-scraping
# nice right
from urllib.request import urlopen
from urllib.error import HTTPError
from bs4 import BeautifulSoup
def getSpan(url):
try:
html = urlopen(url)
except HTTPError as e:
print("Error url open %s",e.msg)
return None
try:... | true |
65a5b19ccc295a00e65b594071825f39933a9cd3 | kevinwood75/woodez-invest | /app/moveavg/price_changes.py | UTF-8 | 762 | 2.796875 | 3 | [] | no_license | import pandas_datareader as web
import pandas as pd
import numpy as np
#tslaQuote = web.DataReader('TSLA', data_source='yahoo', start='2011-01-01', end='2019-10-31')
#print(tslaQuote)
# stocks =['SPY', 'MSFT', 'SPLK', 'TWLO', 'SNAP', 'NOK', 'BYL.TO', 'CNQ.TO', 'NPI.TO', 'BBD-B.TO']
stocks = ['MSFT']
numAssets = len(st... | true |
b3b87959c58dfe384683cc6885f83fbd0e17b949 | TimOrdo/Advent_of_Code_2019 | /day_03/part_02.py | UTF-8 | 4,860 | 2.875 | 3 | [] | no_license | input_list = list()
first_list = [[0, 0]]
second_list = [[0, 0]]
answer_list = list()
step_list = list()
s_wire_steps = 0
f_wire_steps = 0
with open('input.txt', 'r') as file:
for line in file.read().splitlines():
input_list.append(line.split(','))
for bindex, big_item in enumerate(input_list):
for in... | true |
cb6025500656f320df5b4bd555db4c2c17fb1ddd | ankitbrahmbhatt1997/Python-Datastructures-and-ALgorithms | /codechef_snackdown_2019/Qualifier/practice.py | UTF-8 | 103 | 3.5 | 4 | [] | no_license | arr1 = [1, 2, 3, 4, 5]
arr2 = [1, 2, 3, 4, 5]
if arr1 == arr2:
print("Yes")
else:
print("No")
| true |
57f323a61ef5ca0d81f64b651fb569f0ea344add | github-ChenZe/AlgorithmJ | /AlgorithmMiscellanous/profile.py | UTF-8 | 303 | 3.09375 | 3 | [] | no_license | import Stack
import time
start_time = Stack.Stack()
def fire():
start_time.push(time.time())
def check():
start = start_time.pop()
end = time.time()
print end - start
return end - start
if __name__ == '__main__':
fire()
time.sleep(10)
check()
| true |
b48d9a3d10f8029b29eb8fa0a08cd2814d3fbf94 | AutumnalDream/tartiflette-plugin-scalars | /tartiflette_plugin_scalars/us_currency.py | UTF-8 | 1,977 | 3.46875 | 3 | [
"MIT"
] | permissive | from typing import Union # pylint: disable=unused-import
from tartiflette.constants import UNDEFINED_VALUE
from tartiflette.language.ast import StringValueNode
def _parse_us_currency(value: str) -> int:
if isinstance(value, str):
return float(value[1:]) * 100
raise TypeError(
f"USCurrency ca... | true |
c2d067c5199e621b1159c2a68759011471c155b9 | soarhigh03/baekjoon-solutions | /solutions/prob10820/solution_python.py | UTF-8 | 573 | 3.5 | 4 | [] | no_license | """
Baekjoon Online Judge #10820
https://www.acmicpc.net/problem/10820
"""
lower = 'abcdefghijklmnopqrstuvwxyz'
upper = lower.upper()
numeric = '0123456789'
while True:
try:
S = input()
out = [0] * 4
for c in S:
if c in lower:
out[0] += 1
if c in upp... | true |
dffc2ce389694b8a077fc1223700a13d29e73968 | jamilnyc/mealshare | /lambda/application/deployment_package/preferences.py | UTF-8 | 5,466 | 2.640625 | 3 | [] | no_license | import boto3
from botocore.exceptions import ClientError
from boto3.dynamodb.conditions import Key, Attr
from users import MealShareUsers
class MealSharePreferences:
VALID_DINING_PREFERENCES = ['Pick Up', 'Drop Off', 'Eat Together']
USERS_TABLE_NAME = 'mealshare_users'
PREFERENCES_TABLE_NAME = 'mealshare... | true |
995ffa314ce77a1529b8a8915491d05899a67fcd | pkulwj1994/Spectral-Stein-Gradient | /score_estimator/base.py | UTF-8 | 2,694 | 3.40625 | 3 | [
"MIT"
] | permissive | import torch
from all_types import *
from abc import abstractmethod
class BaseScoreEstimator:
@staticmethod
def rbf_kernel(x1: Tensor,
x2: Tensor,
sigma: float) -> Tensor:
return torch.exp(-((x1 - x2).pow(2).sum(-1))/(2 * sigma ** 2))
def gram_matrix(self,
... | true |
c854911fd6a9e787e6a1422ccce2be528201f5df | Boris-Barboris/PySubs | /engine/SpacialHash.py | UTF-8 | 2,912 | 3.0625 | 3 | [
"Apache-2.0"
] | permissive | # Copyright Alexander Baranin 2016
from sfml.graphics import *
from sfml.system import Vector2
import weakref
# 2D hash intended for GUI and overlay mouse lick handling
# works with static Rectangles. References objects weakly.
class Fixed2DHash:
def __init__(self, global_size, cell_count, origin = Vector2(0.0... | true |
674d959905d287291765287141e313fbbaddc025 | rw86347/behavior-cloning | /deleteData.py | UTF-8 | 4,615 | 2.796875 | 3 | [] | no_license | import csv
import cv2
import numpy as np
import os
import threading
import time
useMyData = True
lines = []
startlocation = "data/data"
if useMyData == True:
startlocation = "training"
csvPath = startlocation+'/driving_log.csv'
with open(csvPath) as csvfile:
reader = csv.reader(csvfile)
for line in rea... | true |
f7faf2bd55b4adf420947085e28ab27329ef0be0 | andrewfeikema/multiplayer-minesweeper | /sweeper.py | UTF-8 | 15,053 | 3.09375 | 3 | [
"MIT"
] | permissive | """This program contains all the helper functions for MSGUI.py"""
import random
from tkinter import Label, StringVar, IntVar, Button
class Sweeper:
def __init__(self, window, width, height, bombnum):
self.window = window
self.width = width
self.height = height
self.flag... | true |
c273cc39bee8e9aa6fac43cb0a32eceb6fb45315 | voaneves/LearningML | /Regression/Energy consumption/GBM_EnergyConsumption.py | UTF-8 | 10,232 | 3.109375 | 3 | [
"MIT"
] | permissive | #!/usr/bin/env python
# Title : Boston_LR.py
# Description : With Linear Regression, we hope to accurately predict the Bos-
# ton Housing prices using ScikitLearn techniques and datasets.
# The algorithm used is the Ordinary Least Squares and in the
# output, we're... | true |
1f81a71c20ff7d1cc0e7564439e0ba7405df095c | joewen85/tutory_python | /ifelse.py | UTF-8 | 468 | 3.796875 | 4 | [] | no_license | # -*- coding: utf-8 -*-
#auther: Joe wen
num1 = input('number 1 is:')
num2 = input('number 2 is:')
#print(num1,'和',num2,'平均值:',(int(num1)+int(num2))/2)
age = int(input('input age:')) #说明:如不变成int type会导致下面判断有问题,因为输入时是当作str type输入
# if num1 == num2:
# print("num1 eq num2")
# else:
# print("num1 ne num2")
if n... | true |
2f6a664840dc3a513efc9fadf938f86948fee450 | augusttown/python.opensource.gis | /gdal2agswps/src/packt/calcFeatureLengths.py | UTF-8 | 2,762 | 2.875 | 3 | [] | no_license | # calcFeatureLengths.py
#import sys
import os
import pyproj
from osgeo import osr
from osgeo import ogr
def getLineSegmentsFromGeometry(geometry):
segments = []
if geometry.GetPointCount() > 0:
segment = []
for i in range(geometry.GetPointCount()):
segment.append(geometry.GetPoint... | true |
e1566b80dc6abfa6b190eae70831d18f7cd952af | Bradysm/daily_coding_problems | /buddyString.py | UTF-8 | 1,550 | 4.40625 | 4 | [
"MIT"
] | permissive | # Hi, here's your problem today. This problem was recently asked by AirBNB:
#Given two strings A and B of lowercase letters, return true if and only if we can swap two letters in A so that the result equals B.
#Example 1:
#Input: A = "ab", B = "ba"
#Output: true
#Example 2:
#input: A = "ab", B = "ab"
#Output: false
... | true |
ace93a44cf14415ba1b3f83e01a22a55456eb5b7 | mpizzzle/cryptopals | /set1/fixed_xor.py | UTF-8 | 152 | 2.75 | 3 | [] | no_license | key = "1c0111001f010100061a024b53535009181c"
msg = "686974207468652062756c6c277320657965"
print ''.join([chr(ord(a) ^ ord(b)) for a, b in zip(key.decode("hex"), msg.decode("hex"))])
| true |
4f2402d4d555dd4e5c9ab7df931fc4438417fa5a | bkoh1782291/bkoh1782291 | /2021/s1/cyber/assignment2/pyscript.py.mine | UTF-8 | 364 | 2.609375 | 3 | [] | no_license | #!/usr/bin/env python3
import sys, socket
socket.setdefaulttimeout(0.1) # set timeout to 100ms
host = ".adelaide.edu.au"
with open('dnsmap.txt', 'r') as Lines:
for line in Lines
try:
line = line.rstrip("\n")
test = line + host
ip = socket.gethostbyname(host)
print(f"{test} resolves to ... | true |
eccfc8363fec99551b664ad2580eb2cdd6286a84 | khannasarthak/codingPrep | /g4g/Amazon/School/check-if-given-four-points-form-a-square.py | UTF-8 | 624 | 3.03125 | 3 | [] | no_license | def dist(a,b):
return ((a[0]-b[0])**2 + (a[1] -b[1])**2)
t = int(input())
while (t!=0):
a = ((input().split()))
print (a)
a = map(int,a)
a = list(a)
k = [a[i:i+2] for i in range(0, len(a), 2)] # Very important, can use it in many many places
p1 = k[0]
p2 = k[1]
p3 = k[2]
p4 = k[3]
d1 = dist(p1,p2)
d2 = dis... | true |
cde67bb607efcc16a514a2cb0c60105401ff526d | gcorreaq/ayudantia_python | /certamenes/c2_2011-2_CV/pregunta_4.py | UTF-8 | 1,778 | 3.640625 | 4 | [] | no_license | # encoding: utf-8
from math import sqrt
def calcular_distancia(cliente, antena):
c_x, c_y = cliente
a_x, a_y = antena
# Esta es la formula de distancia entre dos puntos
return sqrt(((c_x - a_x) ** 2) + ((c_y - a_y) ** 2))
def mejor_antena(antenas, clientes, c):
# Se buscan los datos del client... | true |
4914f5047f37f18ff3e2a8b52f0583edf50f91b9 | Malidrisi/SSW-555-GEDCOM | /US05.py | UTF-8 | 2,238 | 3.203125 | 3 | [] | no_license | import datetime
def marrBeforeDeath(IndList, FamList, wr):
Flag = False
husbliveFlag = True
wifeliveFlag = True
wr.write("\n\nUS05 - Marriage before Death\n")
for fam in FamList:
for i in range(len(fam)):
if (fam[i][0:4]) == "MARR":
marrDate = fam[i][10:]
... | true |
46984ecdf968e548dac599b32875589af20cdf85 | clearholder2001/PanNet-Landsat | /utils/preprocessing.py | UTF-8 | 1,603 | 2.609375 | 3 | [
"MIT"
] | permissive | import cv2
import numpy as np
def prepare_input(pan_arr, ms_arrs, use_original_scale=False):
if use_original_scale:
down_pan_shape = pan_arr.shape
down_pan_arr = pan_arr
down_ms_arrs = ms_arrs
else:
down_pan_shape = ms_arrs[0].shape
down_ms_shape = tuple(np.array(down_p... | true |
7ee243d42b44cdf6839c2d635819b404234164a6 | cmiller8/rainmon | /code/rrd/rrdindex.py | UTF-8 | 5,820 | 2.609375 | 3 | [
"BSD-3-Clause",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | #Copyright (c) 2012, Carnegie Mellon University.
#All rights reserved.
#
#Redistribution and use in source and binary forms, with or without
#modification, are permitted provided that the following conditions
#are met:
#1. Redistributions of source code must retain the above copyright
# notice, this list of co... | true |
81d8f5ad27b454a2f844be1369197226e5b0bc0d | kb0rg/hb_hw05 | /sales_report.py | UTF-8 | 1,678 | 3.9375 | 4 | [] | no_license | """
sales_report.py - Generates sales report showing the total number
of melons each sales person sold.
"""
"""
hw: add commentary
find what's broken and note how to fix it
but also
comment what each part of code does
"""
# initialiaze empty lists
salespeople = []
melons_sold = []
# process data i... | true |
56ab0ff2a675ba66e1a16fbdf394b220770b98e7 | sonibla/pytorch_keras_converter | /pytorch_keras_converter/cadene_to_tf/utils.py | UTF-8 | 5,575 | 4.09375 | 4 | [
"MIT"
] | permissive |
def removeBorderSpaces(inputStr):
"""
Function that removes trailing and leading whitespaces
Argument:
-inputStr (str)
Returns:
A str of inputStr without leading and trailing whitespaces
"""
if len(inputStr) == 0:
return str()
if inputStr[0] == ' ':
return... | true |
b892319904589ca2492ffebd9b1f731619c8c819 | qq915155536/My_Project | /sss/unit/demo1.py | UTF-8 | 562 | 2.59375 | 3 | [] | no_license | # ===========================
# -*- coding:utf-8 -*-
# Time :2021/1/14 15:24
# Author :A0025-江苏-小丹
# QQ:915155536
# File :demo1.py
# ===========================
import threading
from selenium import webdriver
driver1=webdriver.Chrome()
driver2=webdriver.Chrome()
driver3=webdriver.Chrome()
def visit(driver):
dri... | true |
064d625fb7e04008f7eae90d864be9f073a193bb | VishalChak/research | /pyresearch/tutorials/dataloader.py | UTF-8 | 3,462 | 2.65625 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Mon Dec 9 13:46:10 2019
@author: vishal
"""
import torch
import torchvision
import numpy as np
from torchvision import datasets, transforms
from torch.utils.data.sampler import SubsetRandomSampler
def load_split_train_test(datadir, valid_size = .2):
data_transforms = trans... | true |
ef003f1a5ac7d343f809f0b371604f036ac377a2 | pastvir/viromatch | /viromatch/host.py | UTF-8 | 1,472 | 2.90625 | 3 | [
"MIT"
] | permissive | from .lib import Host
import yaml
import shutil
# This code will be executed when the top-most (/bin/viromatch_host) script
# is run. Goals for this function follow.
#
# 1. Collect and evaluate command line arguments.
# 2. Create a new processing/working directory.
# 3. Write an instance configuration file.
# 4. Choo... | true |
1fe13ab2d9d7f884666bd466400e7385e162189d | djxf/TensorFlowLearn | /fillAndCopy.py | UTF-8 | 468 | 3.34375 | 3 | [] | no_license | #fill and copy
#pad, tile, broadcast_to
import tensorflow as tf
a = tf.reshape(tf.range(9), [3, 3])
print(a)
a = tf.pad(a, [[1, 1], [1, 1]])
print(a)
#image padding
#tile:
# * repeat data along dim n times
# * [a, b, c], 2
# * ---> [a, b, c, a, b, c]
# broadcast_to只是一个隐式的复制,并不是真实的复制。而tile是真实的。
print(... | true |
e0c26f5f6ccf188b047182095f1052b5b1822ebb | juandp333/mi_primer_programa | /listando_vocales_y_consonantes.py | UTF-8 | 459 | 4.125 | 4 | [] | no_license | # Crear un progra que cuente el numero de vocales y con sonantes dentro de una frase introducida por el usuario
frase_del_usuar = input("introduce una frase: ").upper()
vocales = ["A", "E", "I", "O", "U"]
n_vocales = 0
n_consunantes = 0
for letra in frase_del_usuar:
if letra in vocales:
n_vocales += 1
... | true |
78b42a9a64ab1be294dee5b90b775b154501256d | just331/CheckersPro | /CheckerPro Library/GUI.py | UTF-8 | 6,509 | 3.03125 | 3 | [] | no_license | from randomPlay import * # Previously created functions
from tkinter import * # For gui stuff
startCell = -1
endCell = -1
startMove = True
endGame = Tk() # Make GUI
output = Tk()
master = Tk() # Make GUI
# Set the window size for the GUI
output.geometry("300x400")
# Create button to end game after win or loss
d... | true |
7d742df6882e4f6f63f0095734ab739bd0629a0d | stnbu/sleepnumber256 | /scripts/deploy.py | UTF-8 | 990 | 2.53125 | 3 | [] | no_license | #!/usr/bin/python3
# Outstanding problem(s)
#
# * If the contract is succesfully deployed and then fund() fails, you'll have a useless contract on the network.
from brownie import SleepNumber256, accounts, network, config, interface
def fund(contract):
dev = accounts.add(config["wallets"]["from_key"])
fee = ... | true |
b9d0b377d817d0925cad939c5df6785da90ec9ce | iopoi/triangulation | /primatives.py | UTF-8 | 31,057 | 3.109375 | 3 | [] | no_license |
# reimplementation of primitive methods from tri.c - http://cs.smith.edu/~jorourke/books/ftp.html
from operator import xor
from math import acos, sqrt, degrees
from tkinter import LAST
X = 0
Y = 1
def Area2(a, b, c):
return (b[X] - a[X]) * (c[Y] - a[Y]) - \
(c[X] - a[X]) * (b[Y] - a[Y])
def AreaSign(a... | true |
732961fdca0cd9f4cd180d374bf226c7382432df | Ethan-23/holberton-system_engineering-devops | /0x16-api_advanced/0-subs.py | UTF-8 | 522 | 2.875 | 3 | [] | no_license | #!/usr/bin/python3
"""Gets number of subscribers a sub reddit has"""
import requests
def number_of_subscribers(subreddit):
url = "https://www.reddit.com/"
headers = requests.utils.default_headers()
headers.update(
{
'User-Agent': 'My User Agent 1.0',
}
)
subs = requests... | true |
7e72347b7c9447f1737a34eac91fd880e813e858 | mowayao/algorithms | /Codeforces Round #324 (Div. 2)/A. Olesya and Rodion.py | UTF-8 | 196 | 2.828125 | 3 | [] | no_license | __author__ = 'mowayao'
n,t = map(int,raw_input().split())
ret = 0
if t==10:
ret = 10**(n-1)
if ret == 1:ret=-1
else:
for i in xrange(n):
ret *= 10
ret += t
print ret | true |
63054e0830a05209b9a827378f9ef9e15a932b71 | Thomas-Carlsen/AdventOfCode | /adventOfCode18/1.py | UTF-8 | 490 | 3.734375 | 4 | [] | no_license |
# Setup
f = open("1.txt",'r')
freqs_result = 0
freqs_results = [0]
freqs = []
for freq in f:
freqs.append(int(freq))
freqs_result = freqs_result + int(freq)
freqs_results.append(freqs_result)
# First star
print("First Star:", sum(freqs))
# Second star
done = False
while not done:
for freq in ... | true |
a480614c27ebd1607a086305de530e5c1bab5636 | Yoo-su/python-algorithm | /슬라이딩 윈도우/슬라이딩 윈도우_LeetCode_76.py | UTF-8 | 1,035 | 3.546875 | 4 | [] | no_license | from collections import Counter
class Solution:
def minWindow(self, s: str, t: str) -> str:
#필요한 문자 각각의 개수
need=Counter(t)
#필요한 문자 전체 개수
missing=len(t)
left=start=end=0
for right, char in enumerate(s,1):
missing-=need[char]>0
need[c... | true |
8ca21eead2e0bd9f1a14cbcae844a3e756449b0c | lneisenman/seeg | /src/seeg/epi_index.py | UTF-8 | 7,128 | 2.671875 | 3 | [
"BSD-3-Clause"
] | permissive | # -*- coding: utf-8 -*-
""" Calculate epileptogenicity index as per Bartolomei, Brain 131:1818 2008
"""
from typing import Sequence, Tuple
import warnings
from mne.io import Raw
import numpy as np
import numpy.typing as npt
import pandas as pd
from . import utils
def calc_ER(raw: Raw, low: Sequence = (4, 12), hig... | true |
95c63ee91a05b19f1f59e71cef818c57f2be8bac | gngdb/holo-nets | /tests/test_train.py | UTF-8 | 2,756 | 3.0625 | 3 | [
"MIT"
] | permissive | #!/usr/bin/env python
##############################
# Tests for the train module #
##############################
import unittest
import mock
import pytest
import numpy as np
from .context import holonets
class TestHolonetsTrain(unittest.TestCase):
"""
Test to ensure that the train class is able to take so... | true |
c5f6c175b2f3feee741ea0f805288f2122d0a371 | rafaelperazzo/programacao-web | /moodledata/vpl_data/45/usersdata/84/15512/submittedfiles/lista1.py | UTF-8 | 351 | 3.03125 | 3 | [] | no_license | # -*- coding: utf-8 -*-
from __future__ import division
n=input('digite o valor:')
l=[]
for i in range(0,n,1):
l.append(input('digite o numero:'))
sp=0
si=0
cp=0
ci=0
for i in range(0,n,1):
if l[i]%2==0:
sp=sp+(l[i])
cp=cp+1
else:
si=si+(l[i])
ci=ci+1
print si
pri... | true |
37301ef05cbf032b05029aa3005660c4bfef95fb | whelanj/Bomb-Squad | /Project_Model_Basic.py | UTF-8 | 5,823 | 3.03125 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Wed Apr 29 16:03:27 2020
@author: jwhel
"""
# Documentation
# The University of Texas at Austin - Spring 2020
# ME 337G - Nuclear Safety and Security - Dr. HAAS, Derek
# Team 7 - Bomb Squad - INANC, Ece Shelby WHELAN, Jack
# This code uses the Bateman equation ... | true |
3d92efcd26a64d1be85c867c0cb7a47d7f41b44b | peterhinch/micropython-async | /v3/as_drivers/sched/crontest.py | UTF-8 | 3,673 | 2.90625 | 3 | [
"MIT"
] | permissive | # crontest.py Now works under Unix build
# Copyright (c) 2020-2023 Peter Hinch
# Released under the MIT License (MIT) - see LICENSE file
from time import time, ticks_diff, ticks_us, localtime, mktime
from sched.cron import cron
import sys
maxruntime = 0
fail = 0
# Args:
# ts Time of run in secs since epoch
# exp Ex... | true |
91b51576800ff36a9c169c502d74f589b6316744 | aweffr/auto-grid | /abaqus_api/post.py | UTF-8 | 4,610 | 2.609375 | 3 | [] | no_license | # -*- coding:utf-8 -*-
# odbProcessor.py
# 本脚本用于得到边界点和内部点的后处理(位移)数据。
# 对于边界点,数据格式为np.array(), (original, original, deformed)
# 对于内部点,数序格式为np.array(), (deformed, deformed, deformed)
import shelve
import json
from odbAccess import *
from numpy import array, array2string, std, zeros
import os
def isSamePoint(point1, po... | true |
2e01754c05a8b27589999b379147465a3f5e1bba | dsp6414/demonet | /demonet/modeling/box_heads/box_utils.py | UTF-8 | 3,361 | 2.6875 | 3 | [
"Apache-2.0"
] | permissive | import math
import numpy as np
import torch
def xywha_to_xyxy(boxes):
""" Convert BoxMode of boxes from XYWHA_REL to XYXY_REL.
Args:
boxes (Tensor): XYWHA_REL BoxMode
default BoxMode from priorbox generator layers.
Return:
boxes (Tensor): XYXY_REL BoxMode
"""
return to... | true |
b68ecb096260f6d6cda7c6be0d3fa483d0db2e46 | rubanik/Python_For_Work | /Boss Injection/patterns.py | UTF-8 | 65,528 | 2.515625 | 3 | [] | no_license | #GOOD PATTERNS:
# Приветствие в офисе - 45,0,21,186
good_0 = [makeItPast(currDate,getDelta()).date(), # AuditDate ДАТА АУДИТА
makeItPast(currDate,getDelta()).time(), # AuditTime ВРЕМЯ АУДИТА
50510636, # ObserverID ТАБЕЛЬНЫЙ НОМЕР - ВСЕГДА 50510636
28, ... | true |
af6b83a2dbf2937775aa11f7f4bc7e99b5a4915e | DubeyJacob/R1-peer-review-DubeyJacob | /novel.py | UTF-8 | 7,041 | 3.546875 | 4 | [
"MIT"
] | permissive | #!/usr/bin/python3
import sys
assert sys.version_info >= (3,4), 'This script requires at least Python 3.4'
world = {"start":{"description":"You are at a rest stop in space",
"options":["You go into the tavern","You go back on your ship","You explore the planet"],
"results":["... | true |
44634f36c086c05c379c18878a3a60d89314234f | parappayo/Bushido-Burrito | /skunk/python/lisp/lis_test.py | UTF-8 | 922 | 3.15625 | 3 | [] | no_license | import unittest, lis
class TestEval(unittest.TestCase):
def test_add(self):
self.assertEqual(lis.eval_str("(+ 1 2)"), 3)
def test_sub(self):
self.assertEqual(lis.eval_str("(- 1 2)"), -1)
def test_mul(self):
self.assertEqual(lis.eval_str("(* 2 3)"), 6)
def test_div(self):
self.assertEqual(lis.eval_str("... | true |
f5fcd3ebe13913f52561937e13d396432ba1c853 | MasudHaider/Think-Python-2e | /Exer-10-10.py | UTF-8 | 600 | 4.0625 | 4 | [] | no_license | def make_word_list():
word_list = []
fin = open('words.txt')
for line in fin:
word = line.strip()
word_list.append(word)
return sorted(word_list)
def in_bisect(seq, value):
if len(seq) == 0:
return False
length = len(seq) // 2
if seq[length] == value:
retur... | true |
1b14638556c8aa2a4802ce68a29f9bbb50195caa | Janna112358/study-stuff | /apple2.py | UTF-8 | 1,504 | 3.71875 | 4 | [] | no_license | print 'Only yes and no answers, please.'
ans1 = raw_input('Do you like pie?: ')
while ans1 != 'yes':
if ans1 == 'no':
ans2 = raw_input('Are you sure?: ')
if ans2 == 'no':
ans1 = raw_input('Do you like pie?: ')
elif ans2 == 'yes':
print "No you're not"
... | true |
b23b92e33565320860b62a11a019bab90269b219 | SaraMo14/Progetto-Ingegneria-del-Software | /GestoreMuseiPRO/Login/ControllerLogin/GestioneLogin.py | UTF-8 | 3,701 | 2.6875 | 3 | [] | no_license | import hashlib, os
from sqlite3 import Error
from password_strength import PasswordPolicy
from Login.ModelLogin.Login import Login
from database.MyDB import db
# classe per la gestione dell'accesso degli utenti all'interno del programma, dalla verifica delle credenziali
# alla corretta definizione dei privilegi e pe... | true |
50edcdf54c3ce965b9ef10dea74fc2f3074ffbfd | Samothrace-Shaddam/expense_tracker | /new_mon.py | UTF-8 | 2,052 | 4.28125 | 4 | [] | no_license | """
Accepts date input, checks that it is correct and returns the date as a list.
TODO:
Change functionality to eliminate the initialization of weeks, instead,
simply check that dates are valid and store information for them.
"""
import datetime
def date_input():
"""Check that date input is correct and r... | true |
98e2477bd522f6635a335c721824361c9e4de9d3 | AlDante/nanobodies_dla | /utils_tf.py | UTF-8 | 4,205 | 2.5625 | 3 | [] | no_license | """
Copyright 2020 - by Lirane Bitton (liranebitton@gmail.com)
All rights reserved
Permission is granted for anyone to copy, use, or modify this
software for any uncommercial purposes, provided this copyright
notice is retained, and note is made of any changes that have
been made. This softwa... | true |
6d10119125def7436d79e4d769ddfa50d15a06b3 | songweizhi/FlowCellBiofilm | /Temp/Test_7.py | UTF-8 | 6,866 | 2.625 | 3 | [] | no_license |
import os
from Bio import SeqIO
from Bio.Seq import Seq
from Bio.Alphabet import IUPAC
from Bio.SeqRecord import SeqRecord
import matplotlib as mpl
mpl.use('Agg')
import matplotlib.pyplot as plt
import pylab
import numpy as np
from datetime import datetime
def get_refseq_id_and_len(ref_in):
refseq_id_list = []
... | true |
b9c253f0346fb95704b71272d87cda078e907027 | lilyandcy/pyLearn-1 | /if2_Learn.py | UTF-8 | 173 | 3.140625 | 3 | [] | no_license | #seek for domain
x = input()
y = input()
if x>=0:
if y>=0:
print '1'
else:
print '4'
else:
if y>=0:
print '2'
else:
print '3' | true |
c23d70cc4a5cfb667e93624907c8bae50ca9df4f | MrHamdulay/csc3-capstone | /examples/data/Assignment_8/dsxriy002/question4.py | UTF-8 | 1,533 | 3.90625 | 4 | [] | no_license | #Question 4 - Assignment 8
#Riya Desai
#8 May 2014
import math
import sys
#define a limit that allows for higher numbers to be dealt with
sys.setrecursionlimit (30000)
#define function "Pal"
def pal(s,test):
if(len(str(s))!=1):
#find the last number
lastnumber=s%10
... | true |
bc38cd7462e161c9c6b407d696e7593cb144a4cb | thomasDOTwtf/icvpn-scripts | /mkdns | UTF-8 | 4,718 | 2.65625 | 3 | [] | no_license | #!/usr/bin/env python
import os
import yaml
from textwrap import dedent
from optparse import OptionParser
from socket import AF_INET, AF_INET6, inet_pton
class Formatter(object):
"""
Abstract class to define the interface for formatters.
"""
def __init__(self):
"""
Initialize formatte... | true |
f63be0ba5c2e0a790bfe240f0edf8f760d790a7c | srikanteswartalluri/pyutils | /pythontraining/day2.py | UTF-8 | 234 | 2.859375 | 3 | [
"ISC"
] | permissive | __author__ = 'talluri'
def foo(a,b,*args, **kwargs1):
print kwargs1
print args
print type(args)
print type(kwargs1)
print "#"*50
foo(1,2)
foo(a=3, b=4)
foo(3,5,6,k=55,r=44)
#foo(a=3, b=4,5,6,c=4,f=6)
#foo(t=5,3)
| true |
20cf60cd483b3a3688b0abbc79b0f6ca9e400e99 | cajopa/adventofcode | /2015/day12.py | UTF-8 | 1,406 | 3.265625 | 3 | [] | no_license | import json
import re
import sys
from collections import Mapping, Sequence
if sys.version_info.major < 3:
raise ImportError('requires Python 3')
DEBUG=False
def run1(input_filename='input/day12'):
with open(input_filename, 'r') as f:
return sum(map(int, re.findall(r'\-?\d+', f.read())))
def run2(... | true |
b336f3ab6b9a09276cd6ffec16f809203adbcf9b | almamuncsit/Basic-Python | /03 string/as_array.py | UTF-8 | 115 | 3.625 | 4 | [] | no_license | str = "Bangladesh"
print(str[0])
print(str[1])
# Sub string
print(str[1:6])
print(str[:3])
print(str[4:])
| true |
15431e8f873ef33d046ae7d78fe766671c6bdfc1 | zzhyzzh/Leetcode | /leetcode-algorithms/046. Permutations/permute.py | UTF-8 | 635 | 3.484375 | 3 | [] | no_license | class Solution(object):
def permute(self, nums):
"""
:type nums: List[int]
:rtype: List[List[int]]
"""
combi_list = []
if nums == []:
return []
if len(nums) == 1:
return [nums]
else:
permute_list = self.permute(nums... | true |
063ecd5ebd9847dd7d02abceecc6eb498fd0b0e1 | nurxx/python-101 | /week02/cat2.py | UTF-8 | 204 | 2.828125 | 3 | [] | no_license | # cat2.py
import sys
from cat import *
def cat2(arguments):
for argument in arguments:
cat(argument)
print()
def main():
cat2(sys.argv[1:])
if __name__ == '__main__':
main()
| true |
a01e21ee2151277ceef4e6f580048ff6ee4fa2b3 | akuchlous/leetcode | /997.py | UTF-8 | 707 | 3.109375 | 3 | [] | no_license | from collections import defaultdict
import pdb
class Solution(object):
def findJudge(self, N, trust):
"""
:type N: int
:type trust: List[List[int]]
:rtype: int
"""
trustMap = {}
allP = set()
for l in trust:
pdb.set_trace()
[person, p... | true |
1bfa41bc31104cea60b18497eaa72d79cdee4326 | tnqls1002gh/2020python | /st01.Python기초/py02프로그래밍기초/py02_08ex3_print.py | UTF-8 | 185 | 3.328125 | 3 | [] | no_license | # 표준출력 print() 에서 줄바꿈을 공백으로 바꾸기
x = ('a b c d e f')
print ("a\nb\nc\nd\ne\nf")
print (x)
# 디폴트 매개변수
# 키워드 매개변수
# | true |
e1302169102b2b72a05915814a26c90c9ac9184a | Aasthaengg/IBMdataset | /Python_codes/p02419/s408604323.py | UTF-8 | 194 | 3.0625 | 3 | [] | no_license | W = input()
lis = []
cot = 0
while True:
x = input().split()
if x == ["END_OF_TEXT"]:
break
lis += x
for y in lis:
if y.lower() == W:
cot += 1
print(str(cot))
| true |
28b2b84c8598cd3f14b561544f4e0bbf125ba468 | P-ws/Algorithm | /3반/simple_sort_class3.py | UTF-8 | 3,769 | 3.09375 | 3 | [] | no_license | def insertion_sort(num_list):
bef_n_list = num_list.copy()
o_cnt = 0
for idx in range(len(bef_n_list)):
print(f"{idx}번째: {bef_n_list}")
# 1)
# now_idx = idx
# while now_idx > 0 and bef_n_list[now_idx-1] > bef_n_list[now_idx]:
# # t = bef_n_list[... | true |
7cee288d4980c35436e964b69439717751c27705 | baloothebear4/mDisplay | /frontpanel.py | UTF-8 | 8,642 | 2.5625 | 3 | [] | no_license | #!/usr/bin/env python
#
# mVista Project
#
# v0.1 Baloothebear4 10/11/15
#
# Module : frontpanel.py
# Purpose: encapsulates the Hardware control device interface and presents the button and rotary
# devises as virtual controls that trigger events. The display application manages the
# context of the controls.
#... | true |
4908a4fe669cc64c3ddfb013a9e0300c9b5f11c2 | 8BitFishy/Octavius | /Interpret_Commands.py | UTF-8 | 6,439 | 2.71875 | 3 | [] | no_license | import Format_Manager
import random
#import Arduino_Manager
import List_Manager
import Command_List
def commandhandler(text, Octavius_Vocab, Octavius_Lists, Octavius_Grammar, Octavius_Receiver, Octavius_Camera_Manager, Octavius_RF_Manager):
inputcommand = Format_Manager.lowercase_word(text)
#If received ... | true |
5de24d73cad050ce12f2666f31a1d1e939eb215f | Miguel235711/Competitive-Programming-3-Solutions-by-Miguel-Mu-oz- | /Section 1.4/Palidromes/11221 - Magic square palindromes./Python/main.py | UTF-8 | 689 | 3.140625 | 3 | [] | no_license | from sys import stdin
import math
sqrtLength = int()
def specialPos(i):
return sqrtLength * (i%sqrtLength) + i // sqrtLength
def magicPalindrome(s):
for i1 in range(len(s)):
i3,i2=len(s)-1-i1,specialPos(i1)
i4 = specialPos(i3)
if s[i1]!=s[i2] or s[i1]!=s[i3] or s[i1]!=s[i4]:
... | true |
3135474f204397d4799c1845f6032310ccc3922d | amiya912/PES1-PythonAssignment-SET1 | /program15.py | UTF-8 | 573 | 4.8125 | 5 | [] | no_license | '''
Create a list of 5 names and check given name exist in the List.
a) Use membership operator (IN) to check the presence of an element.
b) Perform above task without using membership operator.
c) Print the elements of the list in reverse direction.
'''
names=['Amy','Billy','Charlie','Dante','Elliot']
search=input('en... | true |
101a8b0823c7c03a5f36f04a6a8ae1a9ad7d2df9 | ClickHouse/ClickHouse | /tests/ci/git_helper.py | UTF-8 | 5,680 | 2.640625 | 3 | [
"Apache-2.0"
] | permissive | #!/usr/bin/env python
import argparse
import logging
import os.path as p
import re
import subprocess
from typing import Any, List, Optional
logger = logging.getLogger(__name__)
# ^ and $ match subline in `multiple\nlines`
# \A and \Z match only start and end of the whole string
RELEASE_BRANCH_REGEXP = r"\A\d+[.]\d+\Z... | true |
201af1d07fb23ef504f2fba0e2ac1686214497fa | kykrueger/openbis | /openbis_all/source/python/nightly_upgrade/run_archived_installer.py | UTF-8 | 1,747 | 2.78125 | 3 | [
"Apache-2.0"
] | permissive | #!/usr/bin/env python
"""Run a .tar.gz installer.
Unpack the installer, run it, and then clean up.
"""
import subprocess
import json
import os.path
import glob
import shutil
def setup_and_preflight():
"""Define global variables and check that the environment is correct"""
global dest_dir
global installer, in... | true |
a51bbb47898e48fc79e603e4b588648cfc4213d0 | zalando-stups/httpie-zign | /httpie_zign.py | UTF-8 | 1,070 | 2.625 | 3 | [
"Apache-2.0"
] | permissive | """
STUPS Zign OAuth plugin for HTTPie.
"""
from httpie.plugins import AuthPlugin
import zign.api
__version__ = '0.2'
__author__ = 'Henning Jacobs'
__licence__ = 'Apache 2.0'
class InvalidZignToken(Exception):
def __init__(self, token_name):
self.token_name = token_name
def __str__(self):
... | true |
aad462140cf2ce8e2c6c4f2a0973a150b7e9f1f3 | PrimeIdeal/Fundamentals | /python/tests/test_LRU_cache.py | UTF-8 | 1,038 | 3.21875 | 3 | [] | no_license | import pytest
from python.structures.LRU_cache import LRU_cache
class TestLRUCache:
"""
Test class for the LRU_cache class.
"""
@pytest.fixture(scope='class')
def update_cache(self):
cache = LRU_cache()
yield cache
@pytest.mark.parametrize(
'elt',
[2, 7, 2]
... | true |
48f39f11d01a30c0dace922cd40b9cfc54d55605 | ninoNinkovic/StoryTime | /StoryTimeModules/Projects.py | UTF-8 | 1,987 | 2.671875 | 3 | [] | no_license | import cherrypy
class Projects(object):
exposed = True
def __init__(self, sql):
super(Projects, self).__init__()
self.sql = sql
@cherrypy.tools.accept(media='text/plain')
@cherrypy.tools.json_out()
def GET(self, listAll=0):
if listAll == 0:
# deal with sessions
if 'projid' not in cherrypy.session:
... | true |
bd77852088a84fa733e5c6b2406e4e3fae72b87e | ypmoraes/Curso_em_video | /ex015.py | UTF-8 | 236 | 2.921875 | 3 | [] | no_license | dias=int(input('Informe a quantidade de dias que vc passou com o carro:'))
km=float(input(('Informe a quantidade de KM que vc rodou:')))
vdias=(dias * 60)
vkm=(km * 0.15)
vfinal=(vdias + vkm)
print(('Tu gastou R$: {}' .format(vfinal))) | true |
a2eb9356b4a180eecdaf17c96f6e57c77077aeae | jersaal/img_pipe_subf | /surface_warping_scripts/make_elec_label.m | UTF-8 | 2,595 | 2.6875 | 3 | [] | no_license | function [] = make_elec_label(elecmatrix, cortex, subject, hem, labelprefix,fsdir)
% function [] = make_elec_label(elecmatrix, subject, hem, labelnameprefix)
% Create a freesurfer label for each electrode in an electrode matrix
%
% Inputs:
% elecmatrix: [n x 3] matrix of electrode coordinates (usu. in nativ... | true |
03be8bb5678b80c0d930ce1ad269e69a0d917fdd | alexbrozovich/FiveThirtyEightSoccer | /fivethirtyeight.py | UTF-8 | 3,053 | 3.125 | 3 | [] | no_license | from bs4 import BeautifulSoup
from requests import get
import datetime
import pandas as pd
def getSoccer(url, chosenLeague='ANY', year=str(datetime.date.today().year), month=str(datetime.date.today().month), day=str(datetime.date.today().day)):
##Convert the given date to a string that will match the... | true |
74e697eb099b513ecf36fbd1fec6712aac22786c | Aasthaengg/IBMdataset | /Python_codes/p03001/s638980516.py | UTF-8 | 173 | 3.0625 | 3 | [] | no_license | w, h, x, y = map(int, input().split())
ans1 = w*h/2
if w % 2 != 0 or h % 2 != 0:
print(ans1, 0)
elif x == w//2 and y == h//2:
print(ans1, 1)
else:
print(ans1, 0) | true |
4bef914d8dbe42420f8e46e81497c7e9e0adb81f | juan-sv/katib | /TransferLearning/main.py | UTF-8 | 2,916 | 2.5625 | 3 | [] | no_license | import argparse
from tensorflow.keras.applications.vgg16 import VGG16
from tensorflow.keras.applications.nasnet import NASNetMobile
from tensorflow.keras.layers import Input, Dense, Flatten
from tensorflow.keras.models import Model
from tensorflow.keras.utils import to_categorical
from tensorflow.keras.datasets import ... | true |
6b18af0aa3805c85a17cffac5646a4356cad0350 | jarad/dep | /scripts/cligen/add_new_year.py | UTF-8 | 1,986 | 2.9375 | 3 | [
"MIT"
] | permissive | """Add additional year to the climate files
python add_new_year.py <scenario> <year_to_add>
The previous year is choosen based on if the year to add is a leap year or not,
if it is, then pick a year four years ago, if it isn't, use last year
"""
import glob
import sys
import os
import subprocess
from tqdm import... | true |
60c064dfa2946ef1a087f55bdc92ea6d8bd1d9f1 | kji0205/py | /CHAPTER06/bw46.py | UTF-8 | 1,431 | 3.296875 | 3 | [] | no_license | import logging
from pprint import pprint
from sys import stdout as STDOUT
from collections import deque
from random import randint
a = {}
a['foo'] = 1
a['bar'] = 2
while True:
z = randint(99, 1013)
b = {}
for i in range(z):
b[i] = i
b['foo'] = 1
b['foo'] = 2
for i in range(z):
del b[i]
if str(b) != str(a)... | true |
0ee22bfa33e07c50828deb7ded844c446ab9e5f3 | khalilhajji/discovering_user_habbits_from_smartphone_logs | /external_attachements/src/data_exploration/observation_period_and_num_records/records_num_and_duration_one_user.py | UTF-8 | 1,398 | 3.15625 | 3 | [] | no_license | '''
see how many records does it have and how long is the period of this observation for one given user(the id of
the user is given as argument)
'''
#!/usr/bin/env python
import sys
import json
import os
import datetime
from pprint import *
sys.path.insert(0, "/home/dehajjik/workspace/src/utils")
from dat... | true |
d681f71f8943b61d69a08deff445db342e9b87eb | charlesreid1/probability-puzzles | /scripts/painting_puzzle.py | UTF-8 | 1,296 | 4.6875 | 5 | [] | no_license | # Painting Puzzle
# You play a game with four balls: One ball is red, one is blue,
# one is green and one is yellow. They are placed in a box.
# You draw a ball out of the box at random and note its color.
# Without replacing the first ball, you draw a second ball and
# then paint it to match the color of the first. Re... | true |
6aba0cb1eef87294239d598258f8d46610704587 | C0RVU55/python | /pythonworkspace/pygame_basic/6_collision.py | UTF-8 | 3,762 | 3.28125 | 3 | [] | no_license | import pygame
pygame.init()
screen_width=480
screen_height=640
screen=pygame.display.set_mode((screen_width, screen_height))
#화면타이틀
pygame.display.set_caption("LDH GAME")
#frame per second
clock=pygame.time.Clock()
#배경 이미지 불러오가
background=pygame.image.load("C:/Users/LeeDahyeon/Desktop/pythonworkspace/pygame_basic/b... | true |
d18aa0ee54d31b929c44c780507f51c3a8e23900 | IamA1536/Execrise | /com/a/example02/IndividualTaxCalcutionExample.py | UTF-8 | 370 | 3.125 | 3 | [] | no_license | pro = int(input("input profit:"))
sum = 0
thresholds = [100000, 100000, 200000, 200000, 400000]
rates = [0.1, 0.075, 0.05, 0.03, 0.01]
for i in range(len(thresholds)):
if pro <= thresholds[i]:
sum += pro * rates[i]
pro = 0
break
else:
sum += thresholds[i] * rates[i]
pro -... | true |
8dd07304b17a890a7b70094998a18e703410f6c0 | salahuddin975/traceroute | /geolocation.py | UTF-8 | 1,349 | 2.828125 | 3 | [] | no_license | import geocoder
from geopy.geocoders import Nominatim
import pycurl
from StringIO import StringIO
def get_organization_name(ip_addr):
url = 'https://ipinfo.io/' + ip_addr
buffer = StringIO()
c = pycurl.Curl()
c.setopt(c.URL, url)
c.setopt(c.WRITEDATA, buffer)
c.perform()
c... | true |
23b802efd449b8afa896f16990035cba104833b0 | dr-dos-ok/Code_Jam_Webscraper | /solutions_python/Problem_116/1505.py | UTF-8 | 2,258 | 2.90625 | 3 | [] | no_license | import os
import re
import sys
import time
print (time.strftime('%d/%m/%y %H:%M;%S',time.localtime()))
inputFile = "E:/Workspaces/codeJam/A-large.in"
outputFile = "E:/Workspaces/codeJam/output.txt"
file = open(inputFile, "r")
fileout = open(outputFile, "w")
#READ COUNT
countCase = int(file.readline()... | true |
841891a3c095d5fe2aadacb23f3aaa1df61fd895 | m-vdb/gooddata-python | /gooddataclient/migration/engine.py | UTF-8 | 2,573 | 2.859375 | 3 | [] | no_license | import os
from gooddataclient.columns import Date
from gooddataclient.migration.actions import AddColumn, AddDate, DeleteColumn, AlterColumn
from gooddataclient.migration.chain import MigrationChain
class MigrationEngine(object):
"""
A class to generate a migration chain from a comparison
between the sta... | true |
7e28a8d09da0c63b06fe6cffdb73190c6db793d8 | RiveTroy/Learning_Python | /How to think like Computer Scientist/Conditional_Continued.py | UTF-8 | 1,053 | 4.59375 | 5 | [] | no_license | ''' Conditional Continued '''
# Nested Conditionals#
'''One conditional can also be nested within another.
if x < y:
print("x is less than y")
else:
if x > y:
print("x is greater than y")
else:
print("x and y must be equal")
'''
x = 10
y = 10
if x < y:
print("x is less than y")
else... | true |
996b82dea2588a756d94513b677e90cf4d16a5cc | seocam/sudoku-solver | /tests/test_game.py | UTF-8 | 6,905 | 3.140625 | 3 | [] | no_license |
import io
import unittest
from sudoku import parse_input, Game
class TestGame(unittest.TestCase):
def setUp(self):
matrix = [
[0, 7, 0, 0, 0, 0, 0, 0, 0],
[0, 0, 0, 0, 0, 0, 0, 0, 0],
[0, 0, 0, 0, 0, 0, 0, 0, 0],
[0, 0, 0, 0, 0, 0, 0, 0, 0],
... | true |
ca8bfd44f8064aef57a0c46fca29378455db3ade | Anirudh314/machine_learning | /knn/knn_accuracy.py | UTF-8 | 743 | 3.015625 | 3 | [] | no_license | from sklearn import datasets
from sklearn.metrics import confusion_matrix
from sklearn.model_selection import train_test_split
# loading the iris dataset
iris = datasets.load_iris()
# X -> features, y -> label
X = iris.data
y = iris.target
# dividing X, y into train and test data
X_train, X_test, y_train, y_test ... | true |
56cb37a36a1e4372f9a50190e580d54c7f43ae08 | Koweiyi/WebSpiderLearning | /01-urllib的使用/07-HTTPError的使用.py | UTF-8 | 203 | 2.6875 | 3 | [] | no_license | from urllib.request import urlopen
from urllib.error import HTTPError
try:
resp = urlopen("http://cuiqingcai.com/index.html")
except HTTPError as e:
print(e.reason, e.code, e.headers, sep='\n')
| true |
539026f0e17633a2b8ca00c9fe0ed6c9847d4b11 | rheehot/ProblemSolving_Python | /leetcode_reverse-string2.py | UTF-8 | 424 | 2.984375 | 3 | [] | no_license | '''
Problem Solving leetcode reverse-string2
Author: Injun Son
Date: October 9, 2020
'''
import sys
from collections import deque
from typing import Deque, List
sys.setrecursionlimit(100000)
from collections import deque
import collections
import re
def reverseString(s: List[str]) -> None:
left, right = 0, len(s)... | true |
6239e7fc4e8bbced1db2825edf2d5ecd93f7a52e | Aasthaengg/IBMdataset | /Python_codes/p03963/s526498103.py | UTF-8 | 70 | 2.65625 | 3 | [] | no_license | N,K=input().split()
N=int(N)
K=int(K)
y=int(K*(K-1)**(N-1))
print(y) | true |
1aa3c97772cf14813740339e31ad09781856ed0e | Rostik-101/Al-mova-python | /pr1/до завдання 4.py | UTF-8 | 683 | 3.5625 | 4 | [] | no_license | tip = 14
tax = 18
dish = input('Назва страви: ')
portions = int(input('Кількість порцій: '))
price = float(input('Ціна за порцію: '))
podatok = (price * portions * tax) / 100
chayovi = (price * portions * tip) / 100
suma = price * portions + podatok + chayovi
print('Податок до страви: {:.2f}'.format(podatok))
print('Ча... | true |
4d4202501132706c450078ed7d919805cd9127be | ChrisLiu95/Leetcode | /easy/Third_Maximum_number.py | UTF-8 | 1,337 | 3.765625 | 4 | [] | no_license | """
Given a non-empty array of integers, return the third maximum number in this array.
If it does not exist, return the maximum number. The time complexity must be in O(n).
Example 1:
Input: [3, 2, 1]
Output: 1
Explanation: The third maximum is 1.
Example 2:
Input: [1, 2]
Output: 2
Explanation: The third maximum ... | true |
4dd87df16767597090fd2c3bbab6db856544462f | marcusreaiche/cpython-book-samples | /32/user.py | UTF-8 | 369 | 2.9375 | 3 | [
"CC0-1.0"
] | permissive | __all__ = ['User']
class User(BaseUser):
name: 'str' = ""
login: 'str' = ""
def __init__(self, name, login):
self.name = name
self.login = login
super(User).__init__()
def __repr__(self):
return ""
class BaseUser:
def __repr__(self):
# This creates a cycli... | true |
b42206767ca44cacf772e5254b220f390f4e2a90 | xxxyyyqqq12345/orbitx | /orbitx/state.py | UTF-8 | 17,776 | 3.15625 | 3 | [
"MIT"
] | permissive | """Classes that represent the state of the entire system and entities within.
These classes wrap protobufs, which are basically a fancy NamedTuple that is
generated by the `build` Makefile target. You can read more about protobufs
online, but mainly they're helpful for serializing data over the network."""
import cop... | true |