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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
4f121cfb9bdf2022697d6bfb229aeb84bb136d3e | Python | Coyotio64/Proyecto | /Pilas_Colas/menu.py | UTF-8 | 3,273 | 3.78125 | 4 | [] | no_license | from random import*
from collections import deque
historial1=deque()
historial2=deque()
historial3=deque()
def opcionJugador():
print("\nElige tu respuesta: ")
print("""
1). Piedra
2). Papel
3). Tijera """)
opcion = int(input("==> "))
if opcion == 1:
historial1.append(... | true |
129131e1777d3f6f076ed3ea935f0b1c27cbda6c | Python | macomzzl/wordseg | /SentenceGraph.py | UTF-8 | 4,230 | 2.984375 | 3 | [] | no_license | #!/usr/bin/env python
# -*- coding: gbk -*-
# Last modified:
"""docstring
"""
__revision__ = '0.1'
import sys
import Utils
from collections import defaultdict
from DataSet import DataSet
from Indexer import HashIndexer
from Indexer import TrieIndexer
class Vertex():
def __init__(self, word, s, e):
self.... | true |
c67664422c60f6b8f9e9ca431db4ffff205ae911 | Python | emilnorman/euler | /problem033.py | UTF-8 | 561 | 3.625 | 4 | [] | no_license | #!/usr/bin/python3
#-*- coding: utf-8 -*-
import time
from fractions import gcd
start_time = time.time()
# (a*10 + b)/(c*10 + d)
num = 1
denom = 1
for a in range(1, 10):
for c in range(1, 10):
for d in range(1, 10):
if ((a*10.0 + c)/(c*10 + d)) == (1.0*a / d):
if (a*10 + c)... | true |
f55e7ac44d29f6dbf6f902b901d4798f877c86fc | Python | jrgparkinson/mushy-layer | /plotting/PlottingExample.py | UTF-8 | 2,697 | 2.625 | 3 | [
"BSD-3-Clause",
"BSD-2-Clause-Views",
"BSD-2-Clause",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | import matplotlib.pyplot as plt
import os
import numpy as np
from plotting.MushyPltFile import MushyPltFile
import sys
plt.close('all')
# latexify(fig_width=10.0, fig_height=10.0)
# 2D plotting example
figure_output_directory = os.path.join(os.environ['MUSHY_LAYER_DIR'], 'plotting')
figure_name = 'PlottingExample'
... | true |
37667e77c0b95a17af906163e0976418b1cf13ef | Python | genkioyaji/sample_selenium | /sample_Hotel.py | UTF-8 | 3,437 | 2.53125 | 3 | [
"MIT"
] | permissive | #20190401
# https://note.nkmk.me/python-openpyxl-usage/
'''
Auto form fulling test_Hotel_reservation_form using selsenium.
'''
import time
from selenium import webdriver
from selenium.webdriver.common.by import By
import openpyxl
class EX_LIST:
def __init__(self,file_1):
self.file_1 = file_1
def ge... | true |
09a05f43d693980f5c6ab87a6bca13aefcac3627 | Python | flowroute/environs-serviceurl | /test/test_service_url.py | UTF-8 | 4,248 | 2.6875 | 3 | [
"MIT"
] | permissive | import pytest
from environs import EnvError
from environs_serviceurl import service_url
basic_cases = pytest.mark.parametrize(('url', 'expected'), [
# Basic null scenario
('', {
'host': None,
'port': None,
'user': None,
'password': None,
'extras': None,
}),
# Si... | true |
718b2c6e6958e497bc3152e804bbb7540b849acf | Python | javarishi/LearnPythonJune2021 | /learn_day04/ForLoop.py | UTF-8 | 564 | 3.90625 | 4 | [] | no_license | shopping_cart = ["milk", "veggies", "medicines", "electronics"]
'''
for eachItem in Data_Set:
Iteration logic for eachItem in Data_Set in Sequence / One by One
'''
for eachItem in shopping_cart:
print(eachItem)
'''
range(start, end, step)
start - where to start
end - where to end (value - 1)
st... | true |
62753fb6bc6675169a09f2a2e9be89f153def4d3 | Python | kaeserchen/one_word | /model/lstm_word.py | UTF-8 | 4,386 | 2.53125 | 3 | [
"MIT"
] | permissive | from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import inspect
import tensorflow as tf
logging = tf.logging
class LSTMWordModel(object):
"""A LSTM model to infer the next word."""
def __init__(self, is_training, config):
self._config = config
... | true |
6139936b8f6cefdb9c673048ad5f050fb8fdad07 | Python | rauljm/instaprize | /prize.py | UTF-8 | 3,018 | 3.328125 | 3 | [] | no_license | import random
import time
from InstagramAPI import InstagramAPI
def insta_login(username, password):
"""
This method will receive a username and password of Instagram
and login at this account.
Parameters:
username -> str
password -> str
return: None
... | true |
702be458cf5d00cbbbffb2b136fe6f3e8e2370de | Python | matthiasa4/GCPUtils | /GenerateProtoBufferFile/ProtoBufferMessage.py | UTF-8 | 3,736 | 2.59375 | 3 | [] | no_license | import re
import pprint
import operator
from gevent._socket2 import socket
pp = pprint.PrettyPrinter()
class ProtoBufferMessage(object):
schema = dict()
def __init__(self, schema_in, type_of_schema):
if type_of_schema == 'bigquery':
self.schema = self.parseBigQueryToProtoBuffer(schema_in... | true |
913ef6ea77055d5a440a0933dd1469f231686d10 | Python | FightingLH/Python_Study | /Python/Unit.py | UTF-8 | 1,524 | 3.296875 | 3 | [] | no_license | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import unittest
class Student():
def __init__(self,score,name):
self.name = name
self.score = score
def get_grade(self):
if self.score > 90:
return 'A'
else:
return 'C'
class TestStudent(unittest.TestCase):
... | true |
ec91bc2f048d319aee7b7806c8cb9653366098ba | Python | amildie/leetcode-solutions | /binary-tree-preorder-traversal.py | UTF-8 | 615 | 3.59375 | 4 | [] | no_license | # https://leetcode.com/problems/binary-tree-preorder-traversal/
# Definition for a binary tree node.
# class TreeNode:
# def __init__(self, val=0, left=None, right=None):
# self.val = val
# self.left = left
# self.right = right
class Solution:
def preorderTraversal(self, root: Optional... | true |
c0d4172e1dbd0128c405eb2db40f267fbe6319b8 | Python | erickclasen/PMLC | /lin-reg-basic/multivariate_lr.py | UTF-8 | 4,947 | 3.484375 | 3 | [] | no_license | import numpy as np
def normalize(features):
'''
features - (10, 3)
features.T - (3, 10)
We transpose the input matrix, swapping
cols and rows to make vector math easier
'''
for feature in features.T:
fmean = np.mean(feature)
frange = np.amax(feature) - np.amin(fe... | true |
371dc8454553c315846ff2c4898440f25ee30628 | Python | joestalker1/leetcode | /src/main/scala/CampusBikes.py | UTF-8 | 863 | 3.234375 | 3 | [] | no_license | class Solution(object):
def assignBikes(self, workers, bikes):
if not workers or not bikes:
return []
buckets = [[] for _ in range(2001)]
for i in range(len(workers)):
for j in range(len(bikes)):
d = abs(workers[i][0] - bikes[j][0]) + abs(workers[i][1]... | true |
5597c042adf66735f0a777f8162b2864b308f16f | Python | bronsonp/Project-Mario | /Pi/Game.py | UTF-8 | 2,788 | 2.90625 | 3 | [
"MIT"
] | permissive | import serial, pygame
from pygame.locals import *
from InputDevice import InputDevice
from Zumo import Zumo
def main():
# TODO CLI
pygame.init()
pygame.joystick.init()
joystick = {}
ser = {}
zumo = {}
# init each joystick
for i in range(pygame.joystick.get_count()):
# joystick
joystick[i] = InputDevice()
... | true |
f4d0fa4919637ea7fe5f95e50553a0c669244936 | Python | naruto001/python | /01python_test/05.py | UTF-8 | 100 | 2.9375 | 3 | [] | no_license | #!/usr/bin/env python3
# -*- coding:utf-8 -*-
if age >= 18:
print('adult')
else:
print('teenager') | true |
eb68ac96cc3c7343d1e67a86a9e6860e6e382fa6 | Python | TheFenix2000/python | /Project/Python learning/dictionaries/dictionary_to_list.py | UTF-8 | 182 | 3.265625 | 3 | [] | no_license | dictionary = {'Character': 'Spider-man', 'Movie': 'Black Panther', 'Person': 'Stan Lee'}
list_from_dict = list(dictionary.items()) #'items()' for keys and values
print(list_from_dict) | true |
8c755f2c8894fbfba141b09196a8650fad7dccd2 | Python | ankitakhatri/Crypto | /BitcoinWallet/RSA.py | UTF-8 | 3,310 | 4.3125 | 4 | [] | no_license | '''
Simple RSA key implementation from scratch, using prime numbers
'''
import random
'''
First step is to implement Euclid's algorithm to determine the greatest common divisor between two numbers
https://www.geeksforgeeks.org/euclidean-algorithms-basic-and-extended/
'''
def euclid_gcd (x, y):
if (x == 0):
... | true |
825de9be026881b918d6069204e2c7ab2e20a0db | Python | naiiytom/healthdoc-ocr | /dewarp/dewarp_wrapper/grad_loss.py | UTF-8 | 5,701 | 2.515625 | 3 | [
"MIT"
] | permissive | import cv2
import sys
from math import exp
import torch
import torch.nn as nn
import torch.nn.functional as F
from torch.autograd import Variable
import numpy as np
np.set_printoptions(threshold=sys.maxsize)
# import matplotlib.pyplot as plt
def sobel(window_size):
assert(window_size % 2 != 0)
ind = window_si... | true |
d628bf3a35caf18e32eb23b1c767dc1b21fd80d3 | Python | jaabee/daily_code | /algorithm/Divide_Conquer_isinList.py | UTF-8 | 1,032 | 4.09375 | 4 | [] | no_license | # @Time : 2020/10/14 19:02
# @Author : GodWei
# @File : Divide_Conquer_isinList.py
# 子问题算法(子问题规模为1)
def is_in_list(init_list, el):
return [False, True][init_list[0] == el]
# 分治法
def solve(init_list, el):
list_length = len(init_list)
if list_length == 1: # 若问题规模等于1,即列表中
return is_in_list(i... | true |
a6cfc0b49289403b0b15c0db7892595c24378710 | Python | frankma/Finance | /src/Utils/Sequence/RdmDiscMutExcVec.py | UTF-8 | 1,314 | 2.8125 | 3 | [] | no_license | import numpy as np
from scipy.stats import rv_discrete
import copy
__author__ = 'frank.ma'
class RdmDiscMutExcVec(object):
def __init__(self, density: dict):
self.density = density
def draw(self, size: int=5):
if size > self.density.__len__():
raise ValueError('drawing size %i is... | true |
783d500cab7f4a96c6149677ca931ab081cfa232 | Python | vgrem/Office365-REST-Python-Client | /examples/outlook/calendars/get_schedule.py | UTF-8 | 754 | 2.671875 | 3 | [
"MIT"
] | permissive | """
Get free/busy schedule of Outlook calendar users and resources
https://learn.microsoft.com/en-us/graph/outlook-get-free-busy-schedule
The following example gets the availability information for user for the specified date, time, and time zone.
"""
import json
from datetime import datetime, timedelta
from offic... | true |
9d20be80c749b3b68b4cb6de392f9fe47673d2b7 | Python | JedGrabman/covidcast-indicators | /quidel/delphi_quidel/export.py | UTF-8 | 1,482 | 2.984375 | 3 | [
"MIT"
] | permissive | # -*- coding: utf-8 -*-
"""Function to export the dataset in the format expected of the API.
"""
import numpy as np
import pandas as pd
def export_csv(df, geo_name, sensor, receiving_dir, start_date, end_date):
"""Export data set in format expected for injestion by the API
Parameters
----------
df: pd.... | true |
0d61b87958136b4f5a5a010230b5b0009c7f6768 | Python | aniketsuthar/tkinter | /script1.py | UTF-8 | 378 | 3.296875 | 3 | [] | no_license | from tkinter import *
window = Tk()
def km_to_miles():
text.insert(END, float(e1_value.get()) * 1.6)
button = Button(window, text="Execute", command=km_to_miles)
button.grid(row=0, column=0)
e1_value = StringVar()
e1 = Entry(window, textvariable=e1_value)
e1.grid(row=0, column=1)
text = Text(window, height=... | true |
5cfe9b6fe53bfcc9c9863bbcaa575074c481c3c4 | Python | DelRoos/crypto-tools | /utils/sets/alphabet.py | UTF-8 | 679 | 3.484375 | 3 | [] | no_license | import string
class SetAlphabet:
def __init__(self):
self.set_ascii: list = list(string.ascii_lowercase)
def give_param_of_set(self, lower = False, upper = False, digits = False, punctuation = False)-> str:
str_alpha = ''
if lower :
str_alpha += string.ascii_lowercase
... | true |
d6bf3605c2c5d8619362abd047aa685269ece0b0 | Python | hboyan/AnimalRescues | /EarlyCleaning/fixcommas.py | UTF-8 | 876 | 2.8125 | 3 | [] | no_license | import re
#note - need to go into dataframes and find commas mid address
fileout = open('/Users/boyan/Dropbox/DCIWork/Capstone/Data/AustinTake2/in_parsed.csv','w')
def fix_commas(myfile):
output = []
text = myfile.read().split('\n')
for i in range(len(text)):
y = re.split(r'([AP]M,)([\s\S]*\(TX\))... | true |
3b02dffe21b7867aa1ac34aedc58fb34a2f4c98c | Python | AndersonHuang95/CodePractice | /python/numDecodings.py | UTF-8 | 1,401 | 4.09375 | 4 | [] | no_license | class Solution:
def numDecodings(self, s):
"""
'A' -> 1
'B' -> 2
...
'Z' -> 26
Input: "226"
Output: 3
Explanation: It could be decoded as "BZ" (2 26), "VF" (22 6), or "BBF" (2 2 6).
This is a chunking problem. Since each letter can be encoded as up to 2 digits, we need
to chu... | true |
a2df1c515515db65fb9efe706ffb198c0623a5e4 | Python | rachel-min/Fin_Forecast | /Class_BFO.py | UTF-8 | 1,704 | 2.578125 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Wed Oct 9 16:17:32 2019
@author: xiagao
"""
import pandas as pd
import inspect
class basic_fin_account(object):
#_log = {} # Must be private variable
def __init__(self):
self._log = {}
_not_addable = ['AccountName', 'lobName', 'OpRisk_Chage_p... | true |
48c7d5745d5db4165d24eb4712927b17e52aadd2 | Python | atremblay/IFT6269 | /src/dataset/dataload.py | UTF-8 | 2,035 | 2.6875 | 3 | [] | no_license | import os
import importlib
from torch.utils.data import Dataset
from skimage import io
from PIL import ImageFile
from PIL import Image
class DatasetLib:
def __init__(self, data_dir):
self.data_dir = data_dir
self.datasets = self._find_dataset()
def _find_dataset(self):
# Data set dic... | true |
90e34defd18581516c55fa7decda014a2a89dacf | Python | yoshio15/AtCoder | /ABC/198/D.py | UTF-8 | 582 | 2.96875 | 3 | [] | no_license | import itertools
S1 = list(input())
S2 = list(input())
S3 = list(input())
S1_len = len(S1)
S2_len = len(S2)
S3_len = len(S3)
num = list('0123456789')
no_ans = 'UNSOLVABLE'
N1_li = [0] * S1_len
N2_li = [0] * S2_len
N3_li = [0] * S3_len
S1_first = S1[0]
S2_first = S2[0]
S3_first = S3[0]
use_char_list = set(S1 + S2 + S3... | true |
deee3db691f8cfe5a79d8bde91e4a726604fa5b7 | Python | thaisnat/LP1 | /atividades/calcula_dv/calcula_dv.py | UTF-8 | 441 | 3.375 | 3 | [] | no_license | # coding: utf-8
# Unidade 4 - Cálculo do Digito Verificador
# Thaís Nicoly - UFCG 2015.1 - 08/06/2015
numero_conta = raw_input()
soma_pares = 0
soma_impares = 0
for i in range(len(numero_conta)):
if i % 2 == 0:
soma_pares += int(numero_conta[i])
else:
soma_impares += int(numero_conta[i])
valor = soma_impares *... | true |
4e2a24369ec1544dc7ac1c80a4d6ce4d0b596bcc | Python | nikartemov/Lab2_repo | /str_algs.py | UTF-8 | 158 | 3.515625 | 4 | [] | no_license | def mirr(str):
buf = ''
c= len(str)
for i in range(len(str)):
buf += str[c-1]
c -= 1
return(buf)
str = 'Hii'
print(mirr(str)) | true |
77f0cbb9097f3941339b38c517f17700a21d003d | Python | PremBamrung/Fractal | /Julia_set.py | UTF-8 | 1,890 | 3.203125 | 3 | [] | no_license | # https://murillogroupmsu.com/julia-set-speed-comparison/
import time #timing
import numpy as np #arrays
from numba import jit, prange
x_dim = 1000
y_dim = 1000
x_min = -1.8
x_max = 1.8
y_min = -1.8j
y_max = 1.8j
z = np.zeros((y_dim,x_dim),dtype='complex128')
for l in range(y_dim):
z[l] = np.linsp... | true |
891de53953ce8b229c3f7d3c67a41a725d07ece6 | Python | GauthamAjayKannan/guvi | /klargestel.py | UTF-8 | 112 | 2.578125 | 3 | [] | no_license | #klargest
n,k=list(map(int,input().split(" ")))
l=list(map(int,input().split(" ")))
print(sorted(l)[::-1][k-1])
| true |
d44a4e5ec18615912683fda02a76c20700e5a352 | Python | ChankitSaini/WilliamButcherBot | /wbb/utils/constants.py | UTF-8 | 1,943 | 2.71875 | 3 | [
"MIT"
] | permissive | # New file
from pyrogram.enums import ChatType, ParseMode
from pyrogram.filters import command
from pyrogram.types import InlineKeyboardButton, InlineKeyboardMarkup, Message
from wbb import BOT_USERNAME, app
MARKDOWN = """
Read the below text carefully to find out how formatting works!
<u>Supported Fillings:</u>
<... | true |
232589edfff6c2b1bce825c58ab3fec94f62eec8 | Python | atforche/Advent_of_Code | /06/solution1.py | UTF-8 | 222 | 3.171875 | 3 | [] | no_license | with open("input.txt", "r") as inFile:
content = inFile.read().split("\n\n")
input = [line.replace("\n", "") for line in content]
total = 0
for i in range(len(input)):
total += len(set(input[i]))
print(total) | true |
06ba24bbcbc3feffac59af242b9c0471e5fd6687 | Python | daveyap1993/Open_dave_L.W.Yap_workspace | /machine_learning/K-NN_classfication_USPS_data.py | UTF-8 | 1,525 | 2.96875 | 3 | [] | no_license | from sklearn.neighbors import KNeighborsClassifier
from sklearn.model_selection import train_test_split
import numpy as np
myFile = np.genfromtxt('alp.csv', delimiter=',')
mydata = myFile[:,0:256]
mylabel = myFile[:,256]
train_prop = [0.1, 0.2, 0.5, 0.8, 0.9]
kVals = [5,10,15,30]
accuracies = []
for j in range(len(tr... | true |
1b10226151b282b3e41c196d3831df3dadcb3422 | Python | ronjacobvarghese/Python_college | /list excercises/q12.py | UTF-8 | 115 | 2.84375 | 3 | [] | no_license | x=list(map(int,input().split()))
x.sort()
s=0
for i in range(1,int(input())+1):
s+=x[-i]
print(s)
print(s)
| true |
e19c43142fdc560486c096ecf5a785032434cf8c | Python | JeongKyeongHwan/16CPFA | /ex03/ex03-2.py | UTF-8 | 129 | 2.84375 | 3 | [] | no_license | print 1 + 3 - 5 + 7 - 8 * 9 - 7
print 1 + 5
print 4 % 3 / 3
print 7 / 4
print 7.0 / 4.0
print 100.0 / 16.0 % 5
print 100 / 18 % 3 | true |
bf6995feef649072890b02439bcf9aca83962097 | Python | DaHuO/Supergraph | /codes/CodeJamCrawler/16_0_4/jedib/d.py | UTF-8 | 207 | 2.859375 | 3 | [] | no_license | #!/usr/bin/python
nb = int(raw_input())
for n in xrange(1, nb+1):
K, C, S = [int(i) for i in raw_input().split()]
ll = [str(i) for i in xrange(1, S+1)]
print "Case #%i:" % (n), " ".join(ll)
| true |
ca948cc918394eac710e1975837d38eb3b9d2f5b | Python | gyang274/leetcode | /src/0900-0999/0906.super.palindrome.py | UTF-8 | 1,543 | 3.65625 | 4 | [] | no_license | class Solution:
def isPalindrome(self, N: int) -> bool:
s = str(N)
n = len(s)
if n & 1:
x, m, y = s[:(n // 2)], s[n // 2], s[(n // 2 + 1):]
else:
x, y = s[:(n // 2)], s[(n // 2):]
return x[::-1] == y
def nextPalindrome(self, N: int) -> int:
s = str(N)
n = len(s)
if n & 1:... | true |
2211467d950527fc509db185a2f118d6d364aa1e | Python | mehedi-shafi/left-shift | /utils/plot_log.py | UTF-8 | 2,476 | 2.8125 | 3 | [
"MIT"
] | permissive | import matplotlib.pyplot as plt
from matplotlib.ticker import FuncFormatter
import numpy as np
import argparse
# def plot(file_path):
# f = np.load(file_path)
# timesteps = f['timesteps']
# results = f['results']
# ep_lengths = f['ep_lengths']
# mean_reward = np.mean(results, axis=1).flatten()
# mean_lengt... | true |
e3e94a32bc196d298b4c3292564cbb1134f823bc | Python | leomonu/NormalDistributionStudentPerformance | /PropertiesOfNormalDistributionProject.py | UTF-8 | 2,656 | 2.953125 | 3 | [] | no_license | import pandas as pd
import statistics
import plotly.figure_factory as ff
import plotly.graph_objects as go
import csv
df = pd.read_csv("StudentsPerformance.csv")
StudentsPerformance = df["math score"].to_list()
mean = statistics.mean(StudentsPerformance)
median = statistics.median(StudentsPerformance)
mode =... | true |
326529aa009978026d30bb9112de5546403ca6f6 | Python | rajatgirotra/study | /machine_learning/6_iris_flower.py | UTF-8 | 2,268 | 3.5625 | 4 | [] | no_license | # sklearn provides a bunch of data sets and easy utilities to load those data sets
from sklearn.datasets import load_iris
from sklearn import tree
import numpy as np
iris = load_iris()
# the dataset includes the actual data from Wikipedia + some metadata
print(iris.feature_names)
print(iris.target_names)
# data is c... | true |
b6b9fe83aaff79a48023a18b88eaf5d67de2ce2e | Python | DS-ML-Blog/Home-Budget-Calculator | /functions/month_funcs/create_pptx_presentation.py | UTF-8 | 1,253 | 2.734375 | 3 | [] | no_license | from pptx.util import Inches
from pptx import Presentation
def create_pptx_presentation(month_num, year_num, results_dir):
prs = Presentation()
title_slide_layout = prs.slide_layouts[0]
blank_slide_layout = prs.slide_layouts[6]
slides = list()
slides.append(prs.slides.add_slide(title_slide_layout... | true |
c708b920441dcc3792484acf96bd78470dad8e8e | Python | heojoung2/Machine_Learning | /auto_spacing/test.py | UTF-8 | 4,645 | 2.796875 | 3 | [] | no_license | # -*- coding: utf-8 -*-
import tensorflow as tf
import numpy as np
import csv
def padding(x_batch,y_batch,length): #패딩
max_length=max(length)
for i in length: #length=[1,2,3,4,5]
for j in x_batch: #X 패딩하기
for k in range(len(j),max_length):
j.append(0)
... | true |
c711f8480b01446e4f84338bfc155f8693a6bd74 | Python | SuganyaDhanasekaran/OTC3D | /Examples/Step2_Building_IdealModel.py | UTF-8 | 1,803 | 3.09375 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Mon May 08 00:34:26 2017
@author: Tiffany Sin 2017
Example construction of a neighborhood of square buildings on Pyliburo ('The model'). The location of the model should be compatible with the imported data (the easiest way to do so is to recenter data coordinates to the origin, ... | true |
1a339c9f69e1120993f1cb1ea0810dbcad9aa0bc | Python | doremi31618/OpenCV_Utility | /src/utilities/opencv_core_operation/ImageBlending.py | UTF-8 | 464 | 2.546875 | 3 | [] | no_license | import cv2
import os
from os.path import join, isfile
def main():
img1 = cv2.imread('C:\\Users\panos\Desktop\PanoAWS\Projects\Opencv_algorithm\All_image\ICL_8251.JPG')
img2 = cv2.imread('C:\\Users\panos\Desktop\PanoAWS\Projects\Opencv_algorithm\All_image\ICL_8226.JPG')
# Image blending
dst = cv2.addWe... | true |
fed7d315cf760922a8a765f0e39d9b12e582e449 | Python | TA-800/CodeForces-Solutions | /Helpful_Maths.py | UTF-8 | 452 | 3.234375 | 3 | [] | no_license | given = input("").split("+")
# convert to normal numbers for calculation
for i in range(0, len(given)):
given[i] = int(given[i])
# sort array algorithm
for i in range(0, len(given)):
for j in range(0, len(given)):
if given[i] < given[j]:
given[j],given[i] = given[i],given[j]
# print... | true |
4bb72870c82b33aead09cdd4408df64fdb6ffc0f | Python | ranbix666/leetcode-1 | /131.palindrome-partitioning.py | UTF-8 | 1,521 | 3.125 | 3 | [] | no_license | #
# @lc app=leetcode id=131 lang=python
#
# [131] Palindrome Partitioning
#
# https://leetcode.com/problems/palindrome-partitioning/description/
#
# algorithms
# Medium (42.87%)
# Likes: 1278
# Dislikes: 51
# Total Accepted: 192.7K
# Total Submissions: 439.7K
# Testcase Example: '"aab"'
#
# Given a string s, par... | true |
551f0637004f9f0a6db22bc6fad5ebb93c24b8d9 | Python | jebrunnoe/Project-Euler | /problem33.py | UTF-8 | 626 | 3.265625 | 3 | [] | no_license | from fractions import Fraction
p = 1
for numer in range (10, 100):
for denom in range (numer + 1, 100):
frac = Fraction(numer, denom)
nstr = str(numer)
dstr = str(denom)
if nstr[0] == dstr[1] and Fraction(int(nstr[1]), int(dstr[0])) == frac: p *= frac
elif nstr[1] == dstr[0] and dstr[1]... | true |
da9d1c51063e7fa665c6333a4b310a80c0947aee | Python | oconnorjoseph/CourseworkPython | /HW1/problem2.py | UTF-8 | 1,096 | 3.59375 | 4 | [] | no_license | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Sun Sep 24 18:29:31 2017
@author: Joseph O'Connor
UNI: jgo2115
"""
BAD_CHARACTERS = [' ',',','y','e','a','r','s']
CURRENT_POPULATION = 307357870
SEC_PER_YEAR = 60 * 60 * 24 * 365
SEC_PER_BIRTH = 7
SEC_PER_DEATH = 13
SEC_PER_IMMIGRANT = 35
def invalidInput... | true |
fa9b8cf30f28ffd680ffaac90220669ec230fb55 | Python | emmmile/friendly-octo-couscous | /utils.py | UTF-8 | 1,463 | 2.53125 | 3 | [] | no_license | #! /usr/bin/env python3
import os
import retrying
import urllib
import lxml.html
import logging
import info
headers = {
# otherwise nginx might reply with 403 Forbidden
'User-Agent': 'Mozilla/5.0',
}
# some utility functions
@retrying.retry(stop_max_attempt_number=8, wait_exponential_multiplier=1000, wait_e... | true |
2401046502991127d180a6e917b0497fa6edb35d | Python | hitochan777/kata | /atcoder/mayokon/20221123/A.py | UTF-8 | 58 | 2.515625 | 3 | [] | no_license | A, B, C = (int(x) for x in input().split())
print(C, A, B) | true |
828b5be11b794e31130a849574c59127163ba20e | Python | midori-takeuchi/CPSC-189 | /lecture_09.py | UTF-8 | 2,379 | 3.421875 | 3 | [] | no_license | import numpy as np
#Question 1a)
# press, temp, height
#Question 1b)
# press = data['press']
# temps = data['temp']
# zcoords = data['height']
# press.shape: 1D array of length 150
# temps.shape: 3D array of dimension 150 x 30 x 30
# zcoords.shape: 1D array of length 150
#Question 1c)
def average_temp_above_height(... | true |
602dc5df82d3d8f9874efbc47e4f69b9c95b5242 | Python | Marcuste1991/PythonGameWebApp | /2dshooter_v4/scores/HighscoreDAO.py | UTF-8 | 657 | 2.859375 | 3 | [] | no_license | import sqlite3
class HighscoreDAO():
def __init__(self):
self.db = sqlite3.connect("scores/HighscoreDB.db")
self.cursor = self.db.cursor()
self.cursor.execute("CREATE TABLE IF NOT EXISTS users(name TEXT, zeit INTEGER, datum TEXT)")
def insert(self,name,zeit,datum):
self.cursor.... | true |
49ee50a8cc7f54fce7b5e22e57a7ac8a08ed158b | Python | ffledgling/GraphingServer | /plot.py | UTF-8 | 1,509 | 3.125 | 3 | [] | no_license | """ This file has all the plotting related capabilities """
import matplotlib.pyplot as plt
import db
class Plotter:
def __init__(self,server_list):
self.SERVERLIST = list(server_list)
# If there is a table corresponding to the server name,
# load data from it. If not, create a table f... | true |
c00e78c892d28a19a216b991c78015ea9553e6a4 | Python | souldeux/GravityScraper | /gravityscraper.py | UTF-8 | 3,894 | 2.703125 | 3 | [] | no_license | import requests
from bs4 import BeautifulSoup
def get_forms_from_page(url):
"""
Takes a FQDN, makes a GET request, and returns a ResultSet object (BeautifulSoup) containing
all form elements on that page that were generated by Gravity Forms
"""
print "Requesting HTML..."
page = requests.get(url)
print "Loading ... | true |
68596243780899ad0a3e47ed1d8fab236d7cc2e7 | Python | Kinjalrk2k/pdfTools-Web | /app/pdfTools/details.py | UTF-8 | 268 | 2.6875 | 3 | [
"MIT"
] | permissive | import os
from PyPDF2 import PdfFileReader
def get_page_numbers(root, filename):
# print(os.path.join(root, filename))
f = open(os.path.join(root, filename), 'rb')
pdf = PdfFileReader(f)
pageNums = pdf.getNumPages()
f.close()
return pageNums
| true |
401b07b6ff2f13b5f63a916d257cfad961ab3edf | Python | zxzerster/algorithms | /BinarySearchTree.py | UTF-8 | 8,921 | 3.875 | 4 | [] | no_license | class BinarySearchTree:
class Node:
def __init__(self, val):
self._left = None
self._right = None
self._val = val
def __init__(self):
self._root = None
def insert(self, node):
if node is None: return
if self._root is None:
se... | true |
7b4fb54692af831037bf8d6610fc76cc75daad00 | Python | nashst/Map-projection-1 | /圆锥投影.py | UTF-8 | 2,785 | 2.671875 | 3 | [] | no_license | from mpl_toolkits.mplot3d import Axes3D
import matplotlib.pyplot as plt
import numpy as np
import time,matplotlib
from numpy import pi as pi
from math import radians as radians
from math import sqrt as sqrt
from math import cos as cos
from math import sin as sin
from math import tan as tan
from math import atan as atan... | true |
866b1d59b0ca37cdf1296de27da9a80be76f9bdf | Python | Arpit0492/-Sport-Programming-Python | /HackerEarth/Circuits/Nov'18/Addition_Errors.py | UTF-8 | 874 | 2.890625 | 3 | [] | no_license | # n, k = [int(x) for x in raw_input().strip().split(' ')]
# A = list(map(int, input().split()))
'''
8786868
3773
-------
9531
'''
def add_error(a, b):
s_a = str(a)
s_b = str(b)
length_s = len(s_a) if len(s_a) < len(s_b) else len(s_b)
# print(length_s)
prefix = s_a[:-length_s] if len(s_a) > l... | true |
71e6700a861a8ce3619af20e4cdc632067eab372 | Python | TanvirKaur17/Array-2 | /NumbersDisappeared.py | UTF-8 | 450 | 2.984375 | 3 | [] | no_license | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Tue Dec 3 08:41:47 2019
@author: tanvirkaur
"""
# Brute Force Solution
# Time complexity = O(n^2)
# Space complexity = O(1)
class Solution:
def findDisappearedNumbers(self, nums: List[int]) -> List[int]:
res = []
for i in range(1,len(n... | true |
7759760a6b174c237de81dd290a5805ee1052b62 | Python | anamika64/Python | /flask2.py | UTF-8 | 307 | 3.078125 | 3 | [] | no_license | from flask import Flask
app=Flask(__name__)
@app.route("/") #function decorator , its automatic call in browser
def hello(): #hello user defined function
return "Welcome to India "
@app.route("/home")#function decorator
def msg():
return "Hello, How are you"
#main program
app.run()
| true |
a9d1fb23327f95fbd7ba399f44e645086860ff3c | Python | Nesac128/tensorimage | /tensorimage/util/log.py | UTF-8 | 1,687 | 2.765625 | 3 | [
"MIT"
] | permissive | import logging
def add_coloring_to_emit_ansi(fn):
def new(*args):
levelno = args[1].levelno
if levelno >= 50:
color = '\x1b[31m' # red
elif levelno >= 40:
color = '\x1b[31m' # red
elif levelno >= 30:
color = '\x1b[33m' # yellow
elif le... | true |
7eb22e7bbb906e0c8f8d04519081ed507d288043 | Python | smonov/HomeWork | /HomeWork1/Task4_While_Loop/count_to_user.py | UTF-8 | 221 | 3.671875 | 4 | [] | no_license | #Week1 Task4.2 count_to_user.py
count = input( "Enter number: ")
count = int(count)
counter = 1
while counter < count:
print(counter)
counter = counter + 1
while counter >= 1:
print(counter)
counter = counter - 1
| true |
5a748628bebd8d8a164376434e9e31436f4679e2 | Python | Ticlero/algorithm_study_with_cpp | /백준/dfs_bfs/11724_linked_vertex_cnt.py | UTF-8 | 616 | 3.1875 | 3 | [] | no_license | import sys
n,m = map(int, sys.stdin.readline().rstrip().split())
if n > 1000 or n < 1 or m < 0 or m > (n*(n-1)/2):
exit()
graph = [[] for _ in range(n+1)]
visited = [False]*(n+1)
for _ in range(m):
v1, v2 = map(int, sys.stdin.readline().rstrip().split())
graph[v1].append(v2)
graph[v2].append(v1)
de... | true |
e96d8c73bfd663c9271880defe76a70039918525 | Python | cohock13/atcoder | /abc/166/2.py | UTF-8 | 245 | 2.75 | 3 | [] | no_license | N,K = map(int,input().split())
snuke = [0]*N
for i in range(K):
d = int(input())
A = list(map(int,input().split()))
for j in A:
snuke[j-1] += 1
cnt = 0
for i in snuke:
if i == 0:
cnt += 1
print(cnt) | true |
6caced9068e61495dc40fd64edba1d76cbbcfaeb | Python | rickcnagy/QSTools | /modules/qs/qs_api.py | UTF-8 | 52,660 | 2.703125 | 3 | [
"MIT"
] | permissive | #!/Library/Frameworks/Python.framework/Versions/2.7/bin/python
import re
import copy
import json
import qs
class QSAPIWrapper(qs.APIWrapper):
"""An API Wrapper specific for the QuickSchools API.
Attributes:
live: Whether or not this is accessing the live QS server (or backup).
schoolcode: Th... | true |
80bfa6a87fa43b606861ca23085a67e7784c8557 | Python | waikato-datamining/wai-common | /src/wai/common/file/csv/_load.py | UTF-8 | 5,508 | 3.1875 | 3 | [
"MIT"
] | permissive | import csv
import io
from typing import IO, Optional, List, Tuple, Type
from .._functions import get_open_func
from ._CSVFile import CSVFile, DATA_TYPE, VALUE_TYPE, TYPES_TYPE
# Number of lines to sample to try and determine CSV format
SAMPLE_SIZE = 4
def loadf(filename: str,
encoding: str = 'utf-8',
... | true |
6fb839243d2827781520aa316ba5a6883dd2a5d0 | Python | xuzhaogit/newMtp | /test.py | UTF-8 | 559 | 3 | 3 | [] | no_license | d={'a':1,'b':2,'c':4,'d':5}
print (d)
l=[1,2,3,4,1,2]
class Student():
def __init__(self,name):
self.name=name
# def _
def study(self):
print (self)
# pass
@classmethod
def func(cls):
print (cls)
class Xs(Student):
pass
st1=Student('zhangsan')
st2=Student... | true |
7fb51c4004fb439e66228267881a6d6dcf26ba45 | Python | alexandraback/datacollection | /solutions_5636311922769920_0/Python/lentmiien/Fractiles.py | UTF-8 | 1,421 | 2.96875 | 3 | [] | no_license | # #
# #
# ONLY SMALL DATASET #
# #
# #
print("## ONLY SMALL DATASET ##")
# IO files
inputfile = open("D-small-attempt0.in", "r")
#inputfile = open("A-large.in", "r")
outputfile = open("output.txt", "w")
# Test cases
line = inputfil... | true |
5ec003082ed5089c26216ecd6c44775ebd25dc77 | Python | Aaron9811/grade-averager | /project4.py | UTF-8 | 1,743 | 3.671875 | 4 | [] | no_license | import studentClass
def writeFile(num, avg, high, low, students):
outputFile = open("summary.txt", "w")
outputFile.write("Number of students:\t" + str(num) + "\n")
outputFile.write("Average grade:\t" + str(avg) + "\n")
outputFile.write("Highest grade:\t" + str(high) + "\n")
outputFile.write(... | true |
79fbaa923e06edd7043701870cfe0437bd097264 | Python | stmangm/pyscript | /lottery.py | UTF-8 | 140 | 3 | 3 | [] | no_license | import random
lottery_num = range(1,49)
for _ in range(5):
win_num = random.sample(lottery_num,6)
win_num.sort()
print(win_num)
| true |
df508d3b36c0c77e8dd79b20118c21cb55ebeef2 | Python | Fahimeh1983/Python-MIT-course | /recursive_greatest_common_divisors.py | UTF-8 | 520 | 4.25 | 4 | [] | no_license | #A clever mathematical trick that makes it easy to find greatest common divisors. Suppose that a and b are two positive integers:
#If b = 0, then the answer is a
#Otherwise, gcd(a, b) is the same as gcd(b, a % b)
def gcdRecur(a, b):
'''
a, b: positive integers
returns: a positive integer, the greatest... | true |
8313704246cd01f2692540bb604dff99489505ac | Python | marshon03/assignment-1-supervised-learning | /DecisionTree.py | UTF-8 | 5,462 | 2.78125 | 3 | [] | no_license | from sklearn.model_selection import train_test_split
from sklearn.tree import DecisionTreeClassifier
from sklearn.metrics import accuracy_score
from sklearn.model_selection import cross_val_score
from sklearn.preprocessing import OneHotEncoder
from sklearn.preprocessing import LabelEncoder
from sklearn.model_selection ... | true |
14b2276b375034cb7a2483f47a3b32a0af10cda1 | Python | BrandonDG/Feistel-Cipher | /a4.py | UTF-8 | 2,854 | 3.96875 | 4 | [] | no_license | #!/usr/bin/python3.5
# Name: Brandom Gillespie
# Student Number: A00966847
# Class: COMP7402
# Assignment: A4
# Purpose: Encrypt and decrypt plaintext in the Feistel Cipher method.
# Plaintext is to be given in an binary string of even length,
# The program... | true |
4a4bef231abe8d1fa191a14e06e43bf77b245e6b | Python | fblrainbow/Python | /study/5-22/map.py | UTF-8 | 522 | 2.984375 | 3 | [] | no_license | #!/usr/bin/env python
#-*-coding:utf-8-*-
def f(x):
return x*x
L = map(f,range(1,11))
print L
S = map(str,range(1,10))
print S
def add(x,y):
return x+y
print reduce(add,[1,3,5,7,9])
def transform(x,y):
return 10*x+y
print reduce(transform,[1,3,5,7,9])
def char2num(s):
return {'0':0,'1':1,'2':2,'3':3,'4':4,'5':5... | true |
38ac4580bfcbfba43ba117185317e2d6855c93c8 | Python | poojakavitha/puthon-set-1 | /8.py | UTF-8 | 68 | 3.109375 | 3 | [] | no_license | x=int(input())
sum=0
i=0
for i in range (0,x+1):
sum+=i
print sum
| true |
c0a3c9382b3c9fe0f68aeeba7538ddbee2e183a8 | Python | daniel-1789/mbta | /mbta_unit_test.py | UTF-8 | 4,309 | 2.953125 | 3 | [] | no_license | import unittest
from mbta import MbtaErrorCodes, print_all_lines, print_stops, main
import yaml
class MbtaUnitTest(unittest.TestCase):
def setUp(self):
"""
Read the yaml that holds the api url
:return:
"""
with open(r'mbta.yaml') as file:
self.api_dict = yaml.loa... | true |
1aa5673f8e23f16aeed564bdbe428a66e14e1bd8 | Python | pisarik/Learning | /python/clean_architecture/tdd/calc/tests/test_meteorites.py | UTF-8 | 1,117 | 2.609375 | 3 | [
"MIT"
] | permissive | from unittest import mock
from calc.meteorites import MeteoriteStats
def test_average_mass():
m = MeteoriteStats()
m.get_data = mock.Mock()
m.get_data.return_value = [
{
"fall": "Fell",
"geolocation": {
"type": "Point",
"coordinates": [6.083... | true |
d69104ca99331d5ad659c967005d364184f7bde1 | Python | dccourt/musicbox | /twinkle.py | UTF-8 | 1,168 | 2.90625 | 3 | [] | no_license | notes_treble = "CCGGAAG-FFEEDDC-GGFFEED-GGFFEEEDCCGGAAG-FFEEDDC-"
notes_bass = "C E F E D C FGE E D C G E D C CGC E F E D C FIC "
#notes_bass = "C E F E D C FGE E D C GGE D C CGC E F E D C FIC "
# Note 'I' in bass line: using > G implies a note in the next octave.
# In this case, 'I' means B(higher).
f = open('... | true |
8d65bd20df41c4f8ee219f1007a509f4cf2088b2 | Python | August-us/exam | /leetcode/200/187. 重复的DNA序列.py | UTF-8 | 2,159 | 3.828125 | 4 | [] | no_license | from typing import List
'''
所有 DNA 都由一系列缩写为 A,C,G 和 T 的核苷酸组成,例如:“ACGAATTCCG”。在研究 DNA 时,识别 DNA 中的重复序列有时会对研究非常有帮助。
编写一个函数来查找目标子串,目标子串的长度为 10,且在 DNA 字符串 s 中出现次数超过一次。
出现多次只需要输出一次
示例:
输入:s = "AAAAACCCCCAAAAACCCCCCAAAAAGGGTTT"
输出:["AAAAACCCCC", "CCCCCAAAAA"]
'''
class Solution:
def findRepeatedDnaSequences_slice(self, ... | true |
620a68dc21262917c20d0766aedfa65fe97b1e4d | Python | bstaab/CS540_ArtificialIntelligence | /cs540_project_green_team/dummyVis/dummyVis.py | UTF-8 | 312 | 2.796875 | 3 | [] | no_license |
# Function to display all blocks in a 'State'
def show_state(state=None, command=None):
print("show_state called with command: ", command)
print("and state: ", state)
def blocksMainThread():
return False
def present(state=None):
print("present called with state: ", state)
def stop():
pass
| true |
6297f726a0db5563a2ca0148cf13927636cc70a9 | Python | markin/elmo-alerting | /elmo/api/client.py | UTF-8 | 11,022 | 2.96875 | 3 | [
"BSD-3-Clause"
] | permissive | from contextlib import contextmanager
from threading import Lock
from requests import Session
from .decorators import require_lock, require_session
from .exceptions import PermissionDenied
from .router import Router
class ElmoClient(object):
"""ElmoClient class provides all the functionalities to connect
to... | true |
bea87a022406cebd6e238deaecb01384f5cf19bf | Python | kaedub/data-structures-and-algorithms | /recursion/find_index.py | UTF-8 | 324 | 3.6875 | 4 | [] | no_license | def find_index(arr, sub, i=0):
if i >= len(arr):
return -1
elif arr[i] == sub:
return i
else:
return find_index(arr, sub, i+1)
animals = ["duck", "cat", "pony"]
print(find_index(animals, 'duck'))
print(find_index(animals, "cat"))
print(find_index(animals, "pony"))
print(find_index(animals, "porcupin... | true |
046275da56a653944cb42e0ca46e40b3a73ac6d1 | Python | sstefano69/dianomic-test | /python/test_all/test_csv.py | UTF-8 | 1,700 | 2.921875 | 3 | [] | no_license | import csv
import sys
import getopt
vFiles = "/tmp/ss/test.csv"
#################################################################################
#
# Read User input : number of milions
#
try:
# print ("Input " + str(sys.argv[1:]) )
opts, args = getopt.getopt(sys.argv[1:], "c:", ["count="])
except getopt.Get... | true |
61a13e1f48b52144b34214dcff88f58ebc48fe26 | Python | sapchatterjee1998/ML-models | /audiotosp.py | UTF-8 | 259 | 2.703125 | 3 | [] | no_license | import speech_recognition as sr
import sys
r=sr.Recognizer()
filename=sys.argv[1]
with sr.AudioFile(filename) as souce:
audio=r.listen(source)
try:
print("system predicts:"+r.rocognize_google(audio))
except Exception:
print("Something went wrong") | true |
4a0685994f5685de9610e18b7b56fb269dfd33f6 | Python | FernandoTorresL/search_dispmag_files | /operacionArchivos.py | UTF-8 | 688 | 3.015625 | 3 | [
"MIT"
] | permissive | import os
def obtenNombreArchivos(ruta):
archivos = list()
with os.scandir(ruta) as ficheros:
for fichero in ficheros:
archivos.append(fichero.name)
return archivos
def concatenaRegistros(ruta,nombreArchivo):
registroConcatenado = list()
with open(ruta,'r') as lecturaArchivo:
for registr... | true |
4d5f43f4b109a287b6589dfca5816a2b7196f6d0 | Python | TVagneron/Reinforcement-learning | /testthomas2D.py | UTF-8 | 8,676 | 2.765625 | 3 | [] | no_license | """
Classic cart-pole system implemented by Rich Sutton et al.
Copied from https://webdocs.cs.ualberta.ca/~sutton/book/code/pole.c
"""
import logging
import math
import gym
from gym import spaces
from gym.utils import seeding
import numpy as np
import time
logger = logging.getLogger(__name__)
class TestThomas2D(gym... | true |
2f6eb2cf55771819589fe6a5d4c9983fa9b3db4d | Python | sreekripa/core2 | /list slicing.py | UTF-8 | 103 | 2.75 | 3 | [] | no_license | li=[10,20,30,40,50,60,70]
# print(li)
# print(li[1:3])
print(li[:5])
# print(li[2:])
# print(li[1:6:2]) | true |
3bcea18503941c6dd9850dc668bd5fd1f0130e35 | Python | notgurev/se2-compmaths-labs | /lab5/methods.py | UTF-8 | 3,014 | 3.15625 | 3 | [] | no_license | import math
from functools import lru_cache
from typing import List
import tabulate
from plot import plot
def lagrange(x, y, x0):
result = 0
for j in range(len(y)):
mul = 1
for i in range(len(x)):
if i != j:
mul *= (x0 - x[i]) / (x[j] - x[i])
result += y[j... | true |
5864342268c52c431bd14366b76455e7b3324c75 | Python | DARRENSKY/COMP9318 | /lab/COMP9318-Lab2/submission.py | UTF-8 | 5,083 | 2.90625 | 3 | [] | no_license | ## import modules here
import pandas as pd
import numpy as np
################# Question 1 #################
# helper functions
def project_data(df, d):
# Return only the d-th column of INPUT
return df.iloc[:, d]
def select_data(df, d, val):
# SELECT * FROM INPUT WHERE input.d = val
col_name = df.c... | true |
13ba8810089ce1f65405de279074862dc389f7b4 | Python | bharlow058/SMOTE-Variants | /examples/sample_optimization.py | UTF-8 | 1,932 | 2.671875 | 3 | [
"MIT"
] | permissive | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Sun Oct 28 18:37:20 2018
@author: gykovacs
Sample script on how to evaluate various classifiers and oversampling techniques
on a given dataset to find the best performing one. Also, illustration of
the processing of the results.
"""
import os.path
# impo... | true |
d95a387afdedc4e4e9907cbadbec44d8345aef38 | Python | SFQRM/Complex-Network | /Importance of Node/minimumDistance_BFS.py | UTF-8 | 2,554 | 3.453125 | 3 | [] | no_license | import numpy as np
global A_matrix, D_matrix # 定义全局变量
A_matrix = np.zeros((8, 8), dtype=int) # 创建一个8x8的全零矩阵,数据类型为int型
D_matrix = np.zeros((8, 8), dtype=int) # 创建一个8x8的全零矩阵,数据类型为int型
# 从文件@filename中读取网络的adjacentMatrix,通过networkx的add_edges方法向... | true |
41747c8e29796877fb9d92440a00b2ef3376640a | Python | filipenegrao/glyphsapp-scripts | /workflow/start_new_project.py | UTF-8 | 1,977 | 2.859375 | 3 | [
"Apache-2.0"
] | permissive | # MenuTitle: Start a new project
# -*- coding: utf-8 -*-
from __future__ import division, print_function, unicode_literals
import os
from datetime import datetime
__doc__ = """
If you have the same folder structure for every project, this script creates that structure in a breeze.
Just edit the FOLDERS list to change... | true |
9d5d873ea028f0a94c3a2f24f5918f1d8e0aaf70 | Python | Asmin75/Beeflux_soln | /3.py | UTF-8 | 678 | 4.46875 | 4 | [] | no_license | """Q3.
Consider a function
def student(name, roll, age, address):
print(name, roll, age, address)
a. What would be output of followings
student(“pratima”, name=”pratima”, 20, 20, 20)
student(“pratima”, 20, age=25, “kathmandu”)
student(“pratima”)"""
def student(name, roll, age, address):
print(na... | true |
70e96ddf1a4b9065acd9ac5802cbf1ff9f318a9e | Python | Hugo-E/ALTIERY_HUGO_WK_CT | /opencamera.py | UTF-8 | 368 | 2.890625 | 3 | [] | no_license | import cv2
#Open camera
cam = cv2.VideoCapture(0)
while True:
ret, frame = cam.read()
#Check error
if not ret:
print("Unable to open camera\n")
break
#Show camera
# gray = cv2.cvtColor(frame, cv2.COLOR_BGR2GRAY)
cv2.imshow("Name", frame)
#Close the window
if cv2.waitKey... | true |
f48f8008126486bb8eb96b9447ddce996ae68e63 | Python | SiriRaavi/MNIST_RS_10 | /mnist10/misc/py_utils.py | UTF-8 | 5,708 | 2.765625 | 3 | [] | no_license | import numpy as np
from scipy.spatial import distance
import os
def count_mislabel(gen, img_names):
"""
:param gen: generator instance
:param img_names: image names in the current batch
:return:
"""
mislab = np.zeros((gen.batch_size, gen.nb_samples_per_class * gen.nb_classes)).astype('int32')
... | true |
8d7cdf34907c4b8054b921a83fca325a721be7f7 | Python | zhouzhaoze/dip | /project1/gray_level_resolution.py | UTF-8 | 949 | 2.796875 | 3 | [
"Apache-2.0"
] | permissive | # *-* encoding=utf-8 *-*
import sys
import scipy
import numpy as np
from scipy import ndimage
from scipy import misc
import matplotlib.pyplot as plt
def reduce_gray_level_resolution(image, level):
for i in range(image.shape[0]):
for j in range(image.shape[1]):
#image[i][j] = np.int8(image[i][j]... | true |