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 |
|---|---|---|---|---|---|---|---|---|---|---|
8257ee2db480a09d0b24f19b21ed8d877e568381 | pvcodes-zz/pi_bot | /cogs/help.py | UTF-8 | 5,325 | 3 | 3 | [
"MIT"
] | permissive | import discord
from discord.ext import commands
from src.helper import _getPrefix2, _sendEmbed
class Help(commands.Cog):
def __init__(self, bot):
self.bot = bot
@commands.command(
name='help', aliases=['h'], description='This is a bot command'
)
# @commands.bot_has_permissions(add_re... | true |
847e74e65acf52ea84e8f98cd67ce0dc1fb78091 | ishwarjindal/Think-Python | /Ex10_10_in_bisect.py | UTF-8 | 1,256 | 4.09375 | 4 | [] | no_license | #Author : Ishwar Jindal
#Created On : 11-Jul-2019 09:24 PM IST
#Purpose : Find word in list using bisect method
def build_list_using_append():
file = open("words.txt")
lst = []
for word in file:
lst.append(word.strip())
return lst
def in_bisect(list_of_words, word_to_find, pass_co... | true |
3edcca3b85adeaef5ebf3dfdf6ff28c5a2dda30b | knmac/ESKF-new | /data_collector/make_rosbag/rgbd2bag.py | UTF-8 | 3,310 | 2.65625 | 3 | [] | no_license | #!/usr/bin/python
import time, sys, os, numpy
from ros import rosbag
import roslib
import rospy
roslib.load_manifest('sensor_msgs')
from sensor_msgs.msg import Image
import ImageFile
def GetFilesFromDir(dir):
'''Generates a list of files from the directory'''
print( "Searching directory %s" % dir )
all = ... | true |
5d9f800f4d6de65193ab9f30fbb4f576fbf41d20 | sengeiou/MyMianLiao | /cocos-avatar/android-build.py | UTF-8 | 1,418 | 2.59375 | 3 | [] | no_license | #!/usr/bin/python
# android-build.py
# Build android
import sys
import os, os.path
import shutil
from optparse import OptionParser
def do_build(build_mode):
app_android_root = os.path.dirname(os.path.realpath(__file__))
if build_mode is None:
build_mode = 'debug'
elif build_mode != 'release':
... | true |
74ec5124fc931eadc1f49fdfa0de1dbd01ce23ca | otienonick/Password-Locker | /run.py | UTF-8 | 8,923 | 3.515625 | 4 | [
"MIT"
] | permissive | #!/usr/bin/env python3.6
import random
from user import User
from credentials import Credentials
def create_user(user_name,pwd):
'''
function to create a new user
'''
new_user = User(user_name,pwd)
return new_user
def save_users(user):
'''
function to save user details
'''
user... | true |
c3c0b7ef6611e4900e3032908f00d90dc2f46857 | yattoni/python-password-manager | /lib/common.py | UTF-8 | 596 | 2.53125 | 3 | [] | no_license | from PyInquirer import style_from_dict, Token, ValidationError
custom_style = style_from_dict({
Token.Separator: '#6C6C6C',
Token.QuestionMark: '#FF9D00 bold',
#Token.Selected: '', # default
Token.Selected: '#5F819D',
Token.Pointer: '#FF9D00 bold',
Token.Instruction: '', # default
Token.A... | true |
cb9159f56c0d1cf374ef8cad806ec868da71c51f | Bleu-royal/SpaghettIDE | /themes/create_theme.py | UTF-8 | 1,911 | 3.171875 | 3 | [] | no_license | import json
import os
import sys
def make_dico(keys):
"""
Makes a dict using the keys from the args and sets all values to a list of 3 zeros.
:param keys: List of keys.
:type keys: tuple
:rtype: dict
"""
dico = {}
for k in keys:
dico[k] = [0, 0, 0]
return dico
def make_js... | true |
c587558198818ffa7b66fa9329e89e7eacdef7f1 | msanjay888/TestRepo | /client_pub.py | UTF-8 | 426 | 2.515625 | 3 | [] | no_license | import paho.mqtt.client as mqtt
import time
# This is the Publisher
def on_connect(client, userdata, flags, rc):
print("Connected with result code "+str(rc))
def printsample2:
print("Hello from sample 2.")
client = mqtt.Client()
client.connect("localhost",1883,60)
client.on_connect = on_connect
client.publish(... | true |
55aede74a0862259efc9de96854602e956e92750 | sw6-aau/LSTnet-demo | /models/TAENet.py | UTF-8 | 3,961 | 2.71875 | 3 | [
"MIT"
] | permissive | import torch
import torch.nn as nn
import torch.nn.functional as F
import math
class Model(nn.Module):
def __init__(self, args, data, cnn):
super(Model, self).__init__()
self.use_cuda = args.cuda
self.P = args.window;
self.m = data.m
self.hidC = cnn;
self.Ck = args.C... | true |
f04a58dc7b25897d0b40c61cac925c0d6a2b5350 | nejohnston/yahtzee | /yahtzee.py | UTF-8 | 15,139 | 3.140625 | 3 | [] | no_license | """
COMP 1510 - Yahtzee
Nicholas Johnston
A01242666
November 30, 2020
"""
import json
import random
import re
def PLAYER_1_NUMBER():
return 1
def PLAYER_2_NUMBER():
return 2
def FULL_HOUSE_SCORE():
return 25
def SMALL_STRAIGHT_SCORE():
return 30
def LARGE_STRAIGHT_SCORE():
return 40
def ... | true |
881b06499e4f1cc0ed9a8f5685fb3f45c7c0bab5 | shreyas-selvaraj/cses_problems | /two_sets.py | UTF-8 | 782 | 4.03125 | 4 | [] | no_license | #check if numbers 1...n can be divided into two sets
#can be divided if total sum is divisible by 2
#if yes, just separate every other digit then put last digit into first array
n = int(input())
set1 = []
set2 = []
# 3 mod 4
if(n % 4 == 0):
j = 4
else:
j = 3
if(n * (n+1)/2 % 2 == 0):
for i in range(0, (n-1)//4... | true |
ac2f222f565c6d9ce16f47940a9c6da1c9e188b5 | surajkeshari/teamwebwarriors | /home/views.py | UTF-8 | 2,034 | 2.5625 | 3 | [] | no_license | from django.shortcuts import render, HttpResponse, redirect
from django.contrib.auth.models import User
from django.contrib import messages
from django.contrib.auth import authenticate, login, logout
# Create your views here.
def home_page(request):
import requests
import json
news_feed = requests.get(
... | true |
65a61fd107d829c78bb8e735a5a28ed85708acf3 | Cermo/Python-Mini-Progs | /gui_experiment.py | UTF-8 | 1,841 | 2.984375 | 3 | [] | no_license | from Tkinter import *
class mp3file(object):
row = 0
def __init__(self, url):
self.url = url
self.name = url
self.label = Label(frame, text = self.name, background="#ffffff").grid(row=self.row, column = 0, sticky='w')
self.checkbox = Checkbutton(frame).grid(row=self.row, column=... | true |
c0617f94f2fcb1978a35cd01d15daa39a96176b6 | josooik/Opencv | /OpenCV 02일차/실습/opencv_30.py | UTF-8 | 487 | 2.703125 | 3 | [] | no_license | # OpenCV 이미지 회전
import cv2
img_src = cv2.imread('img/img3.jpg', cv2.IMREAD_COLOR)
img_src = cv2.resize(img_src, dsize=(500, 500), interpolation=cv2.INTER_AREA)
height, width = img_src.shape[:2]
center = (width / 2, height / 2)
angle = 45
scale = 1
# 회전
matrix = cv2.getRotationMatrix2D(center, angle, scale)
img_dst =... | true |
7213792bf8803261e260f30e4660de5d2e1b6155 | reidzesna/Zang_Products_Auto_Test_Python | /Zang_Connect_for_Cisco_Telepresence/Gmail_and_Google_Calendar/Login_Gmail_Get_Calendar.py | UTF-8 | 2,400 | 2.578125 | 3 | [] | no_license | '''
Created on May 9, 2017
@author: qcadmin
'''
from selenium import webdriver
import os, time
import ConfigParser
from distutils.sysconfig import project_base
PROJECT_ROOT = os.path.dirname(os.path.abspath(__file__))
BASE_DIR = os.path.dirname(PROJECT_ROOT)
# print BASE_DIR
config_file = BASE_DIR + "\configuration.in... | true |
d59ca7100d1f0090e23eb4835edbf10711a56b98 | AssawerBahri/Steganography-application | /fichier.py | UTF-8 | 1,702 | 3.484375 | 3 | [] | no_license | import sys as sys #Importation du module sys
from os import chdir,getcwd #Imprtation des procedure chdir et getcwd du module os
def lecture_fich(filf): #Définition d... | true |
f705a52004b7f6607b0441d3f6e877a015bd182a | ThejasR/Python_Programs | /lexical_parsing/3_ply_pre_process.py | UTF-8 | 479 | 2.65625 | 3 | [] | no_license | import ply.lex as lex
f = open('test.c')
all = f.read()
f.close()
tokens = ('NAME', 'ID', 'REST')
#literals = '(){};=*,'
def t_NAME(t) :
r'\#define\s+(\w+)\s+(.+)'
(name, value) = t.lexer.lexmatch.groups()[1:3]
mydict[name] = value
def t_ID(t) :
r'\w+'
print(mydict.get(t.value, t.value), end = ' ')
def t_REST(t... | true |
cd1cb67556d1d64a6f1362f97eddfeee4229fec1 | akanumur/Data_Science_Everyday | /Learning/Courses/Python for everybody/Week 7/Exercise5.2.py | UTF-8 | 501 | 4.03125 | 4 | [] | no_license | smallest = None
largest = None
while True :
number = input("Enter a number : ")
if number == 'done' :
break
try:
number = float(number)
except:
print("Invalid input")
continue
if smallest is None :
smallest = number
elif number < smallest:
smallest... | true |
dfd5b253d5de021341f86994211af0eebcd93311 | ramseyzhan/JI-Datapipeline | /generate_anomaly_db/generate.py | UTF-8 | 1,020 | 2.5625 | 3 | [] | no_license | f_in = open("abnormal.txt", "r")
f_out = open("data.sql", "w+")
while 1:
line = f_in.readline()
date = line.split()
if line:
recorded = date[0] + ' ' + date[1]
fir_data_line = f_in.readline().split('[')[1]
fir_data = fir_data_line.split()
[global_active_power, global_reactive... | true |
a64bd5e3d703da8fa2d514f01299f18d08a5be3d | fdl9/fdl9python | /PaulTutorial/Lesson1/Lesson1.py | UTF-8 | 315 | 3.171875 | 3 | [] | no_license | import os
import sys
# print("hello world")
to_write_file_pointer= open('to read.txt','w')
for number in range (1,10):
to_write_file_pointer.write("{}\n".format(number))
letters = ['a', 'b', 'c', 'd', 'e']
for i in letters:
to_write_file_pointer.write("{}\n".format(i))
to_write_file_pointer.close()
| true |
bae4a61739c4766804f9854b1f4efd72e063fc32 | Emoto13/Python101 | /week2/01.LinuxCommands/sum_numbers.py | UTF-8 | 280 | 3.203125 | 3 | [] | no_license | # generate_numbers.py
import sys
def sum_numbers(filename):
lst = []
with open(filename, 'r') as f:
lst = [int(i) for i in f.readlines()[0].strip().split()]
return sum(lst)
def main():
print(sum_numbers(sys.argv[1]))
if __name__ == '__main__':
main() | true |
108078089f454a68fe7f55d710c2e2e6483ce357 | JoaoZati/ListaDeExerciciosPythonPro | /EstruturaDeRepeticao/Ex_22.py | UTF-8 | 792 | 4.3125 | 4 | [] | no_license | #%% 22 - Se nao é primo quem divide
"""
Altere o programa de cálculo dos números primos, informando, caso o
número não seja primo, por quais número ele é divisível.
"""
while True:
try:
num_p = int(input('Insira um numero inteiro N: '))
except ValueError:
print('Não foi fornecido um numero in... | true |
5e17f1071e2ea4e836a0a00b09154629c9c9ea12 | htl1126/leetcode | /1367.py | UTF-8 | 997 | 3.390625 | 3 | [] | no_license | # Ref: https://leetcode.com/problems/linked-list-in-binary-tree/discuss/524881/Python-Recursive-Solution-O(N-%2B-L)-Time
# Definition for singly-linked list.
# class ListNode:
# def __init__(self, val=0, next=None):
# self.val = val
# self.next = next
# Definition for a binary tree node.
# class Tr... | true |
fb4583def79194e10414148e979be5e6bdb4089b | AyWhite22/Public-Python-1.2writingSimple | /1.2writingSimple/avg.py | UTF-8 | 470 | 4.5 | 4 | [] | no_license | # avg.py
# by A. White Dec. 10, 2018
# A simple program to average three exam scores.
# Illustrates use of multiple input
def main():
#This is an introduction
print("This program computes the average of three exam scores. ")
#This is an input
score1, score2, score3 = eval(input("Enter three scores sepa... | true |
61e8bc4a7eeb165418a0519ec0a09d6345dbb41d | jasonsrogers/python-basics-for-data-science | /module2-list-and-tuples.py | UTF-8 | 1,595 | 3.765625 | 4 | [] | no_license | ratings = (10, 9 , 6, 5, 10, 8, 9, 6, 2) # <class 'tuple'>
tuple1 = ('disco', 10, 1.2) # different types inside the tuple
tuple1[0] # => 'disco'
tuple1[1] # => 10
tuple1[2] # => 1.2
tuple1[-3] # => 'disco'
tuple2 = tuple1 + ('hardrock', 10) #=> ('disco', 10, 1.2,hardrock', 10)
tuple2[:3] # => slice the tuple first ... | true |
0604fcf9cbfa5d174a7673ce15804bcbfea106d1 | mehmetmertkan/new-dsl-with-a-simple-tank-game | /mert.py | UTF-8 | 1,862 | 3.296875 | 3 | [] | no_license | import time
import sys
from textx import metamodel_from_file
tank_mm = metamodel_from_file('mert.tx')
tank_model = tank_mm.model_from_file('example1.mert')
class Tank(object):
def __init__(self):
self.x = 0
self.y = 0
self.ammo = 0
def __str__(self):
return "Po... | true |
dab563f2681cf91f75e75499e695e6686eb85220 | 1frag/alg_and_data | /geekbrains/lesson3/9.py | UTF-8 | 676 | 3.890625 | 4 | [] | no_license | # 9. Найти максимальный элемент среди минимальных
# элементов столбцов матрицы.
import random
INF = 99 # наибольшее которое может быть сгенерировано
SIZE = 10
matrix = [[random.randint(0, INF) for _ in range(SIZE)] for _ in range(SIZE)]
print('Сгенерирована матрица:')
for line in matrix:
for elem in line... | true |
0e61b48ffd3b51ddc9a9bd1608d091c3f560388c | dpazel/tryinggithub | /similarity/nw_similarity.py | UTF-8 | 2,851 | 3.484375 | 3 | [
"MIT"
] | permissive | '''
'''
class NWAlgorithm(object):
'''
https://en.wikipedia.org/wiki/Needleman%E2%80%93Wunsch_algorithm
'''
def __init__(self, string_a, string_b):
'''
Constructor
'''
self.string_a = string_a
self.string_b = string_b
self.__compute()
def __compu... | true |
c5dc1fc0f970234e2d700eb5448ec88fe7db854e | DimaM315/testmaker | /controllers/TestCreatePage.py | UTF-8 | 7,489 | 2.9375 | 3 | [] | no_license | from tkinter import *
from tkinter import messagebox
from controllers.BaseController import BasePage
from models import save_test
from settings import YELLOW, BLUE, RED
class TestCreatePage(BasePage):
"""docstring for TestCreatePage
Класс отвечает за создание нового теста, добавление его в
test_storage.txt
... | true |
7be6ba4b00d796eae2e7e5a1fee90a562a266c81 | parkeroth/EECS-678-P3 | /nachos/test/makePDFs.py | UTF-8 | 1,482 | 2.71875 | 3 | [] | no_license | import sys
import os
# This script generates a number of histogram graphs.
d = {}
# FORMAT:
#
# I is the instrumentation sampling period
# R is the dynamic priority advantage reduction factor
# i is the number of inertial quanta
#
# n, width, and min are histoggram specifications
#
# d[(I, R, i) = ((n1,width1,min1)... | true |
edf7fdc91af6c59429b10cb1fe306c9a76f65da7 | dragonrobotics/2018-PowerUp | /autonomous/baseline_simple.py | UTF-8 | 4,878 | 2.75 | 3 | [
"MIT"
] | permissive | import math
import wpilib
import sys
class Autonomous:
def __init__(self, robot, robot_position):
self.robot = robot
if robot_position is None:
robot_position = ''
try:
self.robot_position = robot_position.lower()
except: # noqa: E772
self.robo... | true |
1c740d7a62e9cc1cedc88506e90524cf20d27a15 | rssalessio/py-lower-bound-bai | /math_func_cython.pyx | UTF-8 | 7,115 | 2.890625 | 3 | [
"MIT"
] | permissive | #! /usr/bin/env python
# -*- coding: utf-8 -*-
# cython: boundscheck=False
# cython: wraparound=False
# cython: cdivision=True
# cython: nonecheck=False
from __future__ import division, print_function # Python 2 compatibility
from libc.math cimport log, sqrt, exp, fabs
import numpy as np
from scipy.special import la... | true |
47198b9c8397f4b5f9caff0ac5b6873e687ab3cd | ryuseiasumo/Gazoshori100knock | /Question_71_80/q80.py | UTF-8 | 1,822 | 2.78125 | 3 | [] | no_license | import cv2
import numpy as np
# Grayscale
def BGR2GRAY(img):
# Grayscale
gray = 0.2126 * img[..., 2] + 0.7152 * img[..., 1] + 0.0722 * img[..., 0]
return gray
gabor_0 = cv2.getGaborKernel((11, 11), 1.5, np.radians(0), 3, 1.2 ,0 ,cv2.CV_64F)
gabor_45 = cv2.getGaborKernel((11, 11), 1.5, np.radians(45), 3, ... | true |
23e00ee2954d59520e093db815a65b5934f810f9 | haaruhito/Python_Itertools | /Python_Iterators/Filterfalse.Iterator.py | UTF-8 | 320 | 3.75 | 4 | [] | no_license |
# Make an iterator that filters elements from
# iterable returning only those for which
# the predicate is False.
#filterfalse(fun, iter)
from itertools import filterfalse
def filteringfalse(y):
return (y > 5)
li = [2, 4, 5, 7, 8, 10, 20]
print(list(filterfalse(filteringfalse, li)))
| true |
3ebb342fbc8c6619adf0df0e45d153afae2210f9 | sindavid/get_free_amazon_ebooks | /service/abstract_selenium.py | UTF-8 | 4,444 | 2.859375 | 3 | [
"MIT"
] | permissive | import time
from selenium.webdriver.firefox.options import Options
from selenium.common.exceptions import NoSuchElementException, ElementNotInteractableException
from selenium import webdriver
from config.url import urls
from config.elements import elements
from config.user import user
class AbstractSelenium:
def... | true |
217f396603fde86fdc35418be86e2b007f25b352 | Enricho2001/Hash-Encoder-Decoder | /Hash-Encoder&Decoder/function.py | UTF-8 | 2,518 | 3.40625 | 3 | [] | no_license | def user_input():
from md5decode import md5decode
from md5encode import md5encode
from sha1encode import sha1encode
from sha1decode import sha1decode
from sha256encode import sha256encode
from sha256decode import sha256decode
from sha512encode import sha512encode
from sha512decode import... | true |
579b151c0028a33e128616d06f1713eaf03bd24a | hautxuhaihu/Online-encryption-platform | /http_client.py | UTF-8 | 554 | 2.75 | 3 | [] | no_license | # -*- coding: utf-8 -*-
# @Time : 2019/6/1 下午4:00
# @Author : xuhaihu
# @Email : 1829755168@qq.com
# @File : http_client.py
# @Software: PyCharm
import requests
import json
s = requests.Session()
headers = {'Host':'www.xxx.com'}
post_data = json.dumps({"id": 1, "to_en_data": "待测数据", "password": "12345678901... | true |
32a252b25f3680793ba7f745a111ec13f9351e60 | Davidzuluagag/PROGRAMATION | /Talleres y tareas/Taller final.py | UTF-8 | 2,846 | 3.390625 | 3 | [] | no_license | import sys
import matplotlib.pyplot as plt
import pandas as p
def graficar_archivo(archivo):
assert(archivo)
return False
archivo_correcto=True
while(archivo_correcto):
archivo=input("Ingrese el nombre del archivo:")
try:
archivo_correcto=open(archivo)
archivo_correcto=False
except FileNotFoundErro... | true |
92862ecc3e25b00c059e680c1cc0dea7948f3960 | sramachandran/PythonPractice | /tuple.py | UTF-8 | 425 | 2.609375 | 3 | [] | no_license | name = input('Enter file name: ')
if len(name) < 1 : name = "mbox-short.txt"
handle = open(name)
counts = dict()
for line in handle:
if not line.startswith("From "):continue
ly=line.split(" ")
time=ly[6]
pieces=time.split(":")
element=pieces[0]
counts[element]=counts.get(element,0)+1
tmp=list()... | true |
13832c3ccf494fe456018d6ba6e24d3af526a478 | theq629/segtok | /segtok/utils.py | UTF-8 | 111 | 3.4375 | 3 | [
"MIT"
] | permissive | def without_spans(items_with_spans):
for item_text, item_span in items_with_spans:
yield item_text
| true |
a91308569505bb98155ed14109366a450326d59d | freebz/Learning-Python | /ch18/ex18-15.mins.py | UTF-8 | 523 | 3.84375 | 4 | [] | no_license | # 최솟값 구하기
# 만점 답안
def min1(*args):
res = args[0]
for arg in args[1:]:
if arg < res:
res = arg
return res
def min2(first, *rest):
for arg in rest:
if arg < first:
first = arg
return first
def min3(*args):
tmp = list(args) # 또는 Python 2.4+에서: ... | true |
b6894c359e05ca7555ecaad5b73286624d9082ef | RoBoTics-JHJ/Backbone_reuse | /model.py | UTF-8 | 11,952 | 2.78125 | 3 | [
"MIT"
] | permissive | import sys
import torch
import torch.nn.functional as F
from torch import nn
# Activation function
class Mish(nn.Module):
def __init__(self):
super().__init__()
def forward(self, x):
x = x * (torch.tanh(torch.nn.functional.softplus(x)))
return x
class Upsample(nn.Module):
def __... | true |
47f884c1aecc133ab5033ee1ca329f100c52db62 | Jane11111/Rec_proj4 | /preclean.py | UTF-8 | 9,577 | 2.65625 | 3 | [] | no_license | # -*- coding: utf-8 -*-
# @Time : 2020-05-17 11:55
# @Author : zxl
# @FileName: preclean.py
import json
import numpy as np
import pandas as pd
import nltk.tokenize as tk
from sklearn.model_selection import train_test_split
from gensim.models import KeyedVectors
def save_data(file_path,train_path,test_path,val_pa... | true |
9e8485939c0258cf5626311213f1cd0a91a642b2 | WilliamPerezBeltran/studying_python | /clases-daniel_python/archivos/1_files_open.py | UTF-8 | 218 | 2.6875 | 3 | [] | no_license | #!/usr/bin/python -tt
# coding=utf-8
import sys
def names(filename):
f = open(filename,'r')
for line in f:
print(line)
f.close()
def main():
names(sys.argv[1])
if __name__ == '__main__':
main() | true |
06053c7f88239dd4bf1cc5da6beb725b29c165d9 | kandomere/TestOTR | /OTRTest.py | UTF-8 | 11,378 | 2.546875 | 3 | [] | no_license | import SQLfunks
from tkinter import *
import re
import sqlite3 as sql
# Создаем главный объект (по сути окно приложения)
root = Tk()
def clean_client():
"""чистка ячеек клиента"""
nameField.delete(0, END)
nameField.insert(0, "")
surnameField.delete(0, END)
surnameField.insert(0, "")
cityField... | true |
7a90ac3b6d244562140584ae3be1526c1fb4f800 | nickdelgrosso/arduino_ttl | /ttl.py | UTF-8 | 1,038 | 3.015625 | 3 | [] | no_license | __author__ = 'ratcave'
import serial
import serial.tools.list_ports as list_usb_ports
arduino_ports = [x[0] for x in list_usb_ports.comports() if 'Arduino' in x[1]]
arduino_ports = [''] if len(arduino_ports) == 0 else arduino_ports # Really sloppy workaround for if no usb arduino devices connected. Find a better... | true |
e166ef94f5baf38b7e17840248cb8d976d0cb9a9 | MathieuChevalley/CookiePolice | /prototype.py | UTF-8 | 3,760 | 2.625 | 3 | [] | no_license | import re
import traceback
import requests
output = open('output.txt', 'w')
analyticsPattern = r'(google-analytics)|' \
r'(adobe-targeting)'
xSitePattern = r'(googletagmanager\.com)|' \
r'(doubleclick\.net)'
xPlatformPattern = r'(hotjar\.com)|' \
r'(clicktale\.net)... | true |
b893b218c31f65f5496739c5bdcfa76c0115a0a5 | JosephLevinthal/Research-projects | /5 - Notebooks e Data/1 - Análises numéricas/Arquivos David/Atualizados/logDicas-master/data/2019-1/225/users/4009/codes/1671_1079.py | UTF-8 | 368 | 3.796875 | 4 | [] | no_license | from math import*
a = float(input("Lado a: "))
b = float(input("Lado b: "))
c = float(input("Lado c: "))
print("Entradas:", a, ",", b, ",", c)
if (a>0 and b>0 and c>0):
if (a+b > c and a+c>b and b+c>a):
s = (a+b+c) / 2.0
area = sqrt(s*(s-a)*(s-b)*(s-c))
A = round(area, 3)
print("Area:" , A)
else:
print("A... | true |
1d587f5ff20d0a896fc03c353e8e0bf66f3c5025 | tmackall/test | /inherit02.py | UTF-8 | 539 | 3.828125 | 4 | [] | no_license | #!/usr/bin/python
class A(object):
def f(self):
return 'class A'
class B(object):
def f(self):
return 'class B'
class C(B, A):
pass
c = C()
#
# will print from whichever is inherited first (class B)
print c.f()
class A():
def f(self):
return 'class A'
class B():
de... | true |
63fd3c977b9109f751566bddd516298493098eb7 | he9mei/python_appium | /dangdang/test_case/test_pytest_login3.py | UTF-8 | 3,468 | 2.546875 | 3 | [] | no_license |
import time
import os
import pytest
from appium import webdriver
from selenium.common.exceptions import NoSuchElementException
def setup_module():
# 启动driver
caps = {"automationName": "Appium", "platformName": "Android", "platformVersion": "8.0.0",
"deviceName": "HMKNW17727007061", "appPackage": "... | true |
977d45e2a015457df680c49eb0bf95218013293b | xhwupup/xhw_project | /4_Median of Two Sorted Arrays.py | UTF-8 | 447 | 3.4375 | 3 | [] | no_license | # 时间:20190428
# Example:
# nums1 = [1, 3]
# nums2 = [2]
# 则中位数是 2.0
# 难度:Hard(1)
class Solution:
def findMedianSortedArrays(self, nums1: List[int], nums2: List[int]) -> float:
new_nums=sorted(nums1+nums2)
new_len=new_nums.__len__() # new_len=len(new_nums)
if new_len % 2 ==0:
ret... | true |
6c65ae14fe12a85962831ef02916cf7e2802e351 | cassiopagnoncelli/hacker-rank-solutions | /botclean.py | UTF-8 | 1,003 | 3.296875 | 3 | [
"MIT"
] | permissive | # Manhattan distance.
def distance(a, b):
return abs(a[0] - b[0]) + abs(a[1] - b[1])
def parse_board(bot, board):
d = []
closest_dirty = 0
for i in range(len(board)):
for j in range(len(board[i])):
if board[i][j] == 'd':
d.append([ i, j, distance(bot, [i,j]) ])
if d[len(d)-1][2] < d[closest_dirty][2]:... | true |
5bc9b60d3bd43ecc5a72744da6b135b862df1c4d | UWPCE-PythonCert-ClassRepos/Self_Paced-Online | /students/SLammertink/Lesson03/list_lab.py | UTF-8 | 3,916 | 4.375 | 4 | [] | no_license | #! /usr/bin/env python3
# Author: SLammertink
# UW Self-paces Lesson 03 List_lab.py
# Print a fruit list
## Series 1 ##
print(' ')
print('Now we will print a list with the given fruits: ')
fruit_list = ['Apples', 'Pears', 'Oranges', 'Peaches']
print(fruit_list)
print(' ')
# Ask the user to add a fruit to the list t... | true |
1b30ce8153f15983b4eee84b1948397194f37d79 | prashantramnani/nn_likelihoods | /samplers/diagnostics_minimal.py | UTF-8 | 1,275 | 2.609375 | 3 | [
"MIT"
] | permissive | import numpy as np
# Gelman Rubin Multivariate
# ----------------------------------------------------------------------
def _get_W_mv(chains):
tmp = np.zeros((chains.shape[2], chains.shape[2]))
for i in range(chains.shape[0]):
tmp += np.cov(chains[i].T)
return tmp / chains.shape[0]
def _get_B_div_... | true |
3bfb9249b5e38df47bb4d57fed4c783281e9473b | TienVNguyen/ProgrammingFoundationsWithPython | /Lession6_Entertainment.py | UTF-8 | 704 | 2.8125 | 3 | [
"Apache-2.0"
] | permissive | import Lession6_Movie
import fresh_tomatoes
toy_story = Lession6_Movie.Movie("Toy Story",
"A story of a boy and his toys that come to life",
"http://upload.wikimedia.org/wikipedia/en/1/13/Toy_Story.jpg",
"https://www.you... | true |
c64a7fbdb71993a8a91d928b186f2a9695d4b69b | ebome/Mphil-Project | /mobility/large_trial/plot28daymedian_allmedian.py | UTF-8 | 8,217 | 2.78125 | 3 | [] | no_license | import pandas as pd
import datetime as dt
import numpy as np
from matplotlib import pyplot as plt
import merge_sensors as ms # make sure they are in same dir, run ms first
# Chopped datetime
base = dt.datetime.strptime('2019-04-26 00:00:00', '%Y-%m-%d %H:%M:%S')
datelist = pd.date_range(base, periods=400).to... | true |
2732d0c7cb1fec4f5536fdaa9508d20b0292d319 | shenwei0329/FlowControllerBasedTimeScale | /application/system_d.py | UTF-8 | 3,635 | 2.65625 | 3 | [] | no_license | # -*- coding: UTF-8 -*-
#
# A system for sample
# ================================
# Simulation of Queue
#
# 假设:
# 1)负载按时间均衡规律达到,或
# 2)负载按正态分布达到
#
#
import time
from event import event
import random
from displayer import displayer
import numpy as np
import math
random.seed = time.time()
CoX = 80
#... | true |
c653e16b7c72f9efad70aa3f16f043c47116f87e | azaeldrm/Levichess | /levichess/piecetypes/queen.py | UTF-8 | 907 | 3.15625 | 3 | [] | no_license | from levichess.mainfiles.piece import Piece
from levichess.mainfiles.moverules import MoveRules
class Queen(Piece):
"""description of class"""
def __init__(self,colorID,numberID):
Piece.__init__(self,colorID,5)
self.piecetype = 'QUEEN' + ' ' + str(numberID)
self.numberID = numberID
def MoveType(self,yf,xf):... | true |
48e8a6ff034605fb2f00e21a86307b259e808623 | FernandoSinisi/Algoritmos-Programacion-I-1C-2016 | /Programas_python/15.6 recursion_numero_triangular.py | UTF-8 | 200 | 3.5625 | 4 | [] | no_license | def numero_triangular(n):
if n==1:
return 1
return n+numero_triangular(n-1)
print(numero_triangular(1))
print(numero_triangular(2))
print(numero_triangular(3))
print(numero_triangular(4))
| true |
90ed66e50df8c420fedb103a8fbc61f5f757572b | tuananh12101997/MitiGAN_neurips21 | /MitiGAN_single_label/attacks/class_spsa.py | UTF-8 | 7,631 | 2.84375 | 3 | [] | no_license | import pdb
import matplotlib.pyplot as plt
import numpy as np
import torch
def clamp(input, min=None, max=None):
ndim = input.ndimension()
if min is None:
pass
elif isinstance(min, (float, int)):
input = torch.clamp(input, min=min)
elif isinstance(min, torch.Tensor):
if min.nd... | true |
044a90174b198fa3b4691a78f8941ab2f594b5ea | Aasthaengg/IBMdataset | /Python_codes/p03610/s139015522.py | UTF-8 | 101 | 3.09375 | 3 | [] | no_license | S = input()
ans=[]
for i in range(len(S)):
if i%2==0:
ans.append(S[i])
ans=''.join(ans)
print(ans) | true |
9433bcb32227891fa9e2ee4ed5b9577159137e12 | Alex-Dumitru/python | /APPS/playing_with_pandas/geocoding_addresses.py | UTF-8 | 2,035 | 3.796875 | 4 | [] | no_license | import pandas as p
from geopy.geocoders import Nominatim # to use geocoders internet connection is needed, to return latitude and longitude on the given address
df1 = p.read_csv('supermarkets.csv')
nom = Nominatim(scheme='http')
if False:
address = nom.geocode('3666 21st St, San Francisco, CA 94114')
print(a... | true |
a014986b657fc5a9572be4824c172b2233af05c4 | jehyn923/personal_projects | /Coding Test/Python/Programmers_다리를 지나는 트럭.py | UTF-8 | 1,329 | 3.234375 | 3 | [] | no_license | def solution(bridge_length, weight, truck_weights):
answer = 0
passing_queue = []
passing_time_queue = []
passed = []
total = len(truck_weights)
while len(passed)<total:
#턴 종료, 시간 지나게 하기
answer+=1
for i in range(len(passing_time_queue)):
#print(i)
... | true |
14a55ab873b64efd61a791a88fd0eacf00357641 | zhangyuespec/numpy_learning- | /显示youtube点赞数据.py | UTF-8 | 840 | 2.65625 | 3 | [] | no_license | import numpy as np
from matplotlib import pyplot as plt
from matplotlib import font_manager
# 设置字体
my_font = font_manager.FontProperties(fname='C:\Windows\Fonts/STKAITI.TTF')
# 设置框图大小
plt.figure(figsize=(20, 8), dpi=80)
# 本地文件数据输入
x1_file_path = './youtube_video_data/US_video_data_numbers.csv'
x2_file_pa... | true |
a2c8012c4e93b7e45fa13b18f8625ab5b944c3ef | MTE1991/Python-scripts | /sphere.py | UTF-8 | 314 | 3.765625 | 4 | [] | no_license | from math import pi
class Sphere:
def __init__(self,radius): # Initialization...
self.r = radius # attribute(s)
def area(self):
a = 4*pi*self.r**2
return round(a,4)
def volume(self):
v = (4/3)*pi*self.r**3
return round(v,4)
s1 = Sphere(2)
print(s1.volume()) | true |
42bebb6955d814b3ca9d5b5a71ef849f2ef85898 | aydex/TDT4120-AlgDat | /Oving7/oving7.py | UTF-8 | 1,359 | 3.15625 | 3 | [] | no_license | def merge2(A, p, q, r):
n1 = q - p + 1
n2 = r - q
L = [n1 + 1]
R = [n2 + 1]
for i in xrange(0, n1):
L[i] = A[p + i - 1]
for j in range(0, n2):
R[j] = A[q + j]
L[n1 + 1] = float(1e3000)
R[n2 + 1] = float(1e3000)
i = 1
j = 1
for k in xrange(p, r):
if L[i... | true |
34b5dd80b88c72ab06553cc0452b7c7b011f3b62 | ziggi24/DnDRand | /DnDGen.py | UTF-8 | 8,569 | 3.15625 | 3 | [] | no_license | #DnDGen Script
#
#This script will take in a players name, and then assign a surname, title, and roll
#the players stats. Once this is done the script will assign a class, and race based on
#stats, and also assign an age, and some starting equipment.
#
#the public repo for this script can be found at:
#https://githu... | true |
eac4ac8436190091f2c5b771d7f56e75ef68ab0b | AngusMonroe/academicConference | /academicConference/spiders/A-03.py | UTF-8 | 1,047 | 2.8125 | 3 | [
"MIT"
] | permissive | from scrapy.spiders import Spider
import csv
import re
class A03Spide(Spider):
# name of the crawler(primary key)
name = 'A-03'
# urls which contain pages you want
start_urls = ['http://www.cstam.org.cn/channel/103.html#boxs']
for i in range(2, 51):
start_urls.append('http://www.cstam.org.... | true |
f793d28cdfaba91c65fc120d3d7a4b766753bf4f | paolofinelli/pyelsepa | /test/test_predicates.py | UTF-8 | 321 | 2.578125 | 3 | [
"Apache-2.0"
] | permissive | from cslib.predicates import (is_length, is_none, is_)
from cslib import units
def test_unit_predicates():
assert not is_(0)(1)
assert (is_(0) | is_(1))(1)
assert (is_none | is_(0))(0)
assert is_length(1 * units.cm)
assert is_length(30.0 * units.mm)
assert (is_none | is_length)(1 * units.cm)
... | true |
1af571b1182a71a8865a2c44bc732fb499f53c2a | pmvaishakh3/VaishusPythonExercises | /json.py | UTF-8 | 180 | 2.578125 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Wed May 8 15:07:11 2019
@author: vpm6
"""
import json
x = '{"name":john","city":"newyork"}'
y = json.loads(x)
print (y["age"]) | true |
4f7408fa57bde8cc4dbeaae6b6e72daee02e10bf | chemplife/Python | /python_core/polymorphism.py | UTF-8 | 7,521 | 3.71875 | 4 | [] | no_license | '''
Polymorphism:
-> ability to define a generic type of behavior that will (potentially) behave differently when applied to different object types
-> Duck Typing: If it walks like a duck and quacks like a duck, it is a duck.
-> If an object has certain behavior, than we can use that object without caring what that ... | true |
c4a0c1bebd267c7fe046e50eb749972f3a7a9f72 | wensheng/JuicyRaspberryPie | /api/python/examples/minecraftstuff.py | UTF-8 | 40,584 | 3.34375 | 3 | [
"BSD-2-Clause"
] | permissive | #www.stuffaboutcode.com
#github.com/martinohanlon/minecraft-stuff
#Raspberry Pi, Minecraft - Minecraft 'stuff' extensions
# Modified for JuicyRaspberryPie
# remove all dependencies on mcpi (minecraft, block, util, Vec3)
import time
import math
class Vec3(list):
idxmap = {'x': 0, 'y': 1, 'z': 2}
def __init__... | true |
22405ea8a0a69aee26c4d521e77569c4f4c2260e | Ashgomathi/ash | /48.py | UTF-8 | 68 | 2.84375 | 3 | [] | no_license | sat=int(input())
cat=input().split()
mat=cat[int(sat/2)]
print(mat)
| true |
d87cda12bfe204d564a48acdb0e42b9bfba37390 | VladGavra98/Flight_Dyanmics_SVV | /MassBalanceGraph.py | UTF-8 | 924 | 2.734375 | 3 | [] | no_license | import numpy as np
from massbalance import *
#FOR GRAPH
nsteps= 100
x = np.linspace(10,timelst[-1],nsteps)
y = []
for i in range(len(x)):
if 52*60 < x[i] < 53*60:
print('hit')
y.append(cg(x[i], True))
else:
y.append(cg(x[i],False))
y1 = cg(x[x<52*60],False)
yshift =cg(x[52*60 < x],T... | true |
015ff23150b29967dc5813aad358af176151e31c | rkunnawa/MLaaS4HEP | /src/python/workflow.py | UTF-8 | 2,487 | 2.53125 | 3 | [
"MIT"
] | permissive | #!/usr/bin/env python
#-*- coding: utf-8 -*-
#pylint: disable=
"""
File : workflow.py
Author : Valentin Kuznetsov <vkuznet AT gmail dot com>
Description: MLaaS4HEP workflow, it provides example how to read ROOT files and train over them ML model
"""
# system modules
import os
import sys
import json
import ti... | true |
064f077879d2d77328999d867b5913a24bc2f1e0 | Yi-27/Spiders | /tutorial/tutorial/pipelines.py | UTF-8 | 5,967 | 2.78125 | 3 | [] | no_license | # Define your item pipelines here
#
# Don't forget to add your pipeline to the ITEM_PIPELINES setting
# See: https://docs.scrapy.org/en/latest/topics/item-pipeline.html
# useful for handling different item types with a single interface
from itemadapter import ItemAdapter
from scrapy.exceptions import DropItem # 一个丢... | true |
e132ebdbb9aba259c999d4b771e7da594dc684c2 | stSedge/Telegram-Bot | /config.py | UTF-8 | 838 | 2.53125 | 3 | [] | no_license | token = '1757629597:AAEWUwMgAtdk0jE-qysj5K3VzCb6jVeCohA'
api = 'f733b7fb270aea3de9c152e4bfc7225d'
id = '03d88dc0'
text_2 = "Если что-то идет не так, то попробуйте повторить свой запрос на английском. (на самом деле все повара устали и хотят спать)"
text_3 = 'Добавили. Чтобы посмотреть список понравившихся Вам блюд,... | true |
a66912ee1aed83d3c122133f5958d0dea1f2232f | Manish-Kumar317/Python-Assgn. | /Program5.py | UTF-8 | 104 | 3.109375 | 3 | [] | no_license | import sys
i=1
print('Argument List:')
while (i<(len(sys.argv))):
print(str(sys.argv[i]))
i=i+1
| true |
c09f95570dd0cf43b4f8478434e9c96e383faf63 | GeoffreyKarnbach/Fake-News-Detector-AI | /src/detection.py | UTF-8 | 1,772 | 2.984375 | 3 | [] | no_license | from name_recognition import get_human_names
import math
import tensorflow as tf
import pickle
import numpy as np
def get_exclamation_coefficient(text):
# In average, with training data set, (2 times more ! for fake than non fake news) but only 1 in 3 articles (fake news) had !
amount = text.count("!")
... | true |
8507dd0d61e807a809b6db58eed42a8ff72fd23f | pminkov/wip | /codewars/alt_split.py | UTF-8 | 713 | 3.5625 | 4 | [] | no_license | class Node(object):
def __init__(self, data=None):
self.data = data
self.next = None
class Context(object):
def __init__(self, first, second):
self.first = first
self.second = second
def build_list(ar):
n = Node(ar[0])
fi = n
for i in range(1, len(ar)):
n.next = ... | true |
a8062e8fb7bf105b19e2395fc276f571a893e09c | muditgupta68/Codewayy_python_series | /Python_Task6/quest1.py | UTF-8 | 1,165 | 3.65625 | 4 | [] | no_license | # -----------------------------------------------------START------------------------------------------------------------
# function initialised
def speedCheck(speed):
if 70 > speed:
print("OK")
print('\n')
else:
demPoint = (speed - 70) / 5
if demPoint > 12:
print("L... | true |
b8ed25bc7d54cfa983aff25a199d54a22ed75eb8 | panalysis/excel_writer | /main.py | UTF-8 | 6,530 | 2.71875 | 3 | [] | no_license |
import openpyxl
from docx import Document
from docx.shared import Cm
from docx.enum.style import WD_STYLE_TYPE
doc_items = {
'user_stories': [],
'reporting_requirements': []
}
class UserStory:
def __init__(self, id=0, story=None, reqs=None, priority=None):
self.id =id
self.description =... | true |
d059659a5b5a99292627565416ab1697f9d77dcb | mattfenwick/Fourier | /src/nonuniform.py | UTF-8 | 2,225 | 2.671875 | 3 | [] | no_license | import numpy.random
import numpy.fft
from . import ftime
from . import wip
def fnoise(noise):
return lambda _: numpy.random.normal(scale=noise) + 1j * numpy.random.normal(scale=noise)
def signal(amp, omega, t):
offset = 0
return ftime.csComplex(amp, omega, offset, t)
def full(amp, omega, t, noise):
... | true |
81e9465e30095a7db5c37f628f04269e03080a9a | max644/advent_of_code | /2017/10/solve.py | UTF-8 | 866 | 3.34375 | 3 | [] | no_license | INPUT_FILE = "input.txt"
LIST = range(256)
#[0]1 2 3 4
# 2 1 0[3]4
# 4 3 0[1]2
# 4[3]0 1 2
# 3 4 2 1[0]
#
#
def reversePartOfList(ll, position, length):
for idx in range(length/2):
idx1 = (position + idx) % len(ll)
idx2 = (position + length - idx - 1) % len(ll)
pivot = ll[idx1]
ll[idx1] = ll[idx2]
ll[idx2... | true |
78552773be51c90219d8918a5d309967536f7dd7 | elemoine/adventofcode | /2018/day04/part1.py | UTF-8 | 1,393 | 3.03125 | 3 | [] | no_license | import re
import datetime
from collections import defaultdict
recordpattern = re.compile(r"\[(.*)\] (.*)")
guardbeginsshiftpattern = re.compile(r"Guard #(\d+) begins shift")
timeformat = "%Y-%m-%d %H:%M"
def readrecords(inputfile):
with open(inputfile) as f:
lines = [l.strip() for l in f]
records = ... | true |
398d7104edd1064fe872d9861204162394e47937 | dr-dos-ok/Code_Jam_Webscraper | /solutions_python/Problem_200/3615.py | UTF-8 | 833 | 3.28125 | 3 | [] | no_license | #Oversized Pancake Flipper
def check(num):
tmp = list(str(num))
ret = []
for idx, value in enumerate(tmp):
if idx == 0:
continue
if value < tmp[idx-1]:
tmp[idx-1] = str(int(tmp[idx-1])-1)
#print(tmp, tmp[:idx-1], tmp[idx:])
ret = tmp[:idx]
... | true |
06ca5fdd049e74b13d94363e7bf3b7e4f9fe91b6 | PhilipNelson5/DataScienceFinalProject | /main.py | UTF-8 | 706 | 2.828125 | 3 | [] | no_license | #%%
from cards import *
from scrape import *
import numpy as np
import pandas as pd
pd.set_option('display.max_columns', None)
cards = make_all_cards_df()
#%%
filepath = "html/metagame.html"
matrix = scrape_metagame_matrix_filepath(filepath)
print(matrix)
#%%
url = 'https://mtgmeta.io/decks/19010'
url = 'https://mt... | true |
a6d341e91eda58735153c5974788193674107679 | juarezpaulino/coderemite | /problemsets/Codeforces/Python/A35.py | UTF-8 | 245 | 2.671875 | 3 | [
"Apache-2.0"
] | permissive | """
*
* Author: Juarez Paulino(coderemite)
* Email: juarez.paulino@gmail.com
*
"""
F=open('input.txt','r')
W=open('output.txt','w')
I=lambda:[*map(int,F.readline().split())]
x=I()[0]
for _ in[0]*3:
u,v=I()
if x==u:x=v
elif x==v:x=u
W.write(str(x))
W.close()
| true |
6eb40953c67744716badc21d25d34404c4aa7069 | cielavenir/procon | /hackerrank/standardize-mobile-number-using-decorators.py | UTF-8 | 204 | 2.859375 | 3 | [
"0BSD"
] | permissive | #!/usr/bin/python
import sys
if sys.version_info[0]>=3: raw_input=input
z=[]
for i in range(int(raw_input())):
s=raw_input().rstrip()[-10:]
z.append('+91 '+s[0:5]+' '+s[5:])
z.sort()
for e in z:print(e) | true |
5e2f94b2ae639a537848895748fdaa6969d40cad | JuneKim/algorithm | /ProblemSolving/LeetCode/1886_Determine Whether Matrix Can Be Obtained By Rotation.py | UTF-8 | 913 | 3.34375 | 3 | [] | no_license | class Solution:
def findRotation(self, mat: List[List[int]], target: List[List[int]]) -> bool:
# 90 degree: M(i,j) -> M(j, N-j)
N = len(mat)-1
# 90 degree
tmp_mat = mat
while True:
tmp_mat = self.rotation90(tmp_mat)
if tmp_mat == target:
... | true |
2ab8a30d4f0bdb4a9e095daa114d740c0c1f0c67 | darkelement1987/PGScout | /pgscout/moveset_grades.py | UTF-8 | 2,243 | 2.546875 | 3 | [
"Apache-2.0"
] | permissive | import json
import os
import requests
from bs4 import BeautifulSoup
from pgscout.utils import get_move_name
all_movesets = {}
# ===========================================================================
def read_moveset_grades():
global all_movesets
with open('pokemon_moveset_grades.json', 'r') as infil... | true |
a8326d5b61b00cccf1acc093f57466f70814b815 | Kanres-GH/pygame-projects | /Tests/changing title.py | UTF-8 | 407 | 2.859375 | 3 | [] | no_license | import pygame
import sys
import random, time
FPS = 60
titles = ['1', '2', '3', '4', '5']
pygame.init()
pygame.display.set_mode((600, 400))
clock = pygame.time.Clock()
pygame.display.update()
while True:
pygame.display.set_caption(str(random.randint(1, 100)))
clock.tick(FPS)
for i in pygame.event.get()... | true |
777ef57ffd28e497ae0662edb50cb5972ab41956 | nayakshweta/design_patterns | /Interpreter.py | UTF-8 | 560 | 3.359375 | 3 | [] | no_license | import abc
class AbstractExpression(metaclass=abc.ABCMeta):
@abc.abstractmethod
def interpret(self):
pass
class NonterminalExpression(AbstractExpression):
def __init__(self, expression):
self._expression = expression
def interpret(self):
self._expression.interpret()
c... | true |
97a4fd5d2dd1ee13a6d802970c03396e3c058e62 | madeibao/PythonAlgorithm | /PartA/PyFrogClimStairs青蛙跳台阶非递归版本.py | UTF-8 | 178 | 3.625 | 4 | [] | no_license |
def climb():
n = int(input())
if n == 1 or n == 2:
return n
a, b = 1, 2
for i in range(3,n+1):
a, b = b, a+b
return b
print(climb())
| true |
6c3044e6fc29758f68aa1a3d5523cd03225f67fc | ChristopherGS/rolltec_motion | /ML_Sandbox/utilities.py | UTF-8 | 6,895 | 2.671875 | 3 | [] | no_license | from __future__ import division
import glob
import os
import numpy as np
import pandas as pd
from dateutil import parser
from datetime import datetime
import config
DIR = os.path.dirname(os.path.realpath(__file__))
def format_time(ts):
"""round microseconds to nearest 10th of a second"""
t = pd.to_datetim... | true |
b288e2c3b4097bc5bd29bcb4810da6a4f1cf379c | wencan/spider-library | /kehuan_xinty665.py | UTF-8 | 6,981 | 2.578125 | 3 | [] | no_license | #!/usr/bin/env python3
# coding: utf-8
import requests
import lxml
import lxml.html
import lxml.etree
import urllib.parse
import parse
import os.path
import io
from docx import Document
home = "http://www.readers365.com/kehuan/"
encoding = "GB18030"
def get(url, encoding='utf-8', retry=True):
session = requests... | true |
7ea49716a70c1c55ad8951c1c227c5d413612ed9 | abhenson/Kal | /kal-public.py | UTF-8 | 2,699 | 2.84375 | 3 | [] | no_license |
#kal-public.py writen by A.B.Henson January 2013.
#the script goes to the economist website, gets the redirect url of that week's issue, then it extracts the locating of the Kal's cartoon image and saves it. It uses gmail as the SMTP server to email the cartoon to my email address.
#script has been altered to remove p... | true |
6f83a8c7a429e12ac313218d290a5e7a9ddf7f5a | basicskywards/data_structures_algorithms | /Binary_Trees/binary_tree_traversal.py | UTF-8 | 854 | 3.8125 | 4 | [] | no_license | from binary_tree_base import Binary_Tree_Node
def tree_traversal(root):
if root:
# Preorder: Process the root before the traversals/walk of left and right children
print('Preorder: %d' % root.data)
tree_traversal(root.left)
# Inorder: Process the root after ther traversal of left child and before the travers... | true |
eb37f69e1af75c60fed2535d8f89b849b270cc63 | LucasTorres19/Tower-Defense-Game | /enemies.py | UTF-8 | 2,887 | 3.296875 | 3 | [] | no_license | import pygame as py
import random
#Clases de los enemigos.
class Cyclops(py.sprite.Sprite):
def __init__(self,x ,y):
py.sprite.Sprite.__init__(self)
self.sprite = py.image.load('sprites/Cyclops.png').convert()
self.rect = self.sprite.get_rect()
self.posX = x
self.posY ... | true |
98279bcd035d2644936a103196747008d98b49b9 | nataliasm23/distancias_minkowski | /minkowski.py | UTF-8 | 357 | 3.078125 | 3 | [] | no_license |
# coding: utf-8
# In[1]:
from scipy.spatial.distance import pdist
# In[2]:
P1 = [-3, 0, 6]
P2 = [-1,-1,-1]
P3 = [ 3, 4, 3]
P4 = [10, 0, 0]
P5 = [ 0, 9,10]
# In[3]:
X = [P1,P2,P3,P4,P5]
# In[4]:
Y = pdist(X, 'minkowski', p=1)
print(Y)
# In[5]:
Y = pdist(X, 'minkowski', p=3)
print(Y)
# In[6]:
Y = ... | true |