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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
a13a93497e52fbd9c31295b3cd413ccbc04e8f29 | Python | KSrinuvas/ALL | /aa/ref.py | UTF-8 | 514 | 3.375 | 3 | [] | no_license |
class American(object):
@staticmethod
def __init__ (name):
self.__name = name
print (self.__name)
def printNationality():
print ("America")
def Add(self,a,b):
sum = a +b
return sum
def __As(self,bb):
print (bb)
self.__name = bb
#anA... | true |
b793caf9ccebfa217e33a4dabf8a2f3afe38d2e7 | Python | DaHuO/Supergraph | /codes/CodeJamCrawler/16_0_3/baguspewe/sol.py | UTF-8 | 1,100 | 3.234375 | 3 | [] | no_license | def is_prime(n):
if n%2 == 0 or n%3 == 0:
return False
else:
i = 5
while i*i < n:
if n%i == 0 or n%(i+2) == 0:
return False
i+=6
return True
def non_trivial_divisor(n):
if n%2 == 0:
return 2
elif n%3 == 0:
return 3
else:
i = 5
while i < 1000000: #i*i < n:
if n%i == 0:
return i
... | true |
af75520b585510df8bd7ec64866709de7dc4abe1 | Python | matthew-carpenter/nplib | /scratch2.py | UTF-8 | 975 | 2.9375 | 3 | [] | no_license | #!/usr/bin/python
# -*- coding: utf-8 -*-
from lib import to_hex
import codecs
import sys
encoding = sys.argv[0]
filename = encoding + '.txt'
text = u'pi: π'
encoded = text.encode('utf-8')
decoded = encoded.decode('utf-8')
print 'Raw :', repr(text)
print 'UTF-8 :', to_hex(text.encode('utf-8'), 1)
print 'UTF-16:... | true |
f01f52cc315c6ae23b1f5eaf0220e97bffda869b | Python | jacob-brown/python_AdventureGame | /mapbuilding.py | UTF-8 | 1,439 | 3.0625 | 3 | [] | no_license | import numpy as np
import room
class mapOfWorld:
def __init__(self, mapSizeBlocks):
self.mapSizeBlocks = mapSizeBlocks
self.worldMap = []
self.worldRooms = {}
@property
def worldMap(self):
return self.__worldMap
@worldMap.setter
def worldMap(self, newMap):
... | true |
0ac74626d58b1a49402e4cdda475dcc0f1380981 | Python | pschauhan480/coding_python | /program_28.py | UTF-8 | 502 | 3.703125 | 4 | [] | no_license | class Chef:
def make_chicken(self):
print("The chef is making chicken")
return
def make_salad(self):
print("The chef is making salad")
return
def make_special_dish(self):
print("The chef is making bbq ribs")
return
class ChineseChef(Chef):
def make_frie... | true |
5d9978cdcf3f0f704c413a27472996de8521c698 | Python | umunusb1/Python_for_interview_preparation | /all/Interview_Questions/spell_checker.py | UTF-8 | 1,191 | 4.15625 | 4 | [] | no_license | #!/usr/bin/python
"""
Purpose: Write a (bad) spell checker
The product department needs a quick and dirty spell-checker.
Should return a correctly spelled word if found, otherwise return None.
1. A correctly spelled word is defined as one that appears in the list
2. A matching input word would have
a. The same ... | true |
dca86c568bce779f59644d393cf0315034d26c08 | Python | hakopako/algorithm-and-ds-note | /Algorithm/Stack/SortWithTowStacks.py | UTF-8 | 968 | 3.703125 | 4 | [] | no_license | class Stack:
def __init__(self):
self.__stack = []
def push(self, data):
self.__stack.append(data)
def pop(self):
return self.__stack.pop()
def peek(self):
return self.__stack[-1]
def is_empty(self):
return len(self.__stack) == 0
def print_stack(self):
print(self.__stack)
clas... | true |
a561137ccb4441995073bb807dbcbd128e81ff23 | Python | sumanth-fl/Census-automation | /census project.py | UTF-8 | 981 | 2.671875 | 3 | [] | no_license | import openpyxl
import os
os.chdir('g:')
wb = openpyxl.load_workbook('censuspopdata.xlsx')
sheet = wb.get_sheet_by_name('Population by Census Tract')
wb2=openpyxl.Workbook()
sheet2=wb2.active
sheet2.title = 'final population list'
sheet2.cell(row=1,column=1).value='county'
sheet2.cell(row=1,column=2).value= 'n... | true |
e8df30d6541c7aa38e44aba166d01bebf06b6f36 | Python | ajithkalluvettukuzhiyil/Udacity-Self-Driving-Car-Nanodegree | /Term1/Keras_conv2D.py | UTF-8 | 1,681 | 2.96875 | 3 | [] | no_license | ###
Build from the previous network ( Keras_nn.py).
Add a convolutional layer with 32 filters, a 3x3 kernel, and valid padding before the flatten layer.
Add a ReLU activation after the convolutional layer.
Train for 3 epochs again, should be able to get over 50% accuracy.
###
#in[1]:
import pickle
import numpy as np... | true |
2d559e7c5fe17871f8195a6c4e17795cc4e52a63 | Python | cmastalli/crocoddyl | /unittest/bindings/test_utils.py | UTF-8 | 642 | 3.125 | 3 | [
"BSD-3-Clause",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | import numpy as np
EPS = np.finfo(float).eps
NUMDIFF_MODIFIER = 3e4
class NumDiffException(Exception):
"""Raised when the NumDiff values are too high"""
pass
def assertNumDiff(A, B, threshold):
"""Assert analytical derivatives against NumDiff using the error norm.
:param A: analytical derivatives... | true |
9b3d695cb2748725ef334828e8831c2e56ac559f | Python | YigaoFan/ProgrammingLanguage | /Lesson4WritingReduction.py | UTF-8 | 1,022 | 3.6875 | 4 | [] | no_license | # Writing Reductions
# We are looking at chart[i] and we see x => ab . cd from j.
# Hint: Reductions are tricky, so as a hint, remember that you only want to do
# reductions if cd == []
# Hint: You'll have to look back previously in the chart.
def reductions(chart, i, x, ab, cd, j):
if len(cd) == 0:
can... | true |
eb397e98a501d4e3738d4cb74171a257a9913e76 | Python | AWangHe/Python-basis | /13.tkinter与银行系统实战/thinker/21.树状数据.py | UTF-8 | 1,040 | 3.4375 | 3 | [] | no_license | # -*- coding: utf-8 -*-
import tkinter
from tkinter import ttk
#创建主窗口
win = tkinter.Tk()
#设置标题
win.title("魔兽世界")
#设置大小和位置 大小600x400 距离左侧400,距离上侧100
win.geometry("600x400+400+100")
tree = ttk.Treeview(win)
tree.pack()
#添加一级树枝
treeF1 = tree.insert("",0,"中国",text="中国CHI",values=("F1"))
treeF2 = tree.insert("",1,"美国"... | true |
826b7006e34b11df7b2d10849bed4b50eb7999e5 | Python | JnyJny/bitvector | /tests/test_bitvector_display.py | UTF-8 | 1,331 | 3.0625 | 3 | [
"Apache-2.0"
] | permissive | """
"""
import pytest
from bitvector import BitVector
@pytest.mark.fast
def test_bitvector_repr():
bv = BitVector()
repr_value = repr(bv)
assert "BitVector" in repr_value
assert "128" in repr_value
@pytest.mark.fast
@pytest.mark.parametrize("given", [0, 0xDEADBEEFBADC0FFEE, (1 << 128) - 1,])
def... | true |
00a16645c7a3eb1cfc7f6a868cbfb4342d1d4b48 | Python | rajansaini691/gtzan-beat-tracking | /dataset.py | UTF-8 | 1,817 | 2.71875 | 3 | [] | no_license | """
Use tf Dataset API to process audio so that we can shuffle, prefetch, etc.
"""
import tensorflow as tf
import tensorflow_io as tfio
import os
import numpy as np
import cfg
import json
def get_data_from_filename(wav_path):
# Process audio
raw_data = tf.io.read_file(wav_path)
wav_data, fs = tf.audio.dec... | true |
3232c8b1ec78398b0e1d60e59be4821f5cca8d5b | Python | simraan9/dv.pset-simran | /dv.pset/0041/temperature conversion.py | UTF-8 | 100 | 3.359375 | 3 | [] | no_license | def convertFToC(f):
c=(f-32)*(5/9)
return c
f=int(input("Enter F "))
print (convertFToC(f))
| true |
f5dad8eb72646d77c7a1ff16ff59b94cae8224c4 | Python | kundeng123/code_pratice | /find_highest_average.py | UTF-8 | 799 | 3.40625 | 3 | [] | no_license | def findHighestAverage(pointsAndNames):
nameMap = {}
for pairs in pointsAndNames:
#print(pairs)
if pairs[0] not in nameMap:
nameMap.update({pairs[0]:[pairs[1]]})
else:
nameMap[pairs[0]].append(pairs[1])
maxAverage = -float('inf')
for key in nameMap:
... | true |
cafeadb1c944852f9e699a21a1cfc40598c97606 | Python | Tirth257/Game | /Gussing_Game.py | UTF-8 | 3,073 | 3.703125 | 4 | [] | no_license | import random
# Lavels
easy = random.randint(1,50)
normal = random.randint(1,100)
hard = random.randint(1,500)
ultra = random.randint(1,1000)
# Lavel suggetions
# if statement numbers
e1 = 10
e2 = 12
e3 = 10
e4 = 8
a = '''
easy = 1 to 50
10 guesses
normal = 1... | true |
bbd3941c8fcd5ff4e36788c70256224be3aa2d07 | Python | Alkhithr/Mary | /think-python/chapter17_classes_methods/kangaroo.py | UTF-8 | 877 | 3.65625 | 4 | [] | no_license | """Example 17.2"""
class Kangaroo:
"""Kangaroo has pouch"""
def __init__(self, name, contents):
self.name = name
self.pouch_contents = contents
def __str__(self):
return 'Name: {}, contents: {}'.format(self.name, self.pouch_contents)
def put_in_pouch(self, item):
if i... | true |
14890104d91049415308d11a9bdaaf3e7db75cff | Python | Alan19922015/wrangells | /downhillVelocityFilter_v2_05sep2016.py | UTF-8 | 5,844 | 2.9375 | 3 | [] | no_license | '''
Testing script to filter velocities based of downhill-direction.
Requires digitized centerline profiles.
Input = x-direction velocity, y-direction velocity, centerline profiles
Output = "cleaned x, y, and total velocities
05 Sep 2016
William Armstrong
'''
from osgeo import ogr, gdal
import numpy as np
import sy... | true |
6835e0933359e0c7e2f2ab88e225a38ad5fff51d | Python | bea3/ai_summer2017 | /mod_6/unification.py | UTF-8 | 3,666 | 3.5 | 4 | [] | no_license | import tokenize
from StringIO import StringIO
'''
IMPORTANT NOTES:
* constants - values and predicates
* values start with uppercase letter (Fred)
* predicates use lowercase letters (loves)
* variables - lowercase and start with ? (?x)
* expressions (lists) - these use the S-expression syntax
'''
def atom(ne... | true |
83eff1212cce0cb959ea29dedab4cacd4a2fc901 | Python | peragro/peragro-at | /src/damn_at/analyzers/audio/acoustid_analyzer.py | UTF-8 | 2,506 | 2.6875 | 3 | [
"BSD-3-Clause"
] | permissive | """Analyzer for audio files using AcoustID"""
from __future__ import print_function
import os
import mimetypes
import subprocess
import uuid
from damn_at import logger
from damn_at import AssetId, FileId, FileDescription, AssetDescription
from damn_at.pluginmanager import IAnalyzer
from damn_at.analyzers.audio import ... | true |
c4ad0c9e8b99682c7040343068b0015388ab0f72 | Python | Sebski123/Network | /ITT1/ass22SynchronisedTransmissionFromClientToServer/code/client.py | UTF-8 | 937 | 2.71875 | 3 | [] | no_license | #!/usr/bin/env python3
import socket
from time import sleep
from random import randint
HOST = '192.168.43.242' # The server's hostname or IP address
PORT = 65433 # The port to send data to on the server
mySensorReadings = 'go' # The application layer protoll
def temperatureSensor():
with open("... | true |
f520dc956fd17512e4167550ad3493f4c3e2fe12 | Python | Nimitkothari/custom-machine-learning | /just.py | UTF-8 | 1,266 | 2.703125 | 3 | [] | no_license | from flask import Flask
from flask import request,Response
import os
import json
import pandas as pd
path = os.getcwd()
app = Flask(__name__)
column_data = pd.read_csv(path + '/data/columns.csv')
column_1 = (column_data.columns[0])
column_2 = (column_data.columns[1])
column_3 = (column_data.columns[2])
column_4 = (colu... | true |
e946b0783435bd0401e09144272c59a1678b823b | Python | zhoushujian001/homework | /python一些小代码/一些算法.py | UTF-8 | 3,756 | 3.59375 | 4 | [] | no_license | import time
# 选择排序
# def findsmallest(arr):
# smellest=arr[0]
# smellest_index=0
# for i in range(1,len(arr)):
# if arr[i]<smellest:
# smellest=arr[i]
# smellest_index=i
# return smellest_index
# def sel(arr):
# newarr=[]
# for i in range(len(arr)):
# smallest=findsmallest(arr)
# newarr.append(arr.pop... | true |
1e3cf9218313db41dc6ebd2f619cc982fc337e33 | Python | student-jjh/code_it | /다항회귀.py | UTF-8 | 950 | 3.0625 | 3 | [] | no_license | # 필요한 라이브러리 import
from sklearn import datasets
from sklearn.preprocessing import PolynomialFeatures
from sklearn.model_selection import train_test_split
from sklearn.linear_model import LinearRegression
from sklearn.metrics import mean_squared_error
import pandas as pd
diabetes_dataset = datasets.load_diabetes()
... | true |
a54e3a39b7bc7cbaf7de3a225675e588b3f57e15 | Python | trungdong/datasets-provanalytics-dmkd | /analytics.py | UTF-8 | 4,009 | 2.859375 | 3 | [
"MIT"
] | permissive | import pandas as pd
import numpy as np
from scipy import stats
from sklearn import model_selection, tree
from imblearn.over_sampling import SMOTE
from collections import Counter
import warnings
### List of metrics analysed in the paper ###
# The 'combined' list has all the 22 metrics
feature_names_combined = (
'e... | true |
5e1b7f66042d97142f97501dd5fe5a4c18a365b8 | Python | palomabareli/520_2 | /01_Class_20180901/2_InOutData.py | UTF-8 | 123 | 3.34375 | 3 | [] | no_license | #/usr/bin/python3
message1 = 'Welcome'
message2 = input('Enter you name: ')
print(message1, message2, sep='.', end='\n\n')
| true |
4622cbd5f71f9d9409c619275e2d97599d068a02 | Python | NCPlayz/screen | /screen/controls/stack.py | UTF-8 | 1,312 | 2.65625 | 3 | [
"Apache-2.0"
] | permissive | from typing import List, Union
from screen.controls import Control, property
from screen.controls.primitives import Bullet, Orientation
from screen.utils import len
def _bullet_invalidate_measure(before, after):
return not (isinstance(before, str) and isinstance(after, str) and len(before) == len(after))
class... | true |
a617fd59c0cf80e3f5e3069826448eaa11fefefc | Python | Chezacar/AmurTiger2.0 | /not_so_strong_baseline_for_video_based_person_reID-master/lr_schedulers.py | UTF-8 | 11,858 | 3.0625 | 3 | [] | no_license | import math
from bisect import bisect_right
import numpy as np
import torch
from torch.optim.lr_scheduler import ReduceLROnPlateau
from torch.optim.optimizer import Optimizer
class _LRScheduler(object):
def __init__(self, optimizer, last_epoch=-1):
if not isinstance(optimizer, Optimizer):
rais... | true |
0f7d394edf982787e24eef136e8195242b9fd713 | Python | ajtrexler/rando | /cloudfunc_gcp_landing.py | UTF-8 | 1,383 | 2.546875 | 3 | [] | no_license |
from google.cloud import storage
import hmac
from hashlib import sha1
import requests
import subprocess
import zipfile
import os
def hello_world(request):
secret = bytes(os.environ.get("secret"),encoding='utf=8')
#verify header sig using sha
header_signature = request.headers.get('X-Hub-Signature').replac... | true |
c7ed937e09ca716e0578a2b2661cf04e783bfa20 | Python | rachellonchar/bell_algae_game | /code/game_objects/eddy.py | UTF-8 | 1,689 | 3.21875 | 3 | [] | no_license |
##ALIEN INVASION
# IMAGE/SPRITE
#bullet image
import pygame
from pygame.sprite import Sprite
#import random
#print(random.randrange(0,1000,1))
#print(random.randrange(0,700,1))
class Eddy(Sprite):
'''a class to manage bullets leaving the ship'''
def __init__(self,ai_settings,screen):
'''create b... | true |
89d88ae7941710c7f7a66c5d7ef768b0df634da6 | Python | OmarTahoun/competitive-programming | /Code Forces/PY/calculatingFunction.py | UTF-8 | 98 | 2.984375 | 3 | [] | no_license | import math
n = float(input())
res = math.ceil(n/2)
if n % 2 !=0:
res = 0-res
print int(res)
| true |
6fec119b9681493847cf16da01f8a0f75e9f57d6 | Python | brkyydnmz/Python | /Workshops/hesapMakinesi.py | UTF-8 | 824 | 4.1875 | 4 | [
"MIT"
] | permissive | # -*- coding: utf-8 -*-
def topla(sayi1,sayi2):
return sayi1 + sayi2
def cikar(sayi1,sayi2):
return sayi1 - sayi2
def carp(sayi1,sayi2):
return sayi1 * sayi2
def bol(sayi1,sayi2):
return sayi1 / sayi2
print("Operasyon:")
print("=======================")
print("1 : Topla")
print("2 : Çıkar")
print(... | true |
20b3e13151e03ccb630ff6d3ae0d08342e2fd30e | Python | acken/dotfiles | /bin/OpenIDE/.OpenIDE/languages/C#-files/scripts/create-files/preserved-data/copydir.py | UTF-8 | 1,991 | 2.515625 | 3 | [] | no_license | import os
import sys
import uuid
def copyFile(projectName, replacements, source, destination):
if os.path.basename(source) == "project.file":
destination = os.path.join(os.path.dirname(destination), projectName + ".csproj")
f1 = open(source, 'r')
f2 = open(destination, 'w')
for line in f1:
... | true |
c04e026702f2f2955356cdf14a25fec28fda90e1 | Python | vichuda/business_card_parser | /business_card_filter.py | UTF-8 | 6,638 | 3.171875 | 3 | [] | no_license | ######################################################################
# business_card_filter.py
#
# Classes that parse the results of the
# optical character recognition (OCR) component
# in order to extract the name, phone number, and email address
# from the processed business card image
###########################... | true |
25e124489b378f87d1a903a1c8f4edad7b001c3f | Python | TheNeuralBit/aoc2017 | /10/sol1.py | UTF-8 | 792 | 3.390625 | 3 | [] | no_license | def tie_knots(l, lengths):
idx = 0
skip = 0
for length in lengths:
knot(l, length, idx)
idx = (idx + length + skip) % len(l)
skip += 1
return l
def knot(l, length, idx):
halflen = int(length/2)
lindices = (i % len(l) for i in range(idx, idx+halflen))
rindices = (i %... | true |
9eb9e9ac04ed72824a1c8cc6c9832ebc894dcc3d | Python | dimmxx/codecademy | /AdvancedTopicsInPython_ListSlicing.py | UTF-8 | 454 | 3.90625 | 4 | [] | no_license |
l = [i ** 2 for i in range(1, 11)]
# Should be [1, 4, 9, 16, 25, 36, 49, 64, 81, 100]
print l
print l[2:9:2]
to_five = ['A', 'B', 'C', 'D', 'E']
print to_five[3:]
# prints ['D', 'E']
print to_five[:2]
# prints ['A', 'B']
print to_five[::2]
# print ['A', 'C', 'E']
my_list = range(1, 11)
print my_list[::2]
backwa... | true |
49c4d6f0b325ce41cb57704cc05a057b68dd72b9 | Python | A01172971/Tarea_Python | /dates.py | UTF-8 | 1,910 | 3.828125 | 4 | [] | no_license | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import datetime as dt
import re
def make_a_date(from_date="", until_hour=""):
day_names = ["Lun", "Mar", "Mie", "Jue", "Vie", "Sab", "Dom"]
today = dt.datetime.now()
y = today.year
m = today.month
d = today.day
w = today.weekday()
if from_dat... | true |
8e743ee151161a49a47887ed945d434ddbc9e8ea | Python | duynguyenhoang/manga-crawler | /Scrapers/TruyenTranhTuan.py | UTF-8 | 8,009 | 2.59375 | 3 | [
"MIT"
] | permissive | # /usr/bin/python3.5
from __main__ import print_info
from bs4 import BeautifulSoup
from Scrapers.Crawler import Crawler
import gzip
import io
import logging
import re
import urllib.request, urllib.error, urllib.parse
from functools import cmp_to_key
class TruyenTranhTuan(Crawler):
site_name = 'TruyenTranhTuan'
... | true |
908e083615b9bc053c2edec28af8c732c353e588 | Python | kyleperales/exam-assembler | /Parser/Practice Notes/basics.py | UTF-8 | 740 | 4.53125 | 5 | [] | no_license | #<- start with this for comments
#variables
#greet = "Hello"
#print(greet)
#computation
#print (10 * 10)
#print(1 + 1)
#inputs
#print("Please provide a name")
#name = input()
#print("Please provide your age")
#age = int(input())
#print("Welcome {0}, aged {1}".format(name, age))
# for loops
#for ... | true |
517a6943216ec9c36f064e3d3b2fef75eed4e6f7 | Python | cob0013/Kattis-Problems | /Python/Zamka.py | UTF-8 | 407 | 3.359375 | 3 | [] | no_license | def sum(n):
sum = 0
for digit in n:
sum += int(digit)
return sum
def main():
l = int(input())
d = int(input())
x = int(input())
output = []
for i in range(l, d + 1):
if sum(str(i)) == x:
output.append(str(i))
break
for i in range(d, l - 1, -1):
if sum(str(i)) == x:
output.appen... | true |
7b74b79028d3d5d0786bfd86485641e0e67b0865 | Python | omerfarukfidan/VSCode-Python-Basics | /01_python_giris/0117_degiskenler.py | UTF-8 | 141 | 3.234375 | 3 | [] | no_license |
sehir = "İstabul"
sehir_2 = "Danimarka"
mesafe = "2600"
birim = "km"
print(sehir + " ile " + sehir_2 + " arası " + mesafe + " " + birim) | true |
9f062c673fc392307cad4c120be6847acb1a4d7d | Python | liming2013/python-resourses | /Web_Spider/urlopen.py | UTF-8 | 153 | 2.515625 | 3 | [] | no_license | #! -*- encoding:utf-8 -*-
import urllib
import urllib2
response = urllib2.urlopen('http://www.baidu.com/')
html = response.read()
print html | true |
5961340dc5681e6ecbed5b73bf0e83c79a0144a0 | Python | FrankYLai/nlp_predictor | /character_model/interface.py | UTF-8 | 768 | 2.75 | 3 | [] | no_license | from includes import *
import preprocessing
def main():
infile = open("model",'rb')
model = pickle.load(infile)
infile.close
while True:
print("enter input text: ")
intext = input()
print(intext)
for i in range(30):
#encode
encoded = [preproces... | true |
28bf0d90eded6bf727d0ddec4f84aded70364720 | Python | MinasA1/AirBnB_clone_v3 | /api/v1/views/places.py | UTF-8 | 1,970 | 2.828125 | 3 | [
"LicenseRef-scancode-public-domain"
] | permissive | #!/usr/bin/python3
"""api.v1.views.place"""
from api.v1.views import app_views
from flask import jsonify, request, abort
from models import storage
from models.place import Place
@app_views.route('/places/<place_id>', methods=['GET', 'DELETE', 'PUT'])
@app_views.route('/places', methods=['GET', 'POST'],
... | true |
8cd52f5e55570d3fcaa859a1b94385cc92e6ad30 | Python | SquareKnight/onb-math | /solutions/euler040.py | UTF-8 | 857 | 4.15625 | 4 | [] | no_license | """Champernowne's constant
limit;last significant digit;int;1000000
#Champernowne
An irrational decimal fraction is created by concatenating the positive integers:
0.123456789101112131415161718192021...
It can be seen that the 12th digit of the fractional part is 1.
If dn represents the nth digit of the fra... | true |
cd3444f89950cb7c62be01472638bd960ac4482b | Python | dirrgang/esp32-aqs | /main.py | UTF-8 | 3,946 | 2.890625 | 3 | [] | no_license | import time
import adafruit_sgp30 # Library for the usage of the SGP30 VOC sensor
import dht # Library for the usage of the DHT22 temperature/humidity sensor
import json
import os
from machine import Pin, I2C
import logging
import logging.handlers as handlers
class BaselineValues:
def __init__(self, sensor):
... | true |
2177f9445f9dbf2f4b3cac7f745e7faf9065241c | Python | aandyberg/school-projects | /Chalmers python/lab2/gamegraphics.py | UTF-8 | 8,605 | 3.5 | 4 | [] | no_license | #------------------------------------------------------
#This module contains all graphics-classes for the game
#Most classes are wrappers around model classes, e.g.
# * GraphicGame is a wrappoer around Game
# * GraphicPlayer is a wrapper around Player
# * GraphicProjectile is a wrapper around Projectile
#In additio... | true |
6e3d4abef7d1c6bc20c6774d306892cb6525ebe2 | Python | JuanRaveC/AgentSearch | /main.py | UTF-8 | 2,632 | 2.84375 | 3 | [] | no_license | from crawler import Crawler
from utils import *
from index_agent import IndexAgent
from process_agent import ProcessAgent
from join_agent import JoinAgent
from queue import Queue
import threading
import tkinter as tk # python 3
import pygubu
FOLDER_NAME = 'HTML'
#creación de colas
process_agent_queue = Qu... | true |
60e752c8a45c5d5d82ed74db7595ee76253d4efd | Python | Environmental-Informatics/06-graphing-data-with-python-aggarw82 | /number_visualize.py | UTF-8 | 2,016 | 3.484375 | 3 | [] | no_license | """ Program to read data from file, process it
and draw graphs using matplotlib
The program should read the input and output
file names from system arguements
Author: Varun Aggarwal
Username: aggarw82
Github: https://github.com/Environmental-Informatics/06-graphing-data-with-python-aggarw... | true |
a046ce17650a52b26501a7449876343d431ce393 | Python | scout719/adventOfCode | /2018/adventOfCode.py | UTF-8 | 85,633 | 2.71875 | 3 | [] | no_license | # pylint: disable=unused-import
# pylint: disable=import-error
# pylint: disable=wrong-import-position
import functools
import math
import multiprocessing as mp
import os
import re
import string
import sys
import time
from collections import Counter, deque
import heapq
from enum import IntEnum
from struct import pack
... | true |
1f30d62d0c5b05af5af698dfe84717214f221d35 | Python | bradlyke/desi_utilities | /lineClass.py | UTF-8 | 3,900 | 3.1875 | 3 | [] | no_license | class Lines:
def __init__(self,line_name):
line_name = self.name_cleaner(line_name)
if line_name == 'cii':
line_name = 'ciir' #default to semi-forbidden, it's more common
elif line_name == 'oiii':
line_name = 'oiiir' #When calling one in the doublet, use more common
... | true |
532c1e390505ec2640ecfbcff5c1bd37558fd48f | Python | astropd/mcpiMinecraftTools | /projectileGame.py | UTF-8 | 1,561 | 2.765625 | 3 | [] | no_license | from mcpi.minecraft import Minecraft
import time
mc = Minecraft.create("mc2.tokyocodingclub.com")
p1_name = 'TCC_10'
p2_name = 'TCC_05'
p1_id = mc.getPlayerEntityId(p1_name)
p2_id = mc.getPlayerEntityId(p2_name)
p1_health = 10
p2_health = 10
mc.postToChat('THE GAME HAS BEGUN')
mc.postToChat(p1_name + ' vs. ' + p2_na... | true |
1cef71ee9684ee9f580dfb990ae386bcdf4cc793 | Python | fluxt/cs440 | /mp2/gomoku.py | UTF-8 | 4,806 | 3.203125 | 3 | [] | no_license | import time
import numpy as np
import reflex
import minimax
import userplay
import alphabeta
def get_initial_board():
return np.array([[0]*7]*7)
def get_init_alpha_board():
return np.array([['.']*7]*7)
def has_pattern_position(board, pattern):
size = len(pattern)
# check horizontal
for x in range(8 - size):
... | true |
5deb9c7dfd71abced1ace5132fdf53a36fc030d9 | Python | KhallilB/Tweet-Generator | /Code/practice_code/histograms.py | UTF-8 | 3,139 | 3.578125 | 4 | [] | no_license | import re
def histogram(source):
# initializing empty dictionary
histogram_dict = {}
# split the source into seperate words
# on whitespace then iterate over them
for word in source.split():
if word in histogram_dict:
histogram_dict[word] += 1
else:
histogra... | true |
8f5da17d8a3f54dd35cfccdd12b6a316ae4bdd1f | Python | liyunwei-3558/Perc_ErrCorrect | /DatInterface.py | UTF-8 | 3,566 | 2.59375 | 3 | [] | no_license | import numpy as np
import ErrCorrectClass as er
import ErrCorrectClassold as ero
from xml.dom.minidom import parse
import xml.dom.minidom
import cv2
class Processor:
def __init__(self, index, filepath='./dataset/'):
self.filepath = filepath
self.index = index
self.readJPEG()
self.w... | true |
119cfbad55cb9050a1df193b46e1442be040e6e8 | Python | muzigit/PythonNotes | /section3_高级特性/action3.py | UTF-8 | 1,690 | 4.5625 | 5 | [] | no_license | # 列表生成式
# 例子:生成[1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
r = range(1, 11)
l = list(r)
for i in l:
print(i)
# 例子:生成[1*1,2*2,3*3,...,10*10]
# 方法一:通过循环
L = []
for i in range(1, 11):
L.append(i * i)
# L.append(str(i) + '*' + str(i))
print(L)
# 通过列表生成式可以一句话替换上面的代码
# 写列表生成式时,将要生成的元素x * x放在前面,后面跟上for循环
L = [x * x for... | true |
1d8df64b6ce646b0fb0b40f2134fc28fb93c0471 | Python | clydemcqueen/ukf | /scripts/plot_ukf_1d_filter.py | UTF-8 | 1,643 | 2.984375 | 3 | [] | no_license | #!/usr/bin/env python3
"""
Plot the output from test_1d_drag_filter()
"""
import sys
import matplotlib.pyplot as plt
def main():
if len(sys.argv) != 2:
print('Usage: plot_ukf_1d_filter.py filename')
exit(1)
f = open(sys.argv[1], 'r')
print('Expecting t, actual_x, actual_vx, actual_ax, ... | true |
99f02bacc0447cb6e2f79a4ab4f273e8c0461c8b | Python | zardosht/isar | /tmp/opencv_ellipse.py | UTF-8 | 6,450 | 3.046875 | 3 | [
"MIT"
] | permissive | import time
import cv2
import numpy as np
# Colors (B, G, R)
from isar.scene import sceneutil
WHITE = (255, 255, 255)
BLACK = (0, 0, 0)
def create_blank(width, height, color=(0, 0, 0)):
"""Create new image(numpy array) filled with certain color in BGR"""
image = np.zeros((height, width, 3), np.uint8)
#... | true |
0dc8afaa49f44c99f77f1a8639b790dc03e10c5b | Python | katsuya0719/MaterialDB | /libs/util.py | UTF-8 | 993 | 3.234375 | 3 | [] | no_license | def getDirection(angle):
if angle<11.25 or angle>=348.75:
return "N"
elif angle<33.75 and angle>=11.25:
return "NNE"
elif angle<56.25 and angle>=33.75:
return "NE"
elif angle<78.75 and angle>=56.25:
return "ENE"
elif angle<101.25 and angle>=78.75:
return "E"
... | true |
156b55e6453c9f975de82aeb6340970345c3f98a | Python | MESragelden/leetCode | /First Unique Number.py | UTF-8 | 1,325 | 3.5625 | 4 | [] | no_license | class FirstUnique:
def __init__(self, nums):
self.listOFUnique =[]
self.d = dict()
for ele in nums:
self.add(ele)
def showFirstUnique(self) -> int:
if (self.showFirstUnique)==0:
return -1
else :
if(len(self.listOFUnique)>0... | true |
89d3b30cf2aff516ed3da2f66193110a9401d395 | Python | alimabean/Scripts | /scraper.py | UTF-8 | 663 | 3.359375 | 3 | [] | no_license | from bs4 import BeautifulSoup
import re
import urllib2
#function to find links within a given link
def myscrape(url, case):
#makes sure the url is a string
newu = str(url)
#add url components to the given case
newc = 'http://' + str(case) + '/'
page = urllib2.urlopen(newu).read()
soup = Beau... | true |
b7fac54df3b70b9c57e4b296a3b986ff9c1ff674 | Python | emrkyk/Data-Science-Projects | /ML - LightGBM - Hitters Dataset/Hitters_LightGBM.py | UTF-8 | 7,851 | 2.984375 | 3 | [] | no_license | # =============================
# HITTERS LIGHTGBM
# =============================
# Summary of Dataset
# AtBat: Number of times at bat in 1986
# Hits: Number of hits in 1986
# HmRun: Number of home runs in 1986
# Runs: Number of runs in 1986
# RBI: Number of runs batted in in 1986
# Walks: Number of walks i... | true |
b66838a210f215659439388356cf4a25b340739c | Python | tracemap/tracemap-backend | /api/neo4j/tracemapUserAdapter.py | UTF-8 | 14,675 | 2.734375 | 3 | [] | no_license | from neo4j.v1 import GraphDatabase, basic_auth
from neo4j.exceptions import CypherError
import json
import time
import os
class TracemapUserAdapter:
def __init__(self):
uri = os.environ.get('NEO4J_URI')
self.driver = GraphDatabase.driver(uri, auth=(os.environ.get('NEO4J_USER'),
os.environ.... | true |
08c185a74a01bc502a26bc58ad4ead7db0d9d777 | Python | gabylorenzi/python-word-analysis | /hw2.py | UTF-8 | 3,027 | 3.796875 | 4 | [] | no_license | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Sun Jan 5 00:00:00 2020
@author: gabylorenzi
"""
#%% 1
#DONE
def longest_path_length(d):
"""Returns the length of the longest path in d."""
currMax = 0
for k,v in d.items():
path = []
while(True):
if (k,v) not in p... | true |
61c77b1aea076055b686cfbff1c4bd573e4cac6a | Python | deni64/python-scripts | /python-scripts/8cw/покупка домa.py | UTF-8 | 572 | 3.390625 | 3 | [] | no_license | class human:
def __init__(self, name, age, money, home):
self.name = name
self.age = age
self.money = 0
self.home = 0
def present(self):
print(f'my name is {self.name} and i am {self.age} years old')
def earn_money(self):
self.money += 1000
def get_h... | true |
e6feb29ca6cdccddade2156b69fcbb50577613b5 | Python | otisgbangba/python-lessons | /Harder/picker.py | UTF-8 | 327 | 4.1875 | 4 | [
"MIT"
] | permissive | # Pops names off a list in random sequence
from random import randint
import time
remaining_names = ['sue', 'mary', 'hari', 'fred', 'eric', 'menlo']
while len(remaining_names) > 0:
pop_index = randint(0, len(remaining_names) - 1)
popped_name = remaining_names.pop(pop_index)
print(popped_name)
time.sl... | true |
a1b8316ba8c17cf75568542632a2b034961b3463 | Python | allocateam/opendc | /simulator/opendc-experiments/opendc-experiments-allocateam/tools/plot/metrics/job_makespan.py | UTF-8 | 980 | 2.53125 | 3 | [
"MIT"
] | permissive | from .metric import Metric, metric_path
import pandas as pd
import math
class JobMakespanMetric(Metric):
def __init__(self, plot, scenarios):
super().__init__(plot, scenarios)
self.name = "job_makespan"
self.x_axis_label = "Job makespan (seconds)"
def get_data(self, scenario):
... | true |
72298c4a1793826d4681dd3c517923f4f8828356 | Python | mecampbellsoup/procrastinate | /procrastinate/retry.py | UTF-8 | 3,747 | 3.375 | 3 | [
"MIT"
] | permissive | """
A retry strategy class lets procrastinate know what to do when a job fails: should it
try again? And when?
"""
import datetime
from typing import Iterable, Optional, Type, Union
import attr
from procrastinate import exceptions, utils
class BaseRetryStrategy:
"""
If you want to implement your own retry s... | true |
0f8c264fef79f69fe81afd32a893918b6484e37e | Python | Kxfusion/PyProjects | /PyProject5-5.py | UTF-8 | 922 | 3.796875 | 4 | [] | no_license | def Converter(Str, Ints, N):
Added = 0
Base = ('1', '2', '3', '4', '5', '6', '7', '8', '9', '0')
Ints[len(Ints)-1] = Ints[len(Ints)-1]*10 + int(Str[N])
if(N != len(Str) - 1):
for y in range(10):
if(Str[N+1] == Base[y]):
Ints, Added = Converter(Str, Ints, N+1)
Add... | true |
f64c86449b4073c92a4f794bfb44c7b82df92a64 | Python | boscoj2008/blocklib | /blocklib/candidate_blocks_generator.py | UTF-8 | 2,983 | 3.0625 | 3 | [
"LicenseRef-scancode-warranty-disclaimer",
"Apache-2.0"
] | permissive | """Class that implement candidate block generations."""
from typing import Dict, Sequence, Tuple, Type, List, Optional
from .configuration import get_config
from .pprlindex import PPRLIndex
from .pprlpsig import PPRLIndexPSignature
from .pprllambdafold import PPRLIndexLambdaFold
from .validation import validate_signatu... | true |
8354feed55f0cab05a6738d2af4b62462d1b7b38 | Python | Tharani2518/python-programming | /Numdivby5and11.py | UTF-8 | 235 | 3.96875 | 4 | [] | no_license | number = int(input(" Please Enter any Positive Integer : "))
if((number % 5 == 0) and (number % 11 == 0)):
print("Given Number is Divisible by 5 and 11",number)
else:
print("Given Number is Not Divisible by 5 and 11",number)
| true |
410102283d361cb272da43539da4dedbeba57aa8 | Python | hartantosantoso7/Belajar-Python | /program_for_loop.py | UTF-8 | 582 | 4.40625 | 4 | [] | no_license | # membuat program menggunakan For-loop, List dan Range
banyak = int(input("Berapa banyak data? "))
nama = []
umur = []
for data in range(0, banyak):
print(f"data {data}")
print("==========================")
input_nama = input("Nama: ")
input_umur = int(input("Umur: "))
print("====================... | true |
38b85a2ab960bcb151f3cf2ec8a7e301b2bb40b0 | Python | cytsinghua/qa_4_gaokao | /data/modified_test.py | UTF-8 | 653 | 2.515625 | 3 | [] | no_license | import os, sys, json
labels = []
with open('./data/modified_test.csv') as f:
for line in f:
labels.append(1 if line.strip()[-2:] == '11' else 0)
with open('./data/processed_test_data.json') as f, open('./data/processed_modified_test_data.json', 'w') as f1:
start = 0
for line in f:
data = ... | true |
0e768d76c71bb3f53f357b3682be010d09363752 | Python | AndrewYY/modsaber-python | /modsaber.py | UTF-8 | 3,166 | 2.578125 | 3 | [] | no_license | ''' simple beatmods mod installer. run as admin if you need to. '''
import io
import json
import os
import subprocess
import time
import urllib.request
import winreg
import zipfile
# constants
beatmods_url = 'https://beatmods.com'
api_version = '1'
user_agent = 'beatmods-python/0.2.0'
## get the beat saber install di... | true |
33103ce26f33dea0df0c8a59f809a0a2e6cace41 | Python | fkohlgrueber/KeyFun | /Constants.py | UTF-8 | 918 | 2.640625 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Constants contains several functions and constants useful in other modules.
"""
__author__ = 'Felix'
import pyHook
def generate_key_id_name_mappings():
name_to_id = {}
# copy mapping contained in pyHook
for key in pyHook.HookConstants.vk_to_id:
name_to_id[key] = pyHoo... | true |
1840adbacfa931334d255781379638ef15b6d64c | Python | carlopeano/python_work | /chap_9/my_car.py | UTF-8 | 920 | 3.1875 | 3 | [] | no_license | # from car import Car
# my_new_car = Car('audi', 'a4', 2019)
# print(my_new_car.get_descriptive_name())
# my_new_car.read_odometer()
# my_new_car.odometer_reading = 23
# my_new_car.read_odometer()
# my_new_car.update_odometer(24)
# my_new_car.read_odometer()
# my_new_car.update_odometer(23_500)
# my_new_car.read_... | true |
840751cf7b1a89f9783c684e91eb906c71774f33 | Python | juniorppb/arquivos-python | /ExerciciosPythonMundo3/04.Tuplas03.py | UTF-8 | 128 | 2.734375 | 3 | [
"MIT"
] | permissive | pessoa = ('Wellyton', 37, 'M', 82,3)
print(pessoa)
print('-'*20)
pessoa = ('Wellyton', 37, 'M', 82,3)
del(pessoa)
print(pessoa)
| true |
585a114ff4c3d4b903457a77ea43d1c37989071d | Python | YJL33/CSES | /1094.py | UTF-8 | 235 | 2.984375 | 3 | [] | no_license | """
see https://cses.fi/problemset/task/1094
"""
x = int(input())
A = list(map(int, raw_input().split()))
prev = A[0]
res = 0
for i in range(1,len(A)):
prev = max(prev, A[i-1])
if A[i]<prev:
res += prev-A[i]
print(res)
| true |
a912a0ec47a95b11cd04bda35eba9882caa81196 | Python | ptobgui300/CSULA_CubeSat_SeniorDesign | /CubeSat/ComputerVision/DetectMarker.py | UTF-8 | 2,703 | 2.625 | 3 | [] | no_license |
# Note : flip camera for Raspberry pi
import numpy as np
import cv2
import cv2.aruco as aruco
import sys, time, math
#--- Define Tag
class CubeArucoDetect :
def detectMarker():
id_to_find = 24
marker_size = 10 #- [cm]
#--- Get the camera calibration path
calib_path = ... | true |
60d4dc67cfbe532832190e290a81ef91a63a10d4 | Python | sarelg/stuff | /Cluster/figures.py | UTF-8 | 491 | 2.5625 | 3 | [] | no_license | from diff_expo_plot import draw
import matplotlib.pyplot as plt
plt.figure(1)
plt.title('1018-52672-0359 - high std to 1/sn')
draw(1018,52672,359)
plt.figure(2)
plt.title('5942-56210-0308 - high std to 1/sn')
draw(5942,56210,308)
plt.figure(3)
plt.title('2207-53558-227 - high std to 1/sn')
draw(2207,53558,227)
plt.... | true |
a42cbad495562a4c9e27916e9e6a77a05073debe | Python | Ramironacho/PythonSe | /methods/practica.py | UTF-8 | 472 | 3.65625 | 4 | [] | no_license |
def tax(states, income):
net_income = 0
federal_tax = 0.1 * income
if states == 'nyc':
state_tax = 0.11 * income
net_income = income - (federal_tax + state_tax)
if states == 'la':
state_tax = 0.5 * income
net_income = income - (federal_tax + state_tax)
if states == '... | true |
ae90b56935eb2c801c584e786b077c384a46d660 | Python | genkitaiyaki/calc_exercise | /models/formula.py | UTF-8 | 392 | 4.0625 | 4 | [
"MIT"
] | permissive | class Formula:
"""
計算式を管理するためのクラス
"""
def __init__(
self,
_left: int,
_right: int,
_operator: str
) -> None:
self._left = _left
self._right = _right
self._operator = _operator
def to_string(self) -> str:
return f'{str(self._lef... | true |
82c8421f844423573ff710eb717cf2e9aa973249 | Python | amarotta1/FinalDise-oDeSistemas | /Patrones/Abstract Factory Banco/FactoryBlack.py | UTF-8 | 518 | 2.515625 | 3 | [] | no_license | from AbstractFactory import AbstractFactory
from CreditoBlack import CreditoBlack
from CuentaBlack import CuentaBlack
from DebitoBlack import DebitoBlack
class FactoryBlack(AbstractFactory):
def crear_cuenta(self):
print('Creando una cuenta Black')
return CuentaBlack()
def crear_credito(sel... | true |
281e5ca112eb28e49b7e9b85813433b39392ff0c | Python | JTong666/machine_learning | /machine_learning/树回归/test.py | UTF-8 | 117 | 2.6875 | 3 | [] | no_license | import numpy as np
a = [[1, 2],
[3, 4],
[5, 6]]
a = np.mat(a)
print(np.mean(a[:, -1]))
print(np.mean(a)) | true |
22e23beb12a50712bd366526aaf06b401fa4d70d | Python | yingCMU/tensor_flow | /nn_cnn/max_pooling.py | UTF-8 | 797 | 3.03125 | 3 | [] | no_license | import tensorflow as tf
# The tf.nn.max_pool() function performs max pooling with the ksize parameter as the size of the filter and the strides parameter as the length of the stride. 2x2 filters with a stride of 2x2 are common in practice.
#
# The ksize and strides parameters are structured as 4-element lists, with ea... | true |
a4ac3c21fcebd40bb40a0c73b751f21c7a7adfe6 | Python | chua24/CanteenRecommendation | /FS6_Cheong_Chong_Chua_Source Code.py | UTF-8 | 14,239 | 3.203125 | 3 | [] | no_license | import pygame,sys
import time
import random
import math
from collections import OrderedDict
from operator import itemgetter
#-------------------- Welcome Message --------------------
def welcomeMsg():
print ("Welcome to the Ask Panda system! Please enter your option!")
print ("1: Search by Location... | true |
5714f00db6f0c65aeb9567bc2035eb98e873547d | Python | Bruna-Pianco/Activities01-Python | /QuantoTempo.py | UTF-8 | 128 | 3.25 | 3 | [] | no_license | tempo1 = int(input())
tempo2 = int(input())
tempo3 = int(input())
soma = tempo1 + tempo2 + tempo3
print (f'{soma} minutos')
| true |
8a84443432e9b71b4d83cdb4d858f0b86438a9a8 | Python | bassboink/package_demo | /module.py | UTF-8 | 66 | 2.515625 | 3 | [] | no_license | def demo_module(name):
print("String received: " + str(name)) | true |
9c2a91ee8893086ebf48155b4179beddf9fc85c2 | Python | jibinsamreji/Python | /Python_Basics/tuples.py | UTF-8 | 203 | 4.03125 | 4 | [] | no_license | # Tuples unlike Lists in Python, are immutable i.e, unchangeable
# Tuple is a data structure type in Python, similar to list
numbers = (1001, 201, 3)
print(numbers[0])
numbers[0] = 10
print(numbers[0])
| true |
69cf2c9540b544c2f547f306db499b8c25ad42dd | Python | onaio/tasking | /tasking/serializers/base.py | UTF-8 | 1,537 | 2.609375 | 3 | [
"Apache-2.0"
] | permissive | """
Base Serializers
"""
from rest_framework import serializers
from tasking.common_tags import TARGET_DOES_NOT_EXIST
from tasking.utils import get_allowed_contenttypes
class ContentTypeFieldSerializer(serializers.ModelSerializer):
"""
Serializer class that provides a contenty_type field
"""
target_... | true |
e1ae2a931534ee89c6ee4ffe6a89afc0b1bf9d37 | Python | TanmayKumar-EngStud/CryptographyPy | /Modern Cryptosystem/DEStrail3.py | UTF-8 | 717 | 3.046875 | 3 | [] | no_license | from os import system
system('clear')
plainText = "HIJACKINGS"
key = "HELLO"
def BlocksCreation(plainText):
block=[]
while len(plainText)%8 != 0:
plainText+=" "
for i in range(0,len(plainText),8):
block.append(plainText[i:i+8])
return block
def keyRefining(key):
if len(key)<8:
a= "X"
while... | true |
c159de08ea781d6b8e9020b2febf774f5ed5f300 | Python | Samuel1418/ExerciciosPhyton | /Exemplo Notebook.py | UTF-8 | 2,189 | 2.96875 | 3 | [] | no_license | import gi
gi.require_version('Gtk', '3.0')
from gi.repository import Gtk
class Fiestra(Gtk.Window):
def __init__(self):
Gtk.Window.__init__(self, title="Ejemplo GtkNotebook")
notebook= Gtk.Notebook()
self.add(notebook)
paxina1= Gtk.Box()
paxina1.set_border_width(10)
... | true |
9ba5e4418e9556f5e896674c16ff9751815ee304 | Python | SkyWorkerCK/Basic-DeepLearnning-Methods | /MLP_np.py | UTF-8 | 1,279 | 3.046875 | 3 | [] | no_license | import numpy as np
def sigmoid(z):
return 1.0/(1.0 + np.exp(-z))
def dsigmoid(z):
return sigmoid(z)(1-sigmoid(z))
class MLP:
def __init__(self, sizes):
"""
:param sizes: [784, 30, 10]
"""
self.sizes = sizes
# sizes: [784, 30 , 10]
# w: [ch_out, ch_in]
... | true |
2a4eac5f269401354ae6b5af70efe14e4d770d6a | Python | RohilPrajapati/python_traning_assignment | /assignment4/QN2createDictfromlist.py | UTF-8 | 297 | 3.53125 | 4 | [] | no_license | # Students = ['jack’,’jill’,’david’,’silva’,’ronaldo’]
# Marks = ['55’,’56’,’57’,’66’,’76’]
Students = ['jack','jill','david','silva','ronaldo']
Marks = ['55','56','57','66','76']
dict = {}
for i in range(0,5):
dict.update({Students[i]:Marks[i]})
print(dict) | true |
fa50bb35f8c52e14a614f3a31855968fd7a99069 | Python | lbrack1/crypto-tracker-bot | /sentiment.py | UTF-8 | 3,406 | 3.15625 | 3 | [] | no_license | #---------------------------------------------------------------------------
# Data Analysis - Copyright 2017, Leo Brack, All rights reserved.
#---------------------------------------------------------------------------
# This code takes data from the mysql data base and extracts the sentiment
#
#
# -------------------... | true |
6270cc045f7eddf82e9e86650a6ba75d22305e3f | Python | rlafuente/lightwriter | /arduinoserial.py | UTF-8 | 3,464 | 3.703125 | 4 | [] | no_license | #!/usr/bin/python
# Script for sending text data to an Arduino board
# Used for the Lightwriter piece
# It accepts a single string as a parameter;
# This string should be piped in from the console using the
# lw-parsestring script, like this:
# python lw-parsestring "bright happy flowers" | python lw-sendstring
# ... | true |
b9cc4f2552b8e9e041601f01b5a827224507f512 | Python | rulojuka/listas | /mac0448/ep2/cliente_tcp.py | UTF-8 | 6,042 | 2.8125 | 3 | [
"Unlicense"
] | permissive | #!/usr/bin/python3
from socket import *
import threading
from threading import Thread
from time import sleep
import sys, ssl
lock = threading.Lock()
RECV_BUFFER = 2024
global writer
chatting = False
def envia(mensagem, sock):
lock.acquire()
sock.send( mensagem.encode('utf-8') )
lock.release()
class Heartbeat(... | true |
568a22740bacd7c9de22e6e789a8a4984c61a682 | Python | TingtingBo/Scripts | /TIME-Resolved Analysis/extract_features.py | UTF-8 | 1,902 | 3 | 3 | [] | no_license | import pandas as pd
import numpy as np
def extract_features (data,getmean=False):
data=data
# Calculate nr of features with gaussian sum formula
# because we don't take the diagonal as a feature
nr_electrodes = data.shape[1]
nr_features = int(((nr_electrodes - 1) ** 2 + (nr_electrodes - 1)) / 2)
... | true |
b8c20f9a369e1b9338ceaf9407e97566d8b82c68 | Python | jaykumar-parmar/python-practice | /educative_io/ds/level_order_tree_traversal.py | UTF-8 | 886 | 3.453125 | 3 | [] | no_license | from my_tree.tree import BinaryTree
from my_tree.tree import BinaryTreeNode
from my_queue.my_queue import MyQueue
q = MyQueue()
def traversal(rootNode: BinaryTreeNode):
q.enqueue(rootNode)
my_str = level_order_tree_traversal(rootNode)
print(my_str)
def level_order_tree_traversal(node: Binary... | true |