blob_id large_string | repo_name large_string | path large_string | src_encoding large_string | length_bytes int64 | score float64 | int_score int64 | detected_licenses large list | license_type large_string | text string | download_success bool |
|---|---|---|---|---|---|---|---|---|---|---|
f3243725ebc5635925cc4dd042eea654951a66bb | Shaharemrunal/Certification-Project | /Project/Edyoda-Gym-MMP-main/maingym.py | UTF-8 | 15,162 | 2.875 | 3 | [] | no_license | from ed_gym import data_store
gym = data_store.Gym_Member()
while True:
print('\n ###### Welcome to MRUNAL Gym!!! ######\n\n1. Super User login\n2. User login\n3. Exit\n')
choose = input("Enter option number:- ")
if choose == '1':
while True:
print("\n\n#*#*#*#*#*#*#*#*#... | true |
03002ad3f352c7caf1c0de48cd377795e975efd6 | FLOKANYI/dbitnrb264120-DBT1303PythonProject | /dbitnrb264120-DBT1303PythonProjectSourceCode.py | UTF-8 | 925 | 3.171875 | 3 | [] | no_license | # Crime reporting system
# Desc - pseudocode - the crime victim reports a case and the system tracks the crime status
# DBITNRB264120
# Florence Kanyi
# Program start
username = input("kindly Log in using your username:")
verification = input("Enter your Password:")
verification = 'correct'
if verification ==... | true |
5bf267c883cb30a770117f51c4f864a89421391d | cbh968130/ShinieHW | /10_factors/newAlpha7.py | UTF-8 | 760 | 2.90625 | 3 | [] | no_license | # encoding: utf-8
# 文件需要以utf-8格式编码
# 文件名代表因子名称,需满足命名规范
__author__ = "陈熙元" # 这里填下你的名字
default_params = {"t":20} # 这里填写因子参数默认值,比如: {"t1": 10}
params_description = {"t":"过去t日收盘价正变化之和的相反数"} # 这里填写因子参数描述信息,比如: {"t1": "并没有用上的参数"}
def run_formula(dv, params=default_params):
"""
过去20日收盘价正变化之和的相反数
"""
t=params... | true |
e5f8f108f8f94619638d2f38043cdfadbecaa034 | itnlp606/mrc-ner | /constants.py | UTF-8 | 3,162 | 2.671875 | 3 | [] | no_license | import torch
# get device
if torch.cuda.is_available():
DEVICE = torch.device('cuda')
DEVICE_NAME = torch.cuda.get_device_name(0)
else:
DEVICE = torch.device('cpu')
DEVICE_NAME = 'Cpu'
LABEL2Q = { 'DRUG':'中药名称,指在中医理论指导下,用于预防、治疗、诊断疾病并具有康复与保健作用的物质。中药主要来源于天然药及其加工品,包括植物药、动物药、矿物药及部分化学、生物制品类药物。例子: 六味地黄丸、逍遥散',... | true |
7391de55bab3fa5b0cedb50957fe757f511d5f18 | pyccel/pyccel | /tests/codegen/ccode/scripts/ifs.py | UTF-8 | 925 | 2.921875 | 3 | [
"MIT"
] | permissive | # pylint: disable=missing-function-docstring, missing-module-docstring
x = 0
y = 0
z = 3
if 1<0:
x=4
if z < 4:
pass
if (x==2 or y==1) and z>3 :
x = 3
y = 4
if x>2 or y<=1:
x = x-1
y = y-1
if True:
x = 5
if False:
y = 0
if x > 1:
for i in range(0,4):
x = x + 1
... | true |
ce959afcc3e1afc8703f31acdfe8e21e8d1b8914 | gerrardjenner/pyrl | /components/ai.py | UTF-8 | 5,727 | 2.78125 | 3 | [] | no_license | import libtcodpy as libtcod
from random import randint
from game_messages import Message
class BasicMonster:
def take_turn(self, target, fov_map, game_map, entities, allies):
results = []
monster = self.owner
game_map.tiles[monster.x][monster.y].contaminants += 10
if monster.d... | true |
544d3f8ec456ecdedadc1358118e64e2bc81a74e | NinaCapricorn/Python- | /Python基础教程学习笔记/第三章 使用字符串/第三章 使用字符串.py | UTF-8 | 1,898 | 3.359375 | 3 | [] | no_license | # coding=utf-8
import math
from string import maketrans
# 字符串格式化
print 'Price of an egg: $%d' % 42
print 'Price of an egg: $% 5d' % 42
print 'Price of an egg: $% 5d' % -42
print 'Price of an egg: $%+d' % 42
print 'Pi : %f' % math.pi
print 'Pi : %06.2f' % math.pi
print 'Pi : %.3f' % math.pi
print 'Pi : %.*f' % (2, mat... | true |
76258b1d3d5bfd52d0930006a4a4f78fadeb78c3 | myt00seven/svrg | /cifar/cifar_test.py | UTF-8 | 427 | 2.609375 | 3 | [
"MIT"
] | permissive | import cPickle as pickle
import numpy as np
import os
def load_CIFAR_batch(filename):
""" load single batch of cifar """
with open(filename, 'rb') as f:
datadict = pickle.load(f)
X = datadict['data']
Y = datadict['labels']
X = X.reshape(10000, 3, 32, 32).transpose(0,2,3,1).astype("float")
Y = n... | true |
0f330902102f8754ef668758631cddf8ce903c28 | MTTeql/MT-Teql | /transformations/underconstrained_synonym_transformation.py | UTF-8 | 3,992 | 2.71875 | 3 | [
"MIT"
] | permissive | import sys
sys.path.append("..")
import numpy as np
from copy import copy
from Triplet import Triplet, MTriplet, TSchema, Query
try:
from trans_utils import us_en_synonym, _random_choice
except:
from transformations.trans_utils import us_en_synonym, _random_choice
def sup_substitute(triplet):
super... | true |
6c58e0c86baba60811b09b2eb7fee3650bdfff9e | zwicker-group/py-pde | /examples/cartesian_grid.py | UTF-8 | 464 | 3.296875 | 3 | [
"MIT"
] | permissive | """
Diffusion on a Cartesian grid
=============================
This example shows how to solve the diffusion equation on a Cartesian grid.
"""
from pde import CartesianGrid, DiffusionPDE, ScalarField
grid = CartesianGrid([[-1, 1], [0, 2]], [30, 16]) # generate grid
state = ScalarField(grid) # generate initial con... | true |
c7e881537261b2cc780fa85737fbde0fdc17caf7 | huningfei/python | /day4/5.内置函数.py | UTF-8 | 4,044 | 3.6875 | 4 | [] | no_license | # 自定义函数
# 内置函数
# print
# len
# max min
# dir
# def func():
# a = 1
# b = 2
# print(locals())
# print(globals())
# 全局命名空间中的名字
# print(locals()) # 本地的命名空间
# print(globals()) # 全局的命名空间
# func()
# inp = input('>>>')
# 99乘法表
# for i in range(1,10):
# for j in range(1,i+1):
# ... | true |
774a06de2cb3dba2df2a9760353d0d5102a3abe0 | plamen-kondev/SU_Python_Advanced | /E05. Truck Tour.py | UTF-8 | 713 | 3.53125 | 4 | [] | no_license | from collections import deque
n_stations = int(input())
starting_station = 0
full_circle = False
stations = deque([])
for _ in range(n_stations):
stations.append(input())
for starting_station in range(n_stations):
tank = 0
for station in range(n_stations):
current_station = stations[station]
... | true |
46f928955471ee41a45cae2eb88985f7789a71f5 | brishtiteveja/Machine-Learning-Natural-Language-Processing | /cs4740/old/a2/lib/split_validation.py | UTF-8 | 484 | 2.5625 | 3 | [] | no_license | import random, sys
random.seed(1234)
if len(sys.argv) > 1:
split = float(sys.argv[1])
else:
split = 0.7
with open('data/wsd-data/train.data','r') as f:
l = f.readlines()
random.shuffle(l)
split = int( split*len(l) )
train = l[0:split]
validation = l[split:]
with open('data/wsd-data/train_split.data',... | true |
bc99a243e6b6c4d8da3a442a0dfafd6f00b7b6db | rheehot/Algorithm_Programmers | /Level_1/2016년.py | UTF-8 | 318 | 3.375 | 3 | [] | no_license | def solution(a, b):
lastDay = [31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31]
name = ["FRI", "SAT", "SUN", "MON", "TUE", "WED", "THU"]
month = 0
for i in range(a - 1):
month += lastDay[i]
month += b - 1
answer = name[month % 7]
return answer
print(solution(5, 24))
| true |
bf017a72e918dffc3501f78c2f11cd1228d97211 | vivekbhr/myScripts | /samFilter_v3.py | UTF-8 | 6,408 | 2.65625 | 3 | [] | no_license | #!/usr/bin/env python
# author: Fidel Ramirez, Sarah Diehl
# date: 9.11.2013
# version 3: improved removal of multiple mapping reads by recommendations from Friederike:
# - early versions of bowtie2 (< 2.2.0) contained a bug that led to irregular and often faulty setting of the XS tag for paired-end data
# - the mere ... | true |
872bfb0dd6717878f680f69c5244219cbd74d8ed | PengMacro/Storage-Benchmarking | /MNIST/measure_loads.py | UTF-8 | 379 | 2.53125 | 3 | [] | no_license | import os
from timeit import default_timer as timer
import pickle
object_dir = "./mnist_objects"
start = timer()
i = 0
while i < 60000:
filename = "img" + str(i)
with open(os.path.join(object_dir, filename), 'rb') as file: # open spend 5s
ob = pickle.loads(file.read())
... | true |
1ad0662a508ae9f8a96b5e377306853373792496 | forgetbear/B_PYTHON_GIS | /PythonForArcGIS/SF_PFA2/ch18/script/daysELIF.py | UTF-8 | 707 | 4.15625 | 4 | [] | no_license | # daysELIF.py
# Purpose: Print day of the week based on input number.
# Usage: Integer between 0 and 4
import sys
code = int(sys.argv[1])
if code == 0:
day = 'Monday'
print 'Weekday: {0}'.format(day)
elif code == 1:
day = 'Tuesday'
print 'Weekday: {0}'.format(day)
elif code == 2:
day = 'Wednesday'
... | true |
03858061e9de117fef93c176fb5c3f3dd90faf11 | o34n22/hello | /mathplay/arithmetic/adding.py | UTF-8 | 358 | 2.921875 | 3 | [] | no_license | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Fri Aug 30 22:07:02 2019
@author: mig
"""
import random as rd
def pose():
"""
produces two numbers to be added together
"""
top = 10
increment = 0.1
a = rd.randint(0,top)
b = rd.randint(0,top)
return increment*a,increme... | true |
cb7242042360dc41e00733cc49b7d0256e0e11f5 | PiyushKumar186/programming | /basics.py | UTF-8 | 272 | 3.046875 | 3 | [
"MIT"
] | permissive | from Tkinter import *
master = Tk()
whatever_you_do = "Whatever you do will be insignificant, but it is very important that you do it.\n(Mahatma Gandhi)"
msg = Message(master, text = whatever_you_do)
msg.config(bg='lightgreen', font=('times', 24, 'bold'))
msg.pack()
mainloop()
| true |
329afde75ac9400b77c8ccc66c26aa8fbbb3d82b | jamsidedown/adventofcode2019 | /day_08/test_part_02.py | UTF-8 | 360 | 3.03125 | 3 | [] | no_license | import unittest
from part_01 import get_layers
from part_02 import flatten
class Part02Tests(unittest.TestCase):
def test_example(self):
image = [int(x) for x in '0222112222120000']
layers = get_layers(image, 2, 2)
flattened = flatten(layers)
expected = [[0, 1], [1, 0]]
se... | true |
c8a0c4976c8db0c6968058fbb1779e1856498c50 | marcelroed/face-aepca | /src/scraper/scrape.py | UTF-8 | 4,542 | 2.75 | 3 | [] | no_license | from calendar import monthrange, month_name
from bs4 import BeautifulSoup
import re
from bs4.element import Tag
from typing import *
from tqdm import tqdm
import cv2
import numpy as np
import aiohttp
import asyncio
import requests
event_loop = asyncio.get_event_loop()
DATASETS = ['famousbirthdays', 'ntnu']
def get_... | true |
36c4e551d6133e2041d9139d4c875b18e923ddd5 | wangzycloud/deep-learning-pytorch | /Unit1_Regression/PolynomialRegression.py | UTF-8 | 2,043 | 3.484375 | 3 | [] | no_license | import torch
import random
import torch.nn as nn
import torch.optim as optimize
from torch.autograd import Variable
import numpy as np
import matplotlib.pyplot as plt
def loadData(N):
dataX = []
for _ in range(N):
x = random.uniform(-1,1)*5
dataX.append(round(x,2))
dataY = []
for x in ... | true |
56a0fd8d50e289ee8dcc2dbd911fc4736579fd55 | smqh-smqh/lecture | /人工智能实践/fashion_mist.py | UTF-8 | 668 | 2.609375 | 3 | [] | no_license | # !/user/bin/env python
# coding:utf-8
# Author:wangyx
import tensorflow as tf
mnist=tf.keras.datasets.fashion_mnist
(x_train,y_train),(x_test,y_test)=mnist.load_data()
x_train,x_test=x_train/255.0,x_test/255.0
print(y_train[0],x_train[0])
model=tf.keras.models.Sequential([
tf.keras.layers.Flatten(inpu... | true |
35509d53fc06a486f0bb5280d065d752f98f074c | TNYCL/shipping_analizer | /api/trendyol.py | UTF-8 | 1,947 | 2.515625 | 3 | [] | no_license | from mechanize import Browser
import json
from bs4 import BeautifulSoup as bs
class site:
link = 'https://www.trendyol.com'
search_link = 'https://www.trendyol.com/sr?q={0}&qt={0}&st={0}&os=1'
json_product_link = 'https://public.trendyol.com/discovery-web-productgw-service/api/productRecommendation/{}?size... | true |
c3a5fccb158f9dffc75797947794da6719d5449d | Aasthaengg/IBMdataset | /Python_codes/p03426/s154630545.py | UTF-8 | 516 | 2.546875 | 3 | [] | no_license | h,w,d = map(int, input().split())
a=[list(map(int,input().split())) for i in range(h)]
q=int(input())
lr=[list(map(int,input().split())) for i in range(q)]
from collections import defaultdict
zahyo = defaultdict(list)
for i in range(h):
for j in range(w):
zahyo[a[i][j]-1] = [i,j]
rui=[0]*(h*w + 10)
for i... | true |
3d4e68f95b61bc0a2dbd31934fdba20ecf586586 | Aasthaengg/IBMdataset | /Python_codes/p03814/s343570855.py | UTF-8 | 251 | 3.4375 | 3 | [] | no_license | s = str(input())
a = 0
b = 0
for i in range(len(s)+1):
if s[i] == "A":
a = i+1
break
else:
pass
for i in reversed(range(len(s))):
if s[i] == "Z":
b = i+1
break
else:
pass
print(b - a + 1) | true |
53e214c413096fb2ce0c6c28f7f87875bbdab2d1 | SheikhRabiul/mining_bad_credit_card_accounts | /test/test3.py | UTF-8 | 872 | 2.890625 | 3 | [] | no_license | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Wed Aug 9 14:03:14 2017
@author: sheikh
"""
import pandas as pd
import numpy as np
df1 = pd.DataFrame([[1,2],[2,3],[3,4]], columns = ['account','bal'])
df2 = pd.DataFrame([[2,5],[3,6],[4,7]], columns = ['account','bal'])
df3 = df1.append(df2, ignore_inde... | true |
233e43ed80ce358aa951e5ee13a0d504ac43ff40 | danhagen/basketball | /AnimateTrajectory.py | UTF-8 | 8,680 | 3.578125 | 4 | [] | no_license | from numpy import sin, cos
import numpy as np
import matplotlib.pyplot as plt
import matplotlib.animation as animation
import pickle
class Spline:
"""
Initiate a class variable spline that has one break at x = x_break starting at x_initial and has
the equation y = a + b*(x-x_o) + c*(x-x_o)**2 + d*(x-x_o)**3.
... | true |
77533c580dc8f9cb0619e029109b49a0c5011a2a | ReemAladwani/100Daycode | /Week7/Day46,47.py | UTF-8 | 999 | 3.109375 | 3 | [] | no_license | Python 3.8.0b3 (v3.8.0b3:4336222407, Jul 29 2019, 09:46:03)
[Clang 6.0 (clang-600.0.57)] on darwin
Type "help", "copyright", "credits" or "license()" for more information.
>>> class Library:
def __init__(x,book,shelf)
SyntaxError: invalid syntax
>>> class Library:
def __init__(x,book,shelf):
x.book = 300
x.she... | true |
3840109ab2ec8cc75c3814b45c5a6ae987859a76 | fredhii/Python_Projects | /Database/fron.py | UTF-8 | 3,712 | 2.59375 | 3 | [
"MIT",
"Python-2.0"
] | permissive | from tkinter import *
import back
""" ======================================= """
""" LOGIC """
""" ======================================= """
""" selected_row = [] """
def get_selected_row(event):
global selected_row
index = list.curselection()[0]
selected_row = list.get(index)
e1.delete(0, END)
... | true |
6eef37e95b60b590a1496d34daec6459177d8157 | amkotsar-prog/PYTHON | /Lesson4Task5.py | UTF-8 | 161 | 2.953125 | 3 | [] | no_license | from functools import reduce
my_list = [el for el in range(100, 1001) if el % 2 == 0]
print(my_list)
result = reduce((lambda x,y : x*y), my_list)
print(result) | true |
8b30bfe8935860be657b6bae11016563e98362eb | ADITYA727/HeLp_for_ML | /junk/fuel_iocl_odometer_change.py | UTF-8 | 6,682 | 2.65625 | 3 | [] | no_license | """
Acocunt iocl data
"""
import os,sys
import pandas as pd
import tqdm
from datetime import datetime
path='/home/stealth/Desktop/fueldata/iocl1/'
"""
Index(['SNo.', ' Terminal ID', ' Merchant Name ', ' Location',
' Customer ID/Card PAN', ' Vehicle No.', ' Txn Date', ' Txn Type',
' Product', ' Cu... | true |
76c6757cc7df5e09229401113d04e7900d66633a | BinarySpoon/Machine-Learning | /Breast Cancer Prediction Model.py | UTF-8 | 2,540 | 3.140625 | 3 | [] | no_license | # libraries used -->
import numpy as np
import pandas as pd
from sklearn.datasets import load_breast_cancer
from sklearn.pipeline import make_pipeline
from sklearn.preprocessing import StandardScaler
from sklearn.metrics import precision_score
from sklearn.datasets import make_classification
from sklearn.model_selecti... | true |
da1aec1428db680418a45e7b717b8c06639d5f70 | todorovventsi/Software-Engineering | /Programming-Fundamentals-with-Python/functions-lab/01. Grades.py | UTF-8 | 437 | 4.03125 | 4 | [] | no_license | def convert_grade_to_text_grade(grade_as_num):
if 2 <= grade_as_num <= 2.99:
return "Fail"
elif 3 <= grade_as_num <= 3.49:
return "Poor"
elif 3.50 <= grade_as_num <= 4.49:
return "Good"
elif 4.50 <= grade_as_num <= 5.49:
return "Very Good"
elif 5.50 <= grade_as_num <=... | true |
43bf018ad8a3119d2034d41b8221292701c94384 | kookkig11/Python_Language | /testingnow.py | UTF-8 | 423 | 3.078125 | 3 | [] | no_license | area = input()
a1 = area.split('x')
m = int(a1[1]) * [0]
ls = []
for i in range(int(a1[0])):
ls.append(m)
i = i + 1
print(ls)
bomb = int(input())
lsPoint = []
i = 1
while i <= bomb:
point = input()
b1 = point.split(',')
lsPoint.append(b1)
i = i + 1
j = 0
while j < bomb:
x = int(lsPoin... | true |
e1d4ff9f23f796a4109f18b11cb3ea53dbcfb8f1 | daniel-reich/ubiquitous-fiesta | /9BJzrtpdMP8JFQg74_23.py | UTF-8 | 105 | 2.96875 | 3 | [] | no_license |
def twins(lst):
return [idx for idx, num in enumerate(lst) if sum(lst[:idx]) == sum(lst[idx:])][0]
| true |
93a165b24f06df488bca642497b4e2ebb942eab8 | jkfer/Codewars | /disemvowel.py | UTF-8 | 550 | 4.0625 | 4 | [] | no_license |
"""
Your task is to write a function that takes a string and return a new string with all vowels removed.
"""
def disemvowel(string):
vowels = list('aeiouAEIOU')
L = list(string)
for i, lett in enumerate(L):
if lett in vowels:
L.pop(i)
return ''.join(L)
def disemv... | true |
01ad87fb84d2052d101faf89f256b4de0a24410a | algebra-det/Python | /Interview codes/patterns_old.py | UTF-8 | 681 | 3.78125 | 4 | [] | no_license |
user_input = int(input("Enter the digit : "))
limit_of_digit = user_input
user_input *= user_input
line = 0
number = 0
for _ in range(user_input):
if line==0 or line==limit_of_digit-1:
print("0 ", end="")
number += 1
if number == limit_of_digit:
print()
... | true |
f335352f6fe6a674358d489a19adee6ce5ff0fdf | adefossez/music-demixing-challenge-starter-kit | /test_demucs.py | UTF-8 | 3,348 | 2.6875 | 3 | [
"MIT"
] | permissive | #!/usr/bin/env python
#
# This file uses Demucs for music source speration, trained on Musdb-HQ
# See https://github.com/facebookresearch/demucs for more information
# The model was trained with the following flags (see the Demucs repo)
# python run.py --channels=48 --musdb=PATH_TO_MUSDB_HQ --is_wav
# **For more inform... | true |
00ed9a6b8057d7d20911ad904a16850e4eab04cf | okeeffdp/ambari_client | /make_blueprint_index.py | UTF-8 | 1,034 | 2.546875 | 3 | [] | no_license |
"""
Make an index file for the blueprints
Converts each unique configuration to a number
"""
import itertools
settings = [("dfs.replication", "hdfs-site"),
("yarn.nodemanager.resource.memory-mb", "yarn-site"),
("yarn.scheduler.minimum-allocation-mb", "yarn-site"),
("hive.vectorize... | true |
82051782c53b67e52fdee49458b8a8ec5726294b | Nyajur/python-pill | /15-dictionaries.py | UTF-8 | 273 | 3.515625 | 4 | [] | no_license | dayconversions = {
"Sun": "Sunday",
"Mon": "Monday",
"Tue": "Tuesday",
3: "Wednesday",
"Thu":"Thursday",
"Fri": "Friday"
}
print(dayconversions["Sun"]) ## using bracket notation
print(dayconversions.get("Thur","not a valid key")) ## using the keyword get | true |
0284784c8f1c27a0996461ff05a1d11ba48d6abc | dovidgef/mobileye_interview | /mobileye.py | UTF-8 | 1,226 | 4.125 | 4 | [] | no_license | # Given a line of letters and spaces, split it to parts
# so that each part is no longer than 10 symbols,
# the words of 10 symbols and less are never split,
# and there are no unnecessary splits.
class SpecialString:
def __init__(self, string):
self.result = []
self.string_words = string.split()
... | true |
bd38d2cea3f10996e9cb516899350cc86e57e835 | oneSaber/guochuang | /App/Common/CommentCommon.py | UTF-8 | 3,714 | 2.578125 | 3 | [] | no_license | from App import db, cache
from App.Models.models import Comment, Account, MiniBlog
class Comments:
def __init__(self):
self.child_comment_count_cache = 'CHILD_COMMENT_COUNT'
self.blog_comment_count_cache = 'BLOG_COMMENT_cOUNT'
def send_comment(self, blog_id, author_id, parent_comment_id, com... | true |
e01454a0174058e7aaabbcd2cab7740b68718e66 | akshayak96/CS839_DataScience_Group26 | /stage2/code/imdb_wrapper.py | UTF-8 | 3,081 | 2.9375 | 3 | [] | no_license | from bs4 import BeautifulSoup
from requests import get
import pandas as pd
from time import sleep
from random import randint
from tqdm import tqdm
movies_whole = pd.DataFrame(
{'Title': [], 'Year_of_Release': [], 'Rating': [], 'Metascore': [], 'Vote': [], 'Description': []})
# Redeclaring the lists to store data ... | true |
6e26fd7798ab76a533f2470540434c13bc63f390 | andynet/protein_folding | /scripts/structure_realization_our/activation_functions.py | UTF-8 | 3,237 | 3.109375 | 3 | [] | no_license | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Thu May 28 13:42:11 2020
@author: tomasla
"""
# %%
import torch
import matplotlib.pyplot as plt
import numpy as np
from matplotlib import rc
font = {'size' : 12}
rc('font', **font)
# %%
x = torch.linspace(-3, 3, 300)
def hardtanh(x):
res = []
... | true |
61beb2262a520f95bc64cf2719dcf954024d006c | VermilionHail/BankOCR | /ocr.py | UTF-8 | 346 | 3.0625 | 3 | [] | no_license |
class OCR():
def __init__(self, file):
self.lines = self.read_lines(file)
def read_lines(self, file):
with open(file) as accounts:
lines = accounts.readlines()
#remove end of line characters
for i in range(len(lines)):
lines[i] = lines[i].replace('\n',... | true |
082ae74fda5727680a058843cc81b50264abc36f | vik-s/scikit-rf | /skrf/vi/__init__.py | UTF-8 | 6,590 | 3.015625 | 3 | [
"BSD-3-Clause"
] | permissive |
'''
.. module:: skrf.vi
========================================================
virtual instruments (:mod:`skrf.vi`)
========================================================
This module holds Virtual Instruments.
.. automodule:: skrf.vi.vna
.. automodule:: skrf.vi.sa
.. automodule:: skrf.vi.stages
Creating A ... | true |
49cd99d1d5cd5ee13c9520d9a3d20241ed897a47 | thisaripatabendi/sensei | /featureextraction/synonymes.py | UTF-8 | 1,028 | 2.96875 | 3 | [] | no_license | from nltk.corpus import wordnet as wn, stopwords
from nltk.stem.wordnet import WordNetLemmatizer
def getSynonymes(word):
synonyms = []
for syn in wn.synsets(word):
for l in syn.lemmas():
synonyms.append(l.name())
if word == 'assignment':
synonyms.append('coursework')
... | true |
ced8424aaa6e1e89c0b2c8eaa3e7e872179c23dc | Jumaglen/Practical-Network-Automation | /Chapter04/testscript1.py | UTF-8 | 98 | 2.5625 | 3 | [
"MIT"
] | permissive | print('Content-Type: text/html')
print('')
print("<font color='red'>Hello, <b>world!</b></font>")
| true |
ca1d8f9a4579fc3ff626659ce6e0657051a45044 | jerryweihuajing/Drone-Python | /ACTION_LIB/LAND.py | UTF-8 | 1,277 | 3.015625 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Fri Aug 16 16:06:35 2019
@title:ACTION_LIB-LAND
"""
import copy as cp
#------------------------------------------------------------------------------
"""
Drone takes off to height meters (default: 5)
Args:
which_drone: drone object which performs
ax: axes where drone i... | true |
b62c57123ef35d85da081f7027e9635fdbf948e0 | baiktte/APS | /D1/sw2068_최대수구하기.py | UTF-8 | 297 | 3.15625 | 3 | [] | no_license | import sys
sys.stdin = open("input2068.txt","r")
import math
T = int(input())
# 최댓값 출력
for test_case in range(1,T+1):
numbers= list(map(int, input().split()))
for number in numbers:
max_value = max(numbers)
print('#{} {}'.format(test_case, max_value))
| true |
173bded7a3242d15c309e904935a882e88c91368 | chompar4/vicmap-tiles | /aerial_vg/merge.py | UTF-8 | 6,947 | 2.71875 | 3 | [] | no_license | """Copy valid pixels from input files to an output file."""
import logging
import math
import warnings
import numpy as np
import rasterio
from rasterio import windows
from rasterio.transform import Affine
logger = logging.getLogger(__name__)
MERGE_METHODS = ('first', 'last', 'min', 'max')
def merge(datasets, bo... | true |
23d7e6535d12469c3971d96f0cd0a377d1831dd5 | sauln/pyjanitor | /tests/spark/functions/test_update_where_spark.py | UTF-8 | 2,649 | 2.578125 | 3 | [
"MIT"
] | permissive | import pytest
from pandas.testing import assert_frame_equal
from helpers import running_on_ci
if running_on_ci():
import pyspark
else:
pyspark = pytest.importorskip("pyspark")
import janitor.spark # noqa: F401 isort:skip
@pytest.mark.spark_functions
def test_update_where_string(dataframe, spark_dataframe):... | true |
e82933054c816751cafa0c9ed69d67560b75d4b5 | Awang1993/cp1404practicals | /Prac_01/shop_calculator.py | UTF-8 | 545 | 3.875 | 4 | [] | no_license | """
CP1404/CP5632 - Practical
Shop Calculator
"""
total_price = 0
discount_offer = .1
number_of_items = int(input("Number of items: "))
while number_of_items < 0:
print("Invalid number of items!")
number_of_items = int(input("Number of items: "))
for i in range(number_of_items):
item_cost = float(input("Pr... | true |
57d25630330096d42de75efb74d5218f5d3e37f2 | ridhi-thakker/pyinternship-askash | /day-5/sum-class.py | UTF-8 | 459 | 4.84375 | 5 | [] | no_license | # Create a class cal1 that will calculate sum of three numbers.
# Create setdata() method which has three parameters that contain numbers.
# Create display() method that will calculate sum and display sum.
class cal1:
def setdata(self, a, b, c):
self.a = a
self.b = b
self.c = c
... | true |
99b7bf134a7d7d518b1d9a9e73b9ab1c94954474 | prachi735/EPAI | /S7 Sequence/polygon.py | UTF-8 | 913 | 3.28125 | 3 | [] | no_license | from math import sin, cos, pi
class Polygon:
def __init__(self, nedges: int, circumradius: float) -> None:
self.nedges = nedges
self.vertices = nedges
self.circumradius = circumradius
self.interior_angle = (self.nedges-2) * (180/self.nedges)
self.edge_length = 2 * self.cir... | true |
a999f7dcf72343ab4cdf5d4a77c05d0b0f483482 | KobayagiNakamoto/codeInternational | /templates/python/es/text/code/firstKarel.py | UTF-8 | 359 | 2.59375 | 3 | [] | no_license | # Archivo: Primero Karel .py
# -----------------------------
# El programa Primero Karel define un " main "
# función con tres comandos. Estos comandos causan
# Karel a moverse hacia adelante un bloque, tome un cono
# y luego moverse hasta la siguiente esquina.
from karel.stanfordkarel import *
def main():
moverse(... | true |
a54e9182a9806d16eea96847bb009e652bd0175f | valeriacavalcanti/IP-2020.2---R | /semana_09/exemplo5.py | UTF-8 | 205 | 3.328125 | 3 | [] | no_license | lista1 = [1,2,3,4]
lista2 = [5,6,7,8]
lista3 = lista1 + lista2
lista4 = lista3[4:len(lista3)]
print(lista1, len(lista1))
print(lista2, len(lista2))
print(lista3, len(lista3))
print(lista4, len(lista4))
| true |
8eef5ed834af6209471bd8f64bf6d8c75bedd156 | cwdgit/aliyun-backup | /wordpress/lianxi/func_local.py | UTF-8 | 109 | 3.109375 | 3 | [] | no_license | def func(x):
print 'x is',x
x = 2
print 'changed local x to',x
x = 50
func(x)
print 'x is still', x
| true |
8e3726bbba263b60bca9b5f3cf4190eaba971567 | Juan-glitch/air-drawing | /python-stuff/data-wrangling/json-to-csv.py | UTF-8 | 432 | 2.734375 | 3 | [
"MIT"
] | permissive | import json
import pandas as pd
from os import listdir
txt_folder = "data/unlabeled_txt/"
csv_folder = "data/unlabeled_csv/"
for file in listdir(txt_folder):
with open(txt_folder+file) as f:
data = json.load(f)
x = []
y = []
for pt in data:
x.append(pt['x'])
... | true |
232b1bbd3f52e02a2aa59670e04ade96ea2f4002 | Skorpionmaf/PA | /anagram.py | UTF-8 | 1,176 | 3.3125 | 3 | [] | no_license | # Another type of problem
def words_dict_gen(path = '/usr/share/dict/words'):
f = open(path, "r")
words_dict = dict()
for l in f:
w = l.strip()
w_l = "".join( sorted(list(l.strip())) )
if w_l in words_dict.keys():
words_dict[w_l].append( w )
else:
wor... | true |
075cd89bda49999e0080a7614ae9c7ef8775c355 | hwp/hw2012ws | /BV1/ex4/src/removenoise.py | UTF-8 | 1,520 | 3.078125 | 3 | [] | no_license | #!/usr/bin/env python
from PIL import Image
R = 10
def isnoise(img, x, y) :
pv = img.getpixel((x, y))
greater = False
less = False
near = False
for i in (x - 1, x, x + 1) :
if i >= 0 and i < img.size[0] :
for j in (y - 1, y, y + 1) :
if j >= 0 and j < img.size[1] and not (i == x and j == y) :
if i... | true |
ea7a7deb32141cf79409d1e26f119f7f69a5639a | Yuqing-Liao/mcm-2021-d | /artist.py | UTF-8 | 7,664 | 2.734375 | 3 | [] | no_license | import collections
import numpy as np
from util import Excel
from heatmap import make_heatmap
import matplotlib.pyplot as plt
MAX_SPAN = 80
class Influence():
def __init__(self, p=0, e=0, t=0):
self.Persistency = p
self.Expandability = e
self.Transitivity = t
def cal(s... | true |
169dbed9639b92dbbbdd4d42f271733893987b9d | multeng/selenium | /SeleniumPart2/lesson2_step8.py | UTF-8 | 719 | 2.609375 | 3 | [] | no_license | import os
from selenium import webdriver
import time
link = "http://suninjuly.github.io/file_input.html"
current_dir = os.path.abspath(os.path.dirname(__file__))
file_path = os.path.join(current_dir, 'file.txt')
with webdriver.Chrome() as browser:
browser.get(link)
fname = browser.find_element_by_name("firs... | true |
40f1dc82e43baf7442ef6d0f64829527795fb447 | yanbinkang/problem-bank | /leetcode/math/python/powx_n_leetcode.py | UTF-8 | 1,252 | 4.09375 | 4 | [] | no_license | """
Implement pow(x, n).
time complexity: nLogn because we're dividing n / 2 at every step.
Algo:
Logarithmic, O(log n).
The recursive solution has O(logn) memory complexity as it will consume memory on the stack.
A simple algorithm of this problem is to multiply 'x' by 'n' times. The time complexity of this algor... | true |
ee443fcda19f2fd6e4167e9fca91439baddb32a0 | Leewongi0731/DailyCodeTest | /[백준 골드2] 17143번.py | UTF-8 | 1,673 | 2.9375 | 3 | [] | no_license | # 17143번: 낚시왕
import heapq
R, C, M = list( map(int, input().split()) )
graph = [ [ [] for i in range(C)] for i in range(R) ]
for _ in range(M):
r, c, s, d, z = list( map(int, input().split()) )
if d in [1,2]: s %= 2*(R-1) # ex) R이 5인데, 속도가 20으로 우측으로 이동한다면, 우측으로 초당 4로 이동하는 것과 같음
if d in [3,4]: s %= 2*(C-1)... | true |
d1b2cd99edbe00e889efd2475776fc35a5b907cc | fung1018139/Analysis-diffeq-code | /拡散方程式、波動方程式、ラプラス方程式の数値計算コード/拡散方程式/Biaseq1.py | UTF-8 | 855 | 2.90625 | 3 | [] | no_license | import numpy as np
import matplotlib.pyplot as plt
import math
from mpl_toolkits.mplot3d import Axes3D
fig = plt.figure()
ax = Axes3D(fig)
π=math.pi
#[1]格子を作る条件や刻みはば
M=10000
N=20
T=1
DELTA_X=(1/N)#1/N
DELTA_T=(T/M)#T/M
a=(DELTA_T)/((DELTA_X)**2)
if (a<=0.5):
print("stable")
#plotのための配列準備
#[2]
U=[[] for i in ra... | true |
8ecfa8a5ff15cd263c9436dee22fb9f6aea4c56b | sHalnes/advent_calender_knowit | /lukke_5.py | UTF-8 | 795 | 3.625 | 4 | [] | no_license | '''Vi beskriver en tallrekke på følgende måte:
Rekken inneholder positive heltall.
Neste tall i rekken er alltid større enn eller likt det foregående tallet, det minker aldri.
Verdien til tallet på n-te posisjon er antallet ganger n vil forekomme i rekken.
Rekken starter med a(1) = 1.
a(2) = 2
Sammen med de fem neste ... | true |
5fe1bda3f23f76dc36259372ed463290c9e61a29 | szgmwill/algorithm-learning | /leetcode-502-IPO-official-1.py | UTF-8 | 1,841 | 3.203125 | 3 | [] | no_license | from heapq import nlargest
from sys import maxsize
class Solution:
def findMaximizedCapital(self, k: int, W: int, Profits: [], Capital: []) -> int:
print("Need to loop %d times" % k)
print("The current capital is {}".format(W))
project_count = len(Profits)
# check all inputs are val... | true |
efd39b749b6b5b88db9430f050b6511a173fa04f | EnaSmoak/stream-processing | /src/enricher.py | UTF-8 | 1,965 | 3.296875 | 3 | [] | no_license | import geopandas as gpd
import numpy as np
import pandas as pd
from scipy.spatial import cKDTree
points = gpd.read_file('hotosm_gha_points_of_interest_points_shp/hotosm_gha_points_of_interest_points.shp')
def ckdnearest(gdA, gdB, k):
"""Quickly fine the k nearest points close to another
:param gdA: geop... | true |
36649270e229838e912e3d237434f3a5d455b756 | podhmo/individual-sandbox | /daily/20201221/example_python/prime/main.py | UTF-8 | 493 | 3.546875 | 4 | [] | no_license | import math
def is_prime(x: int) -> bool:
stop = math.floor(math.sqrt(x) + 1)
if x <= 1:
return False
for i in range(2, stop):
if x % i == 0:
return False
return True
def minimum_prime_number(X: int):
answer = 0
for i in range(X, (10 ** 14 + 32)):
if is_pr... | true |
41fe07d4708954cfdf49dd8e02199d0d096ddf2c | Juanito98/omegaUp-tcTool | /src/validators/graph.py | UTF-8 | 659 | 3.15625 | 3 | [] | no_license | from typing import Sequence
def noSelfLoop(U: Sequence[int], V: Sequence[int]) -> bool:
for i in range(len(U)):
if U[i] == V[i]:
return False
return True
def isConnected(n: int, U: Sequence[int], V: Sequence[int]) -> bool:
visited = [False] * n
adj = {i: [] for i in range(n)}
... | true |
df6ac334057ae93bb69a90a22e824c419642ef75 | pgupte-git/PythonHybridFramework | /TestData/ReadLoginData.py | UTF-8 | 835 | 3.0625 | 3 | [] | no_license | import pytest
from Utilities import XlsUtil
from Configurations.readProperties import ReadConfig
class ReadLoginData:
@staticmethod
def getlogindata():
Dict = {}
xls_path = ReadConfig.get_xls_file()
rows = XlsUtil.getrowcount(xls_path, 'LoginData')
columns = XlsUtil.getcolum... | true |
2fef0ab2c53a0ddba3dd522758636f559172bad8 | seiya-f/Python100days | /day1/hello.py | UTF-8 | 451 | 4.625 | 5 | [] | no_license | # このプログラムは挨拶を表示して名前と年齢を尋ねる
print('Hello World!') #
print('What is your name?') # 名前を尋ねる
my_name = input() #
print('It is good to meet you, ' + my_name) #
print('It length of your name is:') # 名前の長さを表示
print(len(my_name))
print('What is your age?') # 年齢を尋ねる
my_age = input()
print('You will be ' + str(int(my_age) + 1) +... | true |
0047d4044fa361a3650d47260af932732c9de2c1 | podhmo/individual-sandbox | /daily/20180819/example_inspect/01subclass.py | UTF-8 | 494 | 2.578125 | 3 | [] | no_license | import typing as t
import typing_extensions as tx
from collections.abc import Sequence
# print(t.Sequence, issubclass(t.Sequence[t.Any], Sequence))
print(vars(t.List[int]))
# {'_inst': False, '_special': False, '_name': 'List', '__origin__': <class 'list'>, '__args__': (<class 'int'>,), '__parameters__': (), '__slots_... | true |
8d273d020367500f585a75eb9fca5faa7f69d8bd | yaz/yaz | /yaz/parser.py | UTF-8 | 5,857 | 2.609375 | 3 | [
"MIT"
] | permissive | import argparse
import re
__all__ = ["Parser"]
class Parser(argparse.ArgumentParser):
"""Yaz specific ArgumentParser
Given a collection of yaz.tasks, an ArgumentParser is
constructed. This ArgumentParser will subsequently be
used to handle arguments from the command line.
"""
def __init__(... | true |
699500c097bd6cdc7259677ed4926207579c1a2b | acay08/nguyenminhque-fundamental-c4e16 | /section2/homework/3b-edited.py | UTF-8 | 220 | 3.796875 | 4 | [] | no_license | print()
a = 10
print('1 0 ' * int(a/2),end='')
print()
a = int(input("Enter the total number of 1's and 0's: "))
if a%2 == 0:
print('1 0 ' * int(a/2),end='')
else:
print('1 0 ' * int(a/2),end='')
print('1')
| true |
730ee1385fe81d036c6516c04416e006499325fe | keac/wiki | /PeiQi_Wiki/服务器应用漏洞/VMware/POC/VMware vCenter任意文件读取漏洞.py | UTF-8 | 2,263 | 2.734375 | 3 | [] | no_license | import requests
import sys
import random
import re
from requests.packages.urllib3.exceptions import InsecureRequestWarning
def title():
print('+------------------------------------------')
print('+ \033[34mPOC_Des: http://wiki.peiqi.tech \033[0m')
print('+ \033[... | true |
9097d3c1a9fddc789123b7def0ed0a9d6c453fc0 | Ocheretnuk/HOMEWORK | /task_average.py | UTF-8 | 134 | 3.546875 | 4 | [] | no_license | def average(lst):
sum = 0
for i in range(len(lst)):
sum = sum + lst[i]
avr = round(sum/len(lst),3)
return avr | true |
7d51841816fdd23c6410dc3048c3c64529f55869 | limkokholefork/SPARTA | /spar_python/data_generation/generated_row.py | UTF-8 | 1,460 | 2.6875 | 3 | [
"BSD-2-Clause",
"BSD-3-Clause"
] | permissive | # *****************************************************************
# Copyright 2013 MIT Lincoln Laboratory
# Project: SPAR
# Authors: jch
# Description: A class for the row generated by data_generator_engine
#
# Modifications:
# Date Name Modification
# ---- ... | true |
c3036b76fc9f39515954ce07ca9436c85b1a9371 | maknetaRo/python-katas-with-test | /test_final_grade.py | UTF-8 | 477 | 3.078125 | 3 | [] | no_license | import unittest
from f_grade import final_grade
class TestCalculateFinalGrade(unittest.TestCase):
def test_final_grade(self):
self.assertTrue(final_grade(100, 12), 100)
self.assertTrue(final_grade(99, 0), 100)
self.assertTrue(final_grade(10, 15), 100)
self.assertTrue(final_grade(8... | true |
35b786643a642880186d2095aa82ef77dfa7c01c | Brucenord92/Primeras-practicas-Python | /Entrada_de_datos.py | UTF-8 | 353 | 4 | 4 | [] | no_license | palabra = input("Introduce una palabra: ")
num_int = int(input("Introduce un numero entero: "))
num_float = float(input("Introduce un numero flotante: "))
num_complex = complex(input("Introduce un numero complejo: "))
print("string: ", palabra,)
print("Entero ", num_int)
print("Flotante: ", num_float)
print("N... | true |
1a27f0c3ff35a4ee50b2c9f111383cf338988bb1 | FinTrek/Download_Crypto_Currencies_Data | /dccd/histo_dl/poloniex.py | UTF-8 | 3,716 | 3.03125 | 3 | [
"MIT"
] | permissive | #!/usr/bin/env python3
# coding: utf-8
# @Author: ArthurBernard
# @Email: arthur.bernard.92@gmail.com
# @Date: 2019-03-26 10:42:57
# @Last modified by: ArthurBernard
# @Last modified time: 2019-09-03 22:05:18
""" Objects to download historical data from Poloniex exchange.
.. currentmodule:: dccd.histo_dl.poloniex
..... | true |
6daa614a45590e45c6f2b782c93ba1f8416927b0 | ogomezr/concept-drift-library | /conceptdrift/cases/case3.py | UTF-8 | 2,484 | 2.734375 | 3 | [
"MIT"
] | permissive | import time
import numpy as np
import pandas as pd
import seaborn as sns
import matplotlib.pyplot as plt
import conceptdrift.alg.AdaptativeChange as ac
from conceptdrift.gen.gen import genDataLine, genDataPol
## Caso 3 Tipo Gradual - Cambio de forma.
if __name__ == "__main__":
print('Caso 3 Tipo Gradual - Cambio d... | true |
7993961977771c9e6c7471dd3424b531451591c6 | Jinx-Heniux/Python-2 | /maths/tower_of_hanio.py | UTF-8 | 1,132 | 3.515625 | 4 | [
"Apache-2.0"
] | permissive | """
https://en.wikipedia.org/wiki/Tower_of_Hanoi
"""
def move(number_of_tower: int, a_place: str, b_place: str, c_place: str) -> None:
"""
>>> move(0, "A", "B", "C")
>>> move(1, "A", "B", "C")
move from A to B
>>> move(2, "A", "B", "C")
move from A to C
move from A to B
move from C to ... | true |
378b233f97173bf4db71309ac52b00ef1bc2e410 | priyankapothala/CS226BigData | /spark/parks_lakes.py | UTF-8 | 3,053 | 2.5625 | 3 | [] | no_license | #!/usr/bin/env python
# coding: utf-8
# In[1]:
import shapely
import pyspark
from pyspark.sql import SparkSession
spark = SparkSession.builder.appName("Qol").getOrCreate()
# In[3]:
import geopandas as gpd
from geospark.register import upload_jars
from geospark.register import GeoSparkRegistrator
upload_jars()
G... | true |
63892b766e4f2a7d8d248b494e223b80908c73ff | jonatasgrosman/findpapers | /findpapers/searchers/scopus_searcher.py | UTF-8 | 14,190 | 2.5625 | 3 | [
"MIT"
] | permissive | import requests
import datetime
import logging
import re
from lxml import html
from typing import Optional
import findpapers.utils.common_util as common_util
import findpapers.utils.query_util as query_util
from findpapers.models.search import Search
from findpapers.models.paper import Paper
from findpapers.models.publ... | true |
7d5dcb53a94ef26be6fdddf228d05cf71f326f76 | mitodl/mitx-grading-library | /mitxgraders/formulagrader/matrixgrader.py | UTF-8 | 9,415 | 2.65625 | 3 | [
"BSD-3-Clause"
] | permissive | """
matrixgrader.py
Defines a FormulaGrader subtype that handles matrices, too.
"""
from __future__ import print_function, division, absolute_import, unicode_literals
from numbers import Number
from collections import namedtuple
import six
from voluptuous import Required, Any, Range, All, Optional
from mitxgraders.ex... | true |
f2565412443c6912a771d7f78d5ba444c88c257b | neophack/ESP32-platform-firmware-new | /firmware/python_modules/campzone2020/touchpads.py | UTF-8 | 1,290 | 2.671875 | 3 | [] | no_license | import touchbuttons
## TODO: look up correct value for each buttons
LEFT = 128
RIGHT = 256
HOME = 512
CANCEL = 64
OK = 16
wildcard_handlers = []
touchpad_handlers = {LEFT: None, RIGHT: None, HOME: None, CANCEL: None, OK: None}
touchpad_state = {LEFT: False, RIGHT: False, HOME: False, CANCEL: False, OK: False}
def on... | true |
2fdb152bb5fdd730d6d650ecf1cd8338077ca9a5 | mariano-dim/ProyectoX | /src/exceptions/exceptions.py | UTF-8 | 207 | 2.734375 | 3 | [
"MIT"
] | permissive | #!/usr/bin/python
#
# Proyecto X
# variableDeclaration.py
#
# Creato el 15/09/2019
# Mariano Andres Di Maggio <mariano.dim@gmail.com>
#
class EndOfExpressionException(Exception):
pass
class SyntaxException(Exception):
pass
| true |
ef38238b84496eca09c39408298bdeddea244d66 | rishavmedhi/zomato-module | /retrieval_final.py | UTF-8 | 3,349 | 2.796875 | 3 | [] | no_license | #retreival code for the zomato module
'''list of queries handled
#(restaurant name) restaurant in (city-name)
#phone no/contact no of (restaurant name) restaurant (location+searching)
#restaurants near me
#food places near me
#places to eat near me
#where is food-place restaurant in place-name'''
#using mongo ... | true |
1a4cd9275c68a1fcf05da88f67e2d87d5b5a421c | omoniyi21/python-brokeh-graphs-cs8 | /src/graph.py | UTF-8 | 1,293 | 2.703125 | 3 | [] | no_license | import math
from bokeh.io import show, output_file
from bokeh.plotting import figure
from bokeh.models import GraphRenderer, StaticLayoutProvider, Oval
from bokeh.palettes import Spectral8
from old import *
old_data = Graph()
old_data.debug_create_test_data()
print(old_data.vertexes)
N = 10
node_indices = list(rang... | true |
1b5f414fa0be07775a9a684ff29bfac640031c06 | SeedlingsBabylab/subjfile_duplicates | /py_scripts/compare_hash.py | UTF-8 | 2,012 | 2.546875 | 3 | [] | no_license | import os
import sys
import json
hash_dict = {}
result_dir = "./"
def read_file(path):
with open(path, 'rb') as f:
for file in f.readlines():
[file, hash] = file.replace("\n", "").rsplit(",", 1)
if hash in hash_dict:
hash_dict[hash].append(file)
else:
... | true |
37883dac38bce3cb5af528fa132f25cbbf7ceee4 | Moltenfire/AdventOfCode2018 | /23b.py | UTF-8 | 2,865 | 2.890625 | 3 | [] | no_license | import collections
import itertools
import helper
import re
import math
file = "23.txt"
# file = "input_23.txt"
values = list(map(lambda x : list(map(int, re.findall("-?\d+", x))), helper.load_in_list(file, str)))#
def calc_dist(a,b):
return abs(a[0] - b[0]) + abs(a[1] - b[1]) + abs(a[2] - b[2])
d... | true |
3efd4ad2d9c0d50cc8a440222efde80be1eefdd3 | imfm22/fmcode | /python/utils/ListNode.py | UTF-8 | 726 | 3.78125 | 4 | [] | no_license | class ListNode:
"""简单链表"""
def __init__(self, val: int):
self.val = val
self.next = None
@staticmethod
def from_str(s: str):
"""解析使用空格分隔的字符串"""
node_vals = s.split(" ")
head = ListNode(None)
ptr = head
for v in node_vals:
ptr.next = Li... | true |
e75c7c09bc712749dadddc9124a2558f21c7d8ed | zhyrao/udacity_selfdriving | /Semester I/2. Finding Lane Lines on the Road/6.Combining Color and Region Selections.py | UTF-8 | 1,975 | 3.265625 | 3 | [] | no_license | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Date : 2018-03-22
# @Author : Joe
import matplotlib.pyplot as plt
import matplotlib.image as mpimg
import numpy as np
# read the image
image = mpimg.imread('test.png')
# get the x and y size and make two copies of the image
# one copy we'll extract only the pixel... | true |
9ad7c44ec4c4ad483b8e987799cfaefcdeb7da57 | kaungsgit/parallel_python | /gui_test/mp1.py | UTF-8 | 487 | 2.71875 | 3 | [] | no_license | from multiprocessing import Process, Pipe
# what you're doing here can be done using sockets as well.
# but, https://docs.python.org/3/library/multiprocessing.html#:~:text=Usually%20message%20passing shows how you can
# do it using multiprocessing module.
# also this link. https://www.youtube.com/watch?v=IynV6Y80vws&... | true |
c18965227f1d880ee601c05301918403a5230ab1 | perfectswpuboy1/DIE | /DIE/Lib/DebugValue.py | UTF-8 | 12,225 | 2.640625 | 3 | [
"MIT"
] | permissive | import sark
from DIE.Lib import DieConfig, DataParser
import idaapi
from idc import *
from DIE.Lib.IDATypeWrapers import Array, Struct
from DIE.Lib.IDAConnector import get_adrs_mem
import logging
from DIE.Lib.ParsedValue import ParsedValue, MAX_SCORE
MEM_VAL = 0x01 # Memory based value
REG_VAL = 0x02 # Register bas... | true |
2370eeb6757469831af188ae5c9f4a241c57ab05 | fabiochiusano/SymbolicRegressionPy | /symreg/tree.py | UTF-8 | 2,804 | 3.609375 | 4 | [
"MIT"
] | permissive | import math
import generator as gtr
class Tree(object):
def __init__(self):
pass
class Leaf(Tree):
def __init__(self):
pass
def height(self):
""" The height of a leaf is always 1 """
return 1
def numOfNodes(self):
""" Returns the number of nodes, both internal
and leaves, of the subtree with this ... | true |
8d350c1f43979fedcd7d36b16c6de85bd34391b6 | pengyuhou/git_test1 | /leetcode/面试题61. 扑克牌中的顺子.py | UTF-8 | 689 | 3.0625 | 3 | [] | no_license | class Solution(object):
def isStraight(self, nums):
if nums == []:
return False
count = 0
res = [i for i in nums if i!=0 ]
count =0
for i in nums:
if i==0:
count += 1
res.sort()
l = len(res)
if l==0 or l==1:
... | true |