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 |
|---|---|---|---|---|---|---|---|---|---|---|
00a05b0597d28c810a52e00b03e0b4ee5d9a0b89 | nalnez13/det_lab | /dataset/detection/utils.py | UTF-8 | 2,090 | 2.828125 | 3 | [] | no_license | import torch
import numpy as np
import cv2
def collater(data):
"""Data Loader에서 생성된 데이터를 동일한 shape으로 정렬해서 Batch로 전달
Args:
data ([dict]): albumentation Transformed 객체
'image': list of Torch Tensor len == batch_size, item shape = ch, h, w
'bboxes': list of list([x1, y1, w, h, cid])
... | true |
e8f9355a871629163c3b9430d8b2495562ea18d5 | stenpiren/deep_pipe | /dpipe/model_core/layers/structure.py | UTF-8 | 1,891 | 2.546875 | 3 | [] | no_license | import torch
import torch.nn as nn
from torch.nn import functional
def make_pipeline(structure, make_transformer):
assert all([type(s) is int for s in structure]), f'{structure}'
return nn.Sequential(*[
make_transformer(n_chans_in, n_chans_out) for n_chans_in, n_chans_out in zip(structure[:-1], struct... | true |
036067d72e3fdd77029da2c67e704e192bd750c9 | nova706/nomega | /py/src/i2c_lib.py | UTF-8 | 953 | 2.71875 | 3 | [
"MIT"
] | permissive | from time import *
from OmegaExpansion import onionI2C
class I2cDevice:
def __init__(self, address, port=0):
self.address = address
self.i2c = onionI2C.OnionI2C(port)
# Write a single command
def write_cmd(self, cmd):
self.i2c.write(self.address, [cmd])
sleep(0.0001)
... | true |
6c5c194d3c423005d9b6cd20b38fe94836c02703 | SHSBStudentRobotics/SRProject2018 | /BotTesting.py | UTF-8 | 704 | 2.953125 | 3 | [] | no_license | from MockFramework import *
from PowerMotor import *
import time, unittest
"""
r = MockRobot()
while MotorList[0] < 1:
PowerMotor(r, 0, 1)
r.OutputValues()
time.sleep(0.5)
while MotorList[0] > -1:
PowerMotor(r, 0, -1)
r.OutputValues()
time.sleep(0.5)
"""
class TestHardware(unittest.TestCase)... | true |
46b1cad0138d94cf7f7ecaea6f8f7a71292100a2 | nedegilefendim/SMAIProject-Team31 | /code clean up/main.py | UTF-8 | 850 | 2.734375 | 3 | [] | no_license | import csv
import logging
import string
import numpy as np
import pandas as pd
from model.RNNModel import RNNSeq2SeqModel
logging.basicConfig(level=logging.DEBUG,format='%(levelname)s %(message)s')
def debug(arg):
logging.debug(arg)
def info(arg):
logging.info(arg)
def warn(arg):
logging.warn(arg)
de... | true |
253cb8bdbe37c59f203a1ed46bde2b84942edf3e | DiegoOrejuela/holbertonschool-higher_level_programming | /0x0B-python-input_output/12-student.py | UTF-8 | 630 | 3.390625 | 3 | [] | no_license | #!/usr/bin/python3
class Student:
def __init__(self, first_name, last_name, age):
self.first_name = first_name
self.last_name = last_name
self.age = age
def to_json(self, attrs=None):
if type(attrs) == list:
for item in attrs:
if type(item) != str:
... | true |
1562979f44a6fb9fbf7bcc1bfb25a215783004c0 | asilvino/tempnotebook | /openkattis/modulo.py | UTF-8 | 508 | 2.9375 | 3 | [] | no_license | #! /usr/bin/python2
from __future__ import division
import sys
import math
from collections import Counter
# import StringIO
# import re
# import timeit
# sys.stdin = StringIO.StringIO("1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n")#3^4\n15\n9^2
# start = timeit.default_timer()
def main():
numbers = []
for line in sys.stdin:... | true |
0adb81af9c122d7cf804247e4e7ae5a6cbe3fe7e | juancamilobustossanchez1/ProyectoFinalInteligentesII | /RegresionLinealSciKitLearn/SVMDos.py | UTF-8 | 1,985 | 3.328125 | 3 | [] | no_license | """
Vectores de Soporte Regresión
@author: ligdigonzalez
"""
########## LIBRERÍAS A UTILIZAR ##########
#Se importan la librerias a utilizar
import numpy as np
import matplotlib.pyplot as plt
from sklearn import datasets
########## PREPARAR LA DATA ##########
#Importamos los datos de la misma librería de scikit-l... | true |
c1936d22a927eff7b42ecc5a2258d3ec9ba75e93 | ankitvad/control-sum-cmdp | /build_weighted_vocab.py | UTF-8 | 1,995 | 2.703125 | 3 | [
"MIT"
] | permissive | from os.path import join
import json
import os
import random
import argparse
from collections import Counter
import pickle as pkl
import re
def _count_data(path):
""" count number of data in the given path"""
matcher = re.compile(r'[0-9]+\.json')
match = lambda name: bool(matcher.match(name))
names = ... | true |
0652814570da9da6dc1aecce15a680925938efb3 | vivekprocoder/face-recognition | /face_detector.py | UTF-8 | 11,417 | 3.265625 | 3 | [
"MIT"
] | permissive | '''
@author: vivek
'''
import os
from color import Color
from pyimage import PyImage
from graph import Graph
class FaceDetector(object):
'''
classdocs
'''
def __init__(self, filename, block_size = 5,
min_component_size = 10, majority = 0.5):
'''
Constructor - keeps in... | true |
21b0e9479e61652149c156f4b119037125405feb | HuangJi/crackingInterview | /hackerrank/MinimumMovesToEqualArrayElements.py | UTF-8 | 249 | 2.984375 | 3 | [] | no_license | class Solution(object):
def minMoves(self, nums):
count = 0
nums.sort()
for i in xrange(len(nums) - 1, 0, -1):
count += nums[i] - nums[0]
return count
solution = Solution()
solution.minMoves([1,2,3])
| true |
2e29c2ed801881ff306b41464abc9b23994cb56b | anmalch/python | /lesson_7_2.py | UTF-8 | 2,218 | 3.953125 | 4 | [] | no_license | """
Реализовать проект расчета суммарного расхода ткани на производство одежды.
Основная сущность (класс) этого проекта — одежда, которая может иметь определенное название.
К типам одежды в этом проекте относятся пальто и костюм.
У этих типов одежды существуют параметры: размер (для пальто) и рост (для костюма).
Это мо... | true |
89562cd357b57d6c35b138c7d052430e29188b8a | perfect-python/perfect-python | /part2/chapter08/typing_noreturn.py | UTF-8 | 244 | 2.84375 | 3 | [] | no_license | from typing import NoReturn
def something_return() -> NoReturn:
return True
def raise_if_true(flag:bool) -> NoReturn:
if flag:
raise Exception('raise!')
def raise_always() -> NoReturn:
raise Exception('raise always')
| true |
becbfbc6e9a390a1f87707f83682955950f4748f | dsilabs/zoom | /zoom/records.py | UTF-8 | 26,783 | 2.8125 | 3 | [
"MIT"
] | permissive | """
zoom.records
record store
"""
import datetime
import decimal
import zoom
import zoom.exceptions
from zoom.utils import Record, RecordList, kind
from zoom.database import setup_test
from zoom.store import Store
def get_result_iterator(rows, storage):
"""returns an iterator that iterates over the row... | true |
bbe931ebb6dbcbce7cec917949956b4152c7c869 | Diakakodo/classrooms | /api/lists/str_archi.py | UTF-8 | 1,649 | 3.75 | 4 | [] | no_license | # -*- coding: utf-8 -*-
"""
from Architecture lecture!
Conversion decimal <-> two's complement representation
@author: Nathalie
"""
# simple conversions
def dec_to_bin(n, p):
'''
transform a decimal in binary (as a string) with p bits
'''
s = ""
while n != 0:
s = str(n % 2)... | true |
6184d3eeb293bf9276a3c0eab0289613e5054d06 | inventree/inventree-app | /lib/l10n/collect_translations.py | UTF-8 | 4,298 | 3.109375 | 3 | [
"MIT"
] | permissive | """
Collect translation files into a single directory,
where they can be accessed by the flutter i18n library.
Translations provided from crowdin are located in subdirectories,
but we need the .arb files to appear in this top level directory
to be accessed by the app.
So, simply copy them here!
"""
import os
import... | true |
2e20b3bf5ffa70ebe27d3926a8c1a2b5fd80a6da | Tarthir/DNSPlotter | /plotting/PlotMain.py | UTF-8 | 1,872 | 2.6875 | 3 | [] | no_license | from readers import FileReader as File_Reader
import sys
import pickle
# TODO see if there are different ASNs for both the one we queried and the one who queries our servers
# example of how to call: python PlotMain.py C:/Users/tyler/PycharmProjects/PlottingPractice/datalib
###########################################... | true |
a7ce8e908f0266b48d0877daefb79175ee9cad2e | RuisongZhou/classification.jittor | /models/resnet18.py | UTF-8 | 2,355 | 2.609375 | 3 | [] | no_license | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Time : 2020/3/29 5:45 下午
# @Author : RuisongZhou
# @Mail : rhyszhou99@gmail.com
import jittor as jt
from jittor import nn, Module
class ResidualBlock(Module):
def __init__(self, inchannel, outchannel, stride=1):
super(ResidualBlock, self).__init__()
... | true |
7f86ec621a2e4789ffc990776dd1b6b1871e5c04 | wangzl180/python-1 | /python练习/dict.py | UTF-8 | 626 | 3.796875 | 4 | [] | no_license | def bubble_sort(alist):
count = 0
for j in range(0,len(alist) - 1):#整个数列排序循环
for i in range(0,len(alist) - 1 - j):
# 元素从头走到尾,走完一次,排好一个数
if alist[i] > alist[i + 1]:
#因为要和下一个数相比,所以i只需要走到len(alist) - 1 - j
alist[i],alist[i + 1] = alist[i + 1],alist[i]... | true |
5aaf1d379f296f4fd484ef49e31ee9079dad5648 | jibinmathew69/exercism | /python/luhn/luhn.py | UTF-8 | 631 | 3.296875 | 3 | [] | no_license | class Luhn(object):
def __init__(self, card_num):
try:
card_num = card_num.replace(" ","")
self.card_num = [int(x) for x in card_num]
except:
self.valid = False
return
length = len(card_num)
if length<2:
self.valid = False
... | true |
57f7869e020ec2514e6f8f154e91f4b60e4539b5 | yejiiha/BaekJoon_step | /DFS and BFS/2667.py | UTF-8 | 898 | 3.203125 | 3 | [] | no_license | ## 단지번호 붙이기
import sys
input = sys.stdin.readline
n = int(input())
matrix = [[0]*n for _ in range(n)]
visited = [[0]*n for _ in range(n)]
for i in range(n):
line = input().strip()
for j, b in enumerate(line):
matrix[i][j] = int(b)
dx = [-1, 1, 0, 0]
dy = [0, 0, 1, -1]
def dfs(x, y, c):
visite... | true |
7a8c36cdb2e0aa8f8a64b9f3521ed9419564c3d2 | Kang-kyunghun/codekata | /beakjoon/beakjoon-tree.py | UTF-8 | 863 | 2.90625 | 3 | [] | no_license | memo = {}
def f(n):
if n in memo:
return memo[n]
else:
output = []
ex = f(n-1)
if len(ex) < 2:
output.append(ex[0] + tri_numbers[n-1][0])
output.append(ex[0] + tri_numbers[n-1][1])
else:
output.append(ex[0] + tri_numbers[n-1][0])
... | true |
432fa617614883e25083aa9b32ea83d79159dca8 | sbackon/Boring_Stuff | /Boring_Stuff_12/practice_projects/2048.py | UTF-8 | 550 | 3.140625 | 3 | [] | no_license | #!/usr/bin/env python3
# 2048.py - play the 2048 game by sending up, right, down, left all the time till you loose
from selenium import webdriver
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.common.action_chains import ActionChains
# Open site
browser = webdriver.Firefox()
browser.get('http... | true |
28677bc406bd35756f2d8b6fca5c280403e83947 | dstore-io/dstore-sdk-python | /dstore/helper/DstoreMetadata.py | UTF-8 | 822 | 2.71875 | 3 | [] | no_license | #!/usr/bin/env python
# -*- coding: utf-8 -*-
class DstoreMetadata:
"""
Convenience class to deal with different kind of metadata provided by the dstoreIO grpc server.
"""
ENGINE_RETURN_STATUS_KEY = 'dstore-engine-returnstatus'
USERNAME_KEY = 'dstore-username'
PASSWORD_KEY = 'dstore-password'
... | true |
c59b77a84f3760198f6fd4df2a798207ff5f44ed | NatanLisboa/python | /exercicios-cursoemvideo/Mundo1/ex019.py | UTF-8 | 512 | 4.4375 | 4 | [] | no_license | # Um professor quer sortear um dos seus quatro alunos para apagar o quadro. Faça um programa que ajude ele, lendo o
# nome deles e escrevendo o nome do escolhido
from random import choice
print('Desafio 019 - Sorteando um item na lista')
aluno1 = input('Nome do 1º aluno: ')
aluno2 = input('Nome do 2º aluno: ')
alun... | true |
77bcf4f41b0ce8737967502ce6c4043a980f48b0 | nishantsahoo/APT-Assignment-3 | /Q5.py | UTF-8 | 719 | 3.234375 | 3 | [] | no_license | file = open("New file.txt", 'w')
file.write("Nishant" + '\n')
file.write("Samarth" + '\n')
file.write("Paul" + '\n')
file.write("Srishti" + '\n')
file.write("Sharang" + '\n')
file.write("Bobby" + '\n')
file.write("Nandini" + '\n')
file.write("Kanishk" + '\n')
file.write("Adhish" + '\n')
firstDictionary = {}
secondDict... | true |
4295773965b8d02955c2dd7f7aea59e3235579e1 | myownbourne/Numerical_Analysis_interpolation | /main1.py | UTF-8 | 7,429 | 2.984375 | 3 | [] | no_license | from Lagrange_Interpolation import *
from objfun import *
from data_construction import *
import matplotlib.pyplot as plt
def main():
#1.y=|x|+1/(1+25*x*x) x in [-0.5,0.5]
data10_1=equidistant_nodes(-0.5,0.5,10,1)
data16_1=equidistant_nodes(-0.5,0.5,16,1)
data20_1=equidistant_nodes(-0.5,0.5,20,1)
x... | true |
43b09157cd2a2f2a23b851b9b6964ab686b03cb8 | penguinencounter/bingo | /bingo_card.py | UTF-8 | 1,269 | 3.328125 | 3 | [] | no_license | import random
import typing
import copy
class BingoCard:
def __init__(self, words: typing.List[str], hasFreeSpace: bool=True):
self.created_word_set = copy.deepcopy(words)
self.using_words = []
self.hasFreeSpace = hasFreeSpace
random.shuffle(self.created_word_set)
self.usin... | true |
b66d58baadf97a180f6480770ef52f2baf967a29 | BlockWorksCo/Job | /Engine/Database.py | UTF-8 | 1,090 | 2.53125 | 3 | [] | no_license |
import re
import sys
import sqlite3
from Configuration import *
def ExecuteSQL(query, databaseName=''):
"""
Execute a SQL query & return the results in a list of rows (tuples)
if no rows exist, [] is returned.
"""
if databaseName == '':
databaseName = DatabaseName
... | true |
9caf376b7486406cd8267dfc57a62f24f092f737 | Joaquim10/macgyver | /app/maze.py | UTF-8 | 4,856 | 3.5625 | 4 | [] | no_license | #!/bin/python/env python3
# -*- coding: UTF-8 -*-
"""
maze: maze contains the class Maze.
Classes:
Maze: The Maze object represents the labyrinth.
Methods:
location(structure):
Returns the coordinates of the first specified structure found.
free_paths():
Returns the list of coordinates of... | true |
d45f63cfb9f6789680ecb7b859b84b5b06f261b1 | VenkataNaveenTekkem/GoGraduates | /loops/Loops2.py | UTF-8 | 1,762 | 3.5 | 4 | [] | no_license | #
# x="Python123abc"
#
# # for i in x:
# #
# # if(i.isdecimal()):
# # continue
# # # else:
# # #print(i)
# #
# # for i in x:
# #
# # if(i.isdecimal()):
# # break
# # # else:
# # #print(i)
#
# print("While loops >>>>")
# #while condition:
# # statetments
# #else:
# cou... | true |
15799e54634a107a764bc723b9b4be765aaa545a | rajitbanerjee/kattis | /Moscow Dream/moscow.py | UTF-8 | 176 | 2.9375 | 3 | [
"CC0-1.0"
] | permissive | """https://open.kattis.com/problems/moscowdream"""
a, b, c, n = map(int, input().split())
if 0 not in [a, b, c] and a + b + c >= n >= 3:
print("YES")
else:
print("NO") | true |
14a185a9f63c2e045357b8703e64df892d2bd72e | bodii/test-code | /python/object_python/11/Wheel.py | UTF-8 | 1,058 | 3.015625 | 3 | [] | no_license | #!/usr/bin/env python3
# -*- coding:utf-8 -*-
''' 使用可回调类创建WGI应用程序 '''
import random
__all__ = ['Wheel', 'Zero', 'DoubleZero']
__name__ = "Wheel"
class Wheel:
def __init__( self ):
self.ng = random.Random()
self.bins = [
{
str(n) : (35, 1),
self.redb... | true |
bbc79aaa83b5f2114f846dfe19e910811c82ac47 | HiFiSamurai/Enigma | /legacy/mapWriter.py | UTF-8 | 400 | 3.234375 | 3 | [] | no_license | from random import randint
if __name__ == '__main__':
mapSize = 126
filename = "map.py"
f = file(filename,'w')
keys = []
chars = []
while len(keys) < mapSize-31:
x = randint(32,mapSize)
if (not x in keys):
keys.append(x)
chars.append(unichr(x))
print >> f, "charMap = " + str(chars)
print >> f, "gea... | true |
30812d3a16bf6096bc775c684aeea7fab4214150 | AvivAbramovich/files-workers | /src/consumer_multiprocessing/main.py | UTF-8 | 3,398 | 2.59375 | 3 | [] | no_license | import pika
from argparse import ArgumentParser
import logging
from logging.handlers import QueueHandler, QueueListener
import multiprocessing
from time import sleep
def consume(broker_host, exchange_name, routing_key, queue_name, durable, auto_ack):
logging.info('hi')
logger = logging.getLogger()
logger.s... | true |
76542680492afda68a7d3d95102a254b24a90ef4 | shay93/Motor-Represenations | /physics_util.py | UTF-8 | 5,147 | 3.046875 | 3 | [] | no_license | import numpy as np
import IPython
def Inverse_Kinematics_2DOF(end_effector,\
link_length):
""" Args: Effector_Position - An ndarray consisting of the desired
end_effector positions of an arm
Returns: State
"""
#separate out the x and y positions
end_... | true |
b0ac5b8d2542344d469773b54a386a686e8a971b | 25dishant/EC60002---Computer-Vision | /Assignment 4/Trash/Test.py | UTF-8 | 6,750 | 2.953125 | 3 | [] | no_license | import math as m
import numpy as np
import cv2 as cv
import os
import matplotlib.pyplot as plt
def GaborKernel(lamda, theta, sigma, gamma):
kernel_size = m.ceil(6*sigma**2)
if kernel_size % 2 == 0:
kernel_size += 1
p = kernel_size//2
q = kernel_size//2
Kernel = np.zeros((kernel_size, kerne... | true |
4b95a329e266c40b68e21b4e55cc72bf0045fa91 | 0fftheground/deep_learning_for_computer_vision_starter_bundle | /start_bundle/sgd.py | UTF-8 | 2,564 | 3.21875 | 3 | [] | no_license | # import the necessary packages
from sklearn.model_selection import train_test_split
from sklearn.metrics import classification_report
from sklearn.datasets import make_blobs
import matplotlib.pyplot as plt
import numpy as np
import argparse
def sigmoid_activation(x):
# compute the sigmoid activation value for a ... | true |
b7c62e89342100f3974bf7891e1ca86f3363d3c8 | sisyamo2236/python | /sankaku.py | UTF-8 | 280 | 3.453125 | 3 | [] | no_license |
#---------------------------------------- checkPrime
# 機能:三角形の面積を求める
# 引数:
# h:高さ、w:底辺の長さ
#戻値:
# 三角形の面積=底辺*高さ/2
#
#
def getArea3(h,w):
area=h*w/2
return area
print(getArea3(4,7))
| true |
b41d04be627c797f7ee37cfaf9c4ffcd8ac0deab | Argonauta666/coding-challenges | /grokking-coding-interview/10-subsets/subsets.py | UTF-8 | 585 | 3.46875 | 3 | [] | no_license | # https://leetcode.com/problems/subsets/
from typing import List
class Solution:
def subsets(self, nums: List[int]) -> List[List[int]]:
subsets = []
# add empty subset
subsets.append([])
for num in nums:
# take all existing substs and insert the curren... | true |
ca2855c78fa9457d91bee34f0fc8dfb59828b2fe | leilalu/algorithm | /排序算法/shell_sort.py | UTF-8 | 1,159 | 3.796875 | 4 | [] | no_license | import random
def get_random_array(max_size, min_value, max_value):
return [random.randint(min_value, max_value) for _ in range(max_size)]
def shell_sort(nums):
n = len(nums)
h = 1
# 得到递增的间隔
while h < n // 3:
h = 3 * h + 1
while h >= 1:
for i in range(h, n):
j =... | true |
e9ede39595a6bb1aa4246bde105291d32bf7e6fd | MonikaBarget/DigitalHistory | /Wikidata_Wikimapper.py | UTF-8 | 1,082 | 2.890625 | 3 | [] | no_license | # code to find page titles for Wikidata IDs with Python Wikimapper
# adapted from code snippets on https://pypi.org/project/wikimapper/
# index_enwiki-20190420.db file was separately downloaded from Wikipedia: use latest release if possible
from wikimapper import WikiMapper
import os.path
# Map Wikidata ID to Wikip... | true |
81039b7e6a22c24667788add67b0caa0dcf736c1 | fdantas78/learning_python | /src/MySql_basics.py | UTF-8 | 1,405 | 3.125 | 3 | [] | no_license | '''
Created on Jun 8, 2017
@author: makaidaimyo
'''
'''
pip3 install lxml
'''
#USE PyDB;
#CREATE TABLE links (time FLOAT(18,2), link VARCHAR(400));
from bs4 import BeautifulSoup as BSoup
import time
import urllib.request as url_req
#import urllib2
from MySqlConn import connection
c, conn = connection('PYTHON_DB')
d... | true |
e668b38d0c55c3bea45f8043570926180e0af0bf | mscaceres/tail_end | /tail_end/tick_tests.py | UTF-8 | 552 | 3.046875 | 3 | [] | no_license | from .tick import *
def test_all_clases_created():
l = globals()
assert all( clr.name + 'Tick' in l for clr in Color) is True
def test_colotick_slice():
blue_tick = ColorTick.from_color_string("blue", "#")
blue_tick = blue_tick * 10
slice_tick = blue_tick[5:7]
assert type(slice_tick) == type(b... | true |
3a89d066c9d7e6ae47966ab75c349484d2ece75e | esagara/temp-and-humidity | /lib/upload.py | UTF-8 | 3,244 | 2.84375 | 3 | [] | no_license | #!/usr/bin/python
import os
import glob
import boto
from boto.s3.key import Key
from local_settings import SETTINGS
def upload_to_s3(upload_file, directory, callback=None, md5=None, reduced_redundancy=False, content_type=None):
"""
Uploads the given file to the AWS S3
bucket and key specified.
callb... | true |
f80eae884133d3feca171a39c89b3aa45bcde486 | dthung1602/goodread-bestbook-prediction | /Book.py | UTF-8 | 5,706 | 2.75 | 3 | [] | no_license | import csv
import xml.etree.ElementTree as ET
from datetime import date
def get_date(node, date_name, default_year):
return (date(default_year, 12, 10)
- date(
int(node.findtext(date_name + '_year') or default_year),
int(node.findtext(date_name + '_month') or 1),
... | true |
31acde66d762901f18c4d348c46459ffed21a261 | stewarthkerr/CS760 | /hw3/shkerr/classes.py | UTF-8 | 4,516 | 3.390625 | 3 | [] | no_license | #!/usr/bin/python3.6
import numpy as np
import pandas as pd
import sys
#This takes the json input and converts to numpy
#Note - it automatically will standardize numeric features and do one-hot encoding for categorical features
class json2numpy:
def __init__(self, set):
self.metadata = np.array(set['metad... | true |
10daf8eeecd19d89e2e12dc0cc98cc764b2e83d3 | gjoe344/python-learning | /whatsyourname.py | UTF-8 | 469 | 4.21875 | 4 | [
"MIT"
] | permissive |
firstname = 'Barack'
lastname = 'Obama'
def print_myname(firstname,lastname):
'''
This functions takes in two strings and prints out a message
'''
if isinstance(firstname, str) == True and isinstance(lastname, str) == True:
return 'Hello ' + firstname + ' ' + lastname +'! You just delved into... | true |
2edfa156feca1b21f1b1a14eaa1d847fa4057d5e | epetousis/vce-exam-timetables | /parser/exam_parser.py | UTF-8 | 3,425 | 3.171875 | 3 | [] | no_license | # -*- coding: utf-8 -*-
import os, sys
sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
from bs4 import BeautifulSoup
from exam import Exam
from datetime import datetime, date
import pytz
import csv
# If a line in the table contains these keywords, it's actually an exam instruction.
non_exa... | true |
6ce6094d9861776b01862faf152a26fe1034e95c | xiaolongbjcp/learnpy | /ex15_logging.py | UTF-8 | 257 | 3.21875 | 3 | [] | no_license |
import logging
logging.basicConfig(level=logging.INFO)
def foo(s):
return 10/int(s)
def bar(s):
logging.info('in bar: s = %s' % s)
return foo(s)*s
def main():
try:
bar('0')
except Exception as e:
logging.exception(e)
main()
print('the end')
| true |
b40cf7349284a8b5a0f678a4005bde4d2675ad23 | IsuruBoyagane15/vue4logs-parser | /route.py | UTF-8 | 4,368 | 2.609375 | 3 | [
"Apache-2.0"
] | permissive | from flask import Flask
import pandas as pd
from flask import json
import ast
from flask_cors import CORS, cross_origin
from flask import request
from Vue4logsParser import *
app = Flask(__name__)
cors = CORS(app)
app.config['CORS_HEADERS'] = 'Content-Type'
def list_logs(logs):
out = []
buff = []
for c in... | true |
a4bf4777469a7c10851185e6f7c4125ce311d9f7 | griffy/SimpleSim | /simplesim/stats.py | UTF-8 | 4,835 | 3.859375 | 4 | [
"MIT"
] | permissive | import math
# This class is essentially a more advanced dictionary where the name
# of an attribute of a Stats object is the key and the value is a list
# of sample points that can find their own total, mode, median, mean, etc.
class Stats(object):
def __init__(self):
# stats is a dictionary
self._... | true |
d52f0b4c6bfb5a14c8210e14efb5dcd0418e8ede | kinghaoYPGE/career | /python/20190121/Code/c2.py | UTF-8 | 792 | 3.71875 | 4 | [
"MIT"
] | permissive | """
记录错误
"""
# 记录日志
import logging
def f1(s):
return 10 / int(s)
def f2(s):
return f1(s) ** 2
def main():
try:
f2('0')
except Exception as e:
# 记录错误
logging.exception(e)
# main()
# print('End')
# 自定义错误类型
class MyError(ValueError):
pass
def func(s):
n = int(s)
if n... | true |
8be9cdc9d83cf34348131a144aabba373c4bb23c | ekimekim/pylibs | /libs/textgraph.py | UTF-8 | 4,637 | 3.796875 | 4 | [] | no_license |
"""A variety of text-based graphing techniques"""
def _get_braille(col1, col2):
"""Braille block renders 8 dots according to the 8 bits of the lower byte of the unicode code point number,
in the following pattern:
0 3
1 4
2 5
6 7
where 0 is least signifigant bit and 7 is most signifigant bit.
For our pu... | true |
a8cfee85e64b54b77d6f510263417262b59f6c23 | kmusen/Scientist_Simulation- | /Agent_Based_Approach Code/graph_gompertz.py | UTF-8 | 355 | 2.703125 | 3 | [] | no_license | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Fri Dec 15 15:16:27 2017
@author: michellezhao
"""
from scipy.stats import logistic
import matplotlib.pyplot as plt
import numpy as np
fig, ax = plt.subplots(1,1)
x = np.linspace(0,50)
ax.plot(x, logistic.cdf(x, loc = 3, scale = 1), 'r-', lw=5, alpha=0.6... | true |
f6d8ab4285e648702bd85dd52a1453881599f2ac | eflipe/python-exercises | /udemy-py/postgresql/capa_de_datos/conexion_db.py | UTF-8 | 1,461 | 2.859375 | 3 | [] | no_license | from logger_base import log
import psycopg2 as db
import sys
class ConexionDB:
_DATABASE = 'postgres'
_USERNAME = 'postgres'
_PASSWORD = 'postgres'
_PORT = '5432'
_HOST = '127.0.0.1'
_conexion = None
_cursor = None
@classmethod
def obtenerConexion(cls):
if cls._conexion is... | true |
ec8d267036d0c1cfc1f89c656d150d1044f7e5c3 | LiranAvda-TAU/Research | /Code/Enum/BlastType.py | UTF-8 | 344 | 2.8125 | 3 | [] | no_license | import enum
class BlastType(enum.Enum):
BLASTN = 'blastn'
BLASTP = 'blastp'
BLASTX = 'blastx'
TBLASTN = 'tblastn'
TBLASTX = 'tblasrx'
def fromNtoP(b):
if b is BlastType.BLASTN.value:
return BlastType.BLASTP.value
elif b is BlastType.BLASTP.value:
return... | true |
52c2e2e730956450c809a7342cae22faafe48df0 | JB0925/Bites | /Bite_259.py | UTF-8 | 2,384 | 3.71875 | 4 | [] | no_license | from string import ascii_uppercase
# See tests for a more comprehensive complementary table
SIMPLE_COMPLEMENTS_STR = """#Reduced table with bases A, G, C, T
Base Complementary Base
A T
T A
G C
C G
"""
# Recommended helper function
def _clean_sequence(sequence, str_table):
"""
Receives a DNA sequence and... | true |
4430606e1fb963bc6625b21994443c3308429eb2 | BliZZeRxD/WebDev2020 | /lab8/Codingbat/Informatics/5Array/c.py | UTF-8 | 116 | 3.359375 | 3 | [] | no_license | a = int(input())
list = [int(i) for i in input().split()]
pos = 0
for x in list:
if x > 0:
pos += 1
print(pos) | true |
ae10e7d990c4f1769ff5d6195e3795f4d1b4be81 | anukrit01/Data-Structure | /Singly LinkedList/linkedlist_practice2.py | UTF-8 | 3,013 | 4.71875 | 5 | [] | no_license | # Flattening a nested Linked List
#Let first generate nodes and create linked list
class Node:
def __init__(self, value):
self.value = value
self.next = None
def __repr__(self):
return str(self.value)
class LinkedList:
def __init__(self, head):
self.head... | true |
3d8ceec1103350ad1a90c53ca8ec696537dce162 | SamuelDSR/aoc-2020 | /python/day-5/main.py | UTF-8 | 838 | 3.40625 | 3 | [] | no_license | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from pathlib import Path
def seat_to_int(seat_code):
seat_row = int(seat_code[:7].replace("F", "0").replace("B", "1"), 2)
seat_col = int(seat_code[7:].replace("R", "1").replace("L", "0"), 2)
return seat_row*8 + seat_col
def load_input():
input_path = Path... | true |
7b0a12b1ad10be7484721a9e7d29282169f99d1f | Headshake/Student-Grade-Blockchain | /BlockChain.py | UTF-8 | 7,504 | 3.078125 | 3 | [] | no_license | import sys
import json
import hashlib
from flask import Flask, jsonify, request
from time import time
from uuid import uuid4
from urllib.parse import urlparse
import requests
class Blockchain(object):
def __init__(self):
self.chainBlock = []
self.currentTransactions = []
self.... | true |
e86b95620cdc4bac00e4b6a31a7ba47ee9ab23fb | NChesser/learning_examples | /Python/special_pytha_triplet.py | UTF-8 | 716 | 3.671875 | 4 | [] | no_license | import math
print(math.sqrt(1000))
print (1000**2)
print(24**2 + 640**2 + 768**2)
print(24 + 640 + 768)
count = 1
"""for i in range (count, 1000):
count +=1
for j in range (count, 1000):
for k in range (count, 1000):
#print (str(i) + " " + str(j) + " " + str(k) + " " + str((i... | true |
e62d44e7cd4b3fba9e64e75adfbb1ce5b489f05a | joshsizer/free_code_camp | /algorithms/merge_sort/merge_sort_test.py | UTF-8 | 911 | 3.125 | 3 | [
"MIT"
] | permissive | """
Created on Fri May 7 2021
Copyright (c) 2021 - Joshua Sizer
This code is licensed under MIT license (see
LICENSE for details)
"""
from merge_sort import merge_sort
class TestMergeSort:
"""Test the merge_sort function"""
def test_merge_sort1(self):
assert merge_sort([-530, 13, 593, -41, 66, 727,... | true |
e9122ef85cc1bf1eded2a5518d0b4e0a0bc801ac | hoang-ng/LeetCode | /Tree/107.py | UTF-8 | 1,435 | 4.125 | 4 | [] | no_license | # 107. Binary Tree Level Order Traversal II
# Given a binary tree, return the bottom-up level order traversal of its nodes' values. (ie, from left to right, level by level from leaf to root).
# For example:
# Given binary tree [3,9,20,null,null,15,7],
# return its bottom-up level order traversal as:
# [
# [15,7],
#... | true |
d54c73b62bf73fd0a6b48751180cebcea866ea1b | pengwei715/Ray_tracing_cuda | /CPU_version/build/plot.py | UTF-8 | 313 | 2.71875 | 3 | [] | no_license | import numpy as np
import matplotlib.pyplot as plt
def plot_dat(filename, shape, dtype=np.float64):
a = np.fromfile(filename, dtype=dtype).reshape(shape);
print(a)
plt.imshow(a, origin='lower')
plt.savefig(filename[:-4] + ".png")
if __name__ == '__main__':
plot_dat("ball.dat", (1000,1000))
| true |
8c3dec08bf5f27f3e9caf3d2865619cca317625a | osiddiquee/SP2018-Python220-Accelerated | /Student/osiddiquee/lesson06/test.py | UTF-8 | 690 | 3.28125 | 3 | [] | no_license | import unittest
from roman_to_int import RomanToInt
class TestRomanToInteger(unittest.TestCase):
def test_single_x(self):
self.assertEqual(RomanToInt.convert('X'), 10)
def test_single_i(self):
self.assertEqual(RomanToInt.convert('I'), 1)
def test_single_v(self):
self.assertEqua... | true |
bce3bcbe8768cd4bfd005c1202cf217862812a63 | Python3pkg/PyGoogleForm | /PyGoogleForm/FormParser.py | UTF-8 | 3,102 | 3.015625 | 3 | [
"MIT"
] | permissive | import collections
import urllib.request, urllib.parse, urllib.error, urllib.request, urllib.error, urllib.parse
from bs4 import BeautifulSoup
from .FormQuestion import GFQuestion
class GFParser(object):
"""Allows to access all the questions from a GForm and submit a response"""
def __init__(self, url):
"""Loads... | true |
c3b38ad44f7bf9179a0988811e9446b58d4178ae | Jesrat/pyutl | /pyutl/__init__.py | UTF-8 | 2,137 | 3.359375 | 3 | [
"MIT"
] | permissive | r"""
To use, simply 'import pyutils'
shellExecute can receive a cmd as str or arr example
>>> pyutils.shell_execute('date')
(b'mi\xc3\xa9 ene 30 11:35:00 CST 2019\n', b'')
>>> pyutils.shell_execute(['echo',"'hello world'"])
(b"'hello world'\n", b'')
"""
__title__ = 'pyutl'
__description__ = 'functio... | true |
4e025aee656aa974e0cf84009312d681914dbcfb | a1exandr0/SeamCarving | /module/Interface.py | UTF-8 | 5,468 | 2.765625 | 3 | [] | no_license | from SeamCarving.module.SeamCarve import SeamCarve
import tkinter as tk
from PIL import Image as IM
from PIL import ImageTk as IMTK
import numpy as np
"""
Interface to simplify usage of SeamCarving class.
You mostly need to use interface when you want to use protective or targeting masking in order to remove or keep ce... | true |
3eeecfef41caed8df402a1a9341b87bbaaf377db | Code-Institute-Submissions/irishcraft | /basket/views.py | UTF-8 | 2,357 | 2.890625 | 3 | [] | no_license | """
Basket App views
"""
from django.shortcuts import (
render, redirect, reverse, HttpResponse, get_object_or_404)
from django.contrib import messages
from products.models import Product
def view_basket(request):
"""A view to show the shopping basket"""
return render(request, 'basket/basket.html')
# El... | true |
d2288dee7be65dc67d59aeb780f3c72157abdcfb | oarias2710/IIC2233_2020_2sem | /oarias2710-iic2233-2020-2-master/Tareas/T00/funciones.py | UTF-8 | 11,216 | 3.453125 | 3 | [] | no_license | from parametros import RADIO_EXP
from parametros import NUM_BARCOS
import random
# Funciones a usar en la Tarea 00
# (este archivo debe estar en la misma carpeta del código que ejecuta el juego)
def puntaje(elemento):
return int(elemento[1])
# Esta funcion pide un input numérico al usuario
# y se asegura de que... | true |
b5ac237de990d9ec0be6898e11e27c867fd619cb | tb4jc/MyExplorer | /fsutils/functions.py | UTF-8 | 6,220 | 3.015625 | 3 | [] | no_license | import os
import stat
import datetime
import shutil
import fsutils
from pathlib import Path
from fsutils.fileprepender import FilePrepender
def __local_log__(msg, log_func=None):
"""
Local function for logging given message. If log_func is set, given message is appended to it, else the message is
printed... | true |
9d266370f2ee1ea17e101eb424e75472ed07150e | tonylixu/architect-001 | /week03/work02/ContainerComponent.py | UTF-8 | 216 | 2.53125 | 3 | [
"Apache-2.0"
] | permissive | from abc import ABC, abstractmethod
class ContainerComponent(ABC):
"""Abstract component class"""
@abstractmethod
def print(self):
pass
@abstractmethod
def add_node(self):
pass
| true |
7c760a437b9cff1334448db24607c5edd296dc29 | Hygde/M2-PYSC2-Agent | /src/Actions/select_action.py | UTF-8 | 2,683 | 2.71875 | 3 | [] | no_license | from .sc2action import SC2Action
from pysc2.lib import features, actions
import numpy as np
from enum import IntEnum
## This class defines the different selection type
class SelectType(IntEnum):
## Selects only on unit
SINGLE = 0
## Selects all the units of a type
ALL_TYPE = 1
## Selects idle work... | true |
1caa8e940245870a173c3920494546ced92d246c | kaichua/CZ4042-Neural-Network-Deep-Learning | /Project 1/Part A Files/Part A_3.py | UTF-8 | 10,555 | 2.890625 | 3 | [] | no_license | #Import the required libraries
import matplotlib.pyplot as plt
import tensorflow as tf
import numpy as np
import pandas as pd
import math
from sklearn.utils import shuffle
from sklearn.model_selection import train_test_split
import os
if not os.path.isdir('proj_figures'):
os.makedirs('proj_figures')
tf.compat.v1.... | true |
411ffd61a40ce83abb5fd95aa30bcab3a74aa1f9 | GuzTech/CFU-Playground | /proj/hps_accel/gateware/stream/actor.py | UTF-8 | 4,179 | 2.84375 | 3 | [
"Apache-2.0"
] | permissive | #!/bin/env python
# Copyright 2021 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agre... | true |
89bec221d8ab4cf7c3d723395a5c31f32e7e910d | dubiao0310/lg_study | /web_po/page/base.py | UTF-8 | 1,165 | 2.625 | 3 | [] | no_license | # -*- coding: utf-8 -*-
# @Time : 2020/11/16 下午1:37
# @Author : biao.du
# @Email : MrDu_biao@163.com
# @File : base.py
from selenium.webdriver.chrome.options import Options
from selenium.webdriver.remote.webdriver import WebDriver
from selenium import webdriver
from selenium.webdriver.support import expected_c... | true |
4e3efb7dc97aba2f8c73180eb91cb796f3055d4b | salil-7295/Analysis_of_EU_DATA | /runserver.py | UTF-8 | 14,323 | 2.765625 | 3 | [] | no_license | import dash
import dash_core_components as dcc
import dash_html_components as html
from graph_data import *
from summary import *
external_stylesheets = ['https://codepen.io/chriddyp/pen/bWLwgP.css']
app = dash.Dash(__name__, external_stylesheets=external_stylesheets)
app.layout = html.Div(children=[
html.H1(chi... | true |
5b5b33d19ba5d3966bfad9dd398943a06051eab4 | anguswilliams91/advent-of-code-2020 | /02/main.py | UTF-8 | 1,102 | 3.6875 | 4 | [] | no_license | """2. Check if passwords in a database are compliant with rules."""
from collections import Counter
def is_valid_password_old_rule(rule: str, password: str) -> bool:
# check if a password is compliant with a rule
letter_counts = Counter(password)
count_constraint, letter = rule.split()
lower, upper =... | true |
7a1318ffb088b5d9a03259b0da2dadd99160f773 | micole/slackbucket | /slackbucket/pluginregistry.py | UTF-8 | 2,430 | 2.734375 | 3 | [
"MIT"
] | permissive | import os
import importlib
from .baseplugin import BasePlugin
class PluginNotFoundError(Exception):
""" Raised when plugins can't be found for some reason"""
class PluginConfigurationError(Exception):
""" Raised when something has gone wrong when attempting to configure a plugin """
class PluginRegistry... | true |
14bc8300fe00feb837dec9f97d0506e176b7ed6d | jima80525/ctypes-presentation | /good_string.py | UTF-8 | 742 | 3.671875 | 4 | [
"MIT"
] | permissive | #!/usr/bin/env python3
import ctypes as ct
''' python strings are immutable. The function adds 1 to each value in the
array. The python string will remain unchanged afterwards.
The ctypes string buffer IS mutable, however.
'''
if __name__ == '__main__':
libc = ct.CDLL("./libmyCLib.so")
print("Calling... | true |
4c4e228558189cbb1338e4f569ee31f974435587 | TheJoeSmo/convertible | /convertible/Convertible/Greedy.py | UTF-8 | 2,870 | 2.90625 | 3 | [
"MIT"
] | permissive | from typing import List, Any, Optional
from convertible.Convert.NextArgumentException import NextArgumentException
from convertible.Convert.RejectArgumentException import RejectArgumentException
from convertible.Convert.ExceptionHandler.ConvertException import ConvertException
from convertible.Convert.Convert import N... | true |
5181e3c9acc57a813f05f22402ed10d2b2259880 | undead404/russianroulette | /pypiranking.py | UTF-8 | 2,222 | 2.625 | 3 | [] | no_license | import json
import lxml.cssselect
import lxml.html
import os
# import requests
import concurrent.futures
# from pprint import pprint
ROOT_URL = 'http://pypi-ranking.info/alltime?page={page}'
PACKAGE_ELEM_SELECTOR = lxml.cssselect.CSSSelector('#main_list tr')
PACKAGE_POPULARITY_SELECTOR = lxml.cssselect.CSSSelector('.... | true |
fde1f64407eb3250fd2635dbb3bd8477550e6d91 | sarbajit125/Python-Basic | /zigzagg.py | UTF-8 | 532 | 3.359375 | 3 | [] | no_license | import time, sys
indent=0
indentIncreasing=True
try:
while True:
print(' ' * indent,end='')
print('********')
time.sleep(0.1) #Pause for 1/10th seconds
if indentIncreasing:
indent=indent+1
if indent == 10: # time to decrease indent
... | true |
94f5b953366b71349bbe21997298bed6886d4a41 | wei2374/FoG_detect | /PYTHON_IM/labeling.py | UTF-8 | 568 | 2.71875 | 3 | [] | no_license | import numpy as np
def relabel(labels,metadata):
Relabel = np.zeros(np.size(labels))
print("in function relabel")
length = np.size(labels,0)
jStart=0
windowsize = metadata["windowsize"]
stepsize = metadata["stepsize"]
while(jStart<length-windowsize):
window = labels[jStart:(jStart+windowsize-1)]... | true |
8c953f4a3dd482af3100a12c3a3d1af3cf8e6d78 | AlterCodex/Clases | /Tienda_Maquillaje_Package/Test/test_buscar_servicio.py | UTF-8 | 3,239 | 2.734375 | 3 | [] | no_license | import random
from Tienda_Maquillaje_Package.Dominio.controlador_servicio import ControladorServicio
from Tienda_Maquillaje_Package.Dominio.servicio import Servicio
from Tienda_Maquillaje_Package.Dominio.especificacion_tienda_maquillaje import Especificacion_Tienda_Maquillaje
def test_buscar_servicio():
nombres ... | true |
3a757f0da09b3db8a733e833fc882e3a60c376b9 | WiciuTyraka/ISS_project | /backend/control_system.py | UTF-8 | 1,835 | 2.671875 | 3 | [] | no_license | from pid_controller import PidController
from motor import Motor
class ControlSystem:
def __init__(self, model_parameters):
self.motor = Motor()
self.pid_controller = PidController(model_parameters.kp, model_parameters.Ti, model_parameters.Td)
self._rated_voltage = model_parameters.rated_v... | true |
6d06537ea05c0bd768315bb4f5c5c6442864f1c1 | nmaslov255/presidential-grants-parser | /parser/output.py | UTF-8 | 1,625 | 2.65625 | 3 | [] | no_license | #!/usr/bin/python3
import pandas as pd
import numpy as np
import api
def format_to_excel(rows, links, output, sheetname='noname'):
"""Just wrapper for pd.ExcelWriter
Arguments:
rows {object} -- pd.DataFrame with some data
links {list} -- list with links to grant
output {str} -- fi... | true |
c1598729b800409ebff92a6948362d78bf859cd5 | imjoseangel/100-days-of-code | /python/ansibleplugins/lookup/listmerge.py | UTF-8 | 1,539 | 2.71875 | 3 | [
"MIT"
] | permissive | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import (division, absolute_import, print_function)
__metaclass__ = type
from collections import defaultdict
from ansible.plugins.lookup import LookupBase
from ansible.errors import AnsibleError
from ansible.utils.display import Display
DOCUMENTATION = """... | true |
fd86f09e036d67d73b604cff4f71ab8526e45094 | sskl660/make-scratch | /threshold_tester.py | UTF-8 | 2,122 | 2.671875 | 3 | [] | no_license | import cv2
import numpy as np
import matplotlib.pyplot as plt
from matplotlib.widgets import Slider
from matplotlib import gridspec
config = {
'img_src': './images/original_001.png'
}
def update(val):
global img_gray
global img_bin
global sp_img
th = int(sld_th.val) # threshold
bs = int((2*i... | true |
9c8b17ebf063cb7605afd6ec1dde9e502d555580 | mjsong0712/learn_python | /2019/week8/problem0.py | UTF-8 | 529 | 3.84375 | 4 | [] | no_license | # -*- coding: utf-8 -*-
# 변수명 예시
# L, M, N
# list, number_list, numbers
# input
# 함수 사용시 f1(input), f2()
# 변수 사용시 v1 = v2 + v3
# range(5) == [0, 1, 2, 3, 4]
# [0 for i in range(5)] == [0, 0, 0, 0, 0]
# m = m + 1 <=> m += 1
# a<c and c<b <=> a<c<b
# 바꾸기: a,b = b,a
# 리스트 원소 추가 L.append(a)
# L.sort()
def inOrder(... | true |
48757ba7d6a5812277b8d5803eb35aeedd312b43 | kakaotrack/opensource-class | /python_basic/function.py | UTF-8 | 836 | 4.4375 | 4 | [] | no_license | # -*- coding: utf-8 -*-
var_a = 145
var_b = 13
# 1. 함수의 선언
def sumNumbers(a,b) : # 2. 블럭의 시작은 : (콜론)
return a + b
# 3. 블럭의 구분은 들여쓰기
# 4. 들여쓰기가 끝나면 새로운 블럭이 시작된다
def multiNumbers(a,b) :
return a * b
def complex(a,b) :
# --- complex 함수 블럭 시작
com_a = sumNumbers(a,b)
com_b = multiNumbers(a,b)
# 5. 함수 ... | true |
f11f1120430ae14b35b9c887e3bcf7e8166ae023 | Dojones98/FiniteStateAutomata | /minimize/minimize.py | UTF-8 | 6,224 | 3.9375 | 4 | [] | no_license | """Description: This is a program that minimizes a DFA from an input file that is a
description of that DFA and outputs the distinguishibility table, the indistinguishable
pairs, the sets of states with common transitions, and the description of the minimized DFA."""
import sys
# Input: a character, a nested di... | true |
d67c294c04254aef47bfc5c60466bfa01bcd8e7e | Timothy-Kornish/AstronomyProj1 | /Lab1/Kornish_2.py | UTF-8 | 11,665 | 3.046875 | 3 | [] | no_license | # loading imports
import numpy as np
import math
import matplotlib.pyplot as plt
import scipy.misc
# Loading in the flash drive as the directory and the firts data sets
myDir_1 = '/Volumes/TIM/Lab1_data/'
myData = np.zeros((1,10))
myData_2 = np.zeros ((1,100))
myData = np.loadtxt(myDir_1+'Lab1_n10t10_002')
myData_2... | true |
70db19be4a5e6afec95f3045eb0bb7ad7d079656 | BhCh7051/IR-Assignment | /FabriK.py | UTF-8 | 3,596 | 3.59375 | 4 | [] | no_license | # Bharat Chandwani
# 2019BCS-012
import math
import numpy as np
from matplotlib.pyplot import plot, show, style
# Input: The joint positions pi for i = 1,...,n, the
# target position target and the distances between each
# joint
class Point(object):
'''Creates a point on a coordinate plane wi... | true |
3e9742f4e7830ca7100cc80ea44545ab3a268b8f | Chenbaocun/One-minute-of-knowledge | /decorator1/ClassDecorator.py | UTF-8 | 520 | 3.421875 | 3 | [] | no_license | # -*- coding: utf-8 -*-
# @Time : 2019/10/24 19:34
# @Author : Tom Chen
# @Email : chenbaocun@emails.bjut.edu.cn
# @File : ClassDecorator.py
# @Software: PyCharm
import time
class Decorator:
def __init__(self, fun):
self._fun = fun
def __call__(self, *args, **kwargs):
start = ti... | true |
3b4e9b2c326c5af7e7021de7d27af5a7d0f64da2 | arthurdysart/LeetCode | /0784_letter_case_permutation/python_source.py | UTF-8 | 2,501 | 4.125 | 4 | [
"Unlicense"
] | permissive | # -*- coding: utf-8 -*-
"""
Leetcode - Letter Case Permutation
https://leetcode.com/problems/letter-case-permutation
Created on Fri Nov 30 22:20:04 2018
@author: Arthur Dysart
"""
## REQUIRED MODULES
from collections import deque
import sys
## MODULE DEFINITIONS
class Solution:
"""
Breadt... | true |
582cc0d4c413c27f6dc4baefe1171f92f1accb24 | tanzhenyu/keras-cv | /keras_cv/layers/preprocessing/random_shear_test.py | UTF-8 | 14,292 | 2.71875 | 3 | [
"Apache-2.0"
] | permissive | # Copyright 2022 The KerasCV Authors
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in ... | true |
26dfd1e0a0814b12a98cd508937a999ebde21bbf | Phornrawin/ComputerGraphics | /09_glsl_example.py | UTF-8 | 3,023 | 2.6875 | 3 | [] | no_license | from OpenGL.GL import *
from OpenGL.GLU import *
from OpenGL.GLUT import *
from homework import *
prog_id, angle = 0, 0
def print_shader_info_log(shader, prompt=""):
result = glGetShaderiv(shader, GL_COMPILE_STATUS)
if not result:
print("%s: %s" % (prompt, glGetShaderInfoLog(shader).decode("utf-8")))
... | true |