blob_id stringlengths 40 40 | language stringclasses 1
value | repo_name stringlengths 5 133 | path stringlengths 2 333 | src_encoding stringclasses 30
values | length_bytes int64 18 5.47M | score float64 2.52 5.81 | int_score int64 3 5 | detected_licenses listlengths 0 67 | license_type stringclasses 2
values | text stringlengths 12 5.47M | download_success bool 1
class |
|---|---|---|---|---|---|---|---|---|---|---|---|
d75e1101508bf62bd003d5c7e5b1df9e5993df0f | Python | pengfen/learn19 | /python-learn/basic/object(副本).py | UTF-8 | 1,068 | 4.03125 | 4 | [] | no_license | #!/usr/bin/python
class Person(object):
"""
返回具有给定名称的person对象
"""
def __init__(self, name):
self.name = name
def get_detail(self):
"""
返回包含人名的字符串
"""
return self.name
class Student(Person):
"""
返回Student对象 采用name branch year 3个参数
"""
def __init__(self, name, branch, year)
Person.__init__(se... | true |
69a88f29dd89eb7cdbff19ad2159f703d333c194 | Python | kriya1/Python-Course | /WEEK_01/web_interaction.py | UTF-8 | 1,949 | 2.625 | 3 | [] | no_license | from selenium import webdriver
import time
def rewrite(sentence_to_rewrite):
driver = webdriver.Firefox(executable_path=r'/home/user/Downloads/Zips/geckodriver')
# driver.get('http://seleniumhq.org/')
from selenium.webdriver.common.keys import Keys
# driver.implicitly_wait(30)
driver.... | true |
7e655f695b9f3c6c7e011f742cf71b42b2115723 | Python | GabrielMRocha/firstprojects | /Euro Notification/send_email.py | UTF-8 | 548 | 2.546875 | 3 | [] | no_license | from email.mime.text import MIMEText
import smtplib
def send_email(email, cotacao):
from_email="gabca.robo@gmail.com"
from_password="R0b0.Gabca"
to_email=email
subject="Cotação do Euro"
message="Oi mãe! A cotação o euro hoje é %s " % (cotacao)
msg=MIMEText(message, 'html')
ms... | true |
8a6f825833597b0afb6b4340b1af57cfe1d4135f | Python | rafaelrsanches/cursos_python | /python_para_android_ios_win_linux_mac/03_tomada_de_decisao/exercicio13.py | UTF-8 | 283 | 4.375 | 4 | [] | no_license | # Faça um algoritmo que leia três números e imprima na tela o maior deles.
num1 = float(input("Digite o primeiro número: "))
num2 = float(input("Digite o segundo número: "))
num3 = float(input("Digite o terceiro número: "))
print("O maior número é", max(num1, num2, num3))
| true |
d67d8f2551fdec745cc61e2171999072b231d1d7 | Python | MicTott/Amp_xcorr | /Amp_xcorr.py | UTF-8 | 5,642 | 3.296875 | 3 | [
"MIT"
] | permissive | # ===================
# Necessary packages
# ===================
import numpy as np
import matplotlib.pyplot as plt
from neurodsp.filt import filter_signal
from neurodsp.timefrequency import amp_by_time
# ===========================
# Amplitude crosscorrelation
# ===========================
def amp_xcorr(sig1, si... | true |
f6aeb7d411a93208e90142ed74d55a38cb04d6c5 | Python | Spiritator/neural-system-and-application-homework | /hw4/neural_system_and_app_hw4.py | UTF-8 | 9,247 | 3.234375 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Wed May 16 15:04:37 2018
@author: 蔡永聿
my homework of the class "neural network and appplication" homework 4
references:
http://darren1231.pixnet.net/blog/post/339526256-%E6%89%8B%E6%8A%8A%E6%89%8B%E5%AF%A6%E4%BD%9C%E5%87%BA%E9%A1%9E%E7%A5%9E%E7%B6%93%E5%85%AC%E5%BC%8F-with-... | true |
f02d3d001c2817b56735d3cd3df597aa43b6aabb | Python | newlife19891108/Muses | /core/util.py | UTF-8 | 1,810 | 3.34375 | 3 | [
"MIT"
] | permissive | import platform
import hashlib
import sys
def get_name(file):
"""
get name of file from its filepath
:param file:
:return: name
"""
plt = platform.system()
if plt == 'Windows':
file_list = file.split('\\')
return file_list[len(file_list) - 1]
elif plt == 'Linux':
... | true |
684a4d13febe4d8c1186834b4ca068be9c92aba0 | Python | hanxuema/LeetCodePython | /Problems/Hard/0052.n-queens-ii.py | UTF-8 | 1,484 | 3.078125 | 3 | [] | no_license | #
# @lc app=leetcode id=52 lang=python
#
# [52] N-Queens II
#
# https://leetcode.com/problems/n-queens-ii/description/
#
# algorithms
# Hard (54.15%)
# Likes: 339
# Dislikes: 129
# Total Accepted: 111.9K
# Total Submissions: 206.4K
# Testcase Example: '4'
#
# The n-queens puzzle is the problem of placing n queen... | true |
52f387873c989e61570c3b2fe8c9bd4cbfcb6cdc | Python | PeterGardas/TlustoNET | /check_training_data.py | UTF-8 | 458 | 2.5625 | 3 | [] | no_license | import numpy as np
import pandas as pd
from collections import Counter
from random import shuffle
import cv2
import time
train_data = np.load('training_data_0_BGR.npy')
df = pd.DataFrame(train_data)
print(df.head())
print(Counter(df[1].apply(str)))
for data in train_data:
img = data[0]
choice = data[1]
... | true |
dd41aaaa0bce358992a76245fa057dfafeedc030 | Python | xinlongOB/python_docment | /面向对象/面向对象实例练习.py | UTF-8 | 3,424 | 4.96875 | 5 | [] | no_license | ## 封装
# 1、封装是面向对象编程的一大特点
# 2、面向对象编程的第一步--将属性和方法封装到一个抽象的类中
# 3、外界使用类创建对象、然后让对象调用方法
# 4、对象方法的细节都被封装在类的内部
# 需求 1、小明体重75.0公斤
# 2、小明名词跑步会减肥0.5公斤
# 3、小明每次吃东西体重增加1公斤
"""
class Person():
def __init__(self,name,weight):
#self.属性 = 形参
self.name = name
self.weight = weight
def __str__(self... | true |
767f31b3bea207a5b829741dc80db709e6536050 | Python | vgucsd/cubesat | /lsdo_cubesat/utils/finite_difference_comp.py | UTF-8 | 2,051 | 2.90625 | 3 | [] | no_license | import numpy as np
import scipy.sparse
from openmdao.api import ExplicitComponent
class FiniteDifferenceComp(ExplicitComponent):
def initialize(self):
self.options.declare('num_times', types=int)
self.options.declare('in_name', types=str)
self.options.declare('out_name', types=str)
... | true |
bd3c23da375daff8401805aad057e7e71f0b84a3 | Python | nipunramk/Reducible | /2019/Recursion/recursion.py | UTF-8 | 106,355 | 2.65625 | 3 | [] | no_license | from big_ol_pile_of_manim_imports import *
import random
DEFAULT_COLORS = [BLUE, RED, ORANGE, GREEN, DARK_BLUE, VIOLET, PINK, LIGHT_BROWN, MAROON_C, GRAY]
class Introduction(Scene):
def construct(self):
rectangles, text = self.show_recursion_diagram()
to_fadeout = self.steps_text()
steps = to_fadeout[0]
to_f... | true |
fb60005a4919ea66391bbbb1367ab3ac9f13798d | Python | AdamZhouSE/pythonHomework | /Code/CodeRecords/2950/60790/246461.py | UTF-8 | 182 | 2.90625 | 3 | [] | no_license | str1=input()
if(str1=="2525"):
print(1)
elif(str1=="25"):
print(1)
elif(str1=="225525"):
print(2)
elif(str1=="225525225525225525225525"):
print(2)
else:
print(-1) | true |
baa5936b32dab6f7a31124dfc90bd45adb6b2e3d | Python | m80126colin/Judge | /since2020/ZeroJudge/ZeroJudge a388-2d-dp.py | UTF-8 | 603 | 2.96875 | 3 | [] | no_license | '''
@judge ZeroJudge
@id a388
@name Critical Mass
@source UVa 580
@tag Dynamic Programming
@formula
@definition
dp[n][length of tail U NOT EXCEED 2] = number of ways
@backward
dp[n][0] = sum(dp[n - 1])
dp[n][i] = dp[n][i - 1]
@definition
ans[n] = 2 ** n - sum(dp[n - 1])
'''
from sys import... | true |
c73127b299747bda45e28265287a621e6ec69837 | Python | lihao1225/review_demo2 | /demo2/test_AcitonChains.py | UTF-8 | 564 | 2.53125 | 3 | [] | no_license | from time import sleep
from selenium import webdriver
from selenium.webdriver import ActionChains
class TestActionChains():
def setup(self):
self.driver= webdriver.Chrome()
self.driver.implicitly_wait(10)
self.driver.maximize_window()
def teardown(self):
pass
def test_... | true |
4fc2e93455032cbc4108a7ddffc08291c316bfec | Python | lordzizzy/leet_code | /04_daily_challenge/2021/01-jan/week5/vertical_order_traversal_btree.py | UTF-8 | 4,755 | 3.359375 | 3 | [] | no_license | # https://leetcode.com/explore/featured/card/january-leetcoding-challenge-2021/583/week-5-january-29th-january-31st/3621/
# Vertical order traversal of a binary tree
# Given the root of a binary tree, calculate the vertical order traversal of the binary tree.
# For each node at position (x, y), its left and right chil... | true |
e6e86c0db967a32f4b3533be737436cd4556e9ca | Python | Akhil-64/python | /74 prog.py | UTF-8 | 549 | 3.3125 | 3 | [] | no_license | print("even nos")
list1=[x for x in range(1,10) if(x%2==0)]
s1=set(list1)
print(s1)
list2=[]
list3=[]
print("composite number")
for x in range(1,20):
if(x>1):
for i in range(2,x):
if(x%i==0):
list2.append(x)
break
else:
list3.app... | true |
8462ba72c3edb052d0c347912dff16bdebc4c3a1 | Python | Shivanibachhav/zoi_detector | /GUI.py | UTF-8 | 3,358 | 2.828125 | 3 | [] | no_license | # USAGE
# tkinter_test.py
# import the necessary packages
from tkinter import *
from experiment import Measure
import tkinter as tk
from PIL import Image
from PIL import ImageTk
from tkinter import filedialog
import cv2
import numpy as np
root = Tk()
a = Measure()
global path
# Read image.
def select_image():
# gr... | true |
1f38294361801077a66e0e9197ab24f212bcdcf8 | Python | bangersNmash/smg | /grid.py | UTF-8 | 7,999 | 3.421875 | 3 | [
"MIT"
] | permissive | """
grid.py -- hexagonal grid
==========================
Provides data structures and operations representing grid of hexagons.
"""
from math import sqrt
import random
import pygame
from gui import frame_image
import properties as pr
class Hex:
"""Represents a hexagon"""
def __init__(self, x, y,
... | true |
98a7588741549903068317c6508749c36f6dea5f | Python | jaebradley/python_problems | /geometry/basic.py | UTF-8 | 1,902 | 4.3125 | 4 | [
"MIT"
] | permissive | """
Basic geometric problems
"""
class Triangle:
"""
Represents a Triangle
"""
def __init__(self, longest_side, middle_side, shortest_side):
self.longest_side = longest_side
self.middle_side = middle_side
self.shortest_side = shortest_side
def __eq__(self, other):
... | true |
be4fd860b06dc085592d0f7a41f79eb8787fb98d | Python | herbmks/thesis_gan_fraud_scenarios | /mnist_main.py | UTF-8 | 11,645 | 2.609375 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
This is the main script of the MNIST investigation.
It includes:
- Training of the GAN models.
- Running of expereiments.
- Processing and visualising the results.
All the ncessary classes and functions are in the supporting scripts:
> minst_gans.py, mnist_experiments.py, mnist... | true |
3425f892cbcaab768827e109646b30902b857abb | Python | mdmn07C5/PrawnChicken | /pwn_cheker.py | UTF-8 | 2,385 | 2.890625 | 3 | [] | no_license | import os
import hashlib
import requests
import getpass
def fetch_keys():
path = os.path.abspath(os.curdir)
parent = os.path.dirname(path)
try:
with open(parent + "\Keys.txt") as file:
key = file.readline()
return key
except OSError:
print("Keys file not found")
... | true |
49a0a22ecd306e077d1c9942dc19877fe61dcf7d | Python | knoda/StatML | /source/exercise/py/01/ex_for.py | UTF-8 | 183 | 3.765625 | 4 | [] | no_license | # -*- coding: utf-8 -*-
# インデックスで反復
for i in range(4):
print i
# 値で反復
for word in ('cool', 'powerful', 'readable'):
print 'Python is %s' % word
| true |
92dbb6e43b2e7bed73dfb60f2e3cc13142eeb33a | Python | Aegarain/advent-of-code | /Python/2019/day_03.py | UTF-8 | 208 | 3.109375 | 3 | [] | no_license | input_file=open("day_03_example.txt")
input_txt=input_file.read()
data = [list(]item.split(",") for item in input_txt.split("\n")]
wire1 = data[0]
wire2 = data[1]
def plot(wire):
for direction in wire
| true |
3e8251527fe13473685ec3e450e7196fc72ae5ab | Python | Algorithm-P0/meanjung | /2020/1try/5_dp/2748.py | UTF-8 | 115 | 2.90625 | 3 | [] | no_license | import sys
n=int(sys.stdin.readline())
dp=[0,1]
for i in range(2, n+1):
dp.append(dp[i-1]+dp[i-2])
print(dp[n]) | true |
74d96ab608efcab12bac8ec67f24caaaa77590a7 | Python | JoseAIG/plasma-web2 | /controllers/controlador_imagen.py | UTF-8 | 6,013 | 2.578125 | 3 | [] | no_license | from flask import session, current_app
import os, uuid, ast
from app import db
from models.imagen import Imagen
# FUNCION PARA OBTENER LAS IMAGENES SUBIDAS
def obtener_imagenes():
try:
# BUSCAR TODAS LAS IMAGENES EN ORDEN DESCENDENTE POR ID
imagenes = Imagen.query.order_by(Imagen.id.desc()).all()
... | true |
4ecfab1b9d8d83647ec058cbbe8d7cb0e2c7defc | Python | rbcasperson/rosalind | /rosalind_ini4.py | UTF-8 | 104 | 2.71875 | 3 | [] | no_license | def main(data):
a, b = map(int, data.split())
return sum([i for i in range(a, b + 1) if i % 2])
| true |
77277541c92b830289d9125696afd11116edb3b4 | Python | Youmin-Kim/GLD | /gld.py | UTF-8 | 3,113 | 2.65625 | 3 | [] | no_license | import torch
from torch import nn
import torch.nn.functional as F
class GLDLoss(nn.Module):
def __init__(self, alpha=0.7, beta=500.0, spatial_size=8, div=2):
super().__init__()
self.alpha = alpha
self.beta = beta
self.num_local = div * div
self.cross_entropy = nn.CrossEntro... | true |
c0f407d91111980394afcd56cc81c25ba872289b | Python | TaiPhillips/concurrency-in-python-with-asyncio | /chapter_03/listing_3_10.py | UTF-8 | 2,020 | 2.71875 | 3 | [] | no_license | import asyncio
from asyncio import AbstractEventLoop
import socket
import logging
import signal
from typing import List
async def echo(connection: socket,
loop: AbstractEventLoop) -> None:
try:
while data := await loop.sock_recv(connection, 1024):
print('got data!')
... | true |
9218a828f0c4794caad08031c98ca15d059aa432 | Python | pto8913/KyoPro | /HackerRank/Kodamanと愉快な仲間たち/python/C-remainder_of_module.py | UTF-8 | 43 | 2.78125 | 3 | [] | no_license | k = int(input())
x = int(1e9)+7
print(x%k)
| true |
15fc83c611e5d03fe63fdeee2c26601db207d03e | Python | cylzty110/FundRecommendSystem | /recommend/encode.py | UTF-8 | 1,113 | 3.109375 | 3 | [] | no_license | import pandas as pd
import numpy as np
from sklearn import preprocessing
# 返回值类型统一为numpy.ndarray
# 连续值离散化
def intervalencode(data, bins):
data = np.array(data, dtype=np.float)
length = len(bins)
labels = []
for i in range(length-1):
labels.append(i)
data = pd.cut(data, bins, right=False, ... | true |
43978c327310affb3ce2ed680d660a92b64b7ae5 | Python | BalajiDany/chatbot | /chatterbot/output/terminal.py | UTF-8 | 563 | 2.640625 | 3 | [] | no_license | from __future__ import unicode_literals
from .output_adapter import OutputAdapter
import sys
import time
class TerminalAdapter(OutputAdapter):
def __init__(self, **kwargs):
super(TerminalAdapter, self).__init__(**kwargs)
self.name = kwargs['name']
def process_response(self, statement, sessio... | true |
f51d2142481b8ac48dcbf68a5c782001d6e3f62b | Python | 7ss8n/ProgrammingBasics2-Python | /discrete-math-DFS/dfs.py | UTF-8 | 2,155 | 3.734375 | 4 | [] | no_license | class Graph:
"""Represents graph"""
def __init__(self, matrix):
"""Initializes graph by adjacency matrix"""
self._matrix = matrix
def isCorrect(self):
"""Checks if adjacency matrix is correct"""
vertices_num = len(self._matrix)
for row in self._matrix:
i... | true |
79d9482e3e44e6a7072d29790981282bad80e3ae | Python | ugeshnani/project | /task.py | UTF-8 | 1,139 | 3.09375 | 3 | [] | no_license | import sys
a=str(input("Enter series :"))
l=0
b=0
front_dict={}
back_dict={}
i=0
while i < len(a) :
for j in range(int(a[i])) :
front_dict[l]=b
if j == int(a[i]) -1 :
l=l+1
b=b
else :
l=l+1
b=b+1
i=i+1
if i == len(a) :
break
... | true |
0f5e8850faae5667f923cf25e52af9acb3c4afd8 | Python | digitalemagine/django-hierarchical-auth | /hierarchical_auth/tests/tests.py | UTF-8 | 3,997 | 2.515625 | 3 | [
"BSD-3-Clause"
] | permissive | from django.test import TestCase
from django.contrib.auth.models import User, Group, Permission
from django.contrib.contenttypes.models import ContentType
class UserTestCase(TestCase):
"""
Test the added user functionality.
"""
def setUp(self):
create_test_objects()
def test_get_all_gro... | true |
169242f55c306a85eaf56b0d1be7e4d30641bd6f | Python | markmontymark/patterns | /python/src/Behavioral/Template_Method/test.py | UTF-8 | 903 | 2.734375 | 3 | [] | no_license |
from DvdTitleInfo import DvdTitleInfo
from BookTitleInfo import BookTitleInfo
from GameTitleInfo import GameTitleInfo
import unittest
class TestBehavioralTemplateMethod(unittest.TestCase):
def test(self):
#it 'Can create 3 title infos',->
bladeRunner = DvdTitleInfo("Blade Runner", "Harrison Ford", '1')
elect... | true |
7fefb3f5988d06171c03f3a576723f6c21aca4af | Python | CarlosEMS/PointOfSales | /POSView.py | UTF-8 | 3,503 | 3.421875 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Here will be all the code related to the view (screen)
"""
import POSController
import os
#Getting the inputs commands to show it to the user
#InputCommands=POSController.GetInputCommand()
#Intializing the User choice value with empty string
UserChoice=""
"""
Desc: Main function of the ... | true |
9e4c1d5cbb28735da6abfde634a08cec7d9f001f | Python | aitorlomu/SistemasGestores | /Python/Python/Ejercicios/08.py | UTF-8 | 159 | 3.796875 | 4 | [] | no_license | letra=input('Introduzca una letra ')
suma=0
while letra!=' ':
suma+=1
letra=input('Introduzca una letra ')
print('El número de vocales es de ',suma)
| true |
d439e21a3ad845a104f7cf868f0bbd2f162d426d | Python | jacquessham/sfotraffic | /Part1_2/result_part1_1.py | UTF-8 | 2,138 | 2.625 | 3 | [] | no_license | import pandas as pd
from pandas.tseries.offsets import MonthEnd
from sklearn.metrics import mean_squared_error as mse
from sklearn.metrics import r2_score
import plotly
import plotly.graph_objs as go
from plotly.offline import *
# To initiate ploty to run offline
init_notebook_mode(connected=True)
# Import real worl... | true |
0154ae18842db7b77c33f387f0ed5eeac238b89c | Python | sooyeon9/python | /프로그래밍기초/복습-답안.py | UTF-8 | 2,897 | 3.671875 | 4 | [] | no_license | # 1번문제 deep_reverse
#is_list를 사용.
def is_list(x):
return isinstance(x,list)
def reverse(xs) :
if xs == [] :
return []
elif is_list(xs[0]):
return reverse(xs[1:])+[reverse(xs[0])]
else:
return reverse(xs[1:])+[xs[0]]
print(reverse([1,[2,3,[4,[5,6]]]]))
#대칭정방행렬
x1=[[1,9,5,11],[9,4,7... | true |
d60fca0af10b1b88db73d374ac10b074b75113ff | Python | stsln/python | /Практика програмирвания Python (2020)/Лабораторная работа №2/7ypr.py | UTF-8 | 250 | 3.5625 | 4 | [] | no_license | from turtle import Turtle
import math
t = Turtle()
t.speed(100_000)
t.shape('turtle')
k = 1
fi_radian = 0.3
fi_step = fi_radian * (180 / math.pi)
for i in range(1000):
p = k * fi_radian
t.forward(p)
t.left(fi_step)
fi_radian += 0.1
| true |
5ee61f7835c94d9349506911d321006bf8226ee4 | Python | SukanyaRajendran/python | /sample.py | UTF-8 | 541 | 3.6875 | 4 | [] | no_license | a=6
print("a")
print(a)
a=10
b=5
c=7
print(a ,b,c)
str="hello world hi"
print (str)
print(str[0])
print(str[2:5])
print(str[2:])
print (str *2)
print (str + "abc")
list=['abc',78,34,'facts']
print(list)
print(list[2])
print(list[1:3])
print(list*2)
tuple=('suk',6,9,'hog')
print(tuple)
print(tuple[2:4])
dict={'name'... | true |
45c676b7a2501e7d5eaa03b0f649c03df596eb83 | Python | hi-zhengcheng/tools | /pyplot_demo.py | UTF-8 | 1,978 | 3.53125 | 4 | [] | no_license | # fix some crash problem on mac os x.
import sys
if sys.platform == 'darwin':
import matplotlib
matplotlib.use('TkAgg')
from matplotlib import pyplot as plt
from matplotlib import patches as patches
from PIL import Image
import numpy as np
"""
Most plt tutorials use simplified API, which is easy to write but... | true |
266f827a1bde41549a8284139c7d360407b4ed3f | Python | Rjt17/Python | /automate_the_boring_stuff-with_python/linear_search.py | UTF-8 | 476 | 4.125 | 4 | [] | no_license | #!/usr/bin/env python
searchList = []
i = int(input("please enter the number of values: "))
for x in range(i):
item = int(input(f"enter the no. {x+1}: "))
searchList.append(item)
print(searchList)
target = int(input("please enter the value to search: "))
for location in range(i):
if (searchList[location] ... | true |
724f2c59a055243d68f7a0f1de0a84cba32f6b3f | Python | zkazemi/sentiment_new_approach | /input_to_df.py | UTF-8 | 7,611 | 2.671875 | 3 | [
"MIT"
] | permissive | import os
import csv
import json
import pickle
import pandas as pd
import math
import emoji
import regex
test_dir = '/Users/macbook/Desktop/reasearch/tweets_data_set_2018/all-rnr-annotated-threads'
def get_file_path(dirName):
'''
:param dirName: direction of the directory of all data
:return: a list of f... | true |
0d553ca5de99e5697358e3c0b05590427562959f | Python | richouzo/cs7641 | /hw2/utils.py | UTF-8 | 4,598 | 2.734375 | 3 | [] | no_license | import datetime
import numpy as np
import torch
import pandas as pd
import seaborn as sns
import matplotlib.pyplot as plt
from sklearn.metrics import accuracy_score
from sklearn.metrics import mean_squared_error
from sklearn.metrics import classification_report
from sklearn.metrics import confusion_matrix
from sklea... | true |
a6296837ca2a6fae0dd9875dc83b56f75d805262 | Python | compsciteacher/Programming2019 | /turtle_random.py | UTF-8 | 800 | 3.71875 | 4 | [] | no_license | #HCD
#turtle input v.1
#9/17/19
import turtle,random #always get the turtle
#--------screen-----
screen=turtle.Screen()
screen.bgcolor("green")
screen.screensize(800,800)
#--------make a turtle-----
bob=turtle.Turtle()
bob.color('orange')
bob.pensize(5)
#--------actual movement-----
dist=30 #starting distance to mov... | true |
1846e695ce45d4e396b8d987d6a3b8b0b67096aa | Python | bachi55/rosvm | /rosvm/ranksvm/kernel_utils.py | UTF-8 | 13,536 | 2.75 | 3 | [
"MIT"
] | permissive | ####
#
# The MIT License (MIT)
#
# Copyright 2019, 2020 Eric Bach <eric.bach@aalto.fi>
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the ... | true |
2d576465357c97c7878025e2ad079f48b824a9a9 | Python | ginobilinie/learningDDP | /learn_ddp.py | UTF-8 | 7,107 | 2.84375 | 3 | [] | no_license | import torch
import torch.nn as nn
from torch.autograd import Variable
from torch.utils.data.sampler import BatchSampler,Sampler
from torch.utils.data import Dataset, DataLoader
import os
from torch.utils.data.distributed import DistributedSampler
from operator import itemgetter
import numpy as np
import torch.distrubu... | true |
242073803b125203b8228db8099d2d54adff6484 | Python | ferminitu/F_de_Informatica | /F. de Informática/Python avanzado/Lectura y Escritura de archivos/Ejercicio1.py | UTF-8 | 341 | 2.90625 | 3 | [] | no_license | import re
texto1 = open(r'/Users/ferminiturriaga/Desktop/UCEMA/2021/F. de Informática/UCEMA_Fundamentos_de_informatica-master/Python_intro/manipulacion_archivos.txt')
lineas = texto1.readlines()
contador = 0
print(lineas)
for i in lineas:
if re.search('^[^M]', i) is not None:
contador +=1
... | true |
290eef3914093ac823bde3c39c3eb4deaf9fc9d6 | Python | b33j0r/scrabble-solver | /src/scrabblesolver/board.py | UTF-8 | 3,246 | 3.25 | 3 | [] | no_license | class Board(object):
_default_layout_str = """
. . . tw . . tl . tl . . tw . . .
. . dl . . dw . . . dw . . dl . .
. dl . . dl . . . . . dl . . dl .
tw . . tl . . . dw . . . tl . . tw
. . dl . . . dl . dl . . . dl . .
... | true |
6391d71f7e011fbb23248db015456da6ab84a276 | Python | django/django | /django/utils/functional.py | UTF-8 | 14,541 | 3.15625 | 3 | [
"LicenseRef-scancode-other-copyleft",
"LicenseRef-scancode-unknown-license-reference",
"BSD-3-Clause",
"GPL-1.0-or-later",
"Python-2.0.1",
"LicenseRef-scancode-free-unknown",
"LicenseRef-scancode-other-permissive",
"Python-2.0"
] | permissive | import copy
import itertools
import operator
from functools import wraps
class cached_property:
"""
Decorator that converts a method with a single self argument into a
property cached on the instance.
A cached property can be made out of an existing method:
(e.g. ``url = cached_property(get_absol... | true |
4c6e05890594f5c911e1a14730c182c4df89f2f9 | Python | sysdeep/dcat | /app/lib/sorting.py | UTF-8 | 877 | 3.234375 | 3 | [] | no_license | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
import re
#--- Sort the given iterable in the way that humans expect.(https://stackoverflow.com/questions/2669059/how-to-sort-alpha-numeric-set-in-python)
convert = lambda text: int(text) if text.isdigit() else text
alphanum_key = lambda key: [convert(c) for c in re.spl... | true |
b4e32ab890c5564300051a774226f8b28c426513 | Python | murakumo512/Alpro-Python-2019-2020 | /Pertemuan 12/UG/2.py | UTF-8 | 478 | 3.8125 | 4 | [] | no_license | def dicttotuple(data):
t = list(data.items()) #masukan ke list
#t.sort()
tup = tuple(t)
for i in range (0,len(t)):
t[i]=[key for key in data.keys()][i],tuple(tup[i][1])
print(tuple(t))
data = { "Yusta":[90,160], "Elisabeth":[70,177], "Tasya":[50,175]}
dicttotuple(data)
... | true |
3939913fbd5263952df628c649b23c279780879b | Python | Awesomepig123/pyprojects | /Joe.py | UTF-8 | 3,844 | 3.546875 | 4 | [] | no_license | import random
import sys
import os
import subprocess
random_num = random.randrange(1, 6)
def execute_command(str):
subprocess.Popen(['D:\Program Files (x86)\eSpeak\command_line\espeak.exe', str])
#Start up
execute_command("Hello, I'm Al the Chatbot. \n I exist to be what you humans call a friend. \n... | true |
477a967551b86ddfbb5e23a27b5bd4498b07095b | Python | ethen8181/programming | /recommendation/BIKNN/recommender/psobiknn.py | UTF-8 | 5,142 | 2.8125 | 3 | [] | no_license | import random
import numpy as np
import matplotlib.pyplot as plt
from collections import namedtuple
from recommender.biknn import BIKNN
class PSOBIKNN:
def __init__(self, generation, swarm_size, low, high,
w, c1, c2, vmin, vmax, K, iterations, column_names, verbose):
self.w = w
... | true |
01b5bbdb0a8b0d589b1fb98ab4fa05ebf234a1d5 | Python | rajput-shivam/HuffmanEncoding | /HuffmanEncoding.py | UTF-8 | 752 | 2.90625 | 3 | [] | no_license | from heapq import heapify,heappush,heappop
from collections import defaultdict
def encode(d):
heap=[ [frequency ,[symbol,frequency,'']] for symbol,frequency in d.items() ]
heapify(heap)
while(len(heap)>1):
left=heappop(heap)
right=heappop(heap)
for i in left[1:]:
i[2]+=... | true |
e9187c9c40f213cbb67ffa2a87c0cc4a0f23c0f1 | Python | LyceeClosMaire/projet-final-assistant-jdr | /Code_ptdr t ki/tilemap.py | UTF-8 | 698 | 2.78125 | 3 | [] | no_license | import pygame, sys
from pygame.locals import *
#Constantes de couleurs
NOIR = (0, 0, 0)
ROUGE = (255, 0, 0)
BLEU = (0, 0, 255)
VERT = (0, 255, 0)
#Les sprites de la map
TERRE = 0
HERBE = 1
EAU = 2
MUR = 3
#Une liste associant les couleurs aux sprites
couleur = {
MUR : NOIR,
HERBE : VERT,
... | true |
69577077e4d964e661134ff133105c3006098765 | Python | phase/omgos | /pygos.py | UTF-8 | 607 | 2.984375 | 3 | [] | no_license | from __future__ import print_function # Python 2 garbage
import sys
filename = sys.argv[1]
content = open(filename).read()
parsing = False
buf = ""
last = ' '
index = 0
for c in content:
if parsing:
if last == '%' and c == '>':
buf = buf[:-1] # Remove `%` from `%>`
exec(buf)
... | true |
2eb2cb9c58f5afc40dba03ba1dbfe29d0a2b4cd6 | Python | qntmCharles/EMC | /lib/analysis/oldAnalyse.py | UTF-8 | 7,977 | 2.671875 | 3 | [] | no_license | import cPickle as pickle
import numpy as np
import os, csv
from difflib import SequenceMatcher
from matplotlib import pyplot as plt
#from classes import Author#,Entry
def analyseAuthor(authorobj, verbose):
totalHourCount = 0
totalDayCount = 0
print('Author: ',authorobj.username)
for date,entry in autho... | true |
590997c3fa7234522c60a21998298af309a9d456 | Python | PetriKiviniemi/mazesolver | /mazeSolver.py | UTF-8 | 1,556 | 3.15625 | 3 | [] | no_license | import maze as Mz
import cv2
import breadth_first_search as bfs
def findConnected(x1, x2, y1, y2):
connectedNodes = []
if x1 == x2:
connectedNodes.append((x1,y1))
for vertex in range(min(y1, y2), max(y1, y2)):
connectedNodes.append((x1, vertex))
connectedNodes.append((x2,y2)... | true |
fbfa6a697308fe9fb9722cd8f9354be74d4d0d54 | Python | s-surineni/atice | /insertion_sort.py | UTF-8 | 265 | 3.359375 | 3 | [] | no_license | ip_list = input('Enter the numbers').strip().split()
for idx in range(1, len(ip_list)):
i = idx - 1
a_key = ip_list[idx]
while i >= 0 and ip_list[i] > a_key:
ip_list[i + 1] = ip_list[i]
i -= 1
ip_list[i + 1] = a_key
print(ip_list)
| true |
4515b738a068f0f98f4f1ca25263128fe418c72c | Python | undiffagents/uagent | /tasks/vs/task.py | UTF-8 | 1,956 | 2.8125 | 3 | [] | no_license | import random
from think import DisplayVisual, Task
class VSTask(Task):
'''Visual Search Task'''
def __init__(self, env, instructions=None):
super().__init__()
self.display = env.display
self.keyboard = env.keyboard
self.instructions = instructions
self.stimuli = []
... | true |
d3bf1a8453caaf092afe2403e413250ce15474d9 | Python | GreenLivingCouncil/scada-exporter | /bin/models.py | UTF-8 | 2,455 | 3.125 | 3 | [] | no_license | """The data objects."""
import datetime
import json
# Datetime Format
DT_FORMAT = "%m/%d/%Y %H:%M:%S"
class Building(object):
def __init__(self, name, error=None, kwh=0, kw=0):
# Semantics of kwh and kw are undefined when error is set.
self.name = name
self.error = error
self.kwh =... | true |
aa7193ea57c7e7123d789c8af9a39b364f75589f | Python | Aasthaengg/IBMdataset | /Python_codes/p02830/s388125861.py | UTF-8 | 182 | 3.421875 | 3 | [] | no_license | n = int(input())
s, t = map(str, input().split())
new_word_list = []
for i in range(n):
new_word_list.append(s[i])
new_word_list.append(t[i])
print(''.join(new_word_list))
| true |
f9cc341b1022dbcce16a11a39d8c56778c65272a | Python | ckcr4lyf/9girlpy | /download.py | UTF-8 | 240 | 2.71875 | 3 | [] | no_license | import urllib
import urllib2
codes = open("gag.txt", "r")
def download():
i = 1
for url in iter(codes):
name = str(i)+".jpg"
urllib.urlretrieve(url, name)
print "finished downloading "+url+"\n"
i = i + 1
download() | true |
ceef961c2adf80f82144a9f0e0aeca24cd7aa4bf | Python | litepresence/Honest-MPA-Price-Feeds | /honest/config_sceletus.py | UTF-8 | 3,294 | 2.65625 | 3 | [] | no_license | """
+===============================+
╦ ╦ ╔═╗ ╔╗╔ ╔═╗ ╔═╗ ╔╦╗
╠═╣ ║ ║ ║║║ ║╣ ╚═╗ ║
╩ ╩ ╚═╝ ╝╚╝ ╚═╝ ╚═╝ ╩
MARKET - PEGGED - ASSETS
+===============================+
litepresence2020
enter your sceletus settings here
the script will build combinations matrix between "currencies" and "honest... | true |
5b11348990c44077dc091fedd099e7b818538a73 | Python | haoziyeung/puzzle | /tests/plugins/store/mixins/test_mixin_genelist.py | UTF-8 | 1,006 | 2.609375 | 3 | [
"MIT"
] | permissive | # -*- coding: utf-8 -*-
def test_gene_list(test_db):
list_obj = test_db.gene_list('test-list')
assert list_obj.gene_ids == ['ADK', 'KRAS', 'DIABLO']
assert list_obj.cases[0].case_id == '636808'
def test_gene_lists(test_db):
list_objs = test_db.gene_lists()
assert list_objs.count() == 1
def tes... | true |
9608e50c1f6c72154e335f313f284113ca3dd49a | Python | Vedant003/Python-Tricks | /Pentest/VulnerabilityScanner.py | UTF-8 | 729 | 2.59375 | 3 | [] | no_license | import socket
class TCP_Scan(object):
def __init__(self):
socket.setdefaulttimeout(2)
self.connection = socket.socket()
self.vulnerbilities = [
"FreeFloat Ftp Server (Version 1.00)",
"3Com 3CDaemon FTP Server Version 2.0",
"Ability Server 2.34",
... | true |
4fb96e0edad742e277d52392a4c6a1e057090cf6 | Python | joshbarrass/projection | /screen.py | UTF-8 | 1,841 | 2.96875 | 3 | [
"MIT"
] | permissive | import math
try:
import numpy as np
have_numpy = True
except ImportError:
have_numpy = False
class Screen(object):
def __init__(self, size, fov, centre=(0,0)):
self.size = size
self.centre = centre
self.set_fov(fov)
def set_fov(self, fov):
self.fov = fov
se... | true |
fdb5a41c0f4e017f79b257020840854598d32730 | Python | jeremych1000/collab_pic | /render.py | UTF-8 | 2,337 | 2.703125 | 3 | [] | no_license | import cv2
import random
import numpy as np
import investigate_emoji
from investigate_image import get_image
def greyscale_to_bw():
img = cv2.imread("C:/Users/Jeremy/Documents/GitHub/collab_pic/example_pic/dxV2T1v_g.jpg", cv2.IMREAD_GRAYSCALE)
blur = cv2.GaussianBlur(img, (5, 5), 0)
(thresh, im_bw) = cv2.... | true |
0da9880d6b73c50f5a6ddddae5c9daabce7b96be | Python | hyperskill/hs-test-python | /tests/outcomes/plot/dis/pandas/main.py | UTF-8 | 285 | 2.515625 | 3 | [] | no_license | def plot():
try:
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
import seaborn as sns
except ModuleNotFoundError:
return
s = pd.Series([1, 2, 2.5, 3, 3.5, 4, 5])
ax = s.plot.kde()
plt.show()
plot()
| true |
db001798cc5aa69bd8336f6e3cb55e59525e3394 | Python | timeflux/timeflux | /timeflux/core/branch.py | UTF-8 | 1,939 | 2.984375 | 3 | [
"MIT"
] | permissive | """Branch base class."""
from timeflux.core.node import Node
from timeflux.core.worker import Worker
from timeflux.core.scheduler import Scheduler
from timeflux.core.validate import validate
class Branch(Node):
def __init__(self, graph=None):
self._scheduler = None
if graph:
self.load... | true |
bc57e396e96a340fa5210f43636d9e554a290f85 | Python | ylee297/File-Edit | /readfile.py | UTF-8 | 873 | 3.5 | 4 | [] | no_license | import time
def watch(file):
file.seek(0)
while True:
currentPos = file.tell() # tell current postion
# print("currentPos", currentPos)
file.seek(0, 2) # seek to the end of the file
# this tell the size of the file cause current the pointer is at the end
endPos = file... | true |
4c090e7732eb1dff824241b9ce834e86cf538211 | Python | VictorTurraF/MetodoDaBisseccao | /main.py | UTF-8 | 1,298 | 3.859375 | 4 | [] | no_license | # Equação
eq = lambda x : (x ** 3) + (3 * x) - 1
# Erro
lim = 10 ** -2
# Procura os intervalos onde estão as raizes
def procurar_intervalos( pontos ):
intervalos = []
for x in range(0, len(pontos) - 1):
if pontos[x][1] * pontos[x+1][1] < 0:
intervalos.append( [ pontos[x], pontos[x+1] ] )
return inter... | true |
894f04904e9d5667b7ab1bfaf78f3ece44e135bd | Python | Robin8Put/pmes | /test_signature/client.py | UTF-8 | 1,291 | 2.6875 | 3 | [
"Apache-2.0"
] | permissive | import json
import requests
import random
import pprint
import os
import sys
from bip32keys.bip32keys import Bip32Keys
def post_user():
# Get public and private keys pair from file
with open("generated.json") as keys:
keys_list = json.load(keys)
users_keys = random.choice(keys_list)
public_... | true |
f84c6a3ba27f03c0371ab9c87b3199b078fb3194 | Python | easyguyme/engagmentpushbot | /features/starts.py | UTF-8 | 2,261 | 3.03125 | 3 | [] | no_license |
from config import *
@bot.message_handler(commands=["start", "Start"])
def start(message):
user_id = message.from_user.id
name = message.from_user.first_name
start_text = f"""
Hi {name}, ich bin <b>Claire</b>. 👋🏽🤗
Ich bin deine persönliche Assistentin in Sachen Instagram-Engagement-Growth. 📈😍
Oder m... | true |
855e86e00f6e79a6b4b4a6ab5c20f00021827682 | Python | RahatIbnRafiq/leetcodeProblems | /Hash Table Problems/739. Daily Temperatures.py | UTF-8 | 352 | 2.90625 | 3 | [] | no_license | class Solution(object):
def dailyTemperatures(self, temps):
stack = []
result = [0 for t in temps]
for i in range(0,len(temps)):
while len(stack) > 0 and temps[i] > temps[stack[-1]]:
idx = stack.pop()
result[idx] = i-idx
stack.append(i)... | true |
0028fe65fc84c0cafaadd5c4d3b91fa26a997c07 | Python | wangxuanlin/linux111 | /d盘/test.py | UTF-8 | 712 | 2.53125 | 3 | [] | no_license | import socket
import os
#new出来一个socket对象
server = socket.socket(socket.AF_INET,socket.SOCK_STREAM)
#绑定地址
server.bind(('0.0.0.0',8001))
server.listen()
base_dir = os.path.dirname(__file__)
def msg_gen():
headers = "HTTP/1.1 200 OK\r\nDate: Fri, 26 Apr 2019 02:48:05 GMT\r\nServer: nginx\r\nContent-Type: text/html;\r... | true |
b4446fe37bd1c7b18b6f7dda646d13233c7458ca | Python | juaopedrosilva/Python-Challenge | /EstruturaSequencial/atividade3.py | UTF-8 | 112 | 3.4375 | 3 | [] | no_license | x = int(input("Numero 1: "))
y = int(input("Numero 2: "))
soma = x + y
print("a soma dos numero é: ", soma ) | true |
1448e473b6306e743cc084bdbe5d0764f5e63432 | Python | jiangyingli/python20190601 | /姜英利/class71/Dog.py | UTF-8 | 737 | 4.46875 | 4 | [] | no_license |
class Dog: # class定义类,一类事物的抽象,模板(将来产生对象都依据模板)
#变量:属性
name=""
age=0
color=""
height=0.0
sex=""
#函数:功能
def eat(self):
print("狗能吃东西")
def drink(self):
print("狗能喝水")
def say(self):
print("我是"+self.name)
# 类直接调用属性
Dog.name = "狗狗" #所有对象共享的
dog = Dog()#1狗(对象)... | true |
851a63d64ab356aef5a95c72e2876af67dff484f | Python | ahmadreza-smdi/ms-shop | /.venv/lib/python3.7/site-packages/pylint/test/functional/inherit_non_class.py | UTF-8 | 1,693 | 3.34375 | 3 | [
"MIT"
] | permissive | """Test that inheriting from something which is not
a class emits a warning. """
# pylint: disable=no-init, import-error, invalid-name, using-constant-test, useless-object-inheritance
# pylint: disable=missing-docstring, too-few-public-methods, no-absolute-import
from missing import Missing
if 1:
Ambigu... | true |
1c4eb890def2bf5a37999ef045f11239127f3aed | Python | Sylvia0696/Cloud-Computing | /kinesis.py | UTF-8 | 1,920 | 2.859375 | 3 | [] | no_license | import json
import base64
import boto3
def lambda_handler(event, context):
dynamodb = boto3.resource('dynamodb')
table = dynamodb.Table('number')
for record in event['Records']:
#Kinesis data is base64 encoded so decode here
payload = base64.b64decode(record["kinesis"]["data"])
print... | true |
8aa48619ba0e0741d001f061041aa944c7ee6d05 | Python | amysimmons/CFG-Python-Spring-2018 | /01/formatting.py | UTF-8 | 471 | 3.96875 | 4 | [] | no_license | # STRING FORMATTING
age = 22
like = "taylor swift".title()
name = "Amy"
print "My age is {} and I like {}".format(age, like)
print "My age is 22 and I like Taylor Swift"
print "My age is {1} and I like {0}".format(age, like)
print "My age is Taylor Swift and I like 22"
print "My name is {}, my age is {} and I like... | true |
9b0e48ecce8757c9c906bb59e0815a8fc9ca8e87 | Python | 50183816/lineregression | /Projects/SpamEmailFilter/train_spam_email_filter_model_method2.py | UTF-8 | 6,649 | 2.515625 | 3 | [
"Apache-2.0"
] | permissive | # _*_ codig utf8 _*_
import numpy as np
from sklearn.naive_bayes import GaussianNB, MultinomialNB, BernoulliNB
from sklearn.metrics import classification_report, confusion_matrix, precision_score, accuracy_score
from time import time
import pandas as pd
import matplotlib as mpl
import matplotlib.pyplot as plt
import re... | true |
67da84a95156cd185659fca2d2d5914844233557 | Python | juchuanzhang/coding_practice | /tensorflow/tutorial1/chapter4_4_2.py | UTF-8 | 2,527 | 3 | 3 | [] | no_license | # 计算一个5层神经网络带L2正则化的损失函数
import tensorflow as tf
from numpy.random import RandomState
# 获取一层神经网络边上的权重,并将这个权重的L2正则化损失加入名称为'losses'的集合中
def get_weight(shape, my_lambda):
var = tf.Variable(tf.random_normal(shape), dtype=tf.float32)
tf.add_to_collection(
'losses', tf.contrib.layers.l2_regularizer(my_lambda... | true |
f0e0dbe6b633e97497340c9f75a85bb6278cfa3a | Python | AntoniyaV/SoftUni-Exercises | /Advanced/Python-advanced-course/05_functions_advanced/lab/multiplication_function.py | UTF-8 | 127 | 3.28125 | 3 | [] | no_license | def multiply(*args):
result = 1
for n in args:
result *= n
return result
print(multiply(2, 0, 1000, 5000)) | true |
939c6ae4567d30c6365a34dc072606f1839bc2b1 | Python | MuLx10/1vs1Quiz-Sockets | /question.py | UTF-8 | 210 | 3.21875 | 3 | [] | no_license |
class Question(object):
"""docstring for Question"""
def __init__(self, file_name):
self.file = open(file_name,'r')
def next_question(self):
line = self.file.readline().strip('\n')
return line
| true |
0d3c0f77adf401ca182979755dcdcd41aeba0c32 | Python | AlexEshoo/projectEuler | /euler059.py | UTF-8 | 973 | 3.46875 | 3 | [] | no_license | def keys():
# 97-122 ascii are lowercase letters
for i in range(97,123):
for j in range(97,123):
for k in range(97,123):
key = [i, j, k]
yield key
def get_text(decrypted):
chars = [chr(i) for i in decrypted]
text = ''.join(chars)
return text
with... | true |
1d573d45e7b66023a5ea304e4dc8f0a7e86f9586 | Python | mkohlmann-he/TimeTracker_r2.0 | /DataEntryClass.py | UTF-8 | 3,729 | 2.8125 | 3 | [] | no_license | #6/10/2015
#Michael Kohlmann
#devCodeCamp - Personal Project
# This is the data entry class for my time tracker widget.
# This is Rev 2.0. and a work in progress.
# Rev 1.0 adds a GUI and logs directly to a text file.
# Rev 2.0 adds a database connection for a MySQL server that is on the localhost.
# Non-Standard Li... | true |
4b881f1280a34d7f422f0aeab3b52e0b97f872c7 | Python | tgeery/reddit_script | /main.py | UTF-8 | 922 | 2.578125 | 3 | [] | no_license | #! usr/bin/env python3
import praw
import pandas as pd
import datetime as dt
import time
import os
reddit = praw.Reddit(client_id=os.environ['REDDIT_CLIENT_ID'], \
client_secret=os.environ['REDDIT_CLIENT_SECRET'], \
user_agent=os.environ['REDDIT_USER_AGENT'], \
... | true |
3d82a3b5398769cc442996e8a383c259279bdad4 | Python | iawarner/luddite-1 | /luddite/prokka/stats.py | UTF-8 | 2,553 | 2.890625 | 3 | [] | no_license | import warnings
import argparse
import os
class stats:
"""A simple class for storing prokka output statistics"""
def __init__(self , file = None):
self.stats = {
'contigs': 0 ,
'bases': 0 ,
'tmRNA': 0 ,
'misc_RNA': 0 ,
'tRNA': 0 ,
... | true |
a491dd76e683be624cd62ad6fbc5c6e3b9ad14f3 | Python | bhadurianirban/SoundAnal | /AudioParse.py | UTF-8 | 2,665 | 2.625 | 3 | [] | no_license | import os
import re
import librosa
import numpy as np
from sklearn.preprocessing import LabelEncoder
from keras.utils import np_utils
from keras.models import Sequential
from keras.layers import Dense, Activation, Dropout
class AudioParse:
def __init__(self, audio_file_root):
self.audio_file_root = audio... | true |
d3c058c8abe37212e756fb1a004efac21a719054 | Python | dransonjs/my_python_test_codes | /PycharmProjects/Python_Automated_Testing_Class_16/Class_16_20190506_Handle_Excel/lemon_02_excel_handle_write.py | UTF-8 | 838 | 3.65625 | 4 | [] | no_license | from openpyxl import load_workbook # 可以对已存在的excel进行读写操作
from openpyxl import workbook # 可以新建excel文件
# 使用load_workbook来实现excel读写
# 打开excel文件(已存在)
wb = load_workbook('cases.xlsx')
# 定位表单
ws = wb.active # 获取第一个表单
# 在单元格里写入数据
# 方法一:获取要写入的单元格
# 写入文件时,excel文件必须处于关闭状态
# ws.cell(2, 6).value = 8
# 方法二:
# ws.cell(2, 7, va... | true |
23a298ef93faeaa7c67c6a2da436e72fd08aa2b4 | Python | yklym/tgMailSender | /common/text/default_commands.py | UTF-8 | 216 | 2.640625 | 3 | [] | no_license | def chat_info_text(message):
return ('Hello, {m.from_user.first_name}\n'
'Your id: {m.from_user.id}\n'
'Chat type: {m.chat.type}\n'
'Chat id: {m.chat.id}\n').format(m=message)
| true |
f9f3cce78b05a1d5f7d29a934f5c6923bb243efe | Python | AkhashAk/Python_problems_set1 | /reverse of a single number.py | UTF-8 | 142 | 3.328125 | 3 | [] | no_license | def rev_num(n):
s=0
while n>0:
r=n%10
s=s*10+r
n=n//10
return print(s)
n=int(input())
rev_num(n)
| true |
0314970ca65efb9488e2dfe59432a9a644cb673f | Python | Ashish-Surve/Learn_Python | /Training/Day5/some modules/2_sys_demo_1.py | UTF-8 | 328 | 2.9375 | 3 | [] | no_license |
"""sys. stdin stdout stderr"""
import sys
sys.stdout = open("hello.txt","w")
print ("AAAAAAAAAAAAAAAAaa") #instead of printing on console, it will print inside file hello.txt
sys.stdout.close()
'''
stdin
stdout
stderr
#!/usr/bin/env python
f1 = open("hello.txt","w")
f1.write("Hello !!... | true |
5ed2088181c9b7982b23663df6dedeec4fa1c1ad | Python | programiranje3fon/classes2018 | /classes2018/python/functions.py | UTF-8 | 3,599 | 4.15625 | 4 | [] | no_license | """Demonstrates details of writing Python functions: annotations, default args, kwargs
"""
def demonstrate_annotations(artist: str, song: str = 'Because the Night') -> str:
# """
# Demonstrates annotations.
# :param artist: an artist (string)
# :param song: a song (string)
# :return: string
# ... | true |
f00ea4b0fb315a529c481928a0ed44627bde2c7d | Python | manojkdey/MDey_BootCampRepo | /Instructions/PyBank/.ipynb_checkpoints/main-checkpoint.py | UTF-8 | 3,545 | 2.859375 | 3 | [] | no_license | {
"cells": [
{
"cell_type": "code",
"execution_count": 53,
"metadata": {},
"outputs": [],
"source": [
"#-main script to run for Pypoll analysis\n",
"# Modules\n",
"import os\n",
"import pandas as pd\n",
"import csv"
]
},
{
"cell_type": "code",
"execution_count": 137,
... | true |
4ea9c255d6442f512a910875006996ec7ea31c45 | Python | chenrenren/Python-programming- | /Assignment 4/src/Graph.py | UTF-8 | 3,694 | 2.921875 | 3 | [] | no_license | '''
Created on Oct 31, 2017
@author: michellesong
'''
import os
from Graph import *
from Line import *
from Node import *
from docutils.parsers.rst.directives import path
from copy import deepcopy
class Graph(object):
def __init__(self, folder_name):
'''
Constructor:
'''
os.chdir... | true |