blob_id large_string | language large_string | repo_name large_string | path large_string | src_encoding large_string | length_bytes int64 | score float64 | int_score int64 | detected_licenses large list | license_type large_string | text string | download_success bool |
|---|---|---|---|---|---|---|---|---|---|---|---|
744219f17ceac94e5f43f7072697ff10af25e2db | Python | James4Deutschland/lazer | /metalearning/scanner/fuckMe.py | UTF-8 | 719 | 2.65625 | 3 | [
"WTFPL",
"GPL-1.0-or-later"
] | permissive | import os
def exist(a):
return os.path.exists(a)
def returnDir(a):
return os.listdir(a)
def firstTest(a):
return os.path.isabs(a)
def secondTest(a):
return os.path.isdir(a), os.path.isfile(a)
def thirdTest(a):
return os.path.islink(a), os.path.ismount(a)
def absList(a):
def getReal(a):
... | true |
43b8f7c4fbfe5c71e3b5a57c4676b2a3a9864038 | Python | Felixim0/SnakeTkinter | /Snake.py | UTF-8 | 6,180 | 3.078125 | 3 | [] | no_license | from tkinter import *
from time import sleep
from random import randint
window =Tk()
window.configure(background='black')
w, h = window.winfo_screenwidth(), window.winfo_screenheight()
window.overrideredirect(1)
window.geometry("%dx%d+0+0" % (w, h))
canvasHeight = round(h, -1)
canvasWidth = round(w, -1)
lengthOfSnak... | true |
a080aadc0d2207c1520dcc5825483e5ca0663f44 | Python | yashraj077/Codevita | /Finding_Product.py | UTF-8 | 544 | 3.234375 | 3 | [] | no_license | def n_length_combo(lst, n):
if n == 0:
return [[]]
l =[]
for i in range(0, len(lst)):
m = lst[i]
remLst = lst[i + 1:]
for p in n_length_combo(remLst, n-1):
l.append([m]+p)
return l
def multiply(l, d):
count = 0
for i in l:
mul = 1
for j in i:
mul = mul * j
if (mul%d == 0):
count += 1... | true |
21c14a63f31eecf907b6830cc54252ab5e79cb36 | Python | StanHash/FOMT-DOC | /tools/py/font-tool.py | UTF-8 | 3,498 | 3.25 | 3 | [] | no_license | #!/usr/bin/python3
import sys, os
import png
def read_int(input, byteCount, signed = False):
return int.from_bytes(input.read(byteCount), byteorder = 'little', signed = signed)
class GlyphBase:
COLOR_CHARS = [' ', '██']
COLOR_VALUES = [
(0, 0, 0),
(255, 255, 255),
]
def __init__(self):
self.pixels... | true |
6beccfdea8c7f586614bab4555f9a0afde6686d9 | Python | aryanxk02/HackerRank-Solutions | /Problem Solving/GOCC Practice.py | UTF-8 | 339 | 3.15625 | 3 | [] | no_license | t = int(input())
for _ in range(t):
n = int(input())
i = 1
l = []
# while i <= n-1:
# # for i in range(1, n):
# if n % i == 0:
# l.append(i)
# i += 1
[l.append(i) for i in range(1, n) if n%i == 0]
if n == sum(l):
print('YES')
else:
... | true |
830b1a19925bf7110ce4a401b3624a6e8e739b2e | Python | ezequielo/NewEmpresa | /src/Departamento.py | UTF-8 | 1,093 | 3.3125 | 3 | [] | no_license | __author__ = 'ezequiel'
from Empleado import *
class Departamento:
def __init__(self, nombre_depto, id_depto):
"""
Init function
:param nombre_depto: Department name
:param id_depto: Department ID
"""
self.nombre_depto = nombre_depto
self.id_depto = id_dep... | true |
6158372cdddfd172c05cc7c2224abe59a474ab5f | Python | bubiche/visualQA | /parser/merge.py | UTF-8 | 970 | 2.578125 | 3 | [] | no_license | import h5py
def merge_dat(f1, f2, dset_name, out_file):
input_file_1 = h5py.File(f1, 'r')
input_file_2 = h5py.File(f2, 'r')
output_file = h5py.File(out_file, 'w')
dset1 = input_file_1[dset_name]
dset2 = input_file_2[dset_name]
total_size = dset1.shape[0] + dset2.shape[0]
if d... | true |
af80a49c52fd4e2b5216ea7a499ee3666c9d2264 | Python | hiropppe/abc | /crawler-scripts/filter_seed.py | UTF-8 | 1,504 | 2.671875 | 3 | [] | no_license | import click
import gzip
import sys
import tldextract
from collections import defaultdict
from pathlib import Path
@click.command()
@click.argument("seeds_path")
@click.option('--min_size', '-m', default=3, help='minimum warc size in MB')
def main(seeds_path, min_size):
CRAWLER = "heritrix"
def create_seed_... | true |
7a497458b3513a50c5fa01b444c9c39372134496 | Python | TylerSKull19/Ny-Senator | /lab7_NY_Senator_redux.py | UTF-8 | 790 | 3.984375 | 4 | [] | no_license | '''
CSC101 Lab 7
Part 1: Senator for NY Qualifications
Tyler Smith
10/7/2020
'''
def is_eligible_for_NY_Senator(age, citizenship, residency):
result = age >= 30 and citizenship >= 9 and residency == "New York"
return result
def main():
print("Do you meet the qualifications to become US senator... | true |
89d2954eeea07b1b2d48a0beb139e184af13b47e | Python | SamuelToups/Samuel-Toups-2020-SPR-UML-EECE-5560 | /homework3/src/chatterCounter.py | UTF-8 | 691 | 2.578125 | 3 | [] | no_license | #!/usr/bin/env python
import rospy
from std_msgs.msg import String
from homework3.msg import numberedstring
class chatterCounter:
msgs_count = 0
def __init__(self):
msgs_count = 0
rospy.Subscriber("chatter", String, self.callback)
self.pub = rospy.Publisher('chatterCount', numberedstri... | true |
87ed7d4183a3816ea1261618069a8b6f95b0fdd1 | Python | mctuliomontoya/Proyecto-Integrador-TC1028 | /Funciones/Funcionalidad_7.py | UTF-8 | 1,559 | 3.96875 | 4 | [] | no_license | #Funcion 7 orientada hacia algún administrador
#Trabajada por: André Castillo - A01254180
import csv
import os
clear = lambda: os.system('cls')
def imprimir_registro():
registro = open("registro.txt", "r")
lista_registro = registro.readlines()
for renglon in lista_registro:
print(renglon)
regist... | true |
aa885bd251fc7d74825649e6fdc8ce755361fbf5 | Python | misrashashank/Competitive-Problems | /implement_strStr.py | UTF-8 | 724 | 4.15625 | 4 | [] | no_license | '''
Implement strStr().
Return the index of the first occurrence of needle in haystack,
or -1 if needle is not part of haystack.
Example 1:
Input: haystack = "hello", needle = "ll"
Output: 2
Example 2:
Input: haystack = "aaaaa", needle = "bba"
Output: -1
Clarification:
What should we return when needle is an empty ... | true |
eb3f38c49b632ed6f56dd3b6a2b275adcf041d09 | Python | impradeeparya/python-getting-started | /array/TreasureTruck.py | UTF-8 | 1,096 | 3.65625 | 4 | [] | no_license | def mark_cluster(n, m, park_area):
value = park_area[n][m]
if value == 1:
park_area[n][m] = 0
if n < len(park_area) - 1:
mark_cluster(n + 1, m, park_area)
if n > 0:
mark_cluster(n - 1, m, park_area)
if m < len(park_area[0]) - 1:
mark_cluster(n,... | true |
7a6b8ff2e205a49ffa69e468ded7141775de761c | Python | Thepetapixl/Mini-Project-III | /Ardunio-Python/PushButtonLED.py | UTF-8 | 340 | 2.515625 | 3 | [] | no_license | import pyfirmata
import time
pin = 13
port = '/dev/cu.usbmodem14101'
board = pyfirmata.Arduino(port)
it = pyfirmata.util.Iterator(board)
it.start()
board.digital[10].mode = pyfirmata.INPUT
while True:
sw = board.digital[10].read()
if sw is True:
board.digital[13].write(1)
else:
board.digital[13].write(... | true |
c998017ae82e8cf812b33e3a068afa9aeb1d8f66 | Python | saurabh-pandey/AlgoAndDS | /leetcode/hash_table/tests/test_isomorphic_strings.py | UTF-8 | 627 | 3 | 3 | [] | no_license | import pytest
import hash_table.isomorphic_strings as prob
class TestIsomorphicStrings:
def test_example1(self):
s = "egg"
t = "add"
res = True
assert prob.isIsomorphic(s, t) == res
def test_example2(self):
s = "foo"
t = "bar"
res = False
as... | true |
fc26f7147142fdad1a89779deab3c83daae9aef1 | Python | hendrixone/Project-Euler | /problem16_30/Problem20.py | UTF-8 | 798 | 3.6875 | 4 | [] | no_license | def get_file(name):
file = open('p20.txt', 'r', encoding = 'UTF-8')
names = file.read()
file.close()
return names
def make_list(names):
list = []
index = 0
while index < len(names):
if names[index] == '"':
start = index + 1
end = 0
while True:
index += 1
if names[index] == '"... | true |
b0785ce7c36226ee89525384e218bce645d2a260 | Python | georgeyumnam/MatMiner | /matminer/descriptors/add_descriptors.py | UTF-8 | 1,719 | 2.609375 | 3 | [
"LicenseRef-scancode-generic-cla",
"LicenseRef-scancode-hdf5",
"BSD-2-Clause"
] | permissive | import pandas as pd
from matminer.descriptors.composition_features import *
__author__ = 'Saurabh Bajaj <sbajaj@lbl.gov>'
# TODO: Check how to automatically get stats (mean, median,..) from the descriptor column and use them to set limits
# for plot colors
# TODO: Check how to set legends in plots (return them here ... | true |
46c9130b9444573a355e66cc8f6319791f33fbe8 | Python | sayyuf-shaik/test_automate_tool | /helpers/output_write.py | UTF-8 | 5,510 | 2.859375 | 3 | [] | no_license | import os
import time
import datetime
from helpers import global_constants
import logging
LOG = logging.getLogger(__name__)
class OutputWrite(object):
@staticmethod
def write_to_output(output):
"""
module which will write the output to a text file
:param output:
:return None:... | true |
98fd6b0b85ab45201aa085eaee4df0a4700cc31e | Python | susantabiswas/Natural-Language-Processing | /Code/stop_words.py | UTF-8 | 618 | 3.5 | 4 | [
"MIT"
] | permissive | #how to use stopwords for filtering the tokenss
from nltk.corpus import stopwords
import nltk
#arg: list
#return: list
def remove_stopwords(token):
stop_words = stopwords.words('english')
#print(stop_words)
filter_token = []
for word in token:
if word not in stop_words:
filter_token.append(word)
return f... | true |
29025cc6f1228f7d2e20d4e2e160c19888eff6b3 | Python | SangkyunLee/Pybehav | /util/resample.py | UTF-8 | 859 | 2.921875 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Wed Mar 13 09:12:44 2019
@author: slee
"""
import time
import numpy as np
import pandas as pd
import datetime as dt
x = np.array([1, 2, 4, 8, 10, 13, 16, 17, 18, 19, 21, 23, 25, 27])
y = np.exp(-x/30)
#d={'time':x, 'sig':y}
#df = pd.DataFrame(d)
## Convert to datetime, if neces... | true |
62f7c582094f34f94ede90e4f25edaaf1d131b72 | Python | JakartaLaw/dypa_termpaper | /src/modules/interp.py | UTF-8 | 3,277 | 2.875 | 3 | [
"MIT"
] | permissive | """
Class and functions for multi-linear interpolation
"""
import numpy as np
from numba import njit, jitclass, prange, boolean, int64, double, void, float64
@njit(int64(int64,int64,double[:],double))
def binary_search(imin,Nx,x,xi):
# a. checks
if xi <= x[0]:
return 0
elif xi >= x[Nx-2]:
... | true |
9964a171cb07a886f9832c4e74149267bc3fe982 | Python | MattiaSerra/CoherentStructures | /hyperbolic_ABC.py | UTF-8 | 1,543 | 3.171875 | 3 | [] | no_license | """
An example demonstrating the computation of forward hyperbolic LCSs in a 3D
system, the ABC flow. In order to reduce the computational time, we only
consider trajectories initialized in slabs of thickness 0.2*pi at the planes
x=0, y=0, and z=2*pi.
"""
import numpy as np
import matplotlib.pyplot as plt
import scip... | true |
ec59c127f9652d52c6c4d8964ca00c3bb7088cee | Python | zukaru/Scythe | /controller.py | UTF-8 | 548 | 2.796875 | 3 | [] | no_license | import pygame
pygame.joystick.init()
def joy_init():
joysticks = (pygame.joystick.get_count())
if joysticks >0:
P1 = pygame.joystick.Joystick(0)
if joysticks >1:
P2 = pygame.joystick.Joystick(1)
try:
return P1
except UnboundLocalError:
return None
def joy_a... | true |
49a8eb8b14140f2825d6f13f88a492705a0a7c4b | Python | Jiangyouyue/GITku | /src2/huarong2.py | UTF-8 | 2,442 | 3.140625 | 3 | [] | no_license | #coding=utf-8
from __future__ import division, unicode_literals, print_function
import colorsys
import cairo
class Block(object):
def __init__(self, name, height, width):
self.height = height
self.width = width
self.name = name
self.x = 0
self.y = 0
def draw(self, c... | true |
b0e9c408173db4ae2633b2a7e9a869476c658be5 | Python | reneebrinkman/rpg-protocol | /game.py | UTF-8 | 274 | 2.984375 | 3 | [] | no_license | class Game:
def __init__(self):
self.running = True
self.mainloop()
def mainloop(self):
self.initialize()
while self.running:
self.update()
self.draw()
def stop(self):
self.running = False | true |
1296068b06e80874540e8d6cfc61608795cd0ea5 | Python | al00014/gbd | /age_integrating_model.py | UTF-8 | 4,906 | 3.234375 | 3 | [] | no_license | """ Age integrating models"""
import pylab as pl
import pymc as mc
def age_standardize_approx(name, age_weights, mu_age, age_start, age_end, ages):
""" Generate PyMC objects for approximating the integral of gamma from age_start[i] to age_end[i]
Parameters
----------
name : str
age_weights : arr... | true |
bb95acf62e5a4e48494f164c1cbad1fc98495014 | Python | YskSt030/LeetCode_Problems | /905.sortArrayByParity.py | UTF-8 | 324 | 2.703125 | 3 | [] | no_license | """
Given an array A of non-negative integers,
return an array consisting of all the even elements of A,
followed by all the odd elements of A.
You may return any answer array that satisfies this condition
"""
import sys
class Solution:
def minDeletionSize(self, A):
if __name__ == "__main__":
sol_ = Solutio... | true |
363e9b824f8b140a13cd1c60b42d6c726a0f26a7 | Python | HarjyotSital/Twiminds | /OAuth/OAuth.py | UTF-8 | 433 | 2.546875 | 3 | [] | no_license | # -*- coding: utf-8 -*-
import tweepy
CONSUMER_KEY = 'Account Consumer Key'
CONSUMER_SECRET = 'Account Consumer Secret'
auth = tweepy.OAuthHandler(CONSUMER_KEY, CONSUMER_SECRET)
auth_url = auth.get_authorization_url()
print 'Please authorize: ' + auth_url
verifier = raw_input('PIN: ').strip()
auth.get_access_token(ve... | true |
88650fbdaf9cd894c593e13a009366b76fb70b7c | Python | ISeePlusPlus/Excercise1_TensorFlow_Xor | /Yigal_Diker_Excersice1.py | UTF-8 | 7,041 | 2.640625 | 3 | [] | no_license | import tensorflow as tf
from pylab import *
import numpy as np
# exercise 1 & 2 involves only n = 2.
# hyper parameters for print
x_train = [[0., 0.], [0., 1.], [1., 0.], [1., 1.]]
y_train = [[0.], [1.], [1.], [0.]]
x_validation = [[0., 0.], [0., 1.], [1., 0.], [1., 1.], [1., 0.1], [1., 0.9], [0.9, 0.9], [0.1, 0.9]]
... | true |
f72aea40c02f5204abc2c8ed8d3b0bcce5b9338a | Python | fedeOx/ssd-2020 | /SsdWebApi/Models/keras_MLP_lib.py | UTF-8 | 4,324 | 2.65625 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Thu Dec 10 22:04:26 2020
@author: Federico
"""
import os, random
import numpy as np
import tensorflow as tf
import matplotlib.pyplot as plt
from tensorflow import keras
from keras.models import Sequential
from keras.layers import Dense
class MLPUtil:
def __init__(self, datas... | true |
14658c3f6a67838075ed189f17880805af28f725 | Python | MaHu6/LeetCode | /1480. 一维数组的动态和/__init__.py | UTF-8 | 1,176 | 3.875 | 4 | [] | no_license | import time
from typing import List
from Utils.common import run_time
"""
题目:
给你一个数组 nums 。数组「动态和」的计算公式为:runningSum[i] = sum(nums[0]…nums[i]) 。
请返回 nums 的动态和。
示例 1:
输入:nums = [1,2,3,4]
输出:[1,3,6,10]
解释:动态和计算过程为 [1, 1+2, 1+2+3, 1+2+3+4] 。
"""
"""
注释:
runningSum
将累加数放入新数组
runningSum2
从第 1 个位置开始,累加上一个位... | true |
c5102477146bc54c91b783d4f9824e2881beedea | Python | alpha74/airvd | /device/models.py | UTF-8 | 1,470 | 2.859375 | 3 | [] | no_license | from django.db import models
from django.utils import timezone
"""
Device model:
- uid : unique id of device
- name : textual name of device
- date_added : date when device was added
"""
class Device( models.Model ):
uid = models.CharField( max_length = 12, null=False, blank=False, unique=True )
name = ... | true |
20bc2f14681f51b6655ad4517aa1bc24800d1dfb | Python | GavinHarbus/PicTrans | /pictrans.py | UTF-8 | 544 | 2.703125 | 3 | [
"MIT"
] | permissive | from PIL import Image
import argparse as apa
def cleanPic(pic_name):
try:
img = Image.open("./static/pics/"+pic_name+".jpg")
out = img.point(lambda x:255 if x>75 else 0)
out.convert('L').save("./static/pics/res"+pic_name+".jpg")
print("true")
except Exception:
print("fa... | true |
3fc2ebef7baedb27b7ac7697f083c1808ffb6809 | Python | BenTildark/sprockets-d | /DTEC501_Lab12_1/marking_guide.py | UTF-8 | 472 | 2.796875 | 3 | [] | no_license | """
In this revision quiz, there are 16 marks in total.
Question Marks
1 4
2 8
3 6
4 5
5 5
The marks for the current question can be seen in the top left had corner of the question section.
Partial marks are available for each question.
Marks are awarded as 1 mark each for e... | true |
2861e89adb346082e1c730aad06308a623c65f8f | Python | bandwidth-brothers/ss-scrumptious-data-producers | /app/common/exceptions.py | UTF-8 | 133 | 2.796875 | 3 | [] | no_license |
class MissingAttributeException(Exception):
def __init__(self, msg):
self.msg = msg
super().__init__(self.msg)
| true |
7de2c12b9fa7ba29e236bc94bf8c5111a5aa28b0 | Python | exgs/hongikuniv_chemical-engineering | /화공전산(2-2)/chapter7.상미분 방정식/연습문제/p7.3_a.py | UTF-8 | 883 | 2.8125 | 3 | [] | no_license | from math import sqrt
from scipy.integrate import solve_ivp
import numpy as np
#(a번)
a,b,p,q = 1,1,1,-1
#(b번)
# a,b,p,q = 1,1,1,1
def f(t,z):
[x,y] = z
r = sqrt(x**2+y**2)
k0 = a*x-b*y-0.5*(p*x-q*y)*r**2
k1 = b*x+a*y-0.5*(q*x+p*y)*r**2
return k0,k1
h = 0.1
t0, te = 0, 7
xy = [0.1, 0]
tj = np.arange(t0,te+h/2, h)... | true |
db2a4815875009e0baa0d01e661691c54676de20 | Python | JIghtuse/python-playground | /black_hat/udp_client.py | UTF-8 | 384 | 2.828125 | 3 | [] | no_license | # Simple UDP client example
import socket
TARGET_HOST = "127.0.0.1"
TARGET_PORT = 80
RESPONSE_SIZE = 4096
def main():
data = b"AAABBBCCC"
client = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
client.sendto(data, (TARGET_HOST, TARGET_PORT))
data, addr = client.recvfrom(RESPONSE_SIZE)
prin... | true |
1d72d653f509bea9350250555e77452048655a01 | Python | lianhuo/PyTestfile | /mycompany/Student.py | UTF-8 | 858 | 3.078125 | 3 | [] | no_license | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
class Student(object):
def __init__(self,name):
self.name = name
def print_name(self):
print("name:%s" %self.name)
lh = Student("aa")
lh.name = "lianhuo"
lh.print_name()
lh.age = 19
mh = Student("aaa")
mh.print_name()
print(lh.age)
import jso... | true |
53336f6fbcc61a887b0f53fca7e97c40e3632109 | Python | lahdirakram/lydia_test | /test_data_handler.py | UTF-8 | 2,092 | 2.8125 | 3 | [] | no_license | import sqlite3
import unittest
from datetime import datetime, timedelta
import pandas as pd
from data_handler import DataHandler
class TestDataHandler(unittest.TestCase):
def setUp(self):
self.dh = DataHandler("test_db.db")
@classmethod
def tearDownClass(cls) -> None:
sqlite3.connect("... | true |
f6555a25442880868fc4106fcb357b63dc4e948d | Python | vivek-india/dhs | /yang/gen_skeleton.py | UTF-8 | 564 | 2.71875 | 3 | [] | no_license | import sys
import subprocess
import xmltodict
import json
def execute(cmd):
process = subprocess.Popen(cmd, stdout=subprocess.PIPE)
output = process.communicate()[0]
exitcode = process.returncode
if (exitcode == 0):
return output
else:
raise ProcessException(cmd, exitcode, output... | true |
9b7a35a27675e6bc8d71309b7cb13626df02222a | Python | KidistMaxwell/ARA | /apples.py | UTF-8 | 377 | 3.140625 | 3 | [] | no_license | def solution(A, K,L):
N = len(A)
apple_sum =[]
for i in range(0, N-K+1):
for j in range(0, N-L+1):
if len(set(range(i, i+K)) & set(range(j, j+L)))==0:
apple_sum.append(sum(A[i:i+K])+sum(A[j:j+L]))
if len(apple_sum) == 0:
return -1
return max(apple_sum)
... | true |
805b38df78f55ef0d90d5058abe3b6bffa2be443 | Python | DUanalytics/pyAnalytics | /01C-IIM/PD05_reshape.py | UTF-8 | 3,207 | 3.375 | 3 | [] | no_license | #Topic: Reshape Functions
#-----------------------------
#libraries
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
#create DF of studnts
rollno = pd.Series(range(1,11))
rollno
#name = pd.Series(["student" + str(i) for i in range(1,11)])
name = pd.Series(['Alex', 'Vamsee', 'Ritwik','Shweta','Ka... | true |
20c21944e0d3ad18709d904d5fd8ba9ab10afa4b | Python | ruirlima/Quant-Research---Factor-Analysis | /Prior.py | UTF-8 | 658 | 3.359375 | 3 | [] | no_license | import numpy as np
import pandas as pd
def prior(correlation,covarince):
'''
Computes prior matrix for shrinkage approach.
Prior is constant correlation matrix with variance in diagonal
:param correlation: correlation matrix
:param covariance: covariance matrix
:return: prior
'''
... | true |
eaf05b079af8183a63f632226bbe077584716313 | Python | lodgeinwh/Study | /Python/Project Euler/1-30/012.Highly divisible triangular number.py | UTF-8 | 688 | 3.65625 | 4 | [] | no_license | # !/usr/bin/env python3
# -*- coding: utf-8 -*-
def triangular_number(n):
sum = 0
for i in range(1, n + 1):
sum += i
return sum
def primes(N):
prime = []
flag = [1] * (N + 2)
p = 2
while p <= N:
prime.append(p)
for i in range(2 * p, N + 1, p):
flag[i] ... | true |
df0d3191cc01c0b052496833a417aeac5a53356b | Python | xiashuo/tedu_execises | /month03/django/day01/mysite1/mysite1/views.py | UTF-8 | 398 | 3.09375 | 3 | [] | no_license | from django.http import HttpResponse
def operator_view(request, a, op, b):
if op == 'add':
res = a + b
elif op == 'sub':
res = a - b
elif op == 'mul':
res = a * b
else:
res="your op is wrong!"
return HttpResponse(f"结果:{res}")
def birthday_view(request,year,month,da... | true |
a45aee167c7c92904d3b3026388b17d428a02d7b | Python | thunderhoser/GewitterGefahr | /gewittergefahr/gg_utils/shape_utils.py | UTF-8 | 8,334 | 3.21875 | 3 | [
"MIT"
] | permissive | """Processing methods for shapes (closed polygons and polylines)."""
import numpy
from scipy.interpolate import UnivariateSpline
from gewittergefahr.gg_utils import error_checking
MIN_VERTICES_IN_POLYGON_OR_LINE = 4
SPLINE_DEGREE = 4
def _get_curvature(vertex_x_padded_metres, vertex_y_padded_metres):
"""Compute... | true |
f6fcbf7bca928167f00132398600e59cd48b68b7 | Python | hagrusa/HURRICANE | /runTimePlots.py | UTF-8 | 3,590 | 2.6875 | 3 | [] | no_license | ##########################################
# File name: runTimePlots.py
# Author: Harrison Agrusa, Ramsey Karim, Julian Marohnic
# Date created: 11/12/2017
# Date last modified: 11/20/2017
# Description: create runtime vs number of particle plot
##########################################
from __fu... | true |
71a99a72cff298348be01ba631eec5fed4f2ccfc | Python | johnjim0816/NeuralNetworkClassifier | /NeuralNetworkClassifier.py | UTF-8 | 14,750 | 3.296875 | 3 | [] | no_license | import numpy as np
class NNMulticlass:
def __init__(self, nodes, learningParams, randomSeed, weights):
"""Initializes instance of NNMultiClass.
Args:
nodes: Tuple containing size of (input node, hidden node, output node).
learningParams: Tuple containing (lambda, nu... | true |
85a014e210ab49475cb60c6d3384a7dd1de3496a | Python | sridharreddy7/Algorithms-and-Data-Structures | /MaximumSubarray/dynamicProgramming.py | UTF-8 | 511 | 3.78125 | 4 | [] | no_license | #!/usr/bin/python
# Author : Rajat Khanduja
# Program to solve the maximum subarray problem using DP.
def maximumSubarray (arr):
if len(arr) == 1:
return (arr, arr[0])
(a, aSum) = maximumSubarray (arr[:len(arr) - 1])
maxSum = max(aSum, aSum + arr[len(arr) - 1], arr[len(arr) - 1])
if maxSum == aSum:
... | true |
20306ac0b1d8af29d3a781319e75a85e02079d55 | Python | mrG7/tgene | /util/viewgff.py | UTF-8 | 1,363 | 2.640625 | 3 | [] | no_license | #!/usr/bin/env python
"""viewgff.py <fasta_file> <gff_file>
Outputs sequences from a list of gff features. ref from fasta file must match gff features.
"""
import fasta, sys
from common.feature import *
from common.sequence import *
if len(sys.argv) != 3:
print __doc__
sys.exit(0)
genes = Features(sys.argv[2])
fa... | true |
709d33d569e13bc3280d32c22a280d2d890a0e12 | Python | stevenodb/adventofcode2017 | /_03_spiral_memory/test_manhattan.py | UTF-8 | 533 | 2.890625 | 3 | [] | no_license | from unittest import TestCase
from _03_spiral_memory import spiral_memory
class TestManhattan(TestCase):
def test_manhattan(self):
self.assertEqual(0, spiral_memory.manhattan(1))
self.assertEqual(1, spiral_memory.manhattan(2))
self.assertEqual(3, spiral_memory.manhattan(16))
self.a... | true |
0836d0db04a04e798a631aa0ab3c8c51f0ff8e44 | Python | adamtiger/DeepLearningTutorial | /softmax_regression/softreg.py | UTF-8 | 3,324 | 3.375 | 3 | [] | no_license | import numpy as np
# This is an implementation of softmax regression.
beta = 1.0
def softmax(theta, x):
z = beta * np.matmul(theta, x)
return np.exp(z)/np.sum(np.exp(z))
def error_rate(theta, xs, ys):
'''
Error rate
'''
errors = 0
for x, y in zip(xs, ys):
if np.argmax(softmax(the... | true |
b0b60112bc402e1782103599a997ed3de3d43e8e | Python | kameshkotwani/python_assignment | /Assignment_1/prob3.py | UTF-8 | 773 | 3.734375 | 4 | [] | no_license | '''
Assignment_1:Question_3 Reboot Academy
Cookies Program
This solution is created in python 3.6.4
CAUTION: MAY NOT WORK IN OLDER VERSION
Solved by: Kamesh Kotwani
'''
print("Welcome to Ingredients Counter!!")
#Given quantity for 48 cookies
cup_s = 1.5/48
cup_b = 1/48
cup_f = 2.75/48
#To ask the user for number o... | true |
84cbabd7abd66ebe746c78c840ee219cffc07f76 | Python | JaiminBhagat5021/CyberstormGriffin | /Listening.py | UTF-8 | 294 | 2.765625 | 3 | [] | no_license | from pynput.keyboard import Key, Listener
def on_press(key):
print "{} pressed".format(key)
def on_release(key):
print "{} released".format(key)
if(key == Key.esc):
return False
with Listener(on_press = on_press, on_release = on_release) as listener:
listener.join()
| true |
9525cde222665eef220c59df3e09d0f14d0efc5c | Python | pockerman/quantum_computing_cs | /programs/q_simulator.py | UTF-8 | 2,081 | 3.296875 | 3 | [] | no_license | import numpy as np
from numpy import linalg as LA
class QSimulator(object):
@staticmethod
def bra(ket):
"""
Computes the bra corresponding to the ket
"""
return np.array([np.conjugate(item) for item in ket])
# return np.conjugate(ket)
def __init__(self, state_vec... | true |
98b525e767e76772f31d12924eb8b1df0174484c | Python | jguillaumes/MeteoClient | /analytics/temps-night-day.py | UTF-8 | 1,075 | 2.75 | 3 | [
"BSD-3-Clause"
] | permissive | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Wed Sep 26 08:42:58 2018
@author: jguillaumes
"""
import pandas as pd
import sqlalchemy as sql
from plotnine import *
url = 'postgres://weather:weather@ct01.jguillaumes.dyndns.org/weather'
query = 'select time at time zone \'utc\' as timestamp, temperat... | true |
41331c84848999cb583a0fcb69cfaa6bbaf9dea4 | Python | subratcall/Learning_Python | /PyModuleWeekly/re_example/re_test_patterns.py | UTF-8 | 605 | 3.9375 | 4 | [] | no_license | # re_test_patterns
# 利用finditer找出所有的match并且返回它们的位置
import re
def find_patterns(text, pattern):
# Look for each pattern in the text and print the results
print(f"\nTo Find: {pattern!r}")
print(f"In:\n{text!r}\n")
for match in re.finditer(pattern, text):
s = match.start()
e = match.e... | true |
bd06408d09e4df8f87a559e64026b98b1bc98f47 | Python | anhvanthe/LearnPy | /Practices/Day4/parts_match.py | UTF-8 | 705 | 2.515625 | 3 | [] | no_license | import json
import urllib
queries = [
{'mpn': 'SN74S74N',
'reference': 'line1'},
{'sku': '67K1122',
'reference': 'line2'},
{'mpn_or_sku': 'SN74S74N',
'reference': 'line3'},
{'brand': 'Texas Instruments',
'mpn': 'SN74S74N',
'reference': 'line4'}
]
url = 'http://octopart.com... | true |
81729e610fefb2ecd281bfd44d027199db446f03 | Python | piyush1998gupta/DecisionScience | /week2/lasso.py | UTF-8 | 1,806 | 3.125 | 3 | [] | no_license | import numpy as np
import matplotlib.pyplot as plt
from sklearn.linear_model import Lasso
from sklearn.metrics import mean_squared_error
import pandas as pd
def sklearn(x,y):
size = (70 * x.size)//100
# size=10
x_t = x[:size,np.newaxis]
# print(x_t)
y_t = y[:size,np.newaxis]
model = Lasso(alp... | true |
065e1b78bddac0e409c3ef9a79adf20661979f8a | Python | fusuyfusuy/School-Projects | /pycle/bicycle-scrapes/chainbicycle/structure.py | UTF-8 | 331 | 2.8125 | 3 | [
"MIT"
] | permissive | bicycle = {'Colour': 'Black - Yellow', 'Wheel Size': '700c', 'Frame Size': '47.5cm (18.75"), 44.5cm (17.5"), 54cm (21"), 49.5cm (19.5")', 'Gender': 'Unisex', 'Speed': '22 Speed', 'Material': 'Aluminium', 'Age Group': 'Kids', 'Fork Travel': 'Rigid', 'Rear Travel': '160mm'}
for i in bicycle:
bicycle[i] = '----'
pri... | true |
833e0cbfd39e15d45a9cc30ca3cfacc8dffbd800 | Python | SKREFI/things | /projects/scrapers/upendra_site.py | UTF-8 | 1,091 | 2.546875 | 3 | [] | no_license | # -*- coding: utf-8 -*-
import scrapy
class FirstscraperSpider(scrapy.Spider):
name = 'upendra_scraper'
# allowed_domains = ['enter_url_here']
start_urls = [
'https://scrapeit.home.blog']
def parse(self, response):
self.log(f'Got response from {response.url}')
l = response.cs... | true |
ea0c382e50b30ccb8af74590ee3400d2bcd2d880 | Python | Hszor/Answer | /test_01.py | UTF-8 | 784 | 3.578125 | 4 | [] | no_license | import itertools
#itertools
def permutation_itertools(list1):
list2 = list(itertools.permutations(list1, len(list1)))
return list(set(list2))
#DFS
def permutation_DFS(res, l, nums):
if len(nums) == 0:
res.append(list(l))
pre = None
for i in xrange(len(nums)):
... | true |
4415eb0e59fecfd700d49da96e508d1ca3880169 | Python | D0782868/board | /server.py | UTF-8 | 10,185 | 3.046875 | 3 | [] | no_license | #-*-coding:UTF-8 -*-
import pymysql
conn = pymysql.connect(
host='localhost',
user='yuan',
password='test1234',
database='testdb'
)
cursor = conn.cursor()
#--除了 依球員學號顯示列出球員各項數據平均 這個有問題以外其他都沒問題了耶\(˙ˇ˙)/
#--sql資料表 球員 的好像有少人 Q_Q
#--需要一個函式沒有輸入值,回傳所有球員的姓名跟學號
def show_all_player():
sql='SELECT 學號,名字 FR... | true |
3538d29c196e8d62453318a06c9c9a9c8fda6778 | Python | Isaias301/IFPI-ads2018.1 | /Atividade E/fabio01_q45.py | UTF-8 | 1,668 | 4.03125 | 4 | [] | no_license | """ Questão: Lista E 45
Descrição: Um algoritmo para gerenciar os saques de um caixa eletrônico deve possuir
algum mecanismo para decidir o numero de notas de cada valor que deve ser disponibilizado
para o cliente que realizou o saque. Um possível critério seria o da "distribuição ótima"
no sentido de que as not... | true |
b8d1140c664cf5340483c3d6c814c9298686287f | Python | slamatik/codewars | /4 kyu/Snail Sort.py | UTF-8 | 1,073 | 3.71875 | 4 | [] | no_license | def snail(snail_map):
row_start = 0
row_end = len(snail_map) - 1
col_start = 0
col_end = len(snail_map) - 1
solution = []
if len(snail_map[0]) == 0:
return solution
while row_start <= row_end and col_start <= col_end:
# Top Row
for col in range(col_start, col_end + ... | true |
ccb762372dcc5926e554137e93971f2916bb9a5e | Python | scriptbaby/CTF-Writeups | /picoCTF-2018/script-me-solve.py | UTF-8 | 1,493 | 2.890625 | 3 | [] | no_license | #!/usr/bin/env python
from pwn import *
import re
c = remote('2018shell1.picoctf.com', 22973)
for i in range(14):
c.recvline()
# print c.recvline()
def getLevel(number):
height = 0
level = 0
for char in number:
if char == '(':
height = height + 1
else:
hei... | true |
91a40a1e358c6685b60daa7d97e869e0b60e0079 | Python | Fatmahmh/100daysofCodewithPython | /Day056.py | UTF-8 | 574 | 3.75 | 4 | [] | no_license | #Python JSON 2
#The json.dumps() method has parameters to make it easier to read the result:
#Use the indent parameter to define the numbers of indents
import json
x = {
"name" : "john" ,
"age": 25,
"marreid": True,
"divorced": False,
"children": ("anni","bille"),
"pets": None,
"c... | true |
d37599c3ed45a2d428ce5d1f303cbdcfcb4b6ed5 | Python | NevanPadayachee/AssistantTut | /main.py | UTF-8 | 2,262 | 2.9375 | 3 | [] | no_license | import os
import time
import datetime
import playsound
import speech_recognition as sr
from gtts import gTTS
import subprocess
def speak(text):
tts = gTTS(text=text, lang="en")
filename = "voice.mp3"
tts.save(filename)
playsound.playsound(filename)
os.remove("voice.mp3")
def getAudio():
rec = s... | true |
2f6a8828e272d586dbd1953ac10c9da2f6fb9b90 | Python | karlaHH/DeteccionDePlagios | /OCRs/sinComentarios/ocr17.py | UTF-8 | 18,981 | 2.8125 | 3 | [] | no_license | import matplotlib.image as mpimagen
import csv
import os
def Calcular_dimenciones(imagen):
dimenciones=imagen.shape
return dimenciones
def Razon(dimenciones):
razon=dimenciones[0]/dimenciones[1]
return razon
def Pixeles_blancos(imagen,dimencione... | true |
aee03307181f6ed953f1522a14f8137490d739ee | Python | ruisunyc/leetcode_Solution | /leetcode/0714.买卖股票的最佳时机含手续费/0714-买卖股票的最佳时机含手续费.py | UTF-8 | 246 | 2.640625 | 3 | [
"Apache-2.0"
] | permissive | class Solution:
def maxProfit(self, prices: List[int], fee: int) -> int:
cash,hold = 0,-prices[0]
for price in prices[1:]:
cash = max(cash,hold+price-fee)
hold = max(hold,cash-price)
return cash | true |
b03bfa912566b8af7004088e071fe0a278ee07cd | Python | mercurium/proj_euler | /prob565.py | UTF-8 | 1,258 | 3.5 | 4 | [] | no_license | import time, math
from primes import factor, m_r
START = time.time()
SIZE = 10**11
LIM = SIZE / 12101
MOD = 2017
vals = dict()
for n in sorted(range(1722, int(SIZE**(1/2.)), MOD) + range(294, int(SIZE**(1/2.)), MOD)):
if n**2 > SIZE:
break
if m_r(n):
vals[n] = 2
for n in sorted(range(1788, int(SIZE... | true |
e614628ae4a31e32afe8c4e1446298aae6c5037a | Python | MRINALDEEP/HackerRank-Python-Answers | /merge_the_tools.py | UTF-8 | 318 | 3.09375 | 3 | [] | no_license | def merge_the_tools(word, k):
# your code goes here
for i in range(0,len(word),k):
seen = set()
temp=[x for x in word[i:i+k] if not (x in seen or seen.add(x))]
print("".join(temp))
if __name__ == '__main__':
string, k = input(), int(input())
merge_the_tools(string, k) | true |
5eec5d0dfe4452a0e4d584ef1626699df5284e28 | Python | usmanwardag/prep | /6_linked_list.py | UTF-8 | 1,474 | 4.53125 | 5 | [] | no_license |
# Each member has a value and a tail pointer
# Each member will be a class object
class Node(object):
def __init__(self, value):
self.value = value
self.tail = None
class LinkedList(object):
def __init__(self):
self.linked_head = None
self.linked_tail = None
def add_node... | true |
b66acc314045785cfc1cef3b1026654219b983d2 | Python | fangzhao2019/multi-class_sentiment_analysis | /NB/main.py | UTF-8 | 2,166 | 2.578125 | 3 | [] | no_license | # coding:utf-8
from __future__ import division
import numpy as np
import time
from sklearn import svm
from sklearn.externals import joblib
import matplotlib.pyplot as plt
from sklearn.naive_bayes import BernoulliNB
from sklearn.naive_bayes import MultinomialNB
def evaluate(clf,testMat,testLabel,trainLabel):
labelS... | true |
c121332790c56a655d4be3c4e43bcdb9ea966ff6 | Python | tmaccs/pa_chong | /urllib_try.py | UTF-8 | 151 | 2.515625 | 3 | [] | no_license | from urllib import request
request1 = request.Request("http://www.baidu.com")
response = request.urlopen(request1)
html = response.read()
print(html)
| true |
5213966c3abd857dd090bdb58a4e6e6cdbf9e429 | Python | dezlorator1/computational_linguistics | /Скрипты/tomita_parser.py | UTF-8 | 4,877 | 2.65625 | 3 | [] | no_license | from itertools import groupby
import pymorphy2
from bs4 import BeautifulSoup
from pymongo import MongoClient
morph = pymorphy2.MorphAnalyzer()
def replace_sen(sentence):
objects = []
#Чтение файла
f = open('/home/vagrant/tomita-parser/build/bin/objects_lemm.txt', 'r')
#Создание листа с объектом
f... | true |
9af6d4e349a0cc163ead6098b0fad712b28326b5 | Python | Vishnu-prathap/Python3003 | /Activity_03.py | UTF-8 | 173 | 3.46875 | 3 | [] | no_license | a = input("Enter string 1\n")
b = input("Enter string 2\n")
print(a+b)
c = a+b
print(c+c+c+c+c)
print(c+" "+c+" "+c+" "+c+" "+c)
print(c+"\n"+c+"\n"+c+"\n"+c+"\n"+c)
| true |
78141370140ee38be72539e083934c17d65e0375 | Python | sound-round/python-project-lvl2 | /gendiff/tree.py | UTF-8 | 1,358 | 3.03125 | 3 | [] | no_license | """Main module of gendiff-utility"""
def build_diff(node1, node2):
tree = []
all_keys = node1.keys() | node2.keys()
removed_keys = node1.keys() - node2.keys()
added_keys = node2.keys() - node1.keys()
for key in sorted(all_keys):
if key in removed_keys:
tree.append... | true |
a567374cab476f8a0ea482c8a61e01b21f8eb3f9 | Python | boschmitt/tweedledum | /python/tweedledum/bool_function_compiler/bitvec.py | UTF-8 | 7,615 | 3.734375 | 4 | [
"MIT",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | #-------------------------------------------------------------------------------
# Part of Tweedledum Project. This file is distributed under the MIT License.
# See accompanying file /LICENSE for details.
#-------------------------------------------------------------------------------
class BitVec(object):
"""Clas... | true |
08dfb47a93f95d8c8c60bb42c4b3b0ee65ddc1b3 | Python | jackfoley0811/bizdir-scapers | /bizscraper/spiders/flippa.py | UTF-8 | 2,173 | 2.546875 | 3 | [] | no_license | import scrapy
import json
from datetime import datetime
import time
from bs4 import BeautifulSoup
from bizscraper.settings import SCRAPER_API
from bizscraper.items import BizscraperItem
from bizscraper.utils import cleanItem
class FlippaScraper(scrapy.Spider):
name = "flippa"
start_urls = [
... | true |
7e98630ea3954efcdc2725722f9f1b5e838bcdcb | Python | happinessbaby/Project_Euler | /sum_square_diff.py | UTF-8 | 384 | 3.96875 | 4 | [] | no_license | #Find the difference between the sum of the squares of the
#first one hundred natural numbers and the square of the sum.
def sum_of_square():
sum1 = 0
for i in range(1, 101):
sum1 += i ** 2
return sum1
def square_of_sum():
sum2 = len(range(100)) / 2 * (1 + len(range(100)))
ret... | true |
88c0bf1d2de64caf2e127d7656dfe25b4440437d | Python | KhurshidUmid/BANK | /Account.py | UTF-8 | 259 | 2.90625 | 3 | [] | no_license | import uuid
import Transaction
class Account:
def __init__(self, id, number:int, name:str):
self.id=str(uuid(4))
self.number=number
self.name=name
def __str__(self):
return f'{self.id}\n{self.number}\n{self.name}\n' | true |
b5c381f451621c50e6862d5c3cef624eea2c6ed9 | Python | Metaphor090/YanACG-Fgo | /ADDRegCode.py | UTF-8 | 3,913 | 2.765625 | 3 | [] | no_license | import pymysql
import uuid
import datetime
# 创建文件,msg即要写入的内容
def create__report(msg, timeInfo):
report_path = "RegKeyCode" + str(timeInfo)
f = open(report_path, "a")
f.write(msg + "\n")
f.close()
def MakeKeyCode(keynum, keytype):
DataList = []
NowTime = datetime.datetime.now()
# record k... | true |
fe5f5c64be4f270e046af361ce9275195a704dbf | Python | hyphon81/ec2-gpu-cluster-with-NixOps | /gpu-mpi-test2/src/check_mpi4py.py | UTF-8 | 310 | 2.59375 | 3 | [] | no_license | # coding: utf-8
import os
from mpi4py import MPI
def main():
comm = MPI.COMM_WORLD
size = comm.Get_size()
rank = comm.Get_rank()
for i in range(size):
if i == rank:
print("{} {}".format(os.uname()[1], i))
comm.Barrier()
if __name__ == '__main__':
main()
| true |
b110985ba4f700fcb33d2fdf2456c091af625238 | Python | idan054/InstaBot | /Gadgets/console_design.py | UTF-8 | 941 | 3.140625 | 3 | [] | no_license | import sys
from time import sleep
# from termcolor import colored #Another option
class bcolors:
White = '\033[97m'
Purple = '\033[95m'
Blue = '\033[94m'
Yellow = '\033[93m'
Green = '\033[92m'
Red = '\033[91m'
Grey = '\033[90m'
Normal = '\033[0m'
BOLD = '\033[1m'
UNDERLINE = '... | true |
b89605cc7a78dc7b23335a2c9a2fb32f749daf6b | Python | carolinaNery94/EulerMethod | /Euler.py | UTF-8 | 3,140 | 3.203125 | 3 | [] | no_license | import numpy as np
def solucaoExata(r, t):
No = 4 * pow(10, 9) # População inicial N0
x = np.zeros(t) # inicializa um array com tamanho de n
y = np.zeros(t)
# f = open("exata.csv", "w")
for i in range(0, t): # percorre o for de 0 até 101
exact = No * pow((np.e), r * i)
y[i] = ex... | true |
c6c5f7021b4874f9a93f8e1fd78684b9904c46dd | Python | gregorv/MAPSA_Software | /fallingEdges_histogram.py | UTF-8 | 983 | 2.671875 | 3 | [] | no_license | from ROOT import TCanvas, TH1F, gStyle, TAxis
iMPA =1
gStyle.SetOptFit()
# Load falling edges from threshold scan after trimming and convert to int
fallingEdges = open('data/fallingEdgeTrimmed_MPA'+str(iMPA+1)).read().splitlines()
fallingEdges = [int(edge) for edge in fallingEdges]
histData = [[edge,fallingEdge... | true |
348aee39332306e98169e9c16d045d812e0c95be | Python | GaoJianchao/miniprog | /mac_learn/docclass.py | UTF-8 | 4,209 | 3.3125 | 3 | [] | no_license | #! /usr/bin/env python
# -*- coding: utf-8 -*-
#encoding=utf8
import re
import math
import os
def getwords(doc):
splitter = re.compile('\\W*')
words = []
for s in splitter.split(doc):
#print 'split ' + s
words.append(s)
return words
'''
我们希望计算的概率是
一篇文档属于good的可能性。
P(Dg|Dx)
...
已知D0 D1 D2... | true |
289d20040d4b83574b491d23cbe2c21c5349b367 | Python | dragonskies/fix-fixer | /V2/fixfixer_marketdata.py | UTF-8 | 3,298 | 2.59375 | 3 | [] | no_license | import wx
import pyperclip
class MarketData(wx.TextCtrl):
"""An extended wx.TextCtrl with added functionality."""
def __init__(self, window, tID, ActionHistory, parent):
wx.TextCtrl.__init__(self, window, tID, "", style=wx.TE_PROCESS_ENTER|
wx.TE_MULTILINE|wx.TE_RICH|wx.TE_LINEWRAP)
self.parent... | true |
695d34d0c9b952e5492874cb787b3caebd8db4a7 | Python | VishalChak/research | /pyresearch/torch_françois_chollet/mnist_3_chennal.py | UTF-8 | 1,780 | 2.875 | 3 | [] | no_license | import torch
import torchvision
import torch.nn as nn
import torch.nn.functional as F
import torchvision.transforms as transforms
##https://www.deeplearningwizard.com/deep_learning/practical_pytorch/pytorch_convolutional_neuralnetwork/
class Net(nn.Module):
def __init__(self):
super(Net, self).__init__(... | true |
e23b356b18190f8db47e93eeecc8e1fac6b10525 | Python | sujink1999/DSA | /Data Structures/disjoint-sets.py | UTF-8 | 630 | 4.25 | 4 | [] | no_license | # Implementation of Disjoint Sets
class DisjointSets:
def __init__(self, size):
self.parent = [ -1 for i in range(size)]
def find(self, x):
if self.parent[x] != -1:
self.parent[x] = self.find(self.parent[x])
return self.parent[x]
return x
def union(self, x,... | true |
62a0abffee01c24762f189288831a1adab3634dc | Python | patsonev/Python_Basics_Exam_Preparation | /easter_eggs.py | UTF-8 | 875 | 4.375 | 4 | [] | no_license | count_eggs = int(input())
counter_red = 0
counter_orange = 0
counter_blue = 0
counter_green = 0
for i in range(1, count_eggs + 1):
color = input()
if color == 'red':
counter_red += 1
elif color == 'orange':
counter_orange += 1
elif color == 'blue':
counter_blue +=... | true |
e39498b9bf3dabd58e4be9d3cffcc4841711ca58 | Python | JoaoMWatson/Sheet-reader-8000 | /reader.py | UTF-8 | 1,315 | 2.625 | 3 | [] | no_license | import pandas as pd
import numpy
equals_cnpj = []
inscricao_estadual = []
inscricao_suframa = []
inscricao_municipal = []
gerar_boleto = []
razao_social_nome = []
cont = 0
doc = pd.read_excel('planilha.xls')
cnpj_cpf_Values = doc["CNPJ/CPF"].values
cnpj_Values = doc["CNPJ"].values
nome_values = doc["Razão Social /... | true |
80e8b6c4a5e2fa1352769aab9fbcfc6d38bf331e | Python | zion-ai/PythonLearn | /kacisDizileri.py | UTF-8 | 12,381 | 3.765625 | 4 | [
"Apache-2.0"
] | permissive | """
Ters Taksim (\)
"""
#print("Selamlar "Bugün"yaşamak lazım") #syntaxError: invalid syntax
#hata aldık çünkü python karakter dizisinin nerede sonlandığını anlayamadı
#bunu şu şekilde yazarak hata almayabiliriz
print('Selamlar "Bugün" yaşamak lazım') #Selamlar "Bugün" yaşamak lazım
#tırnak işaretlerini değiştirmede... | true |
f3e8de40ce37a962038e1342ac877275e4a1d2e5 | Python | AtlantisSports/uwh-display-py | /uwhd/gamedisplay.py | UTF-8 | 13,954 | 2.546875 | 3 | [
"BSD-3-Clause"
] | permissive | from .font import Font
from .canvas import Canvas, Color
from uwh.gamemanager import PoolLayout, TimeoutState, GameState
try:
from Adafruit_LED_Backpack import SevenSegment, AlphaNum4
HAS_BACKPACK = True
except ImportError:
HAS_BACKPACK = False
black_color = Color( 64, 128, 255)
white_color = Color(255, 255, 25... | true |
c6952a976873d9091cb12ebd9e424fa7910242e9 | Python | thalespaiva/sagelib | /sage/combinat/crystals/crystals.py | UTF-8 | 7,951 | 3.71875 | 4 | [] | no_license | r"""
Crystals
Let `T` be a CartanType with index set `I`, and
`W` be a realization of the type `T` weight
lattice.
A type `T` crystal `C` is a colored oriented graph
equipped with a weight function from the nodes to some realization
of the type `T` weight lattice such that:
- Each edge is colored with a label in `... | true |
c4026d8e37b7349eeaf640459958cc28172a6cf5 | Python | rossi2018/Zuri-Training-2021 | /Python_clases/18Basic_Auth_part1.py | UTF-8 | 937 | 3.265625 | 3 | [] | no_license | # Things needed for registeration are
#-username,passwprd,email
#-generate user account
#Things needed for login
#- (username or email) and password
#Then finally bank operations
#Inializing the system
database={}
def init():
isValidOptionSelected=False
print('Welcome to bankPHP')
while isValidOptio... | true |
9fe0c8cb6ba3d6e876f3a1a4b938bb37c9dc4ae8 | Python | KSWSCOTT/ML | /sungKimLab/Lec7.py | UTF-8 | 1,660 | 3.15625 | 3 | [] | no_license | # Learning rate, Regularization, Overfitting
import tensorflow as tf
# Gradient descent --> learning rate --> overshooting (by big step)
# 데이터에 따라 적절한 학습률이란 다르다. 그렇기 떄문에 data에 따라 선정하거나
# 학습이 될수록 학습률을 줄여가는 방법도 있다.
# 데이터 전처리에 관하여.
# 입력 데이터의 편차가 매우 크다면, 이상한 형태의 등고선이 나올 것이다.
# Normalize 해준다. (+ zero-centere... | true |
c9caff6aacf252b7aae2a1ab33dc7c4d60334960 | Python | ataberkaslan/wgen | /wgen.py | UTF-8 | 1,975 | 3.4375 | 3 | [] | no_license | #! python
import os
import sys
import time
import string
import argparse
import itertools
import colors,alert
chars = string.ascii_letters + "1234567890"
def createWordList(chrs, min_length, max_length, output):
"""
:param `chrs` is characters to iterate.
:param `min_length` is minimum length of characters... | true |
5440856b66bdd7424293435ffcc04ee72bc4d2cc | Python | JoshCheung/CMPS5P | /PythonProj/Hw1/test.py | UTF-8 | 717 | 3.0625 | 3 | [] | no_license | orders = []
menu = ['spaghetti', 'pizza', 'gnocchi', 'lasagna']
sales = {m: 0 for m in menu}
print("Here is the menu:", menu)
def take_order(new_order):
table = new_order['table']
dish = new_order['dish']
if table not in range(1, 21):
print('Please make a valid table')
elif dish not in menu:... | true |