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 |
|---|---|---|---|---|---|---|---|---|---|---|
7cf4d60185b73a50e372ea21079b6be8fb7eb493 | danielmorine/MovieTrailerWebSite | /media.py | UTF-8 | 1,157 | 2.984375 | 3 | [] | no_license | import webbrowser
class Movie():
"""
Classe responsavel por instanciar os componentes:
movie_title = titulo do filme, movie_storyline = sinopse,
poster_image = poster do filme, movie_direcao = diretor do filme,
movie_classificacao = classificacao do filme,
movie_du... | true |
7f58c735feff8b23ea03fc26eeaef2d303ae162c | roiei/algo | /leet_code/641. Design Circular Deque.py | UTF-8 | 1,919 | 3.578125 | 4 | [] | no_license | import time
from util.util_list import *
from util.util_tree import *
import copy
import collections
class MyCircularDeque:
def __init__(self, k: int):
self.n = k+1
self.data = [0]*self.n
self.front = 1
self.rear = 0
def insertFront(self, value: int) -> bool:
... | true |
c3a82d895ac7f90a7adfa6fa901d4a42354f71f0 | yiyitao/Project-Euler | /025/problem_025.py | UTF-8 | 274 | 2.921875 | 3 | [] | no_license | #-*- coding: utf-8 -*-
if __name__ == '__main__':
f1 = 1
f2 = 1
cnt = 3
limit = 10**1000
while True:
fn = f1+f2
if fn >= limit:
print("answer is %d"%(cnt))
break
f1 = f2
f2 = fn
cnt = cnt+1 | true |
7bd7f13584d926e585f80404a3ee506157050313 | DaveSoftLLC/EngineZ | /BaseGame.py | UTF-8 | 28,247 | 2.78125 | 3 | [
"MIT"
] | permissive | #James Xu and Zhehai (Mark) Zhang
#Outcast: The Game
#File of classes used in both client and server
import pickle #IO serialization
import socket #Networking
import threading #SImultaneous Code
from math import * #sin, cos, radians
from pygame import * #game uses pygame for display
from random import* #Random processi... | true |
5c6c2a35eda018fc2bad7d7291e36378fbeee536 | Dev-Dominic/AnalyzeInstagramPages | /InstagramPullData.py | UTF-8 | 2,989 | 2.859375 | 3 | [] | no_license | #!/usr/bin/env python3
# Imported packages
from selenium import webdriver
from selenium.webdriver.common.action_chains import ActionChains
import sys
import csv
POST_LIMIT = 24
def getAllInfo(accounts):
def instaPageQuery(queryAccount, webdriverVar):
# TODO Refactor Code
# Used to convert num... | true |
4fba618d85d587c66f3116ed6d00b35905e7ccc6 | anitoaeiteodor/sort-visualiser | /main.py | UTF-8 | 3,328 | 3.5 | 4 | [] | no_license | from graphics import *
from random import *
from time import sleep
screen_width = 800
screen_height = 600
buff_width = 50
buff_height = 200
# bar_width = 40
bar_height = 500
max_range = 1000
nbs_count = 200
bar_width = screen_width / nbs_count
def swap(i, j, nbs, bars):
aux = nbs[i]
nbs[i] = nbs[j]
nbs[j]... | true |
4f56b42b15a609f107c518d13e8eba53d78e26e5 | Vincent105/python | /04_The_Path_of_Python/11_function/0106_list.py | UTF-8 | 849 | 3.875 | 4 | [] | no_license | def product_msg(customers):
str1 = "親愛的: "
str2 = "本公司將於2020年舉行發表會"
str3 = "總經理敬上"
for customer in customers:
msg = str1 + customer + '\n' + str2 + '\n' + str3
print(msg, '\n')
members = ['vincent', 'esther', 'john']
product_msg(members)
# 傳遞一般變數與串列變數的區別
def mydata(n):
print("(... | true |
2c35c0d2defb4cfe6be36326519dcc4541e3dfd2 | vibhorverma2015/course | /python/binary_search/lower_bound.py | UTF-8 | 301 | 3.484375 | 3 | [] | no_license | A = [1, 2, 2, 2, 4, 5, 6, 6, 7]
target = 3
def getlowerbound(A, target):
prev = 1
for i in range(0, len(A)):
if A[i] == target:
return i
elif A[i] > target:
return prev
prev = i
if __name__ == "__main__":
print(getlowerbound(A, target))
| true |
ae6d88a6458528cf2da4435574e0ae2bb123f068 | priyank-py/GettingStarted | /Instance_Variable_vs_Class_Variable.py | UTF-8 | 316 | 3.46875 | 3 | [] | no_license | '''
Created on Feb 18, 2019
@author: Priyank007
'''
class Girls:
'''
classdocs
'''
gender = "Female"
def __init__(self, name):
'''
Constructor
'''
self.name = name
print(self.name)
Sandy = Girls('snady')
print(Sandy.gender)
| true |
233a228c9f5c172a41ef573ea744b1bc90b558d2 | hafke88/Python-Assignments | /scriptAssignment.py | UTF-8 | 1,125 | 2.515625 | 3 | [] | no_license | import os
fName = 'Apple.txt'
fPath = 'C:\\Script_Assignment\\'
apple = 'C:\\Script_Assignment\\Apple.txt'
banana = 'C:\\Script_Assignment\\Banana.txt'
cherries = 'C:\\Script_Assignment\\cherries.txt'
dates = 'C:\\Script_Assignment\\dates.txt'
elderberry = 'C:\\Script_Assignment\\elderberry.txt'
fig = 'C:\\Scri... | true |
d3e2d9c9f7bab3a5e4ba0be7ae661e4c6eb31a8b | kyledugan/linear-algebra | /week6/forward_substitution.py | UTF-8 | 346 | 2.53125 | 3 | [] | no_license | import numpy as np
def forward_substitution(A, b):
if len(A.shape) != 2 or len(b.shape) != 2:
return "FAILED"
if A.shape[0] != A.shape[1]:
return "FAILED"
if b.shape[0] != A.shape[0] or b.shape[1] != 1:
return "FAILED"
for i in range(A.shape[0]):
b[i+1:,0] -= b[i,0]... | true |
e3cde3471c17398a84452a2f5beefeaa0a7fe143 | Prkr88/Hackathon_BGU2019 | /Parser/Ranker.py | UTF-8 | 2,164 | 2.5625 | 3 | [] | no_license | from numpy import sqrt
from numpy import log2
class Ranker:
h_other_words = {}
h_cos_data = {}
h_curr_exc = {}
vocabulary = {}
const = 1000
i_N = 103
sigma_w_iq = 0
sqrt_w_iq = 0
i_this_year = '2019'
this_exercise = ''
s_course_id = ''
def __init__(self, vocabulary):... | true |
ef75b202768b85ba79b3334114b21f5b8c025019 | listar0810/jupyterlab-snippets-multimenus | /example_snippets/multimenus_snippets/NewSnippets/Python/Defining classes/Simple class.py | UTF-8 | 255 | 2.796875 | 3 | [
"BSD-3-Clause"
] | permissive | class BPSomeClass(object):
r"""Describe the class"""
def __init__(self, arg1, arg2):
self.attr1 = arg1
self.attr2 = arg2
def attribute1(self):
return self.attr1
bp_obj = BPSomeClass("a", 2.7182)
bp_obj.attribute1() | true |
587750aa54239d7a7d6cda68d2a611d70806ea49 | WangyaqiAlly/burned_in_captions | /mledge-master-8be9042002b67467223306dbefc7bc8e772a95d9/sandbox/zhengji/classify_imagenet/retinaUpload.py | UTF-8 | 10,929 | 2.515625 | 3 | [] | no_license | import h5py
import os
import numpy as np
import tensorflow as tf
import matplotlib.pyplot as plt
RANDOM_MODE = 1
ENTROPY_MODE = 2
CERTAINTY_MODE = 3
SRN1_MODE = 4
SRN2_MODE = 5
CROSS_ENTROPY_MODE=6
class Uploader(object):
def __init__(self, source, dest, subdir_source='default', subdir_dest='default'):
s... | true |
f12061de1b164206b311f6035b46b733a5911bee | lovehhf/LeetCode | /389_找不同.py | UTF-8 | 1,045 | 3.828125 | 4 | [] | no_license | # -*- coding:utf-8 -*-
__author__ = 'huanghf'
"""
给定两个字符串 s 和 t,它们只包含小写字母。
字符串 t 由字符串 s 随机重排,然后在随机位置添加一个字母。
请找出在 t 中被添加的字母。
示例:
输入:
s = "abcd"
t = "abcde"
输出:
e
解释:
'e' 是那个被添加的字母。
"""
class Solution:
def findTheDifference(self, s: str, t: str) -> str:
ret = 0
for c in s + t:
... | true |
23fac5e761ced80f47616a21c9cd65c5d030613a | myxahev/Home_work_5 | /5.3.py | UTF-8 | 572 | 2.921875 | 3 | [] | no_license | # Создать текстовый файл (не программно).
# Построчно записать фамилии сотрудников и величину их окладов (не менее 10 строк).
# Определить, кто из сотрудников имеет оклад менее 20 тысяч, вывести фамилии этих сотрудников.
# Выполнить подсчёт средней величины дохода сотрудников.
# Пример файла:
# Иванов 23543.12
# Петров... | true |
f988f7afd6a954ccb4c0a61a9e3ff702b88b8282 | rudyn2/cbir | /engine.py | UTF-8 | 9,937 | 3.046875 | 3 | [
"MIT"
] | permissive | import glob
from tqdm import tqdm
from features import *
from distances import *
from typing import List
import torch
import matplotlib.pyplot as plt
import warnings
warnings.filterwarnings("ignore")
plt.rcParams.update({'font.size': 25})
def zero_pad(obj, reference_shape: tuple):
result = []
for channel in ... | true |
36369b5e549fb8675172b7ed9f19400b9070a34f | ndarwin314/genshin-math | /gacha.py | UTF-8 | 6,388 | 2.8125 | 3 | [] | no_license | import random
import bisect
import numpy as np
import time
import matplotlib.pyplot as plt
import multiprocessing as mp
import os
rampRate = 0.06
P = 0.006
"""characterProbability = [0]
for i in range(1, 74):
characterProbability.append(P * pow(1-P, i - 1) + characterProbability[-1])
for i in range(74, 90):
#... | true |
7fa61a12f784272c954cf3ca40584ffc11ea441c | azunic/pyhton-tasks | /pmf_vjezba_5/zad_5_4.py | UTF-8 | 468 | 3.734375 | 4 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Sun Aug 9 14:42:40 2020
@author: Ana
"""
#Napišite program u kojem korisnik unosi deset brojeva. Ispi
#sati umnožak brojeva, sumu parnih i sumu neparnih brojeva.
suma = 0
suma_neparnih = 0
mnozenje = 1
for i in range(0, 10):
x = int(input("Unesite ", i + 1, ". broj"))
... | true |
e6334378d185f20330bcb68936c01bebda65c953 | go2bed/python-oop | /oop/oop/Main.py | UTF-8 | 465 | 3.84375 | 4 | [] | no_license | from oop.oop.Book import Book
class Dog(object):
species = 'mammal'
def __init__(self, breed, name):
self.breed = breed
self.name = name
def area(self):
return self.species
def set_name(self, name):
self.name = name
def get_name(self):
return self.name
... | true |
55b5c05b2db8c11cc12a71285828dfe5507d79ec | lorenzoalfieri/crypto | /hotp-topt.py | UTF-8 | 2,057 | 2.59375 | 3 | [] | no_license | #!/usr/bin/python3
import hmac
import hashlib
import struct
import time
import base64
import sys
comp = "059036"
key_google2 = "JBSWY3DPEHPK3PXP"
key_google = 'TRSCA5XBPDTSZCI2WNQWBX623XPBV6YB'
def test_hotp(secret, counter):
key_byte = base64.b32decode(key_google, True)
counter_byte = struct.pack(">Q", coun... | true |
4aef17541418359ba43a4a10b4228ef34ae48387 | geethna/CTF-writeups | /TGhack2019/n00bs.py | UTF-8 | 703 | 3 | 3 | [] | no_license | from pwn import *
import hashlib
p = remote('hash.tghack.no', 2001)
#hashes are : MD5 , SHA256 , SHA512
p.recvuntil('Good luck!\n')
for i in range(100):
p.recvuntil('using ')
hash = p.recvuntil(', ')
hash = hash[:len(hash)-2]
p.recvuntil('please: ')
string = p.recvline().strip()
print hash,strin... | true |
27d4e3b851576a59c7e8d38b8756889ba24a90ee | jojoanne/django_3 | /project3/views.py | UTF-8 | 1,466 | 2.546875 | 3 | [] | no_license | from django.http import HttpResponse
import datetime
from django.template.loader import get_template
from django.template import Context
# to use render_to_response
from django.shortcuts import render_to_response
# to use render
from django.shortcuts import render
def hello(request):
return HttpResponse("hello, w... | true |
2dbc6c755f73f84afa00846d762061971df009b8 | mulan101/deeplearnning | /tensorflow/prototype/classification/multinomial/example3_testdata.py | UTF-8 | 1,793 | 3.203125 | 3 | [] | no_license | '''
Created on 2017. 3. 20.
@author: 한제호
real데이터와 test데이터 분리 sample
'''
import tensorflow as tf
#학습데이터
x_data = [[1, 2, 1], [1, 3, 2], [1, 3, 4], [1, 5, 5], [1, 7, 5], [1, 2, 5], [1, 6, 6], [1, 7, 7]]
y_data = [[0, 0, 1], [0, 0, 1], [0, 0, 1], [0, 1, 0], [0, 1, 0], [0, 1, 0], [1, 0, 0], [1, 0, 0]]
#테스... | true |
7a840f65402be37c9dbc96fa33866b6d12909c4e | ariesduanmu/python3_standard_library | /09_cryptography/02_hmac/hmac_defence.py | UTF-8 | 1,453 | 3.34375 | 3 | [] | no_license | import io
import pickle
import hmac
from helpers.simple_object import SimpleObject
from helpers.secret_digest import make_digest
RIGHT_SECRET = b'YELLOW SUBMARINE'
WRONG_SECRET = b'OH I DONOT KNOWN'
def send_data(data, secret):
out_s = io.BytesIO()
data = SimpleObject(data)
pickled_data = pickle.dumps(data)
di... | true |
3b232fcb0a26ff586f1de2db0671d4ffe4916732 | RutgersCyberKnights/BinaryExploitation | /HeapBufferOverflow/part2/htteclient.py | UTF-8 | 3,557 | 2.953125 | 3 | [] | no_license | import socket
import argparse
import sys
'''
OVERFLOWS INTO OTHER MEMORY SEGMENTS:
This a python client program for making and parsing HTTE request.
It is apart of the lectures of Rutgers Cyber Knights Computer
Hacking Club (R)
IMPORTANT INFO:
make sure you HAVE MADE A BACKUP OF YOUR /etc/passwd BEFORE TRYING.
m... | true |
d1abb23b2b36bb375ae6b0cc2c810a431ada6501 | jazyrcp/Python | /assign_2/assign_6.py | UTF-8 | 154 | 3.6875 | 4 | [] | no_license | size=int(input("Enter the size of the list:"))
li=[]
c=0
for i in range(0,size):
t=int(input("value:"))
li.append(t)
c+=t
print(li)
print("Sum=",c) | true |
5c640187e636f667ba5562a9f122b90aac055005 | hanifelo/keras_examples | /mnistCONV2D.py | UTF-8 | 1,315 | 2.515625 | 3 | [] | no_license | from keras.datasets import mnist
(trainData,trainTarget),(testData,testTarget)=mnist.load_data()
from keras import models
from keras import layers
from keras import regularizers
from keras.utils import to_categorical
trainData=trainData.reshape(60000,28,28,1)
trainData=trainData.astype('float32')/255
testData=testData.... | true |
5ef6683f0ea3d66b02843e007e7bb2a1a0e6a607 | JoseTec2000/Mision_02 | /misDatos.py | UTF-8 | 493 | 3.171875 | 3 | [] | no_license | # Autor:José Isidro Sánchez Vázquez, A01748144
# Descripcion: Datos personales
# Escribe tu programa después de esta línea.
print("Nombre: José Isidro Sánchez Vázquez")
print("Matricula: A01748144")
print("Carrera: ISDR")
print("Escuela de procedencia: UVM Hispano")
print("Gustos: \n Me gusta hacer deportes de contac... | true |
bea4a212fd4fb0ece07703c19fcf88d8e9060407 | Tuananh58131258/rasatest | /actions.py | UTF-8 | 14,276 | 2.625 | 3 | [] | no_license | # This files contains your custom actions which can be used to run
# custom Python code.
#
# See this guide on how to implement these action:
# https://rasa.com/docs/rasa/core/actions/#custom-actions/
# This is a simple example for a custom action which utters "Hello World!"
# from typing import Any, Text, Dict, Lis... | true |
856b9e12d492f5c59a3fca39f0856b22d1fcc9f0 | daniromero97/Python | /e019-Generators/Generators.py | UTF-8 | 371 | 3.328125 | 3 | [] | no_license | def letters(*words):
for word in words:
"""
for letter in word:
yield letter
"""
yield from word
words = letters("example ", "reading ", "letters ", "of ", "words.")
for i in range(15):
print(next(words))
"""
output:
e
x
a
m
p
l
e
... | true |
ad7174d15c98493b65c4126169111dd74435461b | r6047736/UAPython | /root/a5tests/students/mgs3-assignment-5/puter-1.py | UTF-8 | 1,856 | 3.90625 | 4 | [] | no_license | #==============================================================================
#
# Author: Graham Smith
# Assignment 5: Problem 1 - 'Puter
# Date: 02/24/2017
#
# Description:
#
# A program for question/answer interaction between user and AI.
# Questions are printed, then the user is expected to answer acco... | true |
e6966bcdff3514ef7f79395819bc95b250dd5d16 | tsmithe/adaptive-boids | /timeStepping_test.py | UTF-8 | 622 | 2.53125 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Tue Nov 25 10:22:40 2014
@author: rikardvinge
"""
from numpy import *
#import scipy
#import random
import timeStepping
environmentRadius = 1
position = np.array([0.5, 0.5])
velocity = np.array([0, 1])
networkWeights = linspace(0.1, 0.6, 6)
boidWeight = 1
dt = 1
maxVelocity = 10... | true |
1cea73c3e1f84b4958733e83a9c10c48a40e6af2 | Dragfy11/python_list_variable | /function.py | UTF-8 | 1,097 | 3.75 | 4 | [] | no_license | # def print_message(name, language):
# print("Hi, my name is " + name + " and my favorite programming language is " + language)
# print_message("Kadir", "Python")
#####################
#### 1ère façon #####
#####################
# def print_message(name, language):
# print("Hi, my name is " + name + " and my... | true |
db95058471b754b2757a9ef6cbbc49e24e224742 | kuroxx/MusicNoteTranslator | /ctc_predict.py | UTF-8 | 2,474 | 2.671875 | 3 | [] | no_license | """
This code was originally developed by Jorge Calvo Zaragoza:
https://github.com/calvozaragoza/tf-deep-omr
It was used for experiments detailed in this paper:
https://www.mdpi.com/2076-3417/8/4/606
Modifications to the code have been applied to be used for the project: MusicNoteTranslator
"""
import argparse
impor... | true |
ebc5a1a43ae991ade0418e5a8271eb98ab6af738 | bssrdf/pyleet | /N/NextGreaterElementI.py | UTF-8 | 1,889 | 4.0625 | 4 | [] | no_license | '''
-Medium-
*Monotonic Queue*
You are given two arrays (without duplicates) nums1 and nums2 where nums1’s elements
are subset of nums2. Find all the next greater numbers for nums1's elements in the
corresponding places of nums2.
The Next Greater Number of a number x in nums1 is the first greater number to its
r... | true |
a3c17412918796f3282f01ea3ff2558fbdabd3e6 | ChristianBalazs/DFESW3 | /collections_books.py | UTF-8 | 1,689 | 4.40625 | 4 | [] | no_license |
varForAString = 'I like Pies'
print(varForAString[3])
# 1. List
listOfShopping = [ 'meat', 'veg', 'cake', 'beer for the weekend']
print(listOfShopping[1])
emptyList =[]
cool_cows = ["Winnie the Moo", "Moolan", "Milkshake", "Mooana"]
cool_sheep = ["Baaaart", "Baaaarnaby"]
cool_pigs = ["Chris P. Bacon", "Hamlet", ... | true |
c5da3111660d80c7c26ffda8dc4fd670a7cd4bba | ajing2/python-demon | /nosql/redis/demon5.py | UTF-8 | 480 | 2.859375 | 3 | [] | no_license | #!/usr/bin/env python
# -*- coding:utf-8 -*-
# @Time : 2017/10/10 0:02
# @Author : lingxiangxiang
# @File : demon5.py
import redis
pool = redis.ConnectionPool(host="192.168.48.131", port=6379, db=0)
r = redis.Redis(connection_pool=pool)
r.set("name", "lingxiangxiang")
print(r.keys())
print(r.get("name"))
r.ms... | true |
c7829558cccb61863100f7eb6f3adcfcdd9b77a1 | open-student-environment/open-student-environment | /ose/test_statement.py | UTF-8 | 1,141 | 2.671875 | 3 | [
"MIT"
] | permissive | import os
import unittest
from .statement import load_statements
class Test(unittest.TestCase):
def setUp(self):
path = os.path.abspath(
os.path.join(os.path.dirname(__file__), os.pardir))
self.filename = os.path.join(path, 'data/test/statements_sample.json')
def tearDown(self):... | true |
d6ba5b0cac84434dc0e22517fb0733595fb12632 | foodhype/practice | /spoj/TOURIST/python/TOURIST.py | UTF-8 | 2,322 | 3.328125 | 3 | [] | no_license | import sys
def main():
dp = [[[0 for _ in xrange(100)] for _ in xrange(100)] for _ in xrange(200)]
t = int(sys.stdin.readline())
# input
results = []
for _ in xrange(t):
matrix = []
w, h = map(int, sys.stdin.readline().split())
for _ in xrange(h):
matrix.append(list(sys.stdin.readline().... | true |
a3f257e3429ff5d21a5b92abb24860e46ab35240 | Joride/PiCameraStreamer | /multistream.py | UTF-8 | 5,746 | 2.828125 | 3 | [] | no_license | import socket
import picamera
from Queue import Queue
from threading import Thread
kBeginOfMessage = 0b10000000
kEndOfMessage = 0b11000000
# This class exists so that the camera can use it as the file
# fileLikeObject it needs to write to. This object will then
# write the data into multiple clients.
class MultiW... | true |
b8c85c83122498129dba0f0da4f2b70eea096d8a | ALMerrill/NewTestamentSearch | /search.py | UTF-8 | 1,992 | 3.09375 | 3 | [] | no_license | import os
import fnmatch
import re
from textwrap import TextWrapper
from functools import partial
from verse import Verse
from utils import *
def decorate_facory(phrase, pre, post):
def _subber(m):
return pre + m.group(0) + post
return partial(re.compile(phrase, re.IGNORECASE).sub, _subber)
def my_dec... | true |
5abf8991048adbd6edeb267a24f7f1ef7c5f0c23 | zyh0608/SCONES | /DataGeneration/datasets/FireProtDBDatasetGenerator.py | UTF-8 | 2,566 | 2.6875 | 3 | [
"MIT"
] | permissive | from .DatasetGenerator import DatasetGenerator
class FireProtDBDatasetGenerator(DatasetGenerator):
FIREPROTDB_COLUMNS_LIST=["id", "pdb_id", "chain_id", "ref_residue", "seq_position", "resseq_position", "mutated_residue", "pH", "ddG", "dTm", "sequence"]
def __init__(self):
super().__init__()
def r... | true |
8f9c2f2e49f178e2889aa993a088a3ce5ddbdfb5 | Stormzudi/Python3 | /course_9_3.py | UTF-8 | 1,277 | 3.984375 | 4 | [] | no_license | # -*- coding: utf-8 -*-
# @Time : 2020/3/11 21:04
# @Author : ZhuNian
# @FileName: course_9_3.py
# @Software: PyCharm
'''
1.实例方法访问实例变量
2.实例方法访问类变量
'''
class Student():
num = 0
def __init__(self,name,age):
self.name = name
self.age = age
print(self.name) #实例方法访问实例变量
print(s... | true |
db7b6be5a8c25fff421436696ad1d332fa367a66 | CamiloSaboA-csv/problemas_HackerRank | /Strings_Making_Anagrams.py | UTF-8 | 352 | 3.0625 | 3 | [] | no_license | def makeAnagram(a, b):
# Write your code here
from collections import Counter
a,b=list(sorted(a)),list(sorted(b))
a_count=Counter(a)
b_count=Counter(b)
x=((b_count-a_count)+(a_count-b_count)).values()
x=sum(x)
return x
a,b= 'faacrxzwscanmligyxyvym','jaaxwtrhvujlmrpdoqbisbwhmgpm... | true |
0d3c307c1d661af331b9c4e1ef244d0d060a997a | Sayali224/Python-Assignment | /Task6.py | UTF-8 | 614 | 3.84375 | 4 | [] | no_license | # Python-Assignment
def multiple_element(n):
return n*n
x=[1,2,3,4,5,6]
y=list(map(multiple_element, x))
print(y)
string_ex = "Hello World"
res= [i for i in string_ex if i.isupper()]
print("The uppercase letters are : ",str(res))
Student = ['Smit', 'Jaya', 'Rayyan']
capital = ['CSE', 'Networking', 'Operating Sys... | true |
44f5232d38475c28c2c5e3bf54a91e957f598254 | vitobru/asterius | /cogs/roles.py | UTF-8 | 4,972 | 2.65625 | 3 | [
"MIT"
] | permissive | """
Role Color Setter/Getter
by richardfrost
MIT License
"""
import discord
from discord.ext import commands
import utils.utils as util
ROLES_TO_COLORS = {760690161033019423 : 776197851407319070, # Staff
816150880730218576 : 816150975022104666, # Developers
816151271693877258... | true |
b90603a4140561950b1c043528b62fae65d08365 | Th3Lourde/l33tcode | /797_all_paths_from_source_to_target.py | UTF-8 | 472 | 3.359375 | 3 | [] | no_license | '''
Given a directed acyclic graph
of N nodes, find all possible
paths from node at idx 0 to
node n-1
'''
class Solution:
def allPathsSourceTarget(self, graph):
ans = []
stack = [ (0, [0]) ]
end = len(graph)-1
while stack:
idx, path = stack.pop()
if id... | true |
c3f4dd7dddec18c8e3bbee5b588bc71613ba6074 | Kingshida/self_drive | /src/speed_test.py | UTF-8 | 2,725 | 2.734375 | 3 | [] | no_license | # encoding: utf-8
"""
Mobile robot motion planning sample with Dynamic Window Approach
author: Bran Yuan
"""
import math
import time
import sys
import json
import requests
import redis
import scipy.spatial
import matplotlib.pyplot as plt
import numpy as np
from copy import deepcopy
from enum import Enum
from red... | true |
711c6824f1c784cdfa092adb1572617505c3cc60 | Gfuqiang/obj | /example/test_request.py | UTF-8 | 1,215 | 2.515625 | 3 | [] | no_license | import threading, requests, os
from concurrent.futures import ThreadPoolExecutor, as_completed
def request_reef(item):
s = requests.session()
s.keep_alive = False
url = 'http://10.80.5.138:8000/media/job_res_file_export/job-2e47bd0a-d65c-93ee-b414-2df19db5e39c.zip'
res = requests.get(url, timeout=60)
... | true |
d436dcf147dd6d3615a63b111db62e10fc793fc8 | dlnp2/evotuning_protocols_for_transformers | /src/tape_related/utils.py | UTF-8 | 259 | 2.640625 | 3 | [] | no_license | import numpy as np
from scipy.stats import spearmanr as sp_spearmanr
def spearmanr(a: np.ndarray, b: np.ndarray) -> float:
rank_a = np.argsort(np.argsort(a)[::-1])
rank_b = np.argsort(np.argsort(b)[::-1])
return sp_spearmanr(rank_a, rank_b)[0]
| true |
b278ee1e224bb24e102da74c618ae0542b340666 | Steven996/opencv-FaceRecognition | /face_recognition/load_dataset.py | UTF-8 | 3,419 | 2.734375 | 3 | [] | no_license | import os
import sys
import numpy as np
import cv2
from sklearn.decomposition import PCA
IMAGE_SIZE = 100
project_root = os.path.abspath(os.path.dirname(__file__))
# 按照指定图像大小调整尺寸
def resize_image(image, height=IMAGE_SIZE, width=IMAGE_SIZE):
top, bottom, left, right = (0, 0, 0, 0)
# 获取图像尺寸
h = image.shape[... | true |
e5156a8146ef783f919cc6b971fe7b5317cf02b8 | doityu/Project_Euler | /PE1...50/pe-24.py | UTF-8 | 184 | 2.75 | 3 | [] | no_license | # 参考https://qiita.com/BlueSilverCat/items/77f4e11d3930d7b8959b
# ずるい方法
import itertools
num = 10
gole = 1000000
print(list(itertools.permutations(range(num)))[gole-1])
| true |
a2f12cf6ba3fb8ba4dd58d1d1f99f33d8ccf20f7 | yugt/deep-learning-course | /Assignments/Homework1/ex3.py | UTF-8 | 2,178 | 2.734375 | 3 | [] | no_license | import torch
import torch.nn as nn
from torch.utils.data import DataLoader
from torchvision import datasets
from torchvision.datasets.mnist import MNIST
import torchvision.transforms as transforms
import matplotlib.pyplot as plt
import numpy as np
# model initalizatioin
myModel = nn.Linear(28*28, 10)
myLoss = nn.Cross... | true |
a63e6134b685a16c03e30a20972c5c8dd973c991 | aidin-zadeh/logistics-opt-python | /routing/bin_packing.py | UTF-8 | 5,466 | 3.5625 | 4 | [] | no_license | # Python Code for Bin Packing
#
# Simple heuristics and a PuLP integer programming code
# Import PuLP linear integer programming modeling tools
from pulp import *
error_tol = 0.000000001
#
# exact_bin_packing
#
# a function which, given a list with tuples containing item names and
# single dimensional sizes, ret... | true |
3db874bc01ec1871aa99340797c1c084861271b7 | YuriyGuts/pygoose | /pygoose/kg/gpu.py | UTF-8 | 1,053 | 3.125 | 3 | [
"MIT"
] | permissive | import os
def _cuda_get_gpu_spec_string(gpu_ids=None):
"""
Build a GPU id string to be used for CUDA_VISIBLE_DEVICES.
"""
if gpu_ids is None:
return ''
if isinstance(gpu_ids, list):
return ','.join(str(gpu_id) for gpu_id in gpu_ids)
if isinstance(gpu_ids, int):
retur... | true |
4e3e7d5eb7fa9448ad84c7e14dac9c4e5ec19e5d | ashutosh-mishra/movie-info | /src/MovieDataUtil.py | UTF-8 | 440 | 3.078125 | 3 | [] | no_license |
class MovieDataUtil:
def sortMovieData(self, movieData):
"""sort our movie dictionary by their IMDB rating value."""
movieData = sorted(movieData.iteritems(), reverse=True, key=lambda (k,v): (v['imdbRating'],k))
return movieData
def isValidLookupResult(self, movieData):
if mov... | true |
e049a9b36d1cb75c1d4768abb9c7c5283f05cb7c | trajtracker/tsc2017 | /pythonlib/src/tsc2017/_Mouse.py | UTF-8 | 2,076 | 3.1875 | 3 | [] | no_license |
from tsc2017 import Touchpad
class Mouse(object):
#----------------------------------------------------------------
def __init__(self, touchpad, ttrk_mouse=None):
"""
Create a Mouse object
:param touchpad:
:type touchpad: Touchpad
:param ttrk_mouse: The original "Mo... | true |
0b04fbd62dc1bf9a35fc835d55ced9d58943a96a | jalotra/DigitalCommunication | /BasebandSignalTransmission/AdditiveGaussianNoise.py | UTF-8 | 1,975 | 2.96875 | 3 | [
"MIT"
] | permissive | import numpy
import matplotlib.pyplot as plt
import sys
#My Modules
import BasebandWaveforms as BW
import GaussianNoise as GN
# scaling_factor = 2
def add_noise_to_functions(scaling_factor, decimal_number_to_send, time_period, standard_deviation, number_of_samples, duty_cycle, starting_time, ending_time):
timeS... | true |
f96e7b708558b0abdf4bb47c1ca6e1d07b84e130 | fe-sts/curso_em_video | /Python 3 - Mundo 2/4. Repetições em Python (while)/Exercicio 061.py | UTF-8 | 429 | 4.34375 | 4 | [] | no_license | '''
Refaça o desafio 051, utlizando while:
Desenvolva um programa que leia o 1o termo ea razão de uma PA.
No final, mostre os 10 primeiros termos dessa progressão.
'''
termo1 = int(input('Entre com o 1o termo da PA: ').strip())
razao = int(input('Entre com a razão da PA: ').strip())
cont = 10
cont2 = 0
while cont > ... | true |
a7a7ef19a639aa2ee3d00a3ef7dc46542cd53994 | JianLee-dev/swp-04 | /calc/template.py | UTF-8 | 435 | 2.6875 | 3 | [] | no_license | html = b"""
<html>
<body>
<form method="get" action="">
<p>
x = <input type="number" name="x">
</p>
<p>
y = <input type="number" name="y">
</p>
<p>
<input type="submit" value="Submit">
</p>
</form>
... | true |
46bf49472d77f24e4d36f95b8d2b823abe16dbf4 | tcgoetz/Garmin | /Fit/MonitoringOutputData.py | UTF-8 | 12,199 | 2.515625 | 3 | [] | no_license | #!/usr/bin/env python
#
# copyright Tom Goetz
#
import logging
from datetime import tzinfo, timedelta, datetime
from OutputData import OutputData
from FieldStats import *
logger = logging.getLogger(__name__)
logger.setLevel(logging.INFO)
class MonitoringOutputData(OutputData):
_sleep_period_padding = 1
... | true |
60082551999ae88ca9b54986ce60ab34686f55a9 | alexmstaff/TOG | /misc_utils/visualization.py | UTF-8 | 1,778 | 2.65625 | 3 | [] | no_license | import matplotlib.pyplot as plt
import numpy as np
def visualize_detections(detections_dict, outfile="out.png"):
colors = plt.cm.hsv(np.linspace(0, 1, 21)).tolist()
plt.clf()
plt.figure(figsize=(9 * len(detections_dict), 9))
for pid, title in enumerate(detections_dict.keys()):
input_img, detec... | true |
72c92bb0d3fe4f478c1459973cb89a21f0846485 | Archi6828/Python-Projects | /Inheritance and Animation (p.1)/blackhole.py | UTF-8 | 1,391 | 3.34375 | 3 | [] | no_license | # Black_Hole is derived from Simulton only, updating by finding+removing
# any Prey whose center is contained within its radius
# (returning a set of all eaten simultons), and
# displays as a black circle with a radius of 10
# (width/height 20).
# Calling get_dimension for the width/height (for
# contain... | true |
8d88f9f09b038f7e2f8c1db4d7536a8742249b36 | daniel-reich/ubiquitous-fiesta | /MGALfBAXhXqqdFyqo_10.py | UTF-8 | 293 | 3.140625 | 3 | [] | no_license |
def atbash(txt):
uc,lc = list(range(ord('A'), ord('Z')+1)), list(range(ord('a'), ord('z')+1))
normal = [chr(i) for i in uc]+[chr(i) for i in lc]
cipher = [chr(i) for i in uc[::-1]]+[chr(i) for i in lc[::-1]]
return ''.join(cipher[normal.index(i)] if i.isalpha() else i for i in txt)
| true |
3a82a4623665eb1798b0d80a29d2d281ccfe5845 | bobcaoge/my-code | /python/leetcode/1169_Invalid_Transactions.py | UTF-8 | 1,871 | 3.015625 | 3 | [] | no_license | # /usr/bin/python3.6
# -*- coding:utf-8 -*-
import collections
class Solution(object):
def invalidTransactions(self, transactions):
"""
:type transactions: List[str]
:rtype: List[str]
"""
def manager(info):
ret = set()
# time, amount, city
... | true |
070d2f957cf6599c6043db2eaee0c1bbddf13684 | aurkea/python_basic_exercise | /Small Projects/guess_game/guess game.py | UTF-8 | 2,711 | 4.125 | 4 | [] | no_license | import random
import sys
def start():
# this game will be played in two versions
print("Enter 1: You will guess the number, computer will give the feedback")
print("Enter 2: Computer will guess the number, you will give the feedback")
global x
try:
x = int(input("\nEnter you choice: "))
... | true |
81912624bd9d3d0bad45526fe86a636b6ed7f1fe | OptishellConsultancy/PapworthSolutions | /SimpleMLPTrainer.py | UTF-8 | 2,770 | 2.71875 | 3 | [] | no_license | from __future__ import print_function
import tensorflow as tf
class SimpleMLPTrainer(object):
def __init__ (self, dataDonorsSet, dataRecipientSet, dataRequiredResultSet,rows):
print("Running simple Multi layer perception Trainer")
self.Train(dataDonorsSet, dataRecipientSet, dataRequiredResultSet,r... | true |
87611081001e9921f80cad8b15c98046424812c2 | chenrongs/python01 | /Test/add_num.py | UTF-8 | 890 | 3.046875 | 3 | [] | no_license | # -*- coding: utf-8 -*-
# @Time : 2018/4/9 16:21
# @Author : CRS
from PIL import Image, ImageDraw, ImageFont
import random
import string
# 将 图片右上角 加上 数字
# 类似微信
def add_num(img):
draw = ImageDraw.Draw(img)
myfont = ImageFont.truetype('C:/windows/fonts/Arial.ttf', size=40)
fillcolor = "#ff0000"
widt... | true |
8008312d5f857d93040179e3db2e21ffe311c0a2 | occamLab/tango_ros_bridge | /tango_streamer/scripts/command_relay.py | UTF-8 | 1,330 | 2.671875 | 3 | [] | no_license | #!/usr/bin/env python
import socket
import time
import rospy
from std_msgs.msg import Int32, String
class CommandRelay(object):
def __init__(self):
TCP_IP = '0.0.0.0'
TCP_PORT = 12000
self.s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
self.s.bind((TCP_IP, TCP_PORT))
... | true |
d03413f540ee358093f2c05e3b68ebf46cbd59c9 | qwer123369/pyc_compiler | /main.py | UTF-8 | 35,417 | 2.859375 | 3 | [] | no_license | from pyc_vm import *
class token:
TK_NUM_INT = 1
TK_NUM_FLOAT = 2
TK_STRING = 3
TK_ID = 4
TK_IF = 5
TK_FOR = 6
TK_ELSE = 7
TK_WHILE = 8
TK_BREAK = 9
TK_RETURN = 10
TK_GLOBAL = 11
TK_OTHER = 12
def __init__(self):
self.type = None
self.value = Non... | true |
46bb81a06e450f9951424b015e9eba6fb37d44d7 | mephizzle/python-funkyfunc | /funkyfunc/later.py | UTF-8 | 1,598 | 3.09375 | 3 | [
"Apache-2.0"
] | permissive | from threading import Lock, Thread
__all__ = [
'getbacktome',
]
class NotPublished(Exception):
pass
class FutureResult(object):
def __init__(self):
self.lock = Lock()
self._value = None
self._value_published = False
def _publish(self, value):
with self.lock:
... | true |
70cfcf641493c23ef3a0a8e1865d838168709fe7 | FayeLee303/ComputerVision | /test_SVM_MNIST.py | UTF-8 | 26,983 | 2.5625 | 3 | [] | no_license | from test_DCT import Transform # 导入模块
"""支持向量机SMO算法"""
import numpy as np
import pandas as pd
import cv2 as cv
# from sklearn.datasets import load_iris
from sklearn.model_selection import train_test_split
import matplotlib.pyplot as plt
import math
import struct
import collections
from sklearn.svm import SVC
# 训练集文... | true |
f8aa61b163853786c6106df1e005c5adfdb3e03e | danwaterfield/Codecademy | /np_sunflowers.py | UTF-8 | 1,258 | 3.625 | 4 | [] | no_license | #codecademy course that calculates number of sunflowers that bloomed, and the probability of success.
import codecademylib
import numpy as np
from matplotlib import pyplot as plt
#imports csv of data, assigns to sunflower
sunflowers = np.genfromtxt('sunflower_heights.csv',
delimiter=',')... | true |
8fce2b94fcc1246db66c5d5bf703797e067fa376 | syllable2009/py3 | /base/mypygame/1.py | UTF-8 | 1,789 | 3.296875 | 3 | [] | no_license | # !/usr/bin/env python
# 导入pygame库
import pygame
# 导入一些常用的函数和常量,例如set_mode里面窗口的标志(flags)、消息事件(event)的类型等等
from pygame.locals import *
#向sys模块借一个exit函数用来退出程序
from sys import exit
# 指定图像文件名称
background_image_filename = 'sushiplate.jpg'
mouse_image_filename = 'fugu.png'
# 定义窗口的分辨率
SCREEN_WIDTH = 480
SCREEN_HEIGHT = 640... | true |
93e038454e8b50d363661859fdee4bc12dcada70 | anujnaRao/PythonCodes | /numberFormat.py | UTF-8 | 449 | 3.609375 | 4 | [] | no_license | def print_formatted(number):
# your code goes here
for i in range(1, number+1):
width = len(bin(number)) - 2
print("{0:{width}d} {0:{width}o} {0:{width}X} {0:{width}b}".format(i,width = width))
# Conversion methods
# decimal = str(i)
# octal = str(oct(i))[2:]
# h = str(hex(i))[2... | true |
4cf2190c79e57d6d97532fcb7343cce101e0b1bc | willcrichton/generative-grading | /src/utils/countminsketch.py | UTF-8 | 1,943 | 3.828125 | 4 | [] | no_license | # -*- coding: utf-8 -*-
import hashlib
import array
import numpy as np
class CountMinSketch(object):
"""
A class for counting hashable items using the Count-Min—Sketch algorithm.
Serves as an efficient, approximate version of itertools.Counter
Parameters
- `num_buckets` the size of each hash ... | true |
838383e335b1dab5a15d1711dc411dc0106c659b | chrishefele/kaggle-sample-code | /WordImputation/src/old/try_suggestions.py | UTF-8 | 1,813 | 3.125 | 3 | [] | no_license | from NGramIndex import NGramIndex
import nltk
import random
import Levenshtein as lev
def median_word(words, word_counts):
median = lev.median(words, word_counts)
while True:
last_median = median
median = lev.median_improve(median, words, word_counts)
if median == last_median:
... | true |
75dbd818dc3d8d380bf580d247b99a811a1238e2 | BenHawcroft/UnivieristyWork---Airport-Check-in | /Database_Creation.py | UTF-8 | 2,968 | 2.59375 | 3 | [] | no_license | import sqlite3
conn = sqlite3.connect('Airport.db')
c = conn.cursor()
def CreateTables ():
c.execute("""CREATE TABLE Passenger (
Passenger_ID text primary key,
First_Name text,
Last_Name text,
Gender text,
Disability text
... | true |
df9fa40a39d970edd69c55cd0167663d31162104 | HalfBloodPrince010/MOOC-Dropout-Prediction | /notebooks/sampling.py | UTF-8 | 2,772 | 3.015625 | 3 | [] | no_license | from sklearn.utils import resample
from imblearn.over_sampling import SMOTE
from imblearn.pipeline import Pipeline
from imblearn.under_sampling import RandomUnderSampler
def do_sampling(upsampling, train_features, train_truth, smote=False):
X_train = train_features
y_train = train_truth.label
if smote is Fal... | true |
2bf2e9204312f0f05f01c22a7fba2c97185605af | hoyasmh/PS | /boj/09001-10000/9359.py | UTF-8 | 229 | 3.15625 | 3 | [] | no_license | def p(x,y):
while x%y!=0:
x,y=y,x%y
return [0,1][y==1]
for i in range(int(input())):
c=0
a,b,n=map(int,input().split())
for j in range(a,b+1):
c+=p(n,j)
print('Case #{}: {}'.format(i+1,c))
| true |
0d488683a8671f04ae94d62c753270c66e4640ae | sirosen/SALVE | /salve/class_resources/enum.py | UTF-8 | 2,017 | 3.75 | 4 | [
"Apache-2.0"
] | permissive | #!/usr/bin/python
import copy
class Enum(object):
def __init__(self, *seq, **named):
"""
Usually, enum values are strings, so we map them to themselves
for tidy output. For example
>>> x = Enum('A','B')
>>> print(x.A) # "A"
>>> x.B == 'B' # True
This shou... | true |
33e9bf036fc0ce4dd10684574362d0c64d837797 | Cnoor0171/image_organizer | /src/rest_api/exceptions.py | UTF-8 | 205 | 2.515625 | 3 | [] | no_license | from werkzeug.exceptions import HTTPException
class ErrorResponse(HTTPException):
def __init__(self, code, message):
super().__init__()
self.code = code
self.message = message
| true |
700628c7530e562d8c47ab28c6f964dd7753d30f | sharkline/graphy | /asoif_scraper/asoif_scraper.py | UTF-8 | 2,368 | 2.8125 | 3 | [] | no_license | #!/Users/le/.virtualenvs/graphy/bin/python
"""
Scraper to grab asoif links with comments, used later
for further scraping/analysis
To run: ./asoiaf_scraper.py
"""
import re
import sys
import click
import urllib2
import logging
import BeautifulSoup
from datetime import datetime
log = logging.basicConfig(__name__)
def... | true |
083088021d4ff1ab8f7da3162f4121efeb87d582 | codezoners-2/Python | /03_regular_expressions/code-examples/group_and_findall.py | UTF-8 | 226 | 3.109375 | 3 | [] | no_license | import re
email = ''' email codezoners-2@mydomain.com for help or contact@mydomain.com'''
## find all email addresses
match = re.findall(r'([\w-]+)@([\w.]+)', email)
for m in match: # results come back as a list of tuples
print m # a single tuple
| true |
d88f4160205b685cb7e003ea9ad56137ecb97002 | 8059586/webpagefile1.0.1 | /merge.py | UTF-8 | 621 | 2.90625 | 3 | [] | no_license | import csv
data1 = []
with open("dataset_1.csv","r") as f:
reader = csv.reader(f)
for i in reader:
data1.append(i)
headers1 = data1[0]
planetinfo1 = data1[1:]
data2 = []
with open("sorteddataset.csv","r") as f:
reader = csv.reader(f)
for i in reader:
data2.append(i)
headers2... | true |
342ee59f928a09065c6aa5f7a2b99bab3b669fb9 | sebltm/ReedSolomon | /ReedSolomon.py | UTF-8 | 10,760 | 3.28125 | 3 | [] | no_license | from Polynomial import Polynomial
import copy
import random
class ReedSolomon:
def __init__(self, error_size):
self.polyObject = Polynomial()
self.generator_polynomial = Polynomial.generator(error_size=error_size)
self.GF = self.polyObject.GF
def encode(self, message: str, error_size... | true |
daa03f3e07a4fb0e0284ad5285fc676bf92ee993 | yildiz/brawlstats-live | /matcher/template_matcher.py | UTF-8 | 4,913 | 2.671875 | 3 | [] | no_license | # -*- encoding:utf8 -*-
#!/usr/bin/env python3
import os
import cv2
import glob
import json
import time
import logging
import numpy as np
from math import sqrt
from matcher.matcher import Matcher
from matcher.template import Template, TemplateImage
class TemplateMatcher(Matcher):
"""
Compare template images ... | true |
496fa8788e1dccf866f84de0798e934427609e2b | sssilvar/CSD-AD | /test/data_selection/summarize_and_look_for_missings.py | UTF-8 | 1,532 | 2.546875 | 3 | [] | no_license | from os.path import join, dirname, realpath
import pandas as pd
root = dirname(dirname(dirname(realpath(__file__))))
if __name__ == '__main__':
csv_file = join(root, 'param', 'df_conversions_with_times.csv')
print(csv_file)
df = pd.read_csv(csv_file, index_col='PTID')
print(df.head())
for month... | true |
b5dece752e011fa7b898c38d8b5b82b467445f49 | srijan-deepsource/wolfbot | /src/roles/werewolf/wolf_variants/rl_wolf.py | UTF-8 | 1,575 | 2.734375 | 3 | [
"MIT"
] | permissive | """ rl_wolf.py """
import json
from collections import defaultdict
from typing import Any
from src import const
from src.const import logger
from src.roles.werewolf.wolf_variants.reg_wolf import get_wolf_statements
from src.statements import KnowledgeBase, Statement
def get_statement_rl(
player_obj: Any, knowled... | true |
f5c04006ff496ed2a979d356c37c923537b96500 | matplotlib/matplotlib.github.com | /3.7.1/_downloads/bd64a9370f8f5ed60a10a38a58592830/figures-5.py | UTF-8 | 443 | 2.515625 | 3 | [] | no_license | import matplotlib.pyplot as plt
from matplotlib.patches import FancyBboxPatch
fig, ax = plt.subplots(figsize=(4, 2), facecolor='lightskyblue')
ax.set_position([0.1, 0.2, 0.8, 0.7])
ax.set_aspect(1)
bb = ax.get_tightbbox()
bb = bb.padded(10)
fancy = FancyBboxPatch(bb.p0, bb.width, bb.height, fc='none',
... | true |
c8c05c514521f8b5165d03b3d1f0a6d01c97818d | gregoryng/subradar | /subradar/surface.py | UTF-8 | 6,338 | 3.03125 | 3 | [
"MIT"
] | permissive | """Various tools fpr surface detection"""
import numpy as np
import pandas as pd
import scipy.signal
from . import utils
import copy
def detector(rdg, y0=[], winsize=100, method='grima2012', axis=0, **kwargs):
"""Surface detection with the choosen method
Input
-----
rdg: 2d-array
radargram.
... | true |
bbcc07c03dbe11d6b1fbabf3781c7680ff4eec06 | MarioPeper/Gimel-Studio | /src/customnodes/tut2_custom_node.py | UTF-8 | 2,632 | 2.8125 | 3 | [
"Apache-2.0",
"MIT"
] | permissive | import wx
from PIL import Image, ImageFilter
from GimelStudio.api import (Color, RenderImage, List, NodeBase,
Parameter, Property, RegisterNode)
class NodeDefinition(NodeBase):
@property
def NodeIDName(self):
return "box_blur_node"
@property
def NodeLabel(s... | true |
a560cc4b9d3ad14bad6d93502c10d4491022d9b6 | doubledouLiu/python | /pythnonStudy/com/doubledou/study/imooc/test_plt.py | UTF-8 | 227 | 3.296875 | 3 | [] | no_license | import matplotlib.pyplot as plt
year = [1950, 1970, 1990, 2010]
pop = [2.135, 3.692, 5.263, 6.672]
value = [0, 0.6, 1.4, 1.6, 2.2, 2.5, 2.6, 3.2, 3.5, 3.9, 4.2, 6]
plt.hist(value, bins=10)
#plt.scatter(year, pop)
plt.show()
| true |
ed2c5af94b5167e5170835f0f365c635a90d282d | muxuezi/expressfee | /books.py | UTF-8 | 852 | 3.03125 | 3 | [] | no_license | # -*- coding: utf-8 -*-
# 自动加载所有excel,输出汇总excel,名称为”T_文件名“
import pandas as pd
from glob import glob
sheetname = u'F1库存汇总'
def booksort(fname):
outputfname = 'T_' + fname
bookall = pd.read_excel(fname, sheetname)
bookall = bookall.fillna(0)
bookgroup = bookall.groupby(u'书号')
bookgps = []
for... | true |
404dd21531c7ca8d52b9249e3e357fd4d9a0d24c | isabellarhee/15-112 | /week4/AnimationLecture.py | UTF-8 | 5,435 | 3.59375 | 4 | [] | no_license | from cmu_112_graphics import *
def appStarted(app):
app.cx = app.width/2
app.cy = app.height/2
app.r = 40
def keyPressed(app, event):
if (event.key == 'Left'):
app.cx -= 10
elif (event.key == 'Right'):
app.cx += 10
def redrawAll(app, canvas):
canvas.create_text(app.width/2, 20... | true |
f66a18516bd141e953102190fb9cc5273cdaf86b | Nakiito/AI-cantine-Kl-ber | /dataset_in_out.py | UTF-8 | 3,339 | 2.6875 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Mon Dec 7 21:46:20 2020
@author: Frédéric
"""
# -*- coding: utf-8 -*-
"""
Created on Sat Dec 5 22:15:18 2020
@author: Frédéric
"""
import pandas as pd
#permet de voir les tableaux entiers
def set_pandas_display_options() -> None:
"""Set pandas di... | true |
d0daa2a11fde5381e3c999793a9b3b341416a43a | xpxpxpLilac/comp2041 | /python_learning/lesson1.py | UTF-8 | 606 | 4.375 | 4 | [] | no_license | #!/usr/bin/python3
name = input("what's your name?\n")
print("hello",end="") #newline if no "end="""
print("\n")
print("hello",end=",")
print("\n")
print("welcome","to","New","York") #separated by spaces
x=input("Number 1:")
y=input("Number 2:")
print(x+y) #x,y are both string,
#although t... | true |
9ddd4aaa9f2e1aae6e1ac31630349259f2b8a9af | leekyunghun/bit_seoul | /ML/m22_pca7_cancer.py | UTF-8 | 2,489 | 3.15625 | 3 | [] | no_license | # 실습 pca로 축소해서 모델을 완성
# 1. 축소한 차원의 가치가 0.95 이상 -> 1
# 2. 축소한 차원의 가치가 1.0 이상 -> 15
import numpy as np
from sklearn.datasets import load_breast_cancer
from tensorflow.keras.models import Sequential, Model
from sklearn.decomposition import PCA
from tensorflow.keras.layers import Dropout, Dense
from sklearn.model_s... | true |
2d1e151fb99bf020499f0366ddc3c7454252fc70 | hanyong/winrun | /winrunclient.py | UTF-8 | 1,776 | 2.578125 | 3 | [] | no_license | #!/usr/bin/python
# -*- encoding: utf-8 -*-
# -*- 编码: utf-8 -*-
import os
import socket
from winruncyg import WinRunCyg, getWinPath
"""winrun client for cygwin.
在 cygwin 下调用,自动进行参数转换后将命令传送到 winrun-server 运行。
"""
class WinRunClient(WinRunCyg):
def __init__(self):
super(WinRunClient, self).__init__(... | true |