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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
a91eb375ccacec93df14d1c6593ca58ed31b76b1 | Python | Merical/Quantization_Pytorch | /scripts/post_training_quantization.py | UTF-8 | 3,825 | 2.59375 | 3 | [] | no_license | import os
import torch
import torch.nn as nn
from torch.autograd import Variable
import torch.utils.data as Data
import torchvision
from torch.quantization import QuantStub, DeQuantStub
import time
class CNN(nn.Module):
def __init__(self):
super(CNN,self).__init__()
self.quant = QuantSt... | true |
e2945c22b7f2f3b07c9b600275276b90ccb74bcf | Python | barrven/python-expenseTracker | /database.py | UTF-8 | 2,333 | 3.09375 | 3 | [] | no_license | ##########################################
# Barrington Venables #
# 101189284 #
# comp2152 assignment - Expense manager #
##########################################
import sqlite3
from contextlib import closing
from month import *
class Database:
def __init__(self... | true |
0d217624c844ef00710bb5bd74a613cb54036e73 | Python | ayyappa1/application-validate-ip | /validate.py | UTF-8 | 725 | 3.03125 | 3 | [] | no_license | import unittest
from urllib.request import urlopen
import json
# unit testing - unittest.TestCase is used to create test cases by subclassing it
class ApplicateionTest(unittest.TestCase):
# Returns True if host ip address matches in respose ip address.
def test_ip_addr(self):
response = json.load(url... | true |
dbeea0b41cac7559bd9f9e95b2fa2c5b567410bc | Python | Nwebb03/Depth-First-Python | /Graph-Processing/Depth_First.py | UTF-8 | 1,117 | 3.140625 | 3 | [] | no_license | import Graph_Reading as GR
import copy
import pandas as pd
#Basic Load Graph
graph = GR.Read("Graph-Data\Graph1")
startingpoint = input("Starting Node? ")
endpoint = input("End node? ")
#Create a processing queue
#Every item on the queue is a candidate path (Possible path to the goal, another list)
queue = pd.DataFra... | true |
81509d452449d035b0b709e7095e66e4e1291fcf | Python | srea8/cookbook_python | /08/SuperUserFunction.py | UTF-8 | 4,605 | 3.84375 | 4 | [] | no_license | # !/usr/bin/env python
# -*- coding: utf-8 -*-
# @Author: Srea
# @Date: 2019-12-04 23:15:37
# @Last Modified by: srea
# @Last Modified time: 2019-12-08 17:54:24
#****************************#
#super的用法
#类中的命名方式
#****************************#
####super的用法
class MyBaseClass:
def __init__(self, value):
s... | true |
b383e293758e15699734d481b9309238b1777196 | Python | rjbarber/Python | /If Statement.py | UTF-8 | 75 | 2.953125 | 3 | [] | no_license | # Decision Making Statements
a=10
if(a==10):print("The value of a is 10")
| true |
fc2f059fbe126a2fd27b0a7a084a17608ad33c6e | Python | hemanturvyesoftcore/Data-Science-Projects | /PythonPrograms/queue.py | UTF-8 | 153 | 3.328125 | 3 | [] | no_license | from collections import deque
queue = deque ([1,2,3,4,5,6,7])
queue.appendleft(89)
queue.append(77)
print(queue)
print(type(queue))
print(type(deque))
| true |
522498c7ab0cb49b57e7ed6c2301a89089d94980 | Python | MinecraftDawn/LeetCode | /Easy/88. Merge Sorted Array.py | UTF-8 | 577 | 2.96875 | 3 | [] | no_license | class Solution:
def merge(self, nums1: list, m: int, nums2: list, n: int) -> None:
"""
Do not return anything, modify nums1 in-place instead.
"""
index = 0
k = 0
while nums2 and index < m + k:
if nums2[0] <= nums1[index]:
nums1.ins... | true |
ccf216434378f7561833a01fdec336b6d2d86622 | Python | kaneki666/Hackerrank-Solve | /a game of two stacks.py | UTF-8 | 1,894 | 3.484375 | 3 | [] | no_license | class Stack:
lis = []
def __init__(self, l):
self.lis = l[::-1]
def push(self, data):
self.lis.append(data)
def peek(self):
return self.lis[-1]
def pop(self):
self.lis.pop()
def is_empty(self):
return len(self.lis) == 0
# number o... | true |
8c0af1830442ee2bac740a0f6cf8ff387286be34 | Python | kosmitive/bootstrapped-dqn | /environments/GeneralOpenAIEnvironment.py | UTF-8 | 4,069 | 2.640625 | 3 | [
"MIT"
] | permissive | # MIT License
#
# Copyright (c) 2017 Markus Semmler
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merg... | true |
7e44f90f4e9ee575e0cb35ffe1ff11ac66fa3e93 | Python | towardsRevolution/Computer-Vision-Algorithms | /PA1/histEq.py | UTF-8 | 2,409 | 3.3125 | 3 | [] | no_license | import cv2
import numpy,math
import matplotlib.pyplot as plt
__author__ = "Aditya Pulekar"
def main():
L = int(input("Enter the number of gray-scale levels to be considered for the image (256): "))
#Reading a colored image
img = cv2.imread('hazecity.png',1)
cv2.imshow('Aditya Pulekar (Colored)',img)
... | true |
6630cbac994857f9dbb9c033cabac3a6c4b2d918 | Python | T1bzt/hanabi_ai | /tools/tests/hanabi_table_tests.py | UTF-8 | 8,187 | 3.1875 | 3 | [
"MIT"
] | permissive | import unittest
from tools.hanabi_table import HanabiTable
from tools.hanabi_hand import HanabiHand
from tools.hanabi_card import HanabiCard, HanabiColor
from tools.hanabi_deck import HanabiVariant
def diagnose(table):
print("Player 0")
print(table.info_for_player(1)["hands"][0])
print("Player 1")
prin... | true |
0524f592a0c294588defb7d8d5b28b84f61bd495 | Python | sandwu/leetcode_problems | /专题训练/数组/中等/从前序和中续遍历构造二叉树.py | UTF-8 | 697 | 3.671875 | 4 | [] | no_license |
"""
You may assume that duplicates do not exist in the tree.
For example, given
preorder = [3,9,20,15,7]
inorder = [9,3,15,20,7]
Return the following binary tree:
3
/ \
9 20
/ \
15 7
"""
class TreeNode:
def __init__(self,x):
self.val = x
class Solution:
def buildTree(self,pr... | true |
ba83e34b285cfbe78128276b7ce88747d7fa3a53 | Python | Myyyr/imageExplore | /utils.py | UTF-8 | 393 | 2.6875 | 3 | [] | no_license | import os
import numpy as np
import nibabel as nib
import pandas as pd
def nibfile(file):
img = nib.load(file)
return img.get_fdata()
def save_dict(sumary_dict, path = "sumary.csv"):
df = pd.DataFrame(sumary_dict)
df.to_csv(path)
def save_image(img, path):
with open(path, 'wb') as f:
np.save(f, img)... | true |
08a9a35558476573ff517943158e5a3d967de74d | Python | raiscreative/100-days-of-python-code | /day_003/divisibility_checker.py | UTF-8 | 506 | 4.1875 | 4 | [] | no_license | print('Welcome to the divisibility checker!')
game_on = 1
while game_on:
first = int(input('Type a large number, more than 3 digits,please.\n'))
second = int(input('Now type a number between 2 and 25.'))
if first % second == 0:
print(f'{first} is perfectly divisible with {second}.')
else:... | true |
b4f96278d3d2c91f9b78dcf0503c3ad1d7045736 | Python | beyond-algorithms/JaeEun | /src/koitp/보물찾기.py | UTF-8 | 1,419 | 2.9375 | 3 | [] | no_license | from src.Test import Test as T
from collections import defaultdict
from heapq import *
def main():
t = int(input())
for _ in range(t):
numberOfRuins, numberOfClues, timeout = map(int, input().strip().split())
path = []
for __ in range(numberOfClues):
_from, _to = input().s... | true |
17ac398ebba99dd8fc173783690f46a4c72e6993 | Python | rosolczolgmakaron/1st-projekt | /python/konwersje.py | UTF-8 | 2,268 | 3.96875 | 4 | [] | no_license | #!/usr/bin/env python
# -*- coding: utf-8 -*-
def dec2other(liczba10, podstawa):
"""Konwersja liczby dziesiętnej na system o podanej podstawie """
liczba = []
while liczba10 != 0:
reszta = liczba10 % podstawa
if reszta > 9: # wykorzystanie kodu ASCII
reszta = chr(reszta + 55)
... | true |
735bd6bf29cf3bc0bf5cc5ac59909d1da8e6877e | Python | atonderski/Euler | /Euler44.py | UTF-8 | 716 | 2.875 | 3 | [] | no_license | __author__ = 'adam'
pentagonals = set([])
n = 1
diff=9999999999
bestPair=[0,0]
oldPenta=0
newPenta=0
for i in xrange(1,100000000):
pentagonals.add(int(i * (3 * i - 1) * 0.5))
print 'done'
countingPenta = []
while True:
oldPenta=newPenta
newPenta = int(n * (3 * n - 1) * 0.5)
# print 'newPenta: ' + s... | true |
f9e1777f1694175cb29b9851e5b532ed787a479c | Python | 154650362/YaSQL | /yasql/apps/sqlquery/utils.py | UTF-8 | 413 | 2.78125 | 3 | [
"Apache-2.0"
] | permissive | # -*- coding:utf-8 -*-
# edit by fuzongfei
import sqlparse
# 执行前,删除语句开头的注释
def remove_sql_comment(sql):
for stmt in sqlparse.split(sql.rstrip(';')):
statement = sqlparse.parse(stmt)[0]
comment = statement.token_first()
if isinstance(comment, sqlparse.sql.Comment):
return state... | true |
1af2ac502a84837be552aba8be599d3b0907ce39 | Python | pranati05/Misc-4 | /LargestRectangleinHistogram.py | UTF-8 | 1,328 | 3.75 | 4 | [] | no_license | # Time Complexity : O(N)
# Space Complexity : O(N)
# Did this code successfully run on Leetcode : Yes
# Any problem you faced while coding this : No
# Your code here along with comments explaining your approach
# Using monotonous increasing stack to store the indices when the heights are in increasing order.
# Initial... | true |
652ea1ea6b3fab0b00b181dcee3bfac3bea6638a | Python | afreedfayaz18/Assignment_5 | /as4.py | UTF-8 | 218 | 3.28125 | 3 | [] | no_license | def add(a,b):
result=a+b
return result
def sub(a,b):
result=a-b
return result
def mul(a,b):
result=a*b
return result
def truediv(a,b):
result=a/b
return result
def floordiv(a,b):
result=a//b
return result | true |
1026580df88454122cdf6b0b25f884fbf3c1bc98 | Python | ybli/Landslide-Analysis | /analysis/resultWofEAnalysis_Example.py | UTF-8 | 7,103 | 2.890625 | 3 | [] | no_license |
# coding: utf-8
import os
import pandas
import matplotlib.pyplot as plt
import numpy
class ProcessSimulations():
def __init__(self, conf_interval):
self.local_percentiles = self.getPercentiles(conf_interval, quartiles=True)
self.local_step_percentiles = (self.local_percentiles[1] - self.local_... | true |
966a774a38978f8abc05532aa9780e9d664c1f92 | Python | justinhsg/AoC2020 | /src/day20/solution.py | UTF-8 | 6,881 | 2.75 | 3 | [
"MIT"
] | permissive | import sys
import os
import re
from collections import deque
day_number = sys.path[0].split('\\')[-1]
if len(sys.argv)==1:
path_to_source = os.path.join("\\".join(sys.path[0].split("\\")[:-2]), f"input\\{day_number}")
else:
path_to_source = os.path.join("\\".join(sys.path[0].split("\\")[:-2]), f"sample\\{day_nu... | true |
23fbde04e1c4b272cbe76a14a21f470791eb69c0 | Python | metaperl/freegold-focus | /mymail.py | UTF-8 | 1,169 | 2.796875 | 3 | [
"MIT"
] | permissive | import smtplib
from email.mime.multipart import MIMEMultipart
from email.mime.text import MIMEText
def send(text, html, email, name, cc):
import smtplib
from email.mime.multipart import MIMEMultipart
from email.mime.text import MIMEText
me = "ElDorado@FreeGold.Biz"
you = email
COMMASPACE =... | true |
49387d7591b244e88b8cd7601e285f596741b512 | Python | sunatthegilddotcom/Fullerene-Thesis | /triangulation.py | UTF-8 | 1,430 | 2.828125 | 3 | [] | no_license | def triangulation(pentagon_array, hexagon_array):
import numpy as np
if hexagon_array.shape[1] == 0:
T = tri_C20(pentagon_array)
return T
N_T = 5*pentagon_array.shape[1] + 6*hexagon_array.shape[1] #num of coloumns in triangulation
T = np.zeros([3, N_T], dtype=int) ... | true |
6613cad61ac12020145a4a77bf6eaae79c102d7e | Python | hydrotop/PythonStudy | /test/076.py | UTF-8 | 118 | 2.984375 | 3 | [] | no_license | txt1='A tale that was not right'
txt2='이 또한 지나가리라.'
print(txt1[3:7])
print(txt1[:6])
print(txt2[-4:])
| true |
5888047fcf0d2371cf0d33656775fc180ecec3d6 | Python | Habeen-Jun/SaltLux_Project--TOEIC-Helper | /Flask/sr_test.py | UTF-8 | 3,836 | 2.75 | 3 | [] | no_license | import speech_recognition as sr
from pydub import AudioSegment
import os
from pydub.silence import split_on_silence
import pocketsphinx
from jiwer import wer
import time
from datetime import datetime
# 1db = -5dbfs
def db_2_dbfs(db):
return db * -5
def GetCurrentDatetime():
now = datetime.now()
return... | true |
b2f7b7dd6e84e09b4607556cc1a301dd466e4d9f | Python | brandon-rhodes/homedir | /bin/,orphan-xmp | UTF-8 | 756 | 2.84375 | 3 | [
"MIT"
] | permissive | #!/usr/bin/python3
#
# After deleting a few photos with the Delete button in Geeqie, I then
# always want to remove the orphaned .xmp sidecar files.
import glob
import os
import sys
dirs = sys.argv[1:]
if not dirs:
print('usage: give me some directories')
sys.exit(2)
for dirname in dirs:
for dirpath, dir... | true |
d8656cf72e4b674805569711ab7bf44f729b3f6e | Python | leox64/ADT | /Recursividad.py | UTF-8 | 217 | 3.53125 | 4 | [] | no_license | def main():
lista = [3,5,2,1]
print(suma_lista(lista))
def suma_lista (l):
if len(l) == 1:
return l[0]
else:
actual = l.pop()
return actual + suma_lista(l)
main()
| true |
e75dc43b9e4e002b1e98b0aa65c5071abe943914 | Python | prakharshreyash/community_sdk_python | /kentik_api_library/examples/error_handling_example.py | UTF-8 | 1,627 | 2.671875 | 3 | [
"Apache-2.0",
"MIT",
"Python-2.0",
"BSD-3-Clause"
] | permissive | """Examples of handling errors raised in kentik_api library. Only a subset of possible errors is presented."""
import os
import sys
import logging
from typing import Tuple
from kentik_api import KentikAPI, AuthError, NotFoundError, IncompleteObjectError, Device, RateLimitExceededError
from kentik_api.public.types im... | true |
b801cc5693b264fac5e3a53f8571f4cf9fc9e58a | Python | FBergeron/AdventOfCode2020 | /day_22/aoc_22.py | UTF-8 | 1,697 | 3.34375 | 3 | [] | no_license | from itertools import combinations
import re
import sys
input_data_filename = "player_cards.txt"
# input_data_filename = "player_cards_short.txt"
def is_game_over():
for cards in player_cards:
if len(cards) == 0:
return True
return False
player_cards = []
cards = None
with open(input_da... | true |
1c70682b41c5d9e884f1752e638ac5ea1f646ffb | Python | 1narayan1/Guessing-Number | /main.py | UTF-8 | 620 | 4.71875 | 5 | [] | no_license | # GUESSING THE NUMBER GAME
import random
print("Welcome to the GUESSSING THE NUMBER GAME!")
number = random.randint(0,100)
Guesses = 5
win = False
while Guesses > 0:
guess = int(input("Guess: "))
Guesses -= 1
if guess > number:
print("Your guess was too high,you have", Guesses,"remaning")
... | true |
7f785b63e164dafeca0d78bd79d8abd814c9232c | Python | Srinidhi-SA/mAdvisorProdML | /bi/algorithms/time_series_forecasting.py | UTF-8 | 2,665 | 2.984375 | 3 | [] | no_license | from __future__ import print_function
from __future__ import division
from builtins import range
from builtins import object
from past.utils import old_div
class TimeSeriesAnalysis(object):
def __init__(self):
# self._spark = spark
# self.data_frame = data_frame.toPandas()
# self._measure_co... | true |
82ffc9bf46a3d187c9199ab85261a6bc7662a678 | Python | LBJ-Wade/gphist_GW | /gphist/posterior.py | UTF-8 | 7,792 | 2.96875 | 3 | [] | no_license | """Expansion history posterior applied to distance functions.
"""
import math
from abc import ABCMeta,abstractmethod
import numpy as np
import numpy.linalg
import astropy.constants
class GaussianPdf(object):
"""Represents a multi-dimensional Gaussian probability density function.
Args:
mean(ndarray): 1D array o... | true |
57f356579954c46aee8c73dd56e8c4cbff3336a5 | Python | HybridNeos/Graph-Mining-Project | /quickGraph.py | UTF-8 | 8,211 | 3.078125 | 3 | [] | no_license | import networkx as nx
import numpy as np
import matplotlib.pyplot as plt
import pandas as pd
from functools import reduce
from copy import deepcopy
from itertools import combinations
def getTrainTest(df, TrainSchool, TestSchool, asMatrix=True, includeFreshmen=True, yearMethod="none"):
if not includeFreshmen:
... | true |
9640da1dc5b0dc34519ff3768546c193c2509bcc | Python | gabriele-tasca/tesi2021 | /image_scripts/triang_area/triang_area.py | UTF-8 | 345 | 2.578125 | 3 | [] | no_license | import numpy as np
import matplotlib.pyplot as plt
import pandas as pd
import fract
df = pd.read_csv("stats.csv", sep=";")
ratios = df["Area Ratio"]
# df[ df["Nome"] == "Adamello"]
np.min(ratios)
plt.hist(ratios, bins=20)
plt.xlabel("Area Ratio")
plt.savefig("area-ratio-hist.png", bbox_inches='tight')
# np.mean... | true |
949127c5a32445ebfa67a8bf418d0a5a3fefecd3 | Python | vilmarschmelzer/clean-arch | /src/python/products/entities/category.py | UTF-8 | 586 | 2.734375 | 3 | [] | no_license | from abc import ABC
from typing import List
from dataclasses import dataclass
@dataclass
class Category:
name: str
id: int = None
class CategoriesIfRepo(ABC):
def get(self, uid: int) -> Category:
raise NotImplementedError
def get_all(self) -> List[Category]:
raise NotImplementedErr... | true |
bf2cce77d39c988fbf2d3b9d685f3c67c41b2736 | Python | AphroditesChild/Codewars-Katas | /alphabet position.py | UTF-8 | 156 | 3.15625 | 3 | [] | no_license | def alphabet_position(text):
abc = 'abcdefghijklmnopqrstuvwxyz'
return " ".join([str(abc.index(i.lower())+1) for i in text if i.lower() in abc])
| true |
081adeff91053ae9236d281f8ab18423692969c1 | Python | tianhaoz95/py-recurring-investment | /src/core/maybe_invest.py | UTF-8 | 2,037 | 2.6875 | 3 | [
"MIT"
] | permissive | from core.user_context import UserContext
from src.core.stock_context import StockContext
import alpaca_trade_api as tradeapi
class StockFeasibilityChecker():
def __init__(self, user_context: UserContext) -> None:
self.user_context = user_context
def __call__(self, stock_context: StockContext) -> boo... | true |
d9b8ff3a41aea826ca7e813ac85784339d98f860 | Python | aherschend/OOP | /CarClass.py | UTF-8 | 728 | 3.15625 | 3 | [] | no_license | class Car:
def __init__(self,model,make,speed):
self.__year_model = model
self.__make = make
self.__speed = 0
def set_year__model(self,model):
self.__year_model = model
def set_make(self,make):
self.__make = make
def set_speed(self,speed):
self.__s... | true |
0e1e5c9e075726031a68cbe63c93573206019c2c | Python | j0hnsmith/local_files | /tests.py | UTF-8 | 1,918 | 2.578125 | 3 | [] | no_license | import json
import os
import unittest
from config import PROJECT_ROOT
from app import app, db, tasks
from app.models import File
class TestCase(unittest.TestCase):
def setUp(self):
app.config['TESTING'] = True
app.config['SQLALCHEMY_DATABASE_URI'] = 'sqlite:///' + os.path.join(PROJECT_ROOT, 'test.... | true |
36b3cb3bbfc48f3cb7bfefdde4ce4e4d5af4060f | Python | csduarte/FunPy | /csduarte/ex05/sd3.py | UTF-8 | 673 | 2.953125 | 3 | [] | no_license | # %d - Signed integer decimal
# %i - Signed integer decimal
# %o - unsigned octal
# %u - unsigned decimal
# %x - unsigned hexadecimal(lowercase)
# %X - unsigned hexadecimal(uppercase)
# %e - Floating point exponent format(lowercase)
# %E - Floating point exponent format(uppercase)
# %f - Floating point decimal format
#... | true |
5b68e88fc1768d2909d5445b458385ac205d8b24 | Python | CivMap/CivMap | /render/large_tiles.py | UTF-8 | 1,784 | 3.1875 | 3 | [] | no_license | import os
import sys
from PIL import Image
def stitch_four(size, x, z, out_path, in_path):
"""
x,z are tile coords of the nw small tile
size is the width of a small tile
"""
nw_path = in_path + '/%i,%i.png' % (x, z)
sw_path = in_path + '/%i,%i.png' % (x, z+1)
ne_path = in_path + '/%i,%i.png... | true |
0324e26c4e3130ca1cf8c7da044f292bf442ec4b | Python | deriktruyts/Python | /Python3_-_Mundo1_-_Fundamentos/EXERCÍCIOSPython01/Ex_Aula_07/Ex009(TABUADA).py | UTF-8 | 1,228 | 4.21875 | 4 | [] | no_license | # Desafio 009 - Aula 07
# Criar um programa que leia um número inteiro e mostre sua tabuada.
# ------------------------------------------------------------------------
from time import sleep
num = int(input('Insira um número inteiro: '))
print('--------------------------')
t1 = num * 1
t2 = num * 2
t3 = num... | true |
561ffce61848881ced0dced72d8e4f574cf7af7d | Python | 709867472/Amazon-Review-Classifier-Using-Scikit-Learn | /code/my_method.py | UTF-8 | 2,034 | 3.40625 | 3 | [] | no_license | import csv
import sklearn
import nltk
from nltk.corpus import stopwords
import re
import time
start_time = time.time()
inputFile = open("reviews.csv")
reader = csv.reader(inputFile, delimiter='|')
next(reader)
# get all the stopWords and put them into set
stopWords = set(stopwords.words('english'))
# skip first lin... | true |
c5d504886d45b8a6989c5fe5691df4c7162181f0 | Python | nish1998/pubg_predictor | /predict.py | UTF-8 | 1,333 | 2.90625 | 3 | [] | no_license | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Fri Oct 26 22:54:38 2018
@author: nishant
"""
# Importing the libraries
import numpy as np
import pandas as pd
import pickle
# Importing the dataset
dataset = pd.read_csv('train.csv')
testdataset = pd.read_csv('test.csv')
X = dataset.iloc[:, 4:25].valu... | true |
9529147578698383b3e742c9a9e9988a8f8208fd | Python | LeeMoonCh/Arithmetic | /com/Bayes/test.py | UTF-8 | 177 | 2.765625 | 3 | [] | no_license | #conding:utf8
from math import log
#from numpy import *
#list = [[1,3,4,5,6,0,8],[1,2,3,4]]
#
#list = array(list)
#print sum(list[0])
print log(0.5,2)
| true |
01bfca27b96caabe372d57093bea5be6ddca3ba7 | Python | zaproxy/community-scripts | /payloadprocessor/sqlmap - charencode.py | UTF-8 | 503 | 2.90625 | 3 | [
"Apache-2.0"
] | permissive | import string
import time
def process(payload):
retVal = payload
if payload:
retVal = ""
i = 0
while i < len(payload):
if payload[i] == '%' and (i < len(payload) - 2) and payload[i + 1:i + 2] in string.hexdigits and payload[i + 2:i + 3] in string.hexdigits:
... | true |
a40910489379ba2c508e78063fab9077f1744574 | Python | oliviervg1/inventory-manager | /backend/test/test_app.py | UTF-8 | 10,254 | 2.65625 | 3 | [] | no_license | import unittest
import json
from db import Session, tables, bind_session_engine
from models import Room, Item
from app import app
class AppTestCase(unittest.TestCase):
def setUp(self):
app.config["TESTING"] = True
self.app = app.test_client()
engine = bind_session_engine("sqlite:///:mem... | true |
27b6dbb745fe327619b6e2aa5aa70a5abc2b1598 | Python | yusupovbulat/eric-matthes-python-crash-course | /chapter_1_basics/part3/motorcycles.py | UTF-8 | 1,544 | 4.6875 | 5 | [] | no_license | # Create new array and print
motorcycles = ['honda', 'yamaha', 'suzuki']
print(motorcycles)
# Add new element to array's last position with append() method
motorcycles.append('ducati')
print(motorcycles)
# Create empty array and add elements with append() method
motorcycles = []
print(motorcycles)
motorcycles.append(... | true |
3c9ae1fbf88940232863a973baf65d7b820a8f0b | Python | partone/ChessCNN | /ChessCNN.py | UTF-8 | 6,756 | 3.09375 | 3 | [] | no_license | # Pytorch stuff
import torch
import torch.nn as nn
import torch.nn.functional as F
from torch.utils.data import DataLoader
from torchvision import datasets, transforms
from torchvision.utils import make_grid
# The usual
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt # For plotting graphs
... | true |
a25a341d226fd0626f9f02f1ecf0b80160ca1be0 | Python | captainpainway/advent-of-code-2020 | /day_2/day_2_refactor.py | UTF-8 | 1,242 | 3.671875 | 4 | [] | no_license | import re
puzzle_input = open("input.txt", "r")
lines = puzzle_input.readlines()
lines = [line.strip() for line in lines]
# Attempt with regex.
# It's actually messier than the original.
# But I've never used named groups before.
# Also attempted to use one function for both methods,
# which makes things messier as w... | true |
e359c448210e1499756d381154d4d2ee0383e002 | Python | savourylie/behavioral_cloning | /model.py | UTF-8 | 7,303 | 2.65625 | 3 | [] | no_license | import numpy as np
import pandas as pd
import random
import os
import matplotlib.pyplot as plt
import seaborn
from IPython.display import display
import cv2
from keras.models import Sequential
from keras.layers.core import Dense, Activation, Flatten, Dropout
from keras.layers.convolutional import Convolution2D
from ker... | true |
4f84adea7d930a3df21291ab592bae13c7faf43e | Python | liuyuanyuan1992/test_auto | /test_appium/test_xueqiu.py | UTF-8 | 2,498 | 2.640625 | 3 | [] | no_license | # This sample code uses the Appium python client
# pip install Appium-Python-Client
# Then you can paste this into a file and simply run with Python
# 第一个通过Appium录制的代码
from appium import webdriver
from time import sleep
from appium.webdriver.common.touch_action import TouchAction
class TestXueqiu:
def setup(se... | true |
01809e5d0c8406acc4f65fd7e0f81dc8b1909149 | Python | codeAligned/coding-practice | /General/Arrays/preserve_order_in_set.py | UTF-8 | 425 | 3.421875 | 3 | [] | no_license | #!/usr/bin/env python3
# Naturally this method will work only on lists without duplicates.
# A duplicate list cannot create unique indexes in the dict.
sample = [5, 4, 3, 2, 1]
sampleDict = dict((item, index) for index, item in enumerate(sample))
sampleSet = set(sampleDict)
reconstructedList = [None] * len(sampleSet)... | true |
06b119a529e5847c4c35fd0882d9fea068fab343 | Python | tcdavid/advent-of-code-2019 | /python/day8/Day8.py | UTF-8 | 648 | 3.5625 | 4 | [] | no_license | def main():
f = open("input.txt", 'r')
line = f.readline()
rows = 6
columns = 25
n = rows * columns
layers = [line[i:i + n] for i in range(0, len(line), n)]
print(layers)
counts = list(map(findcounts, layers))
counts.sort(key=lambda x: x.zeros)
first = counts[0]
# 1965
... | true |
ea944cb125fda072e5bbfcbe1d0c9a8a2d34bb5c | Python | jimschenchen/PythonSummer2019 | /summerTrialUnit67.py | IBM852 | 813 | 2.953125 | 3 | [] | no_license | dir1 = {'color' : 'blue', 'avalue' : 1, "time" : 1}
print(dir1)
dir1['un'] = 'jim'
print(dir1)
del dir1['un']
print(dir1)
for key, value in dir1.items():
print(key + ": " + str(value))
#default
for key in dir1.values():
print(key)
for key in dir1.keys():
print(key)
for key in dir1:
print(key)
... | true |
16a68c05b5f6e7fcf99fff4423af299970b91bc9 | Python | zaihtml/lpthw | /ex15.py | UTF-8 | 1,160 | 4.09375 | 4 | [] | no_license | # this line calls an argument variable from the system
from sys import argv
# this line unpacks the argument variable
# when running in terminal, you have to type the name of this file,
# as well as the name of the file you want to open
script, filename = argv
# this assigns the command 'open' to the 'txt' variable
... | true |
3e2f88971bbcc34d2dfb6f766954472edcb321f0 | Python | alanrvazquez/MIOSE | /FOalgorithms.py | UTF-8 | 7,559 | 3.140625 | 3 | [] | no_license | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Functions containing first-order algorithms to compute good starting solutions
to the MIO problem and to specify the values of the constants in the boosting
constraints.
"""
import numpy as np
class BetaStart(object):
"""
Python class for solutions.
""... | true |
afb9d0e2d11c2e4ef2ef0fd119b9453215ee0712 | Python | google/mobly | /mobly/controllers/android_device_lib/snippet_event.py | UTF-8 | 2,126 | 2.53125 | 3 | [
"Apache-2.0"
] | permissive | # Copyright 2017 Google Inc.
#
# 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
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | true |
b4032d9d5ea470555946b6d772717eb11df8e5f3 | Python | sytelus/regim | /regim/data_utils.py | UTF-8 | 5,671 | 2.703125 | 3 | [] | no_license | import torch
import numpy as np
import random
from torchvision import datasets
from torchvision import transforms
from torch.utils.data import TensorDataset
from torch.utils.data.sampler import SubsetRandomSampler
class ReshapeTransform:
def __init__(self, new_size):
self.new_size = new_size
def __cal... | true |
c9de20fc2d88a8ff44e396bb90311fff2ffa3c69 | Python | istvan-stv-nagy/master_project | /labeling/label_output.py | UTF-8 | 251 | 2.65625 | 3 | [] | no_license | class LabelOutput:
def __init__(self, pano_image, label_image):
self.pano_image = pano_image
self.label_image = label_image
def data(self):
return self.pano_image
def label(self):
return self.label_image
| true |
77432cdf876d463437c0f32dfd894e228ee71eef | Python | SilverBlaze109/VAMPY2017 | /projects/MMMMM.py | UTF-8 | 790 | 3.40625 | 3 | [
"MIT"
] | permissive | def mode(nums):
"""
nums must be array like mode[1,2,3,1] == 1
mena runs in O(N) time where N = len(nums)
"""
tally = {}
M = nums[0]
for x in nums:
tally[x] = tally.get(x ,0) + 1
if tally[x] > tally[M]:
M = x
return M
#print("The mode is "+str(mode([1,2,3,1,2,3,1,]))
def mean(nums):
if len(nums) == ... | true |
a8cb3569ce947823320d8cac7fd463ad2c1c6cee | Python | hozza94/PythonStudy | /완주하지못한선수.py | UTF-8 | 657 | 3.203125 | 3 | [] | no_license | ### linear time algorithm
def solution(participant, completion):
d = {}
# list 각각에 대해서 key로 사전에 접근, update, 삽입 / hash로 구성되어있기 때문에 O(n)
for x in participant:
d[x] = d.get(x, 0) + 1 # d.get( key, '디폴드 값')
# list 길이에 비례해 접근, update / hash로 구성되어있기 때문에 O(n-1)
for x in completion:
d[x] ... | true |
68f31900dae00a0c8124b26f382a4d5b72b2539c | Python | ArbelRivitz/Four-in-a-row-game | /four_in_a_row.py | UTF-8 | 2,974 | 3.484375 | 3 | [] | no_license | #############################################################
# FILE : four_in_a_row.py
# WRITER : arbelr, noamiel,207904632, 314734302,Arbel Rivitz, Noa Amiel
# EXERCISE : intro2cs ex12 2017-2018
# DESCRIPTION:
# In this excercise we made the game four in a row. This game is moduled to different parts. There is s... | true |
188fe717ccf335fd4e4c7819d9e4ea195ba8d946 | Python | youareeverysingleday/pyOperateChrome | /pyOperateChrome.py | UTF-8 | 3,975 | 2.640625 | 3 | [] | no_license | import pandas as pd
import numpy as np
from selenium import webdriver
from selenium.webdriver.support.wait import WebDriverWait
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support.ui import Select
from selenium.webdriver.chrome.options import Options
from selenium.webdriver.co... | true |
329f5b2c1a33e6a4a49863343d63fd080ee66175 | Python | balu-/deconzpy | /deconzpy/Light.py | UTF-8 | 9,106 | 2.796875 | 3 | [
"MIT"
] | permissive | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
import requests
from .BaseElement import DeconzBaseElement
import logging
logger = logging.getLogger(__name__)
class Light(DeconzBaseElement):
""" Repraesentation eines Lichts """
class State:
""" ein Status eines Lichts """
brightness = None
... | true |
6e57e07704eda693c048b5c58c7549bdb3c2f3ef | Python | mgbo/to_do | /test.py | UTF-8 | 786 | 3.34375 | 3 | [] | no_license |
import csv
import math
lat = float(input("Enter a latitude : "))
lon = float(input("Enter a longitude :"))
f_p = 6373
s_p = 6373
ans_1 = 0
ans_2 = 0
def length(lat, lon, n_lat, n_lon):
return math.sqrt((n_lat - lat)**2 + (n_lon - lon)**2)
with open('location_1.csv', 'r') as file:
reader = c... | true |
391f89f8560c5353ddbee6a22ec84d13f1a725de | Python | Workiva/aws-lambda-fsm-workflows | /tools/yaml_to_json.py | UTF-8 | 3,586 | 2.625 | 3 | [
"Apache-2.0"
] | permissive | #!/usr/bin/env python
# -*- coding: UTF-8 -*-
# Copyright 2016-2020 Workiva Inc.
#
# 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
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless... | true |
112f8a2e10130580e7f8b0a9b3b66f2c41f901a1 | Python | lujh410/matplotlib | /chapter02/demo05.py | UTF-8 | 402 | 3.71875 | 4 | [] | no_license | # 定制盒装图每一部分的颜色
import random
import matplotlib.pyplot as plt
# 0:平均值 1:标准差
values = [random.gauss(0,1) for i in range(100)]
print(values)
b = plt.boxplot(values)
colorList = ['r','b','g','y']
i = 0
for name, line_list in b.items():
color = colorList[i % len(colorList)]
i += 1
for line in line_list:
... | true |
fb4fe8d5fe38f9c1e8a79b333b348e07c5c135e5 | Python | webclinic017/stox | /Examples/AlgoTradingImplementation/main.py | UTF-8 | 2,765 | 3.796875 | 4 | [
"MIT"
] | permissive | ## Import The Modules
import stox
import pandas as pd
stock_list = ['FB','AAPL','AMZN','NFLX','GOOG'] ## List Of Stocks You Would Want To Buy
number_of_stocks = len(stock_list)
print(number_of_stocks)
x = 0
starting_cash = 10000 ## Amount Of Money In Trading Account
current_cash = starting_cash
percent_to_spend = 5
... | true |
a7c5a0629e5711b109a892f148314ecb6fd47e2d | Python | Hashizu/atcoder_work | /abc164/D/main.py | UTF-8 | 765 | 2.921875 | 3 | [] | no_license | #!/usr/bin/env python3
import sys
def solve(S: int):
S =str(S)[::-1]
MOD = 2019
mod_l = [int(0)]*2019
mod_l[0] = 1
prev = 0
for x in range(len(S)):
k = int(S[x]) * pow(10, x, MOD) % MOD + prev
mod_l[k%2019] += 1
prev = k%2019
s = sum([x*(x-1)//2 for x in mod_l])
... | true |
75ac9629a604f0370a2ae4a01131931e5def325c | Python | Magicspell/Programming-Challanges | /imcompression.py | UTF-8 | 6,225 | 2.65625 | 3 | [] | no_license | import pygame
from PIL import Image, ImageFilter
import colorsys
import zlib
import thorpy
import pytesseract
pytesseract.pytesseract.tesseract_cmd = r'C:\Program Files\Tesseract-OCR\tesseract'
im = Image.open(input('Which image? '))
print(pytesseract.image_to_string(im))
data = pytesseract.image_t... | true |
59871e0ea8714ead2f69a0fdfe3c68320e414cf7 | Python | yugimaster/service.1905.content.provider | /resources/lib/util.py | UTF-8 | 1,561 | 2.515625 | 3 | [
"Apache-2.0"
] | permissive | #!/usr/bin/env python
# coding=utf8
import urllib2
import re
import StringIO
import gzip
from common import *
def GetHttpData(url, data=None, cookie=None):
log("Fetch URL :%s, with data: %s" % (url, data))
for i in range(0, 2):
try:
req = urllib2.Request(url)
req.add_header('... | true |
a3133ec126d34bded090f0f54e602242e999e12c | Python | dm-Charles/textEditor | /app_gui.py | UTF-8 | 653 | 2.546875 | 3 | [] | no_license | import tkinter as tk
window = tk.Tk()
window.title("Editor PRO 2")
buttonFrame = tk.Frame(window)
buttonFrame.pack(fill=tk.Y, side=tk.LEFT)
textFrame = tk.Frame(window)
textFrame.pack(side=tk.RIGHT)
saveButton = tk.Button(buttonFrame,text="save", bg="green", width=10)
saveButton.grid(row=1, column=0, pady=5, sticky=... | true |
6a512215a68ac1e5a7489f6c431219b6e335eb85 | Python | disissaikat/cfc_2020 | /ngo_app_code/password_hashing.py | UTF-8 | 508 | 3.1875 | 3 | [] | no_license | from cryptography.fernet import Fernet
key = b'mlgHc4CrmeiVLmR82I1dRTL7zrR-Dff-k8mS_x7x1uY='
cipher_suite = Fernet(key)
def encrypt_pwd(pwd):
byte_pwd = bytes(pwd, 'utf-8') #convert to byte for encryption
ciphered_pwd = cipher_suite.encrypt(byte_pwd)
ciphered_pwd = str(ciphered_pwd, 'utf-8')
r... | true |
7b34c7da4cee2bc289d0ebff62045ceabb9c5593 | Python | erceth/pyflags | /bullet.py | UTF-8 | 570 | 2.875 | 3 | [] | no_license | from gameObject import GameObject
import gameConsts
class Bullet(GameObject):
def __init__(self, color, position, direction, angle):
self.color = color
image = f'img/{color}_tank.png'
size = (gameConsts.BULLET_SIZE, gameConsts.BULLET_SIZE)
speed = gameConsts.BULLET_SPEED
super().__init__(image, ... | true |
61867fbc1a33355561827c553ea504ae079a0b39 | Python | alexlu07/AI_from_scratch | /NeuralNetwork/network.py | UTF-8 | 2,900 | 2.890625 | 3 | [] | no_license | import numpy as np
class Network:
def __init__(self, *nodes, m=10, lr=2):
self.a = []
self.mini = m
self.layers = len(nodes)
self.sizes = nodes
self.weights = [np.random.randn(nodes[i - 1], nodes[i]) for i in range(1, len(nodes))]
self.biases = [np.zeros([1, nodes[i... | true |
15ed6caa2430b11908cdacb9f798941cc33f2674 | Python | dternyak/FlaskAppEngine | /models.py | UTF-8 | 2,511 | 2.59375 | 3 | [
"LicenseRef-scancode-unknown-license-reference",
"Apache-2.0"
] | permissive |
import time
from google.appengine.api import users
from google.appengine.ext import ndb
DEFAULT_GUESTBOOK_NAME = 'default_guestbook'
# We set a parent key on the 'Greetings' to ensure that they are all
# in the same entity group. Queries across the single entity group
# will be consistent. However, the write rat... | true |
d51de4d55174956120a3a12d196ac8e7b573219d | Python | Bstijn/visualisationPythonS7 | /vis1_3.py | UTF-8 | 2,031 | 2.9375 | 3 | [] | no_license | from vtkmodules.all import(
vtkActor, vtkPolyDataMapper, vtkActor, vtkCylinderSource, vtkProp
)
from util.window_renderer import WindowRenderer
from vis1 import Cone
class Cylinder:
def __init__(self, renderer):
self.__renderer = renderer
self.__cylinder = vtkCylinderSource()
self.__... | true |
a02ee4e1d5faf282f457251ed688f01316465e1d | Python | DainDwarf/AdventOfCode | /2019/Day20/day20.py | UTF-8 | 11,542 | 2.640625 | 3 | [] | no_license | import pytest
import networkx as nx
from networkx.algorithms.shortest_paths.generic import shortest_path
# That's handy, the Advent of Code gives unittests.
# Careful with the test input, as there wil be no strip() in the code : space has meaning here
@pytest.mark.parametrize("inp, exp", [
(""" A ... | true |
76f165f41d492683342370e950bf8d2907f58aa0 | Python | tjtimer/aio_arango | /tests/test_graph.py | UTF-8 | 1,675 | 2.625 | 3 | [
"MIT"
] | permissive | """
test_graph.py
author: Tim "tjtimer" Jedro
created: 17.04.19
"""
from pprint import pprint
from aio_arango.db import DocumentType
from aio_arango.graph import ArangoGraph
async def test_graph_create(test_db):
await test_db.create_collection('test_node')
await test_db.create_collection('test_edge', doc_typ... | true |
7f3bc8ee2428ec6ee8e7d2ae4858e58c0c4183ee | Python | jeon-chanhee/DataScience | /Python/basic/Python_day1/Python01_elif_전찬희.py | UTF-8 | 337 | 4.09375 | 4 | [] | no_license | #90점 이상이면 : A 학점
#80점 이상이면 : B 학점
#70점 이상이면 : C 학점
#60점 이상이면 : D 학점
#이외는 F학점
grade = 91
if grade >= 90:
print("A학점")
elif grade >=80:
print("B학점")
elif grade >=70:
print("C학점")
elif grade >=60:
print("D학점")
else :
print("F학점")
| true |
054daed9bc01f7cdc988510404477b41d734c22e | Python | akshaylike/gstracker | /fill_games_into_db.py | UTF-8 | 690 | 2.578125 | 3 | [] | no_license | import sqlite3
import json
json_file = open('gmggames.json')
list_of_games = json.load(json_file)
conn = sqlite3.connect('development.sqlite3')
query = ""
id = 1
for each in list_of_games:
try:
onSale = int(each['onSale'][0])
#steamworks = int(each['steamworks'][0])
gameTitle = each['gameTitle'][0]
gameLink ... | true |
a018faadb75c98616394542514b4c3398197560c | Python | thelumen/Python-com | /plot_presure1.py | UTF-8 | 2,841 | 2.90625 | 3 | [] | no_license | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
import matplotlib.pyplot as plt
from scipy.signal import butter, lfilter
import numpy as np
data = np.fromfile('data/out.prs', np.uint8)
def butter_lowpass(cutoff, fs, order=5):
nyq = 0.5 * fs
normal_cutoff = cutoff / nyq
b, a = butter(order, normal_cutoff, ... | true |
c771dfb7e2fffe77c35704188988cbd34da3bbf7 | Python | citlaligm/Advance-Lane-Detection | /test_images/filters.py | UTF-8 | 3,240 | 2.875 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Mon Dec 12 17:39:05 2016
@author: uidr9588
"""
import cv2
import matplotlib.pyplot as plt
import matplotlib.image as mpimg
import numpy as np
filename = 'test6.jpg'
img=mpimg.imread(filename)
#image_cv2=cv2.imread(filename)
# Convert to HLS color space and separa... | true |
f8c83821888e048577fb933b6065ec26c3700fee | Python | sudo-hemant/CP_CipherSchools | /recursion_and_backtracking/all_possible_word_from_phone_digits.py | UTF-8 | 806 | 3.734375 | 4 | [] | no_license |
# https://www.geeksforgeeks.org/find-possible-words-phone-digits/
def find_possible_combinations(number):
result = []
hash_number = [ "", "", 'abc', 'def', 'ghi', 'jkl', 'mno', 'pqrs', 'tuv', 'wxyz' ]
temp = []
util(0, temp, len(number), number, result, hash_number)
return result
def uti... | true |
6e5427c79c5687c1754395586e3ac691a0e652b4 | Python | phani-1995/Week3-python_libraries | /Matplotlib/Line_marker.py | UTF-8 | 268 | 3.234375 | 3 | [] | no_license | import matplotlib.pyplot as plt
x = [1,4,5,6,7]
y = [2,6,3,6,3]
plt.plot(x, y, color='red', linestyle='dashdot', linewidth = 3,
marker='o', markerfacecolor='blue', markersize=12)
plt.ylim(1,8)
plt.xlim(1,8)
plt.xlabel('x-axis')
plt.ylabel('y-axis')
plt.show() | true |
da27e81bea2e960b59f03586f589762902b5cb3b | Python | dr-dos-ok/Code_Jam_Webscraper | /solutions_python/Problem_156/574.py | UTF-8 | 444 | 2.875 | 3 | [] | no_license | import math
num = raw_input()
num = int(num)
for x in range(num):
output = "Case #"+str(x+1)+': '
i = raw_input()
lis= raw_input().split()
for i in range(len(lis)):
lis[i] = int(lis[i])
m = max(lis)
o = 999999
for sq in range(1,m+1):
s = 0
for x in lis:
s += ... | true |
b3a2aa75915b2b8c928eb8162698d68207a75df2 | Python | sajanganesh/salesforce | /pthon1.py | UTF-8 | 147 | 3.90625 | 4 | [] | no_license | num=int(input("enter the number :"))
i=0
while i<num:
print(" ---"*num)
print(f"| {0} "*num+"|")
i=i+1
if i==num:
print(" ---"*num) | true |
eb3c645adef1e9ed0023a6bc3785d3c68a5e3f5a | Python | pypr/compyle | /examples/axpb_jit.py | UTF-8 | 578 | 2.671875 | 3 | [
"BSD-3-Clause"
] | permissive | """Shows the use of annotate without any type information.
The type information is extracted from the arguments passed
and the function is annotated and compiled at runtime.
"""
from compyle.api import annotate, Elementwise, wrap, get_config, declare
import numpy as np
from numpy import sin
@annotate
def axpb(i, x, ... | true |
6d0f82859b8265d08b7f78e013d905e8c415654f | Python | dgarridouma/streamlit-example | /streamlit1.py | UTF-8 | 1,795 | 3.46875 | 3 | [] | no_license | import streamlit as st
import pandas
import plotly.graph_objects as go
st.title("Ejemplo utilización streamlit")
st.markdown("Este ejemplo muestra cómo utilizar streamlit para mostrar datos de DataFrames Pandas en una aplicación web")
st.sidebar.title("Seleccionar gráficas")
st.sidebar.markdown("Selecciona el tipo d... | true |
3c7cb827dd94764bdc05754c3219b1e6ef630ad3 | Python | dle519/CS1026-Assignment-1 | /dle46_Assign1.py | UTF-8 | 1,498 | 4.21875 | 4 | [] | no_license | ##
# This program simulates flipping a coin into a grid for a carnival game
from random import random
# Variable list
distance = float(input("Please enter the distance between the lines: ")) # Distance between the lines (in mm)
reward = int(input("Please enter the reward if the customer wins: ")) # How much th... | true |
66052a42e1091d441136a51fbd06039ce7991f01 | Python | Kent-EGUCHI/practice | /matplotlib_practice.py | UTF-8 | 115 | 3.046875 | 3 | [] | no_license | import numpy as np
import matplotlib.pyplot as plt
x = np.linspace(0, 1, 100)
y = x ** 2
plt.plot(x, y)
plt.show() | true |
7b81ee5a5c48d601f0eb4733b24ca7db6e853524 | Python | hdjsjyl/machine_learning_interview | /torchMnist.py | UTF-8 | 1,282 | 2.84375 | 3 | [] | no_license | # step1 load dataset
# step2 make dataset iterable
# step3 create model class
# step4 instantiate model class
# step5 instantiate loss function
# step6 instantiate optimizer
# step7 train model
# step8 test model
import torch as tc
import torchvision as tv
import torchvision.transforms as trans
import torch.utils.data... | true |
13e12ce117edcfb2d64c48e727546049b1b1b0cb | Python | LuisBernabe/RoboticaSalonNav | /src/mesa_marker/src/mesa.py | UTF-8 | 2,334 | 2.921875 | 3 | [] | no_license | #!/usr/bin/env python
#9 cuadritos de ancho
import rospy
from visualization_msgs.msg import Marker
from geometry_msgs.msg import Point
"""
Clase que crea un publicador Marker simulando una mesa
author: Berna
"""
class Mesa(object):
"""
Constructor que tiene 3 parametros:
index: Funciona como i... | true |
f6f442a3b599e542a87db29e731395ec09d96ca6 | Python | sukraBhandari/pythonCode | /BST.py | UTF-8 | 2,147 | 3.59375 | 4 | [] | no_license | #binary search tree
class Node(object):
def __init__(self, data):
self.left = None
self.right = None
self.data = data
class Tree(object):
def __init__(self):
self.root = Node(data)
def addChild(self,data):
if self.root is None:
self.root = Node(data)
else:
current = ... | true |
d1a103133c46db7edccbc2b07822561b959faa15 | Python | KAA-sign/stepik | /python_1/multi_table.py | UTF-8 | 219 | 3.578125 | 4 | [] | no_license | a = 7
b = 10
c = 5
d = 6
for j in range(c, d+1):
print('\t', j, end='')
print()
for i in range(a, b+1):
print(i, '\t', end='')
for j in range(c, d + 1):
print(i * j, '\t', end='')
print()
print() | true |
3d528192e69abe50aab8714065c3947653c3e546 | Python | Echocage/Data-Management | /GraphUser.py | UTF-8 | 984 | 2.84375 | 3 | [] | no_license | import sqlite3
from pylab import *
con = sqlite3.connect('C:/data/FacebookFriendsData.db')
c = con.cursor()
times = [0] * 24
user = input("Enter user's name: "),
#Load timestamps into memory
c.execute("SELECT timestamp FROM TimestampIds")
timestamps = c.fetchall()
#Get Users's ID
c.execute('SELECT id FROM Userids WHERE... | true |
07439891b648f77ad585fb17f702395f074ac8a3 | Python | daniel-reich/ubiquitous-fiesta | /Lx9mL2uBWwtJFv94a_23.py | UTF-8 | 457 | 3.203125 | 3 | [] | no_license |
def checker_board(n, el1, el2):
if el1 == el2:
return 'invalid'
output = []
lsteven = []
while len(lsteven) < n:
lsteven.append(el1)
if len(lsteven) == n:
break
lsteven.append(el2)
lstodd = []
while len(lstodd) < n:
lstodd.append(el2)
if len(lstodd) == n:
break
lstod... | true |