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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
01aaebf9eff735a8beb710f7ed8da9fd5af5b10f | Python | tomergill/DL_ass3 | /part_3_model.py | UTF-8 | 15,175 | 3.28125 | 3 | [] | no_license | import numpy as np
import dynet as dy
import itertools
import pickle
class AbstractNet:
"""
Class for an abstract neural network for part 3.
Holds 2 biLSTMs (2 builders for each, one for each direction), an embedding matrix and a
MLP with 1 hidden layer.
All subclasses needs to implement the repr ... | true |
6c24cd414a113f9aa14a4c753fe15e9a47c5a548 | Python | tahmad08/AutomateTheBoringStuffPractice | /Textbook Code/shoe_size.py | UTF-8 | 1,747 | 3.953125 | 4 | [] | no_license | #shoe size trick
from datetime import datetime
def shoe_trick():
print("we'll use your shoe size to tell your age\n"
+ "what is your shoe size?")
sz = input()
while not(sz):
print("enter a value for your shoe size: ")
sz = input()
rsz = sz
if (str(rsz))[-2:] == ".5":
... | true |
534258ed5ab26c7782cc3b6b0cd8d53db2e6453b | Python | ivanferreirajr/sad-pasa | /src/database.py | UTF-8 | 2,511 | 2.859375 | 3 | [
"MIT"
] | permissive | import psycopg2 as db
import psycopg2.extras as extras
import os
from os.path import join, dirname
from dotenv import load_dotenv
dotenv_path = join(dirname(__file__), '..', '.env')
load_dotenv(dotenv_path)
DB_HOST = os.environ.get("DB_HOST")
DB_DATABASE = os.environ.get("DB_DATABASE")
DB_USER = os.environ.get("DB_US... | true |
fecd995109c70b709fb358f83e327d1efc1c9e79 | Python | Green0v0/TIL | /Prgrms/Prgrms-ct-py4/Hint.py | UTF-8 | 3,618 | 3.671875 | 4 | [] | no_license | # 힌트를 참고하여 코드 작성
def solution(seat):
answer = -1
# [실행] 버튼을 누르면 출력 값을 볼 수 있습니다.
print('Hello Python')
return answer
# 가장 긴 팰린드롬
def solution(s):
p = 0
for i in range(len(s)):
if s[i - p:i + 1] == s[i - p:i + 1][::-1]:
p += 1
elif i - p > 0 and s[i ... | true |
41dd594b2805c18a03d74ee13bc5f98fa352bf18 | Python | CodeValue/Pylab | /03. Lists/01. Lists.py | UTF-8 | 4,399 | 4.5 | 4 | [] | no_license |
# Define a list
#-----------------
# Empty list
lecturers = []
# Populated list
lecturers = ["Ori", "Haim", "Omer", "Maor", "Hagai"]
# List can hold items from different types
items = ["Hello", 3.14, True, ("23", -13), None]
# Indexing in lists
#-------------------
lecturers = ["Ori", "Haim", "Omer... | true |
b35190a50b7a815a384d90d9d34d8480febdd421 | Python | kimyeee/Video | /lagou/cloud.py | UTF-8 | 1,871 | 2.84375 | 3 | [] | no_license | import random
from PIL import Image
from sqlalchemy import create_engine
from sqlalchemy.orm import sessionmaker
import numpy as np
from os import path
import matplotlib.pyplot as plt
from wordcloud import WordCloud, STOPWORDS, ImageColorGenerator, random_color_func
from lagou.models import Comment, Lagou
engine = cre... | true |
214f75253c19099edfdb972ee361c8914af5a6ec | Python | looper123/python-quickstart | /com/quark/quick/start/JsonAnaylyis.py | UTF-8 | 2,272 | 3.4375 | 3 | [] | no_license | # json类型与各个类型间的转换
import json
# convert dic to json and repalce
import time
# %y 两位数的年份表示(00-99)
# %Y 四位数的年份表示(000-9999)
# %m 月份(01-12)
# %d 月内中的一天(0-31)
# %H 24小时制小时数(0-23)
# %I 12小时制小时数(01-12)
# %M 分钟数(00=59)
# %S 秒(00-59)
# %a 本地简化星期名称
# %A 本地完整星期名称
# %b 本地简化的月份名称
# %B 本地完整的月份名称
# %c 本地相应的日期表示和时间表示
# %j 年内的一天(001... | true |
52d36e7f42c80e28420abc427f1fb55052516848 | Python | mvattuone/pee-wee-hermann-hesse | /get_quotes.py | UTF-8 | 1,600 | 3.140625 | 3 | [] | no_license | #!/usr/bin/env python
# -*- coding: utf8 -*-
from bs4 import BeautifulSoup
import requests
import re
hh_page = requests.get("https://www.goodreads.com/author/quotes/1113469.Hermann_Hesse")
hh_soup = BeautifulSoup(hh_page.text, 'html.parser')
hh_quotes = hh_soup.find_all("div", class_="quoteText")
new_hh_quotes =... | true |
d67265eb684df470937a013db2d0eb6dc8a2c369 | Python | ycs1m1yk/LoLHighlighter | /flask/audio_test.py | UTF-8 | 3,227 | 2.78125 | 3 | [
"MIT"
] | permissive | import librosa
import numpy as np
import warnings
import sys
def audio_test(directory, game_start_time, game_end_time):
warnings.filterwarnings("ignore")
try:
print("Now Extracting H/L Time-Line")
reSampleRate = 5500
offset = game_start_time
duration = 360
total_time = ... | true |
223f63f17e271a0c05f49d9504408c2c99eb98b7 | Python | pedroalpacheco/100DaysOfCode | /028/uri1002.py | UTF-8 | 754 | 4.25 | 4 | [] | no_license | """
https://www.urionlinejudge.com.br/judge/en/problems/view/1002
The formula to calculate the area of a circumference
is defined as A = π . R2. Considering to this problem
that π = 3.14159:
Calculate the area using the formula given in the
problem description.
Input
The input contains a value of floating point
(do... | true |
f61534c5085ade1d9cf0d0b360c63ad331ba5d72 | Python | ndparker/rjsmin | /tests/test_issue17.py | UTF-8 | 7,990 | 2.53125 | 3 | [
"Apache-2.0"
] | permissive | # -*- coding: ascii -*-
u"""
:Copyright:
Copyright 2019 - 2022
Andr\xe9 Malo or his licensors, as applicable
:License:
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.... | true |
43af3c6dcd3f882cce20e690f57fdb634d13e766 | Python | mdifatta/Hand-Tracking | /source/library/neural_network/keras/custom_layers/abs.py | UTF-8 | 956 | 2.796875 | 3 | [] | no_license | from keras.engine.topology import Layer
from keras import backend as K
class Abs(Layer):
def __init__(self, **kwargs):
super(Abs, self).__init__(**kwargs)
def build(self, input_shape):
super(Abs, self).build(input_shape)
def call(self, x, mask=None):
return K.abs(x)
def comp... | true |
2f3780854eeb976902011f332e22a56689f32668 | Python | eartharmstrong/Challenge | /Ch14_Challenge-2.py | UTF-8 | 185 | 3.515625 | 4 | [] | no_license | class Square:
def __init__(self, m):
self.m = m
def __repr__(self):
return "{} by {} by {}".format(self.m, self.m, self.m)
no1 = Square(10)
print(no1)
| true |
899f7e56e1b81578fabff5ce153b19695b089ce4 | Python | maikia/StrokeUNET | /brats/preprocess.py | UTF-8 | 27,609 | 2.546875 | 3 | [
"MIT"
] | permissive | """
Tools for converting, normalizing, and fixing the T1 brain scans and
corresponding lesion data.
"""
import os
import shutil
import subprocess
import warnings
from joblib import Memory, Parallel, delayed
import matplotlib.pylab as plt
from nibabel.filebasedimages import ImageFileError
from nilearn import plotting
f... | true |
4d3e2056bd7fcadcc761dbcb7dfd90a11679f0ca | Python | adriaant/calmpy | /simulator/tools.py | UTF-8 | 7,318 | 2.765625 | 3 | [] | no_license | # -*-*- encoding: utf-8 -*-*-
# pylint: disable=E1101
from __future__ import absolute_import, unicode_literals, division
import logging
import numpy as np
from matplotlib import pyplot as plt
from matplotlib import colors
from matplotlib import cm
from mpl_toolkits.mplot3d import Axes3D # noqa
from django.utils.six.mo... | true |
2cd0d6c8b1a9a22b9897e8370642931ab1ff659e | Python | gulup/BotW-SBFRES-to-FBX | /bfresextraction/MultiPartModelCombiner.py | UTF-8 | 935 | 3.0625 | 3 | [] | no_license | import os, shutil
def findAndCombineMultipartModels():
# Checks for an ending like -00, -01, -02, etc.
def isMultipartFolder(folderPath: str):
for i in range(0, 99):
if i < 10:
return folderPath.endswith("-0" + str(i))
else:
return folderPath.end... | true |
8f9a78023a22ce4d1a80bb70c3963e1c9ebb509f | Python | Valkyrja3607/AtCoder | /atcoder.jp/abc059/abc059_a/Main.py | UTF-8 | 108 | 2.9375 | 3 | [] | no_license | a,b,c=input().split()
ans=""
ans+=chr(ord(a[0])-32)
ans+=chr(ord(b[0])-32)
ans+=chr(ord(c[0])-32)
print(ans) | true |
c123e193821adb6c0d9d9b5498d7bd0ebc2b0e2b | Python | Godgaojiafu88/AID2006 | /game2048/game2048.py | UTF-8 | 2,122 | 3.578125 | 4 | [] | no_license | map = [
[2, 0, 0, 2],
[4, 2, 0, 2],
[2, 4, 2, 4],
[0, 4, 0, 4],
]
list_merge=[]
class Game2048Viem:
def __init__(self):
self.controller=Game2048Controller()
def __display_menu(self):
for i in range(len(map)):
print(map[i])
def print_direction(self):
d... | true |
4fc1bbc371f6d9ae96de7fff474d757ab92e72cb | Python | ConJov/NZJ-Repository | /Task 1 - NZJ.py | UTF-8 | 248 | 3.140625 | 3 | [] | no_license | """Task 1 - N Z J"""
Sessions_Attended = {'sessions' : '1011,2344,3222,44322,555,6332,721,8789,99,1011,1124,1245,137,1499'}
n = Sessions_Attended['sessions']
n = n.split(",")
print("I have attended : ", len(n), "sessions")
| true |
301f10f8dba742fddcf5140744745a3a094405a0 | Python | premanshum/pythonWorks | /aFolder/Theory/Datastructure.py | UTF-8 | 5,125 | 4.125 | 4 | [] | no_license | '''
collections:
- str
- list
- dict
- tuple
- range
- set
1. str
- Immutable sequence of homogeneous unicode codepoints (characters)
- Single quote and double quote
- "first" "second" => "firstsecond"
- help(str) => to get a list of functions on str
- ... | true |
fd4968b2297fc6ba3fbf70c69f4939a72acb22ec | Python | asiya00/Exercism | /python/protein-translation/protein_translation.py | UTF-8 | 556 | 3 | 3 | [] | no_license | def proteins(strand):
di = {"Methionine": "AUG","Phenylalanine": ("UUU","UUC"), "Leucine": ("UUA","UUG"), "Serine": ("UCU", "UCC", "UCA", "UCG"), "Tyrosine": ("UAU", "UAC"), "Cysteine": ("UGU", "UGC"), "Tryptophan": "UGG", "STOP": ("UAA", "UAG", "UGA")}
li = []
for i in range(0,len(strand),3):
codon... | true |
a8ac5659092b88c631019dc20fbd091fed40724c | Python | bs-lab/pegboard_slide_python | /plotting.py | UTF-8 | 2,868 | 2.890625 | 3 | [] | no_license | import sys
import matplotlib.pyplot as plt
import matplotlib.animation as animation
from math import cos, sin, pi
# constants
DEBUG = False
# --------------------------------------------------------------------------------------------------
def make_circle_points(center: list, radius: float) -> tuple:
"""only us... | true |
77fa9bcf5bdcc867cc3cb735a3af909fdc73fad0 | Python | MatthewNeu/SFARI | /remove_footer.py | UTF-8 | 1,058 | 2.71875 | 3 | [] | no_license | #!/usr/bin/python
import sys, re
from sys import argv
import os
################################
# Matthew Neu
# Aug 9 2016
# This script removes all commented lines from the bottom of a VCF file,
# then creates a new file with "footerless" appended to name.
#
# to run: remove_footer.py <filename.vcf>
##############... | true |
d6cb420620b1f2735311f8d4057fb0620c8a8c8b | Python | AAAEEEE/conceptual_img_ref | /src/models/listener_population.py | UTF-8 | 6,748 | 2.640625 | 3 | [] | no_license | import torch
import torch.nn as nn
from torch.distributions.bernoulli import Bernoulli
from torch.distributions.normal import Normal
import numpy as np
import pickle
class ListenerPopulation(nn.Module):
def __init__(self, n_clusters, n_attributes, n_corrupt, n_agents,
def_epsilon, corr_epsilon, ... | true |
450006b6a662e91a12deab4247006c204ee612d1 | Python | FlMondon/forecast_SN_GW | /forecast_SN_GW/math_toolbox.py | UTF-8 | 1,093 | 3.03125 | 3 | [] | no_license | """ Math toolbox, that include all the usefull tools."""
import numpy as np
def comp_rms(residuals, dof, err=True, variance=None):
"""
Compute the RMS or WRMS of a given distribution.
:param 1D-array residuals: the residuals of the fit.
:param int dof: the number of degree of freedom of the fit.
... | true |
7950b3ce4156848892827c6f6d5fdd35b74334ae | Python | ccena/Learning-Basic-Python | /Chapter 3 Data Manipulation with Pandas/3.11.2 Pandas Time Series Data Structures.py | UTF-8 | 1,577 | 4.09375 | 4 | [] | no_license | # -*- coding: utf-8 -*-
"""
For time stamps, Pandas provides the Timestamp type.
For time periods, Pandas provides the Period type.
For time deltas or durations, Pandas provides the Timedelta type.
Timestamp and DatetimeIndex objects are invoked by using the pd.to_datetime()
function, which can parse a wide vari... | true |
0ee321eb98ca24af47d9b844c283e8cc6422cdce | Python | Fernweh-8/dla_Mai | /wishes.py | UTF-8 | 743 | 3.78125 | 4 | [] | no_license | def add_best_wishes(filename, name, wishes_num):
with open(filename, 'a+') as wish_list:
for num in range(wishes_num):
wish = input(f'{name}, czego życzysz Mai?\n')
wish_list.writelines(wish)
wish_list.write("\n")
def get_best_wishes(filename):
with open(file... | true |
dff15da9368c9d4c5c6f32f335ad7160cbd2fe2b | Python | false-git/maildir2thunderbird | /maildir2thunderbird.py | UTF-8 | 1,027 | 2.578125 | 3 | [] | no_license | import sys
import pathlib
import shutil
import imap_tools
# 実行する前にやることを見たいときはTrueにする
DRY_RUN = False
if __name__ == "__main__":
args = sys.argv
if len(args) < 2:
print("Usage: {} maildir".format(args[0]))
exit(1)
maildir = pathlib.Path(args[1]).absolute()
name = maildir.name
subdir... | true |
a6fbfe544d019b51d64667f8d258d49ed8d7466e | Python | emresevilgen/IE400_Project | /partB.py | UTF-8 | 1,895 | 2.984375 | 3 | [] | no_license | import pulp as pl
import pandas as pd
import numpy as np
def read_data(filepath):
d = pd.read_excel(filepath, 'd', header=None)
p = pd.read_excel(filepath, 'p', header=None)
return d, p
number_of_centers = 4
prob_treshold = 0.6
# Read data
d_i_j = read_data("data.xlsx")[0]
p_i_j = read_data("data.xlsx"... | true |
b19cfed81fe439dd4c54954672fff0e1df788548 | Python | FritzHeiden/sesu-beleg | /analyse/min_hasher.py | UTF-8 | 1,270 | 2.515625 | 3 | [] | no_license | from data.signature import Signature
import numpy as np
class MinHasher:
#nicht getestet - läuft wahrscheinlich nicht
@staticmethod
def generate_min_hash(shingles, hash_functions):
#np.asarray(shingles)
# min hash dict
#min_hash = []
strep_id = 1
strep_size = 10
... | true |
fdb438f24b36af68ec0cd76443e82a17fa1fff7d | Python | irfhanaz/ComputerNetworksLab | /tcpdate-timeclient.py | UTF-8 | 211 | 2.640625 | 3 | [] | no_license | #date time client
import socket
client = socket.socket()
host = socket.gethostname()
port = 6666
client.connect((host, port))
message = client.recv(1024)
print ("Current Time: ", message.decode())
client.close() | true |
bc7a675f8a0d2b03fd79567f878ebb9c00213a3c | Python | halisyilboga1/NeuralStyle-Music | /filter_music.py | UTF-8 | 4,184 | 2.765625 | 3 | [] | no_license | # script to run a frequency analysis on given audio file to determine strength in different passbands
import numpy as np
import matplotlib.pyplot as pyplt
import scipy.io.wavfile as wav
import scipy.signal as signal
def analyze(finname, pps, cutlow, cuthigh, foutname):
Fs, arr = wav.read(finname)
dt = 1.0 / Fs... | true |
99fc3bd5c4ba3025eadc8797d09e070f9e032598 | Python | Ahtaxam/Python_Programms | /cutting_str.py | UTF-8 | 623 | 4.3125 | 4 | [] | no_license | # Write a program that asks the user to enter a word that contains the letter a. The program
# should then print the following two lines: On the first line should be the part of the string up
# to and including the first a, and on the second line should be the rest of the string. Sample
# output is shown below:
# Ent... | true |
21aefe5d4ce6c00a5f005021d68686ab594f998a | Python | loganzartman/termiformer | /demo.py | UTF-8 | 1,276 | 3.5625 | 4 | [] | no_license | import termiformer
def input_name_simple():
data = {}
with termiformer.form(data) as f:
f.label("Name Input Form")
f.text("first_name", label="First name")
f.text("last_name", label="Last name")
return "{} {}".format(data["first_name"], data["last_name"])
# functionally the same as... | true |
b3411c5ff47d3bb085d31eab406b160f03913d09 | Python | marcosllessa/teste_git | /projeto v1/simuladorNFe_v1.py | UTF-8 | 3,481 | 2.6875 | 3 | [] | no_license | import xml.etree.ElementTree as ET
from random import randint
import random
import connection
'''GERA CNPJ ALEATÓRIO PARA EMISSOR E DESTINATARIO'''
def cnpj(self, punctuation = False):
n = [random.randrange(10) for i in range(8)] + [0, 0, 0, 1]
v = [2, 3, 4, 5, 6, 7, 8, 9, 2, 3, 4, 5, 6]
# calcula dígito... | true |
dbf81b9aef35e58f262b02006d7308e316d4cc28 | Python | abhilash1998/BFS_exploration_and_path_planning | /exploration_r.py | UTF-8 | 25,119 | 3.078125 | 3 | [] | no_license | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Thu Mar 4 12:56:40 2021
@author: abhi
"""
import numpy as np
import cv2
class exploration_r:
def __init__(self,start,goal):
"""
Intializes variables for the class. Stores the goal state and
start state
... | true |
80df912f509275d698356e0cfe30afc9dc1bba0e | Python | jswinther/dtu-beng-computer-engineering-projects | /intro-to-machine-learning-projects/Machine_Learning_EksamenScripts-master/ImpurityGain.py | UTF-8 | 2,043 | 3 | 3 | [] | no_license | from massImport import *
# Number of observations belonging to each class.
n = [263, 359, 358]
######################################
# Change this matrix.
InputMatrix = np.array([[143.0, 223.0],
[137.0, 251.0],
[54.0, 197.0]])
######################################
d... | true |
b6586d40394d8372df4699c6808107f44ee64bc5 | Python | lincolnoliveira/wttd | /eventex/core/tests/test_view_home.py | UTF-8 | 546 | 2.578125 | 3 | [] | no_license | from django.test import TestCase
class HomeTest(TestCase):
def setUp(self):
self.resp = self.client.get("/")
def test_get_code(self):
""" GET / should return status code 200"""
self.assertEqual(200, self.resp.status_code)
def test_template(self):
""" Should use index.html"... | true |
57a36e4f7d82eb084488259d5d0ab25d444b67fb | Python | edmontdants/ImageProcessing | /Tensorflow/.ipynb_checkpoints/image_augmentation-checkpoint.py | UTF-8 | 788 | 2.828125 | 3 | [] | no_license | def image_augmentation(rescale_value,rotation_range,width_shift_range, height_shift_range, shear_range, zoom_range, horizontal_flip, fill_mode):
from tensorflow.keras.preprocessing.image import ImageDataGenerator
# rotation_range= 0-180 degree
# height_shift_range = moving the subject inframe of the ... | true |
2b95a82cecb1bd58fe1bba2ec3f0bd503934e5b5 | Python | daniel-reich/ubiquitous-fiesta | /Mv5qSgZKTLrLt9zzW_5.py | UTF-8 | 188 | 2.671875 | 3 | [] | no_license |
def get_drink_ID(flavor, ml):
a = ''.join((ch if ch in '0123456789 -e' else '') for ch in ml)
words = ''.join([x[0:3] for x in flavor.split()])
return str(words).upper() + a
| true |
ee23eb7cbe982e0bd6796f0cf53762f926ed6134 | Python | SonOfLilit/gameboyoflife | /src/rle.py | UTF-8 | 4,099 | 2.75 | 3 | [] | no_license | #Written by Sean McKiernan (Mekire)
#
# Minor changes 2013 Aur Saraf and friends.
import numpy
import re
LEVEL_DATA_RE = re.compile(r"# Player: (\d+,\d+) Door: (\d+,\d+)$")
#reads pattern files in the "Life 1.05", "Life 1.06", and "Run-Length-Encoded" format
def load_rle(path):
def get_info(line,info):
... | true |
faf593b98e8f4d75bcccf3c0a238dcd05a14eb4a | Python | PythPeri2017/PyProgFall2017 | /pitonozavr/l07/add_ops.py | UTF-8 | 1,414 | 3.75 | 4 | [] | no_license | # group = input("Введите состав подразделения, солдат: ")
# print(group)
# group_list = group.split(", ") #split() - разбивал строку
# print(group_list)
# final_group = " <3 ".join(group_list) #join() соединяет в строку
# print(final_group)
# numbers = [3, 11, 5, 30]
# print(len(numbers))
# print(max(numbers))
# prin... | true |
7f53ae9842499f77f45b12bd98aef410fa661d7f | Python | JustinSelig/pen_to_paper | /simulator.py | UTF-8 | 4,550 | 3.0625 | 3 | [
"MIT"
] | permissive | import math
import msgpackrpc
import pygame
import random
import sys
import socket
import time
import threading
from math import cos, sin, pi, sqrt, atan2
from pygame.locals import *
screen_size_x = 1920
screen_size_y = 1080
DIST_PER_TICK = 1
d2r = pi/180
# https://gist.github.com/xaedes/974535e71009fa8f090e
class... | true |
6f34b469dea71d8ef89f75fac2d8fd9f95c99bfe | Python | Aasthaengg/IBMdataset | /Python_codes/p03208/s701304856.py | UTF-8 | 225 | 2.703125 | 3 | [] | no_license | N, K = list(map(int, input().split()))
h = [0]
for _ in range(N):
h += [int(input())]
h = sorted(h)
min_value = h[-1]
for i in range(K, N + 1):
min_value = min(h[i] - h[i - K + 1], min_value)
print(min_value) | true |
924d898c9a96af1965d7f2d5c2e9062852cef9c9 | Python | mgeshelley/group_10 | /project_code/old_files/input_func.py | UTF-8 | 11,170 | 3.59375 | 4 | [] | no_license | # This file contains a function to read in the input from the command line
import numpy as np
def give_file_names(g, extension=''):
folder_name = 'table_files/'
sp_basis_filename = folder_name+'%s3s.sp' %extension
SD_filename = folder_name+"%s3s_slater_det.sd" %extension
tbme_filename = folder_name+"... | true |
276df692c6e396e7078d0403b0aa702e6d6c9dc9 | Python | ajburjek/sister | /AdditiveUnscentedKalman.py | UTF-8 | 848 | 3.109375 | 3 | [] | no_license | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Tue Sep 17 12:57:08 2019
@author: William Patton
Attempt at Kalman Filter
"""
import pylab as pl
import numpy as np
from pykalman import AdditiveUnscentedKalmanFilter
'Initialize Parameters'
def transition_function(X):
...
def observation_function(... | true |
414d5889d55aaf27ace0231b2fd5239a5f972900 | Python | amrithajayadev/misc | /binary_trees/binary-searchtree_from-sorted_array.py | UTF-8 | 2,584 | 3.65625 | 4 | [] | no_license | from collections import deque
class TreeNode:
def __init__(self, val=0, left=None, right=None):
self.value = val
self.left = left
self.right = right
def preorder_traversal(node):
if node is not None:
print(node.value, end=" ")
preorder_traversal(node.left)
pre... | true |
46723b91be02ac78a790deae779edc7007355520 | Python | NguyenThao1912/CyberSecurity | /Ma Co Dien/Playfair_cipher.py | UTF-8 | 6,454 | 3.765625 | 4 | [] | no_license | class Playfair():
'''
Sets up a playfair cipher based on key supplied, used to encrypt and
decrypt.
'''
def __init__(self, text):
'''Builds cipher so that it can be used to encrypt and decrypt text.'''
self.text = text
'''Bảng chữ cái'''
self.alpha = ['a', 'b', 'c'... | true |
ab89502e83e05d5ef47d17d72c0bd9d53435ca31 | Python | rpytel1/multimedia-project | /preprocess_data.py | UTF-8 | 6,362 | 2.96875 | 3 | [] | no_license | import pandas as pd
import pickle
import gensim.downloader as api
import nltk
import numpy as np
model = api.load("glove-wiki-gigaword-100")
print(model['man'])
tokenizer = nltk.RegexpTokenizer(r'\w+')
def apply_one_hot(df, categorical_features):
"""
Function that applies one-hot encoding to the features spe... | true |
036a9186a2d8f8aa02bbc91a0a181fe066dae294 | Python | steppehare/tor_proxy | /get_proxy_ip.py | UTF-8 | 3,513 | 2.765625 | 3 | [] | no_license | #!/usr/bin/python3
# -*- coding: utf-8 -*-
import subprocess
import json
import asyncio
import requests
from bs4 import BeautifulSoup
# import re
async def get_ip_by_torapi(host, port):
"""
Print proxy ip through tor api
:param host: string - proxy host
:param port: integer - proxy port
:return: p... | true |
8071fe1b7447981b1ba0b37d348b7f7eb028e5b7 | Python | YuanZheCSYZ/algorithm | /datastructure/list/36 Valid Sudoku.py | UTF-8 | 1,070 | 3.3125 | 3 | [] | no_license | # https://leetcode.com/problems/valid-sudoku/submissions/
class Solution:
"""
Runtime: 92 ms, faster than 89.26% of Python3 online submissions for Valid Sudoku.
Memory Usage: 14.3 MB, less than 43.57% of Python3 online submissions for Valid Sudoku.
"""
def isValidSudoku(self, board: List[List[str]]... | true |
7f87126713680f538aabe1201621577ef1ce0927 | Python | abiraja2004/shiyanlou | /python_learning/sci/ch 2/Recipe_1f.py | UTF-8 | 512 | 3.828125 | 4 | [] | no_license | # Matrix operations
a_matrix = np.arange(9).reshape(3,3)
b_matrix = np.arange(9).reshape(3,3)
# Addition
c_matrix = a_matrix + b_matrix
# Element wise multiplication
d_matrix = a_matrix * b_matrix
# matrix multiplication
e_matrix = np.dot(a_matrix,b_matrix)
# matrix tranpsose
f_matrix = e_matrix.T
# min,max,sum
pr... | true |
2e502b3b3a6447ef4eb9af237a4ae424d8b91601 | Python | rehab-saleh/AlogrithmsPr-project | /Model.py | UTF-8 | 3,023 | 2.921875 | 3 | [] | no_license | class Model:
db = None
connection: None = None
def __init__(self):
self.create_table()
self._saved = False
@classmethod
def _get_table_name(cls):
return cls.__name__.lower()
@classmethod
def got_columns(cls):
columns = {}
for key, value in cls.__di... | true |
f22a69888ee05850ff1f5f546e307c743b0e1e54 | Python | lsxceo/51cto-task | /0406minitoutiao/http_server.py | UTF-8 | 3,349 | 2.671875 | 3 | [] | no_license | #!/usr/bin/env Python
# -*- coding: utf-8 -*-
# http_server.py
import json
import socket
from pagecounter import PageCounter
import minitoutiao as mt
HOST = '' # localhost: 本机,ip值,空:任意主机都可以访问
PORT = 8000
ADDR = (HOST, PORT)
BUFSIZE = 1024
# 新建socket
sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) # TCP相... | true |
0135b6a113df6f5d4cdd96cc0f85804542581c24 | Python | jtfield/useful_scripts | /seq_line_catter.py | UTF-8 | 1,161 | 2.734375 | 3 | [] | no_license | #! /usr/bin/env python3
import argparse
import os
from re import split
def parse_args():
parser = argparse.ArgumentParser()
parser.add_argument('--align')
parser.add_argument('--output_align', default="NONE")
return parser.parse_args()
def main():
args = parse_args()
lengths = {}
input_... | true |
403f8d9d0685efe2bc721e0577d782dfd1d0f6b9 | Python | ddonggsa/algorithm | /07.radix_sort.py | UTF-8 | 1,640 | 3.796875 | 4 | [] | no_license | data = list(map(int,input().split()))
isSort = False # 정렬이 완료되었나 기억하는 변수, True로 변경되면 정렬이 완료됨을 의미한다.
radix = 1 # 큐에 넣어줄 자리수의 위치를 기억하는 변수, 1 => 10 => 100 => 1000
# 정렬이 완료될 때 까지 반복한다.
while not isSort:
isSort = True
# 정렬할 숫자의 기수(진법)의 크기만큼 큐로 사용할 리스트를 만든다.
queueList = [[] for i in range(10)]
print('ra... | true |
da9ec2435105c1e35155529facc1dd1950d52657 | Python | Reza-Salim/Training | /12.py | UTF-8 | 558 | 3.46875 | 3 | [] | no_license | id1 = -1
max1 = -1
max2 = -1
id2 = -1
n = 0
while n < 2:
print ("Please enter a number greater than 1")
n = int(input("Enter n : "))
else:
for i in range (1, n+1):
id0 = int(input("Enter id: "))
aver = float(input("Enter average: "))
if aver > max1:
... | true |
7d48273ee0c35d44f3a192a955bcb3ba6230a6e7 | Python | Referor/ep_index | /st_proto.py | UTF-8 | 6,873 | 2.75 | 3 | [] | no_license | import streamlit as st
import pandas as pd
import numpy as np
from scipy.stats import pearsonr
from statsmodels.sandbox.stats.multicomp import multipletests
import seaborn as sns
import plotly as py
import plotly.graph_objs as go
import plotly.express as px
import matplotlib.pyplot as plt
#https://medium.com/@u.pranee... | true |
1e06888dc7ddb8bc0c85f47b26a5424758c9e70b | Python | Remedious-RUHacks/remedious-bot | /bot.py | UTF-8 | 3,961 | 2.734375 | 3 | [] | no_license | import os
import json
import discord
from discord.ext import commands
import requests
from dotenv import load_dotenv
load_dotenv()
TOKEN = os.getenv("DISCORD_TOKEN")
client = commands.Bot(command_prefix='$')
URL ="https://remedious-api.herokuapp.com/"
request = requests.get(URL + "dashboard",headers={
"email":"emai... | true |
d5e7c7fd746f0f24cd9aa12241a2b999178ac039 | Python | omaotzu/python | /object_and_basic_data_structure/strings.py | UTF-8 | 1,181 | 4.59375 | 5 | [] | no_license | # len function for length
print(len('Hello'))
string = 'Hello'
# Print second index location
print(string[1])
# Print everything from index location to end of string
print(string[1:])
# Print everything before given index location
print(string[:3])
# If unknown length -- can loop backwards and print specific index ... | true |
6492a09ff2df9a026f9272f29730007d075ccd2b | Python | yuvallanger/arcade_book | /source/chapters/14_libraries_and_modules/openpyxl_example.py | UTF-8 | 478 | 3.546875 | 4 | [] | no_license | """
Example using OpenPyXL to create an Excel worksheet
"""
from openpyxl import Workbook
import random
# Create an Excel workbook
work_book = Workbook()
# Grab the active worksheet
work_sheet = work_book.active
# Data can be assigned directly to cells
work_sheet['A1'] = "This is a test"
# Rows can... | true |
4f39f29b8c40bb54806ddf273e90692497a1607c | Python | valbok/penger.db | /core/lib/db/db.py | UTF-8 | 1,377 | 2.8125 | 3 | [] | no_license | """
" @author VaL
" @copyright Copyright (C) 2013 VaL::bOK
" @license GNU GPL v2
"""
import MySQLdb
"""
" MySQL Database handler
" Used to initialize database connection and keep it for whole process
" Implements kind of singelton
"
" Usage:
" DB.init( db = "databasename" )
" db = DB.get()
" cur = db.currsor... | true |
af719b40ed7ecec6e5ac7147ac69553e818221c3 | Python | epcm/2020_Summer_School_Python | /Day3/1714.py | UTF-8 | 277 | 3.421875 | 3 | [] | no_license | a = int(input())
b = int(input())
count = 0
for n in range(a, b + 1):
flag = True
for i in range(2, int(n**0.5) + 1):
if(n % i == 0):
flag = False
break
if(n == 1):
flag = False
if(flag):
count += 1
print(count) | true |
7be6702701d9bee013338d42d15cd3371421bed8 | Python | 1214367903/CubeOnline | /server/util/connector.py | UTF-8 | 950 | 2.625 | 3 | [
"MIT"
] | permissive | """
目前的服务主要是请求本地的一个接口,以及微信获取open_id的接口
因此,使用连接池理论上会有更好的性能
tornado没有自带的连接池,只好上aiohttp了
"""
from typing import Optional
import aiohttp
from config import connection_config
from util import UtilError
_client = None
async def init() -> None:
global _client
if _client is not None:
return
# client对象... | true |
8f21d5248aed6aa4b9e9d8abf8b45afa3cceb6a1 | Python | Roboy/lightskin-python-framework | /LightSkin/Algorithm/RayInfluenceModels/DirectSampledRayGridInfluenceModel.py | UTF-8 | 1,192 | 2.921875 | 3 | [
"BSD-3-Clause"
] | permissive | from functools import lru_cache
from typing import Tuple, List, Dict
import math
from .RayInfluenceModel import RayGridInfluenceModel, Ray
class DirectSampledRayGridInfluenceModel(RayGridInfluenceModel):
"""
Calculates the weights of the grid cells by sampling along the direct path of the ray
an... | true |
b93d4dd085abde060c59570c184aba2816f9f802 | Python | mswift42/project-euler | /euler42.py | UTF-8 | 1,122 | 4.1875 | 4 | [] | no_license |
#!/usr/bin/python
# -*- coding: utf-8 -*-
"""Coded triangle numbers
Problem 42
The nth term of the sequence of triangle numbers is given by, tn = ½n(n+1); so the first ten triangle numbers are:
1, 3, 6, 10, 15, 21, 28, 36, 45, 55, ...
By converting each letter in a word to a number corresponding to its alphabetical... | true |
ea85abac8cc1f63d7172b6f40ae2b702d49912fd | Python | AnjaliG1999/DSA | /Graphs/pathsBtwVertices.py | UTF-8 | 1,148 | 3.828125 | 4 | [] | no_license | #!usr/bin/env python3
# Graph object creation and methods
class Graph():
def __init__(self, nodes):
self.adjList = {}
self.V = nodes
for v in range(nodes):
self.addVertices(v)
def addEdge(self, v1, v2):
self.adjList[v1].append(v2)
def addVertices(self,... | true |
9236349a37c9eab6c22a64c5f43d41e9e484ddce | Python | standrewscollege2018/2020-year-12-python-code-the311thsheep | /bookstore.py | UTF-8 | 4,152 | 4.25 | 4 | [] | no_license | """bookstore."""
"""21/2/2020"""
#asks again if user enters str or
#out of range when asking for int
def get_correct_input(prompt, length = 10000):
while True:
try:
value = int(input(prompt))-1
except ValueError:
print ("sorry i didnt understand that, try entering a number"... | true |
36e99e64c57ac6fa9ddce35a00ac6f5f538755a5 | Python | ariadnapm/python_level_1 | /python/modulo_exemple.py | UTF-8 | 152 | 2.890625 | 3 | [] | no_license | def check_bank(iban):
bban = iban[4]
verif = int(bban[-2:])
number = int(bban[:-2])
return number % 97 == verif
print(check_bank(""))
| true |
544134f1bda751a86d389d937bcf492592b07d2e | Python | gxyd/competitive-programming | /charging-the-batteries.py | UTF-8 | 211 | 3.015625 | 3 | [] | no_license | #!/usr/bin/python3
n, m, k = map(int, input().split())
X = []
for i in range(m):
x, y = map(int, input().split())
X.append((x, y))
def distance(a, b):
return abs(a[0] - b[0]) + abs(a[1] - b[1])
| true |
b31b611f9d8202a7c1dc119a6d4731de92db577c | Python | achernyshova/Reddit-NLP-Classification | /AWS/reddit_collect.py | UTF-8 | 2,914 | 3.09375 | 3 | [] | no_license | import requests
import time
import pandas as pd
import os.path
def load_posts(posts, direction, limit, url):
headers = {'User-agent': 'Bleep bot 0.1'}
pagingId = None
#create while loop, it'll be work until 'after'/'before' gets None
#it allows me to avoid collecting duplicates
while True:
... | true |
850809fa0ddcc6caee55f640b6cd2d414c74ef1d | Python | elmanhamdi/Whitted-Ray-Tracing | /objects/ray.py | UTF-8 | 2,982 | 2.921875 | 3 | [] | no_license | # CENG 488 Assignment7 by
# Elman Hamdi
# 240201036
# June 2021
from utils import *
class Ray:
def __init__(self, start_pos=Pos3d(0, 0, 0, 1), direction=Vec3d(1, 1, 1, 0)):
self.start_pos = start_pos
self.direction = direction
def __str__(self):
return '\nRay Properties+\n' +'start... | true |
817dd1703e6ee27474bb462ed0ee2ed01b472d28 | Python | kishoreio/code-kata | /basics/basics1.py | UTF-8 | 96 | 3.140625 | 3 | [] | no_license | N = int(input())
sum1 = 0
if(N<=100000):
for i in range(1,N+1):
sum1+=i
print(sum1)
| true |
bf3cdd455356d21f00d3b5beb64ff351f65d9435 | Python | ssst0n3/college | /app/models.bak.py | UTF-8 | 6,108 | 2.734375 | 3 | [] | no_license | #-*- coding:utf-8 -*-
import MySQLdb
def mysql_con():
global db, cursor
# 打开数据库连接
db = MySQLdb.connect("localhost","root","","college")
# 使用cursor()方法获取操作游标
cursor = db.cursor()
def mysql_clo():
# 关闭数据库连接
cursor.close()
db.close()
# 为信息公告服务,提供按照类型分类的文章
def init_articles_xxgg():
... | true |
cc36525c2a0d0a1af520cbec59a48bc01669219f | Python | mahdeesharef/coding-in-turkey-2021 | /problem-1/problem1-solution-mahdeesharef.py | UTF-8 | 338 | 2.71875 | 3 | [] | no_license | def validateRecipe(fridge, ingredients):
for i in ingredients:
if i not in fridge:
return False
return True
validateRecipe(ingredients = ['tomato', 'onion', 'lettuce'],fridge = ['tomato', 'banana', 'apple', 'oni... | true |
3d04db4f7eef5f2f6a12aee5760ba76d8aa4105d | Python | wh-debug/python | /.history/6_1_20210201203413.py | UTF-8 | 604 | 3.640625 | 4 | [] | no_license | '''
Author: Daylight
Date: 2021-02-01 20:18:57
LastEditTime: 2021-02-01 20:33:54
LastEditors: Please set LastEditors
Description: In User Settings Edit
FilePath: \python\6_1.py
'''
#todo 字典(简单的字典)
alien_0 = {'color': 'green', 'point': 5} #! 保存两个键值
alien_1 = {'colors': 'red'} #! 最简单的字典
print(alien_0['colo... | true |
9e295b2134c3368301a10af67ef6fd2db69933ed | Python | thierryreding/scripts | /pwm/coverage | UTF-8 | 4,020 | 2.671875 | 3 | [] | no_license | #!/usr/bin/python3
#
# example: ./coverage build/pwm linux/pwm.h
#
import argparse, os, subprocess, sys
class Log:
COLOR_NONE = '\033[0m'
COLOR_RED = '\033[31;1m'
COLOR_GREEN = '\033[32;1m'
COLOR_YELLOW = '\033[33;1m'
COLOR_BLUE = '\033[34;1m'
COLOR_MAGENTA = '\033[35;1m'
def __init__(sel... | true |
a37dda257988b3bfb55a797c652c13ca8ec93627 | Python | brelsford/topology | /my_graph_helpers.py | UTF-8 | 41,125 | 3.015625 | 3 | [] | no_license | import numpy as np
import shapefile
import math
from collections import defaultdict
import networkx as nx
import random
import itertools
import operator
from scipy.cluster.hierarchy import linkage, dendrogram
import json
# import plotly.plotly as ply
# from plotly.graph_objs import *
import my_graph as mg
""" This... | true |
d79efd6e55fb9c4d6f50132cf671ddf0456eaa60 | Python | toanloi2569/short_code | /regex.py | UTF-8 | 382 | 3.140625 | 3 | [] | no_license | import re
partern = r'^[0-9a-z]{8}$'
string = 'ms201669'
# re.compile(pattern, flags=0)
# Biên dịch 1 regex expression thành 1 regex expression object. Từ đó có thể dùng các hàm match(), search()
prog = re.compile(pattern)
result = prog.match(string)
#re.finditer(pattern, string, flags=0)
# Trả về iterator match ob... | true |
acb5e6d432ea256c1836198856f77564dee26278 | Python | mavb86/ejercicios-python | /seccion4/bucles/ejercicio12.py | UTF-8 | 430 | 4.09375 | 4 | [] | no_license | # Ejercicio 12
#
# Realizar un algoritmo para determinar cuánto ahorrará una persona en un año, si al final de cada mes
# deposita cantidades variables de dinero; además, se quiere saber cuánto lleva ahorrado cada mes.
ahorro_acum = 0
for mes in range(1,13):
ahorro_mes = float(input("¿Cuánto has ahorrado en el mes... | true |
f03c880a5c1db9ed8ed949e4411924c6f400e4b0 | Python | tanxiumei/interfaceWushui | /temp.py | UTF-8 | 1,527 | 2.71875 | 3 | [] | no_license | import os
import requests
# 定义一个common的类,它的父类是object
class Common(object):
# common的构造函数
def __init__(self):
# 被测系统的根路由
self.url_root = 'http://127.0.0.1:12356'
# 封装你自己的get请求,uri是访问路由,params是get请求的参数,如果没有默认为空
def get(self, uri, params=''):
# 拼凑访问地址
url = self.url_root... | true |
1c923fa07b48b9f998dee64a76d61ba6728cab83 | Python | fdavis/learning-python | /algo-data-structures/maze/lib/car.py | UTF-8 | 551 | 3.296875 | 3 | [] | no_license | #!/usr/bin/python
# coding=utf-8
import util
import constants as C
class car:
def __init__(self, pos = None, dir = None):
if pos:
self.position = util.coordinate(pos)
else:
self.position = C.DEFAULT_POSITION
if dir:
self.direction = dir
else:
self.direction = C.DEFAULT_DIRE... | true |
7d3f39b643d555f7586f406cad82b91bd87469f3 | Python | Ivanovich64/PyPlayground | /PySweeper/main.py | UTF-8 | 608 | 2.59375 | 3 | [] | no_license | # # # # # # #
# # # # # # #
# # PySweeper # #
# # # # # # #
# # # # # # #
# by: PieChai
# Python 3.8.2
# Enjoy
from matrixFunc import *
from validations import *
# Welcome Screen
print(" Welcome to PySweeper ".center(35,"~")+"\n Select your difficulty:\n (1) Crybaby\n (2) n00b\... | true |
85ef82e5a1b47cf007abecaf3e642f395b913feb | Python | goo-goo-goo-joob/Catalan-Number | /Calculate/management/commands/secret.py | UTF-8 | 618 | 2.671875 | 3 | [] | no_license | from os import urandom
from django.core.management.base import BaseCommand
alphabet = r"0123456789qwertyuiopasdfghjklzxcvbnm[];',./{}:>?<!@#$%^&*()_+=-"
def get_int():
n = 0
for _ in range(4):
n = (n << 2) + ord(urandom(1))
return n
class Command(BaseCommand):
help = 'Init secret file'
... | true |
3c4df60cf32d304d25bbc60bb0f13819d3511cd4 | Python | jahona/pdf_encrypt | /encrypt.py | UTF-8 | 634 | 2.921875 | 3 | [] | no_license | import PyPDF2
import os
class Encrypt():
def __init__(self):
super().__init__()
@staticmethod
def do(path, password):
print(path, password)
pdfFile = open(path, 'rb')
pdfReader = PyPDF2.PdfFileReader(pdfFile)
pdfWriter = PyPDF2.PdfFileWriter()
for pag... | true |
7d7b3f0f5ec4dcfeb5b29cbfe641516fd9c46943 | Python | ccdle12/RSA-Example | /python/rsa.py | UTF-8 | 5,934 | 3.953125 | 4 | [] | no_license | import unittest
import math
class RSA:
def __init__(self, p, q, e):
# Calcualte N, half of the public key.
# p and q are prime numbers. N is the product.
self.P = p
self.Q = q
self.N = self.P * self.Q
# Set the variable e, the other half of the public key, relativel... | true |
03cade6dd43daccc735ea36a362c275f706471fc | Python | chenhh/Uva | /uva_10100_string.py | UTF-8 | 1,800 | 3.796875 | 4 | [] | no_license | # -*- coding: utf-8 -*-
"""
Authors: Hung-Hsin Chen <chenhh@par.cse.nsysu.edu.tw>
License: GPL v2
status: AC
difficulty: 2
https://uva.onlinejudge.org/external/101/10100.pdf
longest common sub-sequence of words.
Note: the word is case-sensitive.
"""
import sys
def lcs(line1, line2):
"""
line1: list of wor... | true |
a53f9d4513f9fe05c83ef132b8ebe111005c636f | Python | AZAZAZAZ1/first_re-pository | /vedio-69.py | UTF-8 | 6,307 | 3.15625 | 3 | [] | no_license |
import random
class Coin:
def __init__(self,rare=False,clean=True,heads=True,**kwargs):#Kwargs is to back in dictionary the upacked ** data
for key,value in kwargs.items():
setattr(self,key,value)
self.is_rare=rare
self.is_clean=clean
self.heads=heads
... | true |
77a6a851c95038057d86e693b029841b4a3b4f3c | Python | RogerMCL/PythonExercises | /Ex015.py | UTF-8 | 186 | 3.953125 | 4 | [] | no_license | #EXERCÍCIO 015:
km = float(input('Quantos km rodados? '))
d = int(input('Quantos dias alugados? '))
p = (60 * d) + (0.15 * km)
print(f'O preço a ser pago será de R${p:.2f}')
| true |
7b2c13414a26c5add8a4b3783e0767202014742d | Python | pastrouveedespeudo/ste-fois-c-la-bonne | /imageimage/doc_question.py | UTF-8 | 11,564 | 2.859375 | 3 | [] | no_license | class question:
def questionnage(self):
self.question = [["la voiture est rouge"],
['le crayon est vert et sur la table rouge'],
['le crayon est vert'],
['le crayon est vert et sur la table rouge'],
['le crayon est vert et sur la table ... | true |
a886283ba47d519387bb5cd4cfa01d584dcfbaca | Python | AbolareRoheemah/Python-Tasks | /pangram.py | UTF-8 | 735 | 4.125 | 4 | [] | no_license | """
#This function helps check if a word is a pangram
print("Hello, I would love to tell you if a word or a sentence " +
" is a pangram")
print("If you are going to be entering a sentence, please do" +
" not space the words")
word = input("Please enter the word or sentence:\n")
alphabets = ["a", "b", "c", "d", "e"... | true |
82bf25f6f59f0be1fb46ffa2947d4e8416d2429e | Python | ntvo7/CIS2348-Homework2 | /Lab6.22.py | UTF-8 | 384 | 3.359375 | 3 | [] | no_license | a = int(input())
b = int(input())
num1 = int(input())
c = int(input())
d = int(input())
num2 = int(input())
X = 0
Y = 0
for x in range(-10, 11):
for y in range(-10,11):
if (a*x + b*y - num1) == (c*x + d*y - num2) and (a*x + b*y - num1) == 0:
X = x
Y = y
if X != 0 a... | true |
6e6e666bced8e027a8dcf8c991b4c21c4e571c54 | Python | CharlesMicou/ezomnotho-prototype | /visual/structure/visualizer.py | UTF-8 | 868 | 2.59375 | 3 | [] | no_license | import os
import string
from parsing.agent_data import AgentData
from plotting.agent_plotter import AgentPlotter
logs_location = os.path.abspath("../../logs")
# get the latest data unless we specify otherwise
run_dir = "0"
for dir in os.listdir(logs_location):
if string.atoi(dir) > string.atoi(run_dir):
... | true |
cba3d2bc3d588a576ef6563403a335c4bafc5781 | Python | humanoiA/Python-ML-Sessions | /exp18.py | UTF-8 | 788 | 2.984375 | 3 | [] | no_license | import matplotlib.pyplot as plt
import numpy as np
from sklearn import datasets,linear_model
from sklearn.model_selection import train_test_split
boston=datasets.load_boston(return_X_y=False)
x=boston.data
y=boston.target
#print(x,y)
x_train,x_test,y_train,y_test=train_test_split(x,y,test_size=0.33,random_state... | true |
e2531c08fa759f9a4e4db46e01839e70fc93ab52 | Python | oskmy270/udpstreamer | /udpSender.py | UTF-8 | 3,319 | 3.15625 | 3 | [] | no_license | import socket
import time
import string
import random
import testData
import os
class Starter:
def __init__(self):
print 'Default values set'
def askSize(self):
atr.setSize(int(raw_input('Enter size for each UDP packet in Bytes: ')))
def askIntensity(self):
atr.setI... | true |
8688367d335d72ccbddab5b9df34463a5a9b4092 | Python | jingmca/leetcode | /p907.py | UTF-8 | 1,904 | 3.34375 | 3 | [] | no_license | class Solution(object):
def sumSubarrayMins(self, A):
"""
:type A: List[int]
:rtype: int
"""
left = [None] * len(A)
right = [None] * len(A)
stack = []
for i in xrange(0, len(A)):
while stack and A[i] <= A[stack[-1]]:
stack.... | true |
263a2991dff1d2783b38c69ceb4a0c54f4017c2d | Python | zhaokang555/Developer | /Python3/201508/09-kw-Creative.py | UTF-8 | 436 | 3.46875 | 3 | [] | no_license | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
# class Student(object):
# pass
# def func(o, **kw):
# for k, v in kw.items():
# setattr(o, k, v)
# s = Student()
# func(s, name = 'zk', age = 23)
# print(s.name, s.age)
class Student(object):
def __init__(self, **kw):
for k, v in kw.items():
setattr(self,... | true |
2c60119949ab38f37f7a697248e060840414cb66 | Python | Einsteinder/Leetcode | /73. Set Matrix Zeroes.py | UTF-8 | 741 | 3.171875 | 3 | [] | no_license | class Solution:
def setZeroes(self, matrix):
zeroXIndex = {}
zeroYIndex = {}
for i in range(len(matrix)):
for j in range(len(matrix[0])):
if matrix[i][j] == 0:
zeroXIndex[i] = 1
zeroYIndex[j] = 1
for i in range(len(m... | true |
b010ad1d0eea17a6bdf634906e2518c44b92ed7b | Python | github-mohsinalam/Python | /Nested Data and Nested Iteration/m_list.py | UTF-8 | 1,029 | 4.21875 | 4 | [] | no_license | #Iterate through the list so that if the character ‘m’ is in the string, then it should be added to a new list called m_list.
#Hint: Because this isn’t just a list of lists, think about what type of object you want your data to be stored in. Conditionals may help you.
d = ['good morning', 'hello', 'chair', 'python',... | true |
12b8b9303a7b7abc931af3c66220964bbd94dd1b | Python | buttplugio/buttplug-py | /buttplug/utils/eventhandler.py | UTF-8 | 1,716 | 3.390625 | 3 | [
"BSD-3-Clause",
"MIT",
"Apache-2.0",
"BSD-2-Clause"
] | permissive | # Taken from https://bitbucket.org/marcusva/python-utils/
#
# Original license is public domain, don't want to bring the whole package in,
# and it's not really updated anyways.
class EventHandler(object):
"""A simple event handling class, which manages callbacks to be
executed.
"""
def __init__(self,... | true |