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 |
|---|---|---|---|---|---|---|---|---|---|---|
cb2a8fa72bd2fd5754a1922c73ae8662573b646e | tessereth/misc | /bin/pr_stats.py | UTF-8 | 4,991 | 2.5625 | 3 | [
"Apache-2.0"
] | permissive | #!/usr/bin/env python3
# Retrieve github pull requests statistics for a repo
#
# (c) 2016 Teresa Bradbury
import requests
import json
import argparse
import datetime
import csv
import os
import collections
def parse_args():
parser = argparse.ArgumentParser()
parser.add_argument('-r', '--repo', help='github r... | true |
6c09ad84dfb431cfc32078d0bbcc30f41c991a0b | Yu-AnChen/cellcutter | /cellcutter/cli.py | UTF-8 | 1,850 | 2.875 | 3 | [
"MIT"
] | permissive | import logging
import click
import pandas as pd
from . import cut as cut_mod
@click.command()
@click.argument("image", type=click.Path(exists=True, dir_okay=False))
@click.argument("segmentation_mask", type=click.Path(exists=True, dir_okay=False))
@click.argument("cell_data", type=click.Path(exists=True, dir_okay=F... | true |
0dce0ca1dfa2fd3b80fce65604c08a78c2d7ad58 | meloLeeAnthony/PythonLearn | /12-Numpy数学函数库/10修改数组的维度.py | UTF-8 | 692 | 3.875 | 4 | [] | no_license | # 导入numpy模块
import numpy as np
# 通过reshape将一维数组修改为二、三维
# 创建一个一维数组
a = np.arange(1, 25)
print(a)
# 将一维修改为二维 (2,12) (4,6) (3,8)
# b=a.reshape(4,6)
b = a.reshape((3, 8))
print(b)
# 将一维修改为三维 (2,3,4)
c = a.reshape((2, 3, 4))
print(c)
# 通过np.reshape()进行修改
# bb=np.reshape(a,(3,8)) #将一维修改为二维
bb = np.reshape(a, (4, 3, 2)) ... | true |
fb706fe2f2dd76a4136f0d10e5ae86ff20f27bbf | markhenryfisher/Raspberry-Pi-Interface-Course | /exercise1.py | UTF-8 | 2,801 | 3.46875 | 3 | [] | no_license | import glob
import time
SAMPLE_RATE = 2
# Function to find the list of temperature probes
def find_temperature_probes():
# Get and return a list of the temperature probes
return glob.glob('/sys/bus/w1/devices/28*')
# Function to read the current temperature reported by the requested probe
#
# Arguments:
#
... | true |
c8eebfabcfaa2128ed3b52f62847e71a6666a5d7 | anhkietnt1999/learnPythonCode | /fixbug.py | UTF-8 | 4,412 | 2.734375 | 3 | [] | no_license | from bs4 import BeautifulSoup
import requests
import unicodedata
import re
import json
def CrawlDataPage(soup):
dataAll = []
dataStory = []
dataSite = []
dataRank = []
Ranks = soup.find_all('span',class_='rank')
for rank in Ranks:
tempstr = rank.string.replace('.','')
dataR... | true |
8ad2b2d47d96d0d71df5857fb6f052553c5c5a33 | lensabillion/CS487 | /MaximumLengthOfPairChain.py | UTF-8 | 402 | 2.9375 | 3 | [] | no_license | class Solution(object):
def findLongestChain(self, pairs):
"""
:type pairs: List[List[int]]
:rtype: int
"""
pairs.sort(key = lambda x:x[1])
cnt,i = 0,0
for j in range(len(pairs)):
if j == 0 or pairs[i][1] < pairs[j][0] :
... | true |
0268fced75602e9cb0bb8c939683310d1cb1f572 | ogalindomo/Degree-code | /CS 5363/Final Exam/segmentation _Galindo_Oscar.py | UTF-8 | 4,428 | 2.5625 | 3 | [] | no_license | import matplotlib.pyplot as plt
import numpy as np
import os
from skimage.data import astronaut
from skimage.color import rgb2gray
from skimage.filters import sobel
from skimage.segmentation import felzenszwalb, slic, quickshift, watershed, active_contour
from skimage.segmentation import mark_boundaries
from sk... | true |
415d485d00b8faf0fe0ee4d72e42256f1cfeeb2a | HHIR/Voice-Mood-NLP-CNN | /python/explore/explore_nltk.py | UTF-8 | 7,434 | 3.140625 | 3 | [] | no_license | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Fri Mar 13 11:23:12 2020
@author: billcoleman
"""
import pandas as pd
eb = pd.read_csv("data/emobank.csv", index_col=0)
print(eb.shape)
test = eb.head()
# NLP module
import nltk
# https://www.guru99.com/tokenize-words-sentences-nltk.html
from nltk.tokeni... | true |
cf239957f246c7f1d2f9921a50eb4be3910ce07f | leVirve-arxiv/Crawler.PY | /nthu-library-renew.py | UTF-8 | 1,687 | 2.734375 | 3 | [
"MIT"
] | permissive | import requests
from bs4 import BeautifulSoup
from collections import namedtuple
import secret
Account = namedtuple('Account', ['id', 'password'])
'''
ACOOUNT DATA STRUCTURE:
accounts = [
('id', 'password'),
]
'''
def get_page(url):
response = requests.get(url)
response.encoding = 'utf8... | true |
47df903fd464e85935b23e4693b192c1c680f8a3 | santamanyu/Yocto_Auto_Calibration | /Final_Algorithm.py | UTF-8 | 5,460 | 2.640625 | 3 | [] | no_license | '''
Some limitations with the sensor
1.if(offset > single_bulb_Lux) ---------> gives negative value
2.Sensor must be placed at equidistant from all the lamps.
exceptional case:- if we are getting more then number of light for a site,we can ignore
if sensor is pointed perpendicular towards a light sourse,it wi... | true |
d70b3151b28bb23399f455719fa560a5b0855fa2 | MyloTuT/IntroToPython | /Excercise/Ex2/ex2.6.py | UTF-8 | 232 | 3.71875 | 4 | [] | no_license | #!/usr/bin/env python3
bday = "Happy Birthday to you!"
a = 1
while a <= 10:
print(bday)
a = a + 1
how_many = input("How many times should I greet you?: ")
if how_many.isdigit() == False:
exit('error202: not a digit')
| true |
ed9ea93a60636763170009b1faecedf96b7b2ed2 | cdgus1514/Algorithm | /Algorithm_Test/haafor/C4.py | UTF-8 | 238 | 3.84375 | 4 | [] | no_license | # C4. Write a code that finds the Nth element of the Fibonacci sequence, defined as
# 피보나치
def fibo(n):
s = [0, 1]
for i in range(2, n + 1):
s.append(s[i - 1] + s[i - 2])
# print(s)
print(s[n])
fibo(10) | true |
eaf0a978fb22c240a4f9a59d6bf0e900271cb24d | sagarnikam123/learnNPractice | /pluralSight/pythonBeyondTheBasics/8_iterablesAndIteration/5_mapVersusComprehensions.py | UTF-8 | 160 | 3.96875 | 4 | [
"MIT"
] | permissive | # 08_05-map() Versus Comprehensions
[str(i) for i in range(5)]
list(map(str, range(5)))
i = (str(i) for i in range(5))
list(i)
i = map(str, range(5))
list(i)
| true |
1019a2faec17a979223b5395df05b58741277a1e | KeelyHill/KHCmdExtras | /cmdextras.py | UTF-8 | 1,699 | 2.828125 | 3 | [
"MIT"
] | permissive | """KHCmdExtras
A small extension for Python's cmd module.
Can function as a boiler plate.
All vanilla features still apply
"""
__author__ = "Keely Hill"
__copyright__ = "Copyright (c) 2014, Keely Hill"
__license__ = "MIT"
__version__ = "0.1.1"
__maintainer__ = "Keely Hill"
import cmd
import sys
import os
class KHCm... | true |
aa423364b14e82b96c8c1ac88986f41d6ee2b7e2 | superlou/right-now | /tests/test_basics.py | UTF-8 | 2,318 | 2.8125 | 3 | [] | no_license | import dateutil.parser as parser
from datetime import timedelta
from right_now import Schedule, Event
def test_loading_schedule():
schedule = Schedule('tests/basic.json')
assert schedule
def test_loaded_schedule_events_count():
schedule = Schedule('tests/basic.json')
assert len(schedule.events) == 3... | true |
db97538d96116928f64aa6457166f2145fb39485 | hkbruvold/datasyn16 | /tfapplymodel.py | UTF-8 | 1,069 | 2.859375 | 3 | [] | no_license | #! /usr/bin/env python
#
# functions to apply model to images
#
import cv2
import tfdata
import tfmodel
import tensorflow as tf
class TFmodel:
def __init__(self, modelname):
# create model
Xsize = tfmodel.Xsize # number of neurons on input side
Ysize = tfmodel.Ysize # number of neurons... | true |
4fa1ae78123eef2280fc07e07bd9a8f4d8446a45 | lovee/supermarket | /Cashier.py | UTF-8 | 1,062 | 2.703125 | 3 | [] | no_license | #coding:utf-8
#超市收银员
#@author: caohang
#@date: 2017-02-25
#@version: v0.1
import Queue
import random
import time
class Cashier:
'''
收银员
'''
def __init__(self, name, super_market):
self.name = name
self.super_market = super_market
#消费者请求数
self.request_count = 0
def p... | true |
c0e7f5f37b5d40230baa9c7e328832f8c08022e2 | RWJMurphy/roguelike | /color.py | UTF-8 | 2,895 | 3.328125 | 3 | [] | no_license | # -*- coding: utf-8 -*-
__all__ = ['Color']
class Color:
def __init__(self, r, g, b):
r = max(0, min(r, 255))
g = max(0, min(g, 255))
b = max(0, min(b, 255))
self.__r = r
self.__g = g
self.__b = b
def __eq__(self, other):
return self.rgb() == other.rgb(... | true |
e01ff51b224430117798a420353a7e4deac8c681 | Tsai-nono/py-projects | /repository/boggle_game_solver/boggle.py | UTF-8 | 5,448 | 3.28125 | 3 | [
"MIT"
] | permissive | """
File: boggle.py
Name:
----------------------------------------
TODO:
"""
from boggle_logging import Logging
from boggle_dictionary import Dictionary_Dict
# This is the file name of the dictionary txt file
# we will be checking if a word exists by searching through it
DICT_FILE = 'dictionary.txt'
LOG_FILE = 'boggle... | true |
44d4a47b635240066bbeb22e0d7e099cc1500aa1 | sachiko0817/flask727 | /app.py | UTF-8 | 1,370 | 2.65625 | 3 | [] | no_license | from flask import Flask,render_template,request,redirect
import sqlite3
app = Flask(__name__)
@app.route('/')
def hello():
return "Hello World!"
@app.route('/top')
def top():
return "ここはトップだよ〜"
@app.route('/hello/<text>')
def namehello(text):
return text + "さんこんにちは"
@app.route('/index')
def ... | true |
fa67592ccd65b71f96cb4ed0da0049db4e10a300 | andrewtracer/dataflow | /regular_gridding_example.py | UTF-8 | 833 | 3.453125 | 3 | [] | no_license | #taken from http://www.scipy.org/Cookbook/Matplotlib/Gridding_irregularly_spaced_data
import numpy as N
from matplotlib.mlab import griddata
import matplotlib.pyplot as plt
import numpy.ma as ma
from numpy.random import uniform
# make up some randomly distributed data
npts = 200
x = uniform(-2,2,npts)
y = uniform(-2,... | true |
59cf9d1ae20c76cd420e55bd0ff7833a5c7a3dbd | cverdence/spam_classifier | /spam_classifier/classifier.py | UTF-8 | 1,379 | 3.03125 | 3 | [] | no_license | # Load libraries
import pandas as pd
import spam_classifier.utils as u
from sklearn.feature_extraction.text import CountVectorizer
from sklearn.model_selection import train_test_split
from sklearn.naive_bayes import MultinomialNB
from sklearn.metrics import accuracy_score, precision_score, recall_score, f1_score
# Re... | true |
a33b78d6a24bd33c4a55b2396dff4fd8b95cd52b | maslovaleksandr/homeworks | /flask_homework_part_2/exceptions_log_homework.py | UTF-8 | 584 | 3.484375 | 3 | [] | no_license | # +2.Сделать менеджер контекста, который бы проглатывал все исключения вызванные
# в теле и писал их в консоль, пример использования:
#
# with no_exceptions():
# 1 / 0 # => logs: ZeroDivisionError
#
# print('Done!') # => continues execution
from contextlib import contextmanager
@contextmanager
def no_exception... | true |
628290232bcab028eebbeda07ecc4892fd3c8964 | AnnaClee/htm2020 | /src/Tkinter_image.py | UTF-8 | 1,534 | 3 | 3 | [] | no_license | from tkinter import *
import tkinter as tk
from src.base_gui import BaseGUI
class TkinterImage(BaseGUI):
def __init__(self, master_window, controller):
# calling parent constructor:
super(TkinterImage, self).__init__(master_window, controller, "Second Frame")
# This is for the background... | true |
b946e2fef365a743902cf3fb0fa599faa313de98 | gbozee/Binance_Futures_python | /binance_f/model/markpriceevent.py | UTF-8 | 967 | 2.796875 | 3 | [] | no_license | class MarkPriceEvent:
def __init__(self):
self.eventType = ""
self.eventTime = 0
self.symbol = ""
self.markPrice = 0.0
self.fundingRate = 0.0
self.nextFundingTime = 0
@staticmethod
def json_parse(json_data):
result = MarkPriceEvent()
... | true |
2dd3220d4ce76de3ba235d378875cf4c5d65fe71 | krysmathis/flask-api-basic | /security.py | UTF-8 | 491 | 2.765625 | 3 | [] | no_license | from werkzeug.security import safe_str_cmp
from models.user import UserModel as User
def authenticate(username, password) :
""" Authenticate that the given username and password resolve to
and active user """
user = User.find_by_username(username)
if user and safe_str_cmp(user.password, password... | true |
f0e77f4941aa09ec02635082ce748afe4eeec4e3 | vt0311/python | /ch7/membertest.py | UTF-8 | 2,067 | 3.015625 | 3 | [] | no_license | '''
Created on 2017. 10. 20.
@author: acorn
'''
from ch7.member import Member
from ch7.member import GuideM
from ch7.member import TravelerM
mList = []
while True:
menuNo = int(input('0:종료, 1:입력, 2:출력:'))
if(menuNo == 0): ''' 종료 '''
break
elif(menuNo == 1): ''' 입력 '''
#guideY... | true |
303392ca704707a5af45ccac51629ccbb09cd274 | hammygoonan/link-shortener | /tests/links.py | UTF-8 | 4,185 | 2.75 | 3 | [
"MIT"
] | permissive | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""Unit tests for links module."""
from flask.ext.login import current_user
from tests.base import BaseTestCase
from shortener.models import Link
from mock import patch
from mock import MagicMock
import requests
class LinkTestCase(BaseTestCase):
"""Link test cases.... | true |
fd864a24ba6d679a014d508a948b0222a8f0ee55 | dianabarbo/billing-services | /app.py | UTF-8 | 354 | 2.71875 | 3 | [] | no_license | import os
from flask import Flask
def create_app(test_config=None):
# create and configure the app
app = Flask(__name__, instance_relative_config=True)
# a simple page that says hello
@app.route('/hello')
def hello():
return 'Hello, World!'
return app
if __name__ == '__main__':
... | true |
b0b1a3cb48c7510d1d9224e46c9a1fe645379057 | renanmat/ExPython | /ex048.py | UTF-8 | 211 | 3.953125 | 4 | [] | no_license | soma = 0
n = 0
for cont in range(1, 501, 2):
if cont % 3 == 0:
n += 1
soma += cont
print('A soma entre os numeros é \033[1;34m{}\033[m contendo \033[1;33m{}\033[m numeros.'.format(soma, n))
| true |
079f49999f899b8d6eb34ae1f0cecaa5c718779b | AAAR-Salmon/procon | /introduction/model_answer/python/04_accepted.py | UTF-8 | 60 | 3.015625 | 3 | [
"MIT"
] | permissive | ans=0
for c in input():
if c == '1':
ans += 1
print(ans)
| true |
6ec5cf7baec2eddfd8df3a360cb58696cca610b4 | rest7/python | /python/dds2png.py | UTF-8 | 455 | 2.828125 | 3 | [] | no_license | import json, requests, shutil
url = 'http://api.rest7.com/v1/image_convert.php?format=png'
files = {'file': ('test.dds', open('test.dds', 'rb'), 'application/octet-stream', {'Expires': '0'})}
js = requests.post(url, files=files).text
data = json.loads(js)
if (data['success'] != 1):
print('Conversion failed')... | true |
ee0b24c6e3c418c77fc46e13ef966cc63df7280b | perina98/website-data-extraction | /tests/overall.py | UTF-8 | 1,034 | 3.203125 | 3 | [] | no_license | #
# File: overall.py
# Brief: Calculate and print overall weighted results of tests from temporary overall file and remove that file
# Author: Lukáš Perina
# xlogin: xperin11
# Year: 2021
#
import os
try:
file = open('overall','r+')
except:
print("Run tests first by using ftest.py")
exit(0)
arr = file.rea... | true |
b0b5798c5a583ec92038b5884fa76dd9e3ee475b | Full-Stack-Typhoon/Autonomous-Driving | /code/Test/model.py | UTF-8 | 13,475 | 2.515625 | 3 | [] | no_license | import torch.nn as nn
import torch.nn.functional as F
import torch
import copy
import torchvision.models as models
from __future__ import absolute_import, division, print_function
from collections import OrderedDict
class DepthDecoder(nn.Module):
def __init__(self, num_ch_enc, scales=range(4), num_output_channels... | true |
20b8b80a5145f9ecbd13501e7ea4d7eaff2c6d06 | HarrisonMarcRose/covid | /main.py | UTF-8 | 27,419 | 2.5625 | 3 | [] | no_license | import json
from argparse import ArgumentParser
from datetime import datetime, timedelta
from enum import Enum
from os import path
from statistics import mean
import matplotlib.pyplot as plt
import numpy as np
import requests
from matplotlib.animation import FuncAnimation, FFMpegWriter
class CovidType(Enum):
CAS... | true |
80bb058b889cf5167e2ac7a31959bfc25d9f8b16 | KuroKousuii/Codeforces | /Python/800 - IV/1271A.py | UTF-8 | 200 | 2.875 | 3 | [] | no_license | a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
f = int(input())
print(min(a, d)*e+min(b, c, d-min(a, d))*f if e >= f else min(d, c, b)*f+min(a, d-min(d, c, b))*e) | true |
d4c2d31e53d0216ae6a9c1daf0759c2380fe8cdb | 10k-in-6months/CW-AWS-DEVOPS-WORKING | /python/coding-challenges/cc-006-generate-password/paswordgen_fth.py | UTF-8 | 217 | 3.46875 | 3 | [] | no_license | import random
name = input ("Please enter your full name without any space :")
result=""
while len(result)< 3:
result+=name[random.randint(0,len(name))].lower()
result+=str(random.randint(1000,9999))
print(result) | true |
cf8f158f3ef897574a9256b75722ab1c67373953 | iamludal/icewalker | /src/main-console.py | UTF-8 | 1,043 | 3.34375 | 3 | [] | no_license | from Game import Game
def usage():
print("To play ice walker, type in the following command:")
print(" ")
print(" $ python3 main-console.py [filename] ")
print(" ")
print("where [filename]... | true |
730eb97a67cd2b7cac9a84eb78b2a87b8c03c606 | bexiturley/My-First-Program | /my-first-program.py | UTF-8 | 161 | 3.484375 | 3 | [] | no_license | # Rebecca Turley, 2019-01-30
# Calculate the factorial of a number.
start = 20
ans = 1
i = 1
while i <= start:
ans = ans * i
i = i + 1
print (ans)
| true |
858f555a2cea2572b79d0ed59fa36c4e4231bf95 | HyunsuChoi-git/Python | /crawling/crawling04/CSVD01.py | UTF-8 | 1,578 | 4.03125 | 4 | [] | no_license | '''
CSV 파일 - 데이터 저장/읽기
CSV (Comma-Seperated Values)
형식 : 각 열은 콤마(,)로 구분, 각 행은 줄바꿈 문자로 구분
라이브러리 : csv
'''
import csv
#//1. csv 파일 저장
with open('test01.csv', 'w', encoding='UTF-8', newline='') as writer_csv:
#// ㄴ> 파일정보들
writer = csv.writer(writer_csv, delimiter=',')
#// ㄴ> 파일 객체, 구... | true |
925d3a28a4170d3010bb39a667a488409342f1e4 | dolv/PythonLearning | /lab8_2_find_fraction.py | UTF-8 | 949 | 3.578125 | 4 | [] | no_license | import math
def find_fraction(summ):
a = int(summ / 2)
b = summ - a
if summ > 5:
listPrime = [2]
for i in range(3, int(math.sqrt(summ))):
yes = True
for prime in listPrime:
if i % prime == 0:
yes = False
break
... | true |
adf05474bcd2404353d4b88d8b9bb33f2b98c8c5 | arnauqb/statistics | /fibonacci.py | UTF-8 | 300 | 3.71875 | 4 | [] | no_license |
def fibonacci(n):
"""
Returns first n elements of fibonacci sequence.
"""
fibonacci_series = [1,0]
for i in range(2,n):
num1 = fibonacci_series[i-1]
num2 = fibonacci_series[i-2]
fibonacci_series.append(num1+num2)
return fibonacci_series
| true |
9eb7de73887dfd5699552185de132725d2c5ec9a | nodesense/aws-databricks | /code/spark/s80_movie_lens.py | UTF-8 | 2,620 | 2.71875 | 3 | [] | no_license | #spark ui url http://localhost:4040/jobs/
import os
import findspark
findspark.init()
import pyspark
from pyspark.sql import SparkSession
import configparser
from pyspark.sql.functions import *
config = configparser.ConfigParser()
spark = SparkSession.builder.master("local[1]").appName("Spark... | true |
58714b765a7e3c75a347286e2c897236f4ff7142 | alesapin/Dirichlet_problem | /graph/plotter.py | UTF-8 | 2,208 | 2.796875 | 3 | [] | no_license | import os
from mpl_toolkits.mplot3d import Axes3D
import matplotlib.pyplot as plt
from matplotlib import cm
import numpy as np
from scipy.interpolate import griddata
from matplotlib.ticker import LinearLocator, FormatStrFormatter
import math
def read_file(fpath):
result = []
with open(fpath,'r') as f:
... | true |
03cfb8cb0715a692737f4ab7178b452cf13d4021 | svalinn/r2s-act | /scripts/r2s/data_transfer/write_alara_fluxin.py | UTF-8 | 7,318 | 2.890625 | 3 | [] | no_license | #!/usr/bin/env python
"""
`write_alara_fluxin.py` is used to create a fluxin file for ALARA. Fluxes are
taken from a MOAB mesh, with tag names of the form 'n_group_###' where ### is
a 3 digit number with leading zeros as needed (e.g. 001).
"""
from optparse import OptionParser
import sys
from itaps import iMesh, iBas... | true |
af7525885e6ecf119d0d474fb9f7dd87d3ed30ab | Bitwise-01/Miscellaneous | /SalesMan2/salesMan.py | UTF-8 | 1,716 | 3.5 | 4 | [
"MIT"
] | permissive | # Date: 04/14/2018
# Author: Mohamed Sheikh
# Description: Another attempt to solving the TSP
class Point(object):
def __init__(self, name, x, y):
self.coord = (x, y)
self.name = name
class SalesMan(object):
def __init__(self, data):
self.data = self.parseData(data)
self.initial = Point('Initia... | true |
2c810986d23aec80c7bd230f4c2aef5d04c344b8 | dieguinsss/challenge | /01_server/01_agente.py | UTF-8 | 1,477 | 2.78125 | 3 | [] | no_license | #!/usr/bin/env python3
import os, time
import json, dicParser, fileAdmin
import requests, sys
# EJEMPLOS
# curl -X POST -d 'hola' http://localhost:5000/resultado
# curl -X POST -d '{name: diego, age: 37}' -H 'Content-Type: application/json' http://localhost:5000/resultado
#
url = str(sys.argv[1])
# setear ruta donde ... | true |
2151209d561ef7a8db7c6a6d85afe3ff1e38ac9d | jutish/master-python | /07-ejercicios/ejercicio1.py | UTF-8 | 293 | 3.828125 | 4 | [] | no_license | """
Ejercicio 1.
-Crear variables una pais y otra continente
-mostrar su valor por pantalla.
-poner un comentario diciendo el tipo de dato
"""
pais = "Argentina" #Es un String
continente = "America" #Es un String
year = 2020
print(f"Pais: {pais} - continente: {continente} - año: {year}") | true |
ee2294bcdf81835848bdd6f6925d068f67cb17de | hellerve/nautobot | /nautobot/utilities/forms/widgets.py | UTF-8 | 5,120 | 2.515625 | 3 | [
"Apache-2.0"
] | permissive | import json
from urllib.parse import urljoin
from django import forms
from django.conf import settings
from django.urls import get_script_prefix
from nautobot.utilities.choices import ColorChoices
from .utils import add_blank_choice
__all__ = (
"APISelect",
"APISelectMultiple",
"BulkEditNullBooleanSelect... | true |
d66553be674fdc5bb80d31053110ef618777e0c9 | stefchen0922/test | /password.py | UTF-8 | 432 | 3.890625 | 4 | [] | no_license | #密碼重試程式
#password = 'a123456'
#讓使用者重複輸入密碼
#最多輸入3次
#如果正確 就印出"登入成功"
#如果不正確 就印出 "密碼錯誤! 還有___次機會!"
password = 'a123456'
icount = 3
while True:
if password != input("請輸入密碼:"):
icount -= 1
if icount == 0:
break
print("密碼錯誤! 還有" + str(icount) + "次機會")
else:
print("登入成功")
break
| true |
5988f4b223456cbf2a883f1a4a065936ca3ee740 | Mike575/udp | /ChatBox.py | UTF-8 | 3,642 | 2.875 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Sat Feb 16 21:29:35 2019
@author: Administrator
"""
import socket
import threading
import time
import inspect
import ctypes
import traceback
global dest_ip
global dest_port
def _async_raise(tid, exctype):
"""raises the exception, performs cleanup if needed"""
tid = ctyp... | true |
ad890e9f6a05c95946cea9230d6fe83c91b9d435 | williamtw0131/interview_test | /solution2.py | UTF-8 | 468 | 4.0625 | 4 | [] | no_license | '''
2. 現有設定如下:
s = [1, 2, 3, 4, 5]
m = [99, 98, 97, 96, 95]
以 s[0] 對 m[0] 、s[1] 對 m[1] 的方式,依序計算每組的 '+' '*' 運算,
輸出成 => '1 + 99 = 100', '1 * 99 = 99', '2 + 98 = 100'...
一條算式為一行
'''
s = [1, 2, 3, 4, 5]
m = [99, 98, 97, 96, 95]
len = len(s)
for i in range(len):
total = s[i] + m[i]
mul = s[i] * m[i]
... | true |
c4626de8d9260b99aa90142944983a0ec5a78481 | shalin-s/02-512_F20_Final_Project | /ODE/ODE.py | UTF-8 | 8,396 | 3.203125 | 3 | [
"MIT"
] | permissive | import matplotlib.pyplot as plt
import matplotlib.patches as mpatches
## First ODEs
def ODE_1(k1, k2, k3, S0, I0, R0, D0, T, dt):
inputs = (k1, k2, k3, dt)
S = S0
I = I0
R = R0
D = D0
def simS(S, I, R, D, inputs, deltat, Scurr):
(k1, k2, k3, dt) = inputs
new = (Scurr + (delta... | true |
0822ad894d226323aaeb09d3982d7d1f01c8426c | paravangular/poets-vis | /graph_schema-master/tools/create_random_graph.py | UTF-8 | 5,048 | 2.5625 | 3 | [] | no_license | from graph.load_xml import load_graph
from graph.save_xml import save_graph
from graph.core import *
import sys
import os
import random
n=1
if len(sys.argv)>1:
n=int(sys.argv[1])
nEdgeTypes=n
nDeviceTypes=n
nDeviceInstances=n*10
nEdgeInstances=n*40
urng=random.random
def make_random_string(prefix):
return... | true |
99b3126bb22626047bb47076e0537314314e3bcc | Eugene-Kocherga/aifil_tasks | /core/pfm_fpi.py | UTF-8 | 3,539 | 2.828125 | 3 | [] | no_license | from collections import defaultdict
def mean(values):
return sum(values)/len(values)
def global_uniform_metric(values):
l = len(values)
if l <= 1:
return 0
m = mean(values)
if m <= 0:
return 0
mse = mean([(v-m)**2 for v in values])**0.5
normed_mse = mse/m/(l-1)**0.5
re... | true |
4a3d6faf8c1d038faf4c994e3ff4acc7f295dfe3 | feldman4/lasagna | /lasagna/codes.py | UTF-8 | 7,855 | 2.828125 | 3 | [] | no_license | import numpy as np
from itertools import product
from collections import defaultdict, OrderedDict, Counter
from Levenshtein import distance, editops
from lasagna.designs.pool0 import GC_penalty, homopolymer_penalty, contiguous
from scipy.sparse import coo_matrix
### VT
def mod_sum(x, q=4):
return int(np.sum(x) % ... | true |
e0740acce3577e81751c61c29762b4c65d91c3ba | raushankumar27/python-samples-collection | /tcs1.py | UTF-8 | 134 | 3.28125 | 3 | [] | no_license |
a=input()
try:
s=0
for x in a.split():
s+=int(x)
print(s)
except(Exception):
print("Invalid Input")
| true |
f05d05502ba60c4aac94f885a5c97618c75f3c42 | lordniss/python_hookingMacro_win32 | /c_Replayer.py | UTF-8 | 10,052 | 2.640625 | 3 | [] | no_license | """
[ReplayThread : 읽기 및 키보드/마우스 재생]
- 요구패키지
pypiwin32
- 보완할점
1. 특정 상황에서 kor/en_eky 반환값이 -127로 바뀐다.
"""
import csv
import queue
import time
import win32api
import win32con
import threading
from c_HookingThread import HookingThread
from tk_TextWindow import TextThread
from VK_CODE import VK_CODE
import ctypes
from c_M... | true |
48d02d16ec3faa450b36a62c49be1a6ecd7b6e72 | babiswas2020/python-practise | /Graph/graph15.py | UTF-8 | 820 | 3.359375 | 3 | [] | no_license | class Cell:
def __init__(self,x,level):
self.x=x
self.level=level
def is_valid(x,N):
if x<0 or x>=N:
return False
return True
def step_to_end(pos,N,l):
queue=[]
visited=[False]*N
dx=[1,-1]
queue.append(Cell(pos,0))
visited[pos]=True
while queue:
m=queue.pop(... | true |
99842dffb0b93c2400fa1b443c35158176854e96 | pycgo/dvadmin | /backend/dvadmin/utils/json_response.py | UTF-8 | 1,449 | 2.546875 | 3 | [
"Apache-2.0"
] | permissive | # -*- coding: utf-8 -*-
"""
@author: 猿小天
@contact: QQ:1638245306
@Created on: 2021/6/2 002 14:43
@Remark: 自定义的JsonResonpse文件
"""
from rest_framework.response import Response
class SuccessResponse(Response):
"""
标准响应成功的返回, SuccessResponse(data)或者SuccessResponse(data=data)
(1)默认code返回2000, 不支持指定其他返回码
... | true |
b3b97e3fcd9bd2eb1f0371751868823aec0d428f | LwPerson/pi_pico_neopixel | /examples/rainbow.py | UTF-8 | 728 | 3.140625 | 3 | [
"MIT"
] | permissive | import time
from neopixel import Neopixel
numpix = 60
strip = Neopixel(numpix, 0, 0, "RGBW")
red = (255, 0, 0)
orange = (255, 165, 0)
yellow = (255, 150, 0)
green = (0, 255, 0)
blue = (0, 0, 255)
indigo = (75, 0, 130)
violet = (138, 43, 226)
colors_rgb = (red, orange, yellow, green, blue, indigo, violet)
# same colo... | true |
a5344c28a56f096a315b5d8573682c745c4d2747 | jreag1/Examples | /Project_Euler/E02.py | UTF-8 | 540 | 4.3125 | 4 | [] | no_license | #Each new term in the Fibonacci sequence is generated by adding the previous two terms. By starting with 1 and 2, the first 10 terms will be:
#1, 2, 3, 5, 8, 13, 21, 34, 55, 89, ...
#By considering the terms in the Fibonacci sequence whose values do not exceed four million, find the sum of the even-valued terms.
d... | true |
1ac7f5eee300e6a09deea28e8f4867fc75266539 | fgdangiolo/Python | /Graphic_Python/Square_cosine.py | UTF-8 | 621 | 3.8125 | 4 | [] | no_license | # -*- coding: utf-8 -*-
import numpy as np
import matplotlib.pyplot as plt
# Frecuency
T = 2*np.pi # T = 2pi
wo = 2*np.pi/T # wo = 1
# time
t = np.arange(0,10,0.1) # time "t"
# cos and cos²
cosine = np.cos(2*np.pi*1/T*t) # cos(wo.t)
square_cosine = cosine * cosine # cos²(t) = cos(t) * cos(t)
# Graphics
p... | true |
0b93bb0e82cb5cb431086b227ec70a3a4758041a | jmtilli/yale | /pybridge/test.py | UTF-8 | 388 | 2.703125 | 3 | [
"MIT"
] | permissive | import httpparser
h=httpparser.Http()
print(h.host())
print(h.feed("GET / HTTP/1.1\r\nHost: localhost\r\n\r\n", 1))
print(h.host())
print("----")
h=httpparser.Http()
print(h.host())
print(h.feed("GET / HTTP/1.1\r\n", 0))
print(h.host())
print(h.feed("Host: localhost\r\n", 0))
print(h.host())
#print(h.feed("Foo: bar\... | true |
6faab388361c843141963f1e0b068516db9180c4 | GuilhermeEsdras/Mamba-3 | /Exercícios Resolvidos/The Huxley/746 - Multiplicação de Matrizes.py | UTF-8 | 972 | 3.484375 | 3 | [
"MIT"
] | permissive | def multiplicador(matriz_A, matriz_B):
matriz_C = []
for v in range(len(matriz_A)):
matriz_C.append([])
for x in range(len(matriz_B[0])):
soma = 0
matriz_C[v].append(soma)
for y in range(len(matriz_A[0])):
matriz_C[v][x] += matriz_A[v][y] * ma... | true |
ca682705d39ce62fc4a5e43e1e41b1e29fb6ba4b | pvital/4lg0rithm5 | /encryption/encription.py | UTF-8 | 1,128 | 3.265625 | 3 | [
"MIT"
] | permissive | #!/bin/python3
import math
import os
import random
import re
import sys
# Complete the encryption function below.
def encryption(s):
# remove the spaces of the msg
msg = ''.join(s.split())
# make the necessary calculations
rows = math.floor(math.sqrt(len(msg)))
columns = math.ceil(math.sqrt(len(... | true |
98891faa8652ea6c6d4b086d6dd6bc764cee98d5 | artbohr/codewars-algorithms-in-python | /7-kyu/map-function.py | UTF-8 | 780 | 4.46875 | 4 | [] | no_license | def map(function, iterable):
return [function(x) for x in iterable]
'''
In this kata, you need to make your own map function. The way map works is that
it accepts two arguments: the first one is a function, the second one is an
array, a tuple, or a string. It goes through the array, applying the function
to eac... | true |
483434e766f62f55cbfb5387b5f426575c550bd8 | kaloyansabchev/Programming-Basics-with-Python | /PB Exam - 20 and 21 April 2019/03. Easter Trip.py | UTF-8 | 787 | 3.828125 | 4 | [] | no_license | destination = input()
dates = input()
nights = int(input())
price_for_night = 0
if destination == "France":
if dates == "21-23":
price_for_night += 30
elif dates == "24-27":
price_for_night += 35
elif dates == '28-31':
price_for_night += 40
elif destination == "Italy":
if dates... | true |
7fd0f050d78337b298a34392e2cecc78f092e6d6 | smithbro2115/GameTimer | /Reminders.py | UTF-8 | 1,306 | 2.515625 | 3 | [] | no_license | import win32gui
import win32process
import time
import psutil
import threading
GAMES = ["javaw.exe", "robloxplayerbeta.exe", "civilizationv_dx11.exe"]
time.sleep(2)
def get_current_processes() -> dict:
processes_dict = {}
for proc in psutil.process_iter():
pInfoDict = proc.as_dict(attrs=['pid', 'name'])
proc... | true |
d6f177b23a02c6d73c3eec599c2ac5889ca08295 | lingsitu1290/code-challenges | /print_digits_backwards.py | UTF-8 | 859 | 3.890625 | 4 | [] | no_license | def print_digits_backwards(number):
"""Given an integer, print each digit in reverse order.
>>> print_digits_backwards(12345)
5
4
3
2
1
>>> print_digits_backwards(-2)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "hb-printdigitsbkwds.py", lin... | true |
98c9a4e988534ae4de5fe99bc53d497e69b0c071 | MoonKuma/WordList | /StartLearning.py | UTF-8 | 5,267 | 3.109375 | 3 | [] | no_license | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# @File : StartLearning.py
# @Author: MoonKuma
# @Date : 2018/10/8
# @Desc : Entrance of all functions:
# [1]. Set file patten
# [2]. Recall (press [enter] within limited time)
# # [3]. Multiple-choice(select 1/4 meanings)
# [3]. Repor... | true |
d693b0cebd424f8a95f2d7f709b5b92fbfb9db5c | ChanaRoss/Thesis | /MachineLearning/cnnModel.py | UTF-8 | 6,168 | 2.65625 | 3 | [
"Apache-2.0"
] | permissive | import numpy as np
import time
import matplotlib.pyplot as plt
import seaborn as sns
# pytorch imports -
import torch
import torch.nn as nn
from torch.autograd import Variable
import torch.optim as optim
import torch.nn.functional as F
import torch.utils.data as data
# my imports -
import sys
sys.path.insert(0, '/Users... | true |
f572c4abcbfd674bea899dfd9589099d8319b73e | AfridShaik/293653_daily_commit | /15.py | UTF-8 | 304 | 3.6875 | 4 | [] | no_license | def multiplication_table(number):
multiplier = 1
while multiplier <= 5:
result = multiplier * number
if result > 25 :
break
print(str(number) + "x" + str(multiplier) + "=" + str(result))
multiplier += 1
multiplication_table(3)
multiplication_table(5)
multiplication_table(8) | true |
5fe058c5c0b32ebbc1a377191f7c9a9c053d7d15 | fabiengueret/realestate | /OCRImprovement.py | UTF-8 | 1,367 | 2.703125 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Wed May 30 18:05:45 2018
@author: Fabien Gueret 4 TerraMollis Ltd.
"""
from lxml import html
#url management library
import requests
# open floorplan
import io
#OCR
import pytesseract
#Regex
import re
#Pillow image management
from PIL import Image
#database
... | true |
39a74d0c54ef1728153982e740921955d281666d | daniel-reich/ubiquitous-fiesta | /yKMxg88HGXmLhirht_18.py | UTF-8 | 381 | 3.234375 | 3 | [] | no_license |
def add_letters(a):
if (a == []):
return "z"
CODE = "0abcdefghijklmnopqrstuvwxyz"
Score = 0
Counter = 0
Length = len(a)
while (Counter < Length):
Item = a[Counter]
Letter = Item.lower()
Value = CODE.index(Letter)
Score += Value
Counter += 1
while (Score > 26):
... | true |
696c19181c8d39b6f1897a1818b0a77cbe610f27 | Marcoakira/Desafios_Python_do_Curso_Guanabara | /Mundo2/aula8c.py | UTF-8 | 162 | 3.90625 | 4 | [
"MIT"
] | permissive | # Tranforma um nomero real ex: 6.658125 em um nomero inteiro ex: 6
from math import floor
n1 = float(input('insira um nomero real ex: 9.8651 '))
print(floor(n1))
| true |
2f165e43308f3f3f94cb373be910263b53f147e3 | AlexandruRusu23/fairness-trading-prediction | /Byudhra/byudhra.py | UTF-8 | 5,594 | 2.515625 | 3 | [] | no_license | import numpy
import pandas
import keras
import scipy
import matplotlib
import statsmodels
import sklearn
import theano
import data_exporter
import data_interpreter
import data_mapping
from datetime import datetime
from keras.models import Sequential
from keras.layers import Dense
from keras.wrappers.scikit_learn imp... | true |
81bb74c8c69ebf83bf81f2f30fabc04bbdcc1d74 | jcsq20/Interfaces-grafica-con-python | /main.py | UTF-8 | 819 | 3.125 | 3 | [] | no_license | import toga
#funcionalidad al precionar widget es un disparador para que funcione un evento
def on_press(widget):
print("Hola mundo utilizando toga")
def new_button():
button = toga.Button("Hola mundo", on_press=on_press)#(lo que dira el boton, on_press=)
button.style.padding = 20
button.style.font_si... | true |
09755f296de7650c79fd261f136ebc5b8c6199d6 | jamie-g/movie_ratings_3 | /model_new.py | UTF-8 | 2,287 | 3.53125 | 4 | [] | no_license | db = None
class User(object):
def __init__(self, age, occupation, gender):
self.age = age
self.occupation = occupation
self.gender = gender
@staticmethod
def get(user_id):
user = db.users.find_one({"_id": user_id})
return User(user['age'], user['occupation'].capital... | true |
89e25dcb81790e187ddc2d63fb7789c6789b82b2 | isabella0428/Leetcode | /python/3.py | UTF-8 | 688 | 3.25 | 3 | [] | no_license | class Solution:
def lengthOfLongestSubstring(self, s):
"""
:type s: str
:rtype: int
"""
char = []
num = 0
longest = 0
for i in s:
if i not in char:
char.append(i)
num = num + 1
if longest < n... | true |
6d44439c05d142aa68bf670619569c6fc2db23ae | architecture-building-systems/CityEnergyAnalyst | /bin/create-changelog.py | UTF-8 | 3,610 | 3.1875 | 3 | [
"MIT"
] | permissive | """
Create the CHANGELOG.md file using git and the GitHub REST api.
This script assumes it is being run from the root of the CEA repository, as ``python bin\create-changelog.py``
Output format (example)::
2019-01-24 (v2.9.2) - #1743 updated ArcGIS install instructions
We use the command ``git log origin/master -... | true |
3a7f06d3365216bd88454c9da5cb06b60c9332d6 | Tomoya777/BBC.siteproject | /summer/sm_calendar.py | UTF-8 | 2,583 | 3.125 | 3 | [] | no_license | import os
import datetime as dt
import calendar as cl
def read_Fl( file1 ):
with open( file1, 'r' , encoding = 'utf-8') as f1:
str1 = f1.read()
return str1
def write_Fl( file1, str1 ):
with open( file1, 'w', encoding = 'utf-8' ) as f1:
f1.write( str1 )
return 0
def generate_Calendar(... | true |
cfb0b497ad7d69c932a88b78d08ce3a2c75aad68 | ShapeShifter420/Base64 | /base64.py | UTF-8 | 881 | 2.859375 | 3 | [] | no_license | TABLE = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'
def encode(text):
result = ''
c = 0
l = len(text)
A = []
A2 = []
tmp = ''
for t in range(l):
A.append(bin(int(ord(text[t]))))
A[t] = A[t][2:]
if len(A[t]) != 8:
while len(A[t]) !=... | true |
22645886dff06651510e03b231a4a889d1c7a17f | ondrejbudac/python_test | /turtletest.py | UTF-8 | 425 | 2.875 | 3 | [] | no_license | __author__ = 'ondrej'
from turtle import *
t = Turtle()
t.speed(2000)
screen = t.getscreen()
N = 4
M = 6
P = 6
length = 50
for k in range(P):
t.forward(4 * length)
for j in range(M):
t.forward(length)
for i in range(2 * N):
t.forward(length)
t.left(180 - 180/N)
... | true |
38462a3bfe0e41929721f6838edd7c00e1bf6f88 | Julius2342/xknx | /xknx/devices/sensor.py | UTF-8 | 3,371 | 2.921875 | 3 | [
"MIT"
] | permissive | """
Module for managing a sensor via KNX.
It provides functionality for
* reading the current state from KNX bus.
* watching for state updates from KNX bus.
"""
from xknx.remote_value import RemoteValueControl, RemoteValueSensor
from .device import Device
class Sensor(Device):
"""Class for managing a sensor.""... | true |
d0533024884e6907cab4d5b8882d8a7e7dbf4912 | xcctbys/crawl | /sources/china_court_net/generator.py | UTF-8 | 2,471 | 2.5625 | 3 | [] | no_license | # encoding=utf-8
""" example is http://www.live.chinacourt.org/fygg/index/kindid/6.shtml
"""
import logging
import json
import unittest
import traceback
import os
import cPickle as pickle
try:
import pwd
except:
pass
DEBUG = False
if DEBUG:
level = logging.DEBUG
else:
level = logging.ERROR
logging.ba... | true |
6f5643b6771ae4fb1ed9058ed9318809886a413e | mkilli83/twitter-classifier | /src/core.py | UTF-8 | 6,423 | 2.859375 | 3 | [
"BSD-2-Clause"
] | permissive | # -*- coding: utf-8 -*-
import datetime
import re
from pprint import pformat
import GetOldTweets3 as got
import pandas as pd
from src.utils import Timer, load_csv, paths
USE_TWEETS_COLS = ["username", "formatted_date", "cleaned_text", "text"]
PRE_PROCESSING_OPTIONS = {
# custom
"lower_string": True,
... | true |
7ca2491a5ec0fe4c11fb2003c6fab818f500f87f | AdamZhouSE/pythonHomework | /Code/CodeRecords/2169/60782/309202.py | UTF-8 | 1,276 | 4.125 | 4 | [] | no_license | """
题目描述
给定后缀表达式,任务是评估表达式并打印最终值。运算符将仅包括基本算术运算符,例如*,/,+和-。
输入描述
输入的第一行将包含一个整数T,表示测试用例的数量。然后是T测试用例。每个测试用例都包含一个后缀表达式。1 <= T <= 100;1 <= 表达式长度 <= 100
输出描述
对于每个测试用例,请在新行中评估后缀表达式并打印该值。
"""
# 后缀表达式求值
from pip._vendor.progress.counter import Stack
def postfixEval(postfixExpr):
operandStack = Stack()
tokenList = ... | true |
89101af40a0ac7639eb89ed0f6f344a62ce00a33 | Dieg0Alejandr0/6.08-Project-Spring-2020 | /passChecker.py | UTF-8 | 1,195 | 2.5625 | 3 | [
"MIT"
] | permissive | import sqlite3
#We need a data base that stores position X,Y,Width,Height
start_db= "__HOME__/databases/start.db"
alldata_db = "__HOME__/databases/alldata.db"
conn = sqlite3.connect(alldata_db)
c = conn.cursor()
def request_handler(request):
if request['method'] == 'POST':
passin = str(request["form"]... | true |
81753607302b300142f3fd287a426c6bd7b74d47 | GRAAL-Research/domain_adversarial_neural_network | /experiments_moons.py | UTF-8 | 5,570 | 2.625 | 3 | [
"BSD-2-Clause"
] | permissive | import numpy as np
from sklearn.datasets import make_moons
from sklearn.decomposition import PCA
from matplotlib.colors import ListedColormap
from DANN import DANN
from matplotlib import pyplot
from scipy.spatial.distance import cdist
def main():
X, y, Xt, yt = make_trans_moons(35, nb=150)
Xall = np.vstack((... | true |
af06d34d65604b9829f1316cce7fb7a93842387e | tburton12/NetLogsAnalyzer | /black_list.py | UTF-8 | 2,678 | 2.609375 | 3 | [] | no_license | from PyQt5.QtWidgets import *
from PyQt5.QtGui import QIcon
class BlackListManager(QWidget):
def __init__(self, parent):
self.parent = parent
super(BlackListManager, self).__init__()
# self.setWindowFlags(QtCore.Qt.WindowStaysOnTopHint)
self.setGeometry(600, 300, 350, 300)
... | true |
8d79957a3b76089874c0021a53b28c6cd3a0969d | mr-zhouzhouzhou/LeetCodePython | /面试题/排序/出现频率最多的 k 个元素.py | UTF-8 | 1,363 | 3.75 | 4 | [] | no_license |
"""
给定一个非空的整数数组,返回其中出现频率前 k 高的元素。
输入: nums = [1,1,1,2,2,3], k = 2
输出: [1,2]
"""
"""
耗时太高了:执行用时 :
1292 ms, 在所有 Python 提交中击败了5.23%的用户
内存消耗 :16.1 MB, 在所有 Python 提交中击败了6.38%的用户
"""
class Solution(object):
def topKFrequent(self, nums, k):
"""
:type nums: List[int]
:type k: int
:rtype: Li... | true |
3362fe19f7ee5f1f241801ecc396c6b1eea84728 | Explore-AI/test-repo | /python-script-test/testcases/financial_calulator_test_suite.py | UTF-8 | 3,253 | 2.859375 | 3 | [] | no_license | """
Test suite for Financial Calculator python test
"""
import pytest
import submission as Submission
@pytest.mark.timeout(5)
@pytest.mark.parametrize("test_input,expected_output", [
([10000, 20, 0.1], 572749.99),
([20000, 10, 0.104], 324926.69),
([10000, 20, 0.1], 572749.99),
([20000, 15, 0.1], 635449... | true |
1d319d1fe90633ce5fae0da5eca38e7e67e00e20 | patternrecog-arai/source | /Chap3.LSM_SDM_WidrowHoff/LetsTry.3-1/Quiz3-1.LSM.py | UTF-8 | 3,044 | 3.125 | 3 | [] | no_license | #!/usr/bin/env python3
#coding:utf-8
"""
最小自乗法による評価関数最小法の解析解
2次元データ
"""
from mpl_toolkits.mplot3d import Axes3D
import numpy as np
import matplotlib.pyplot as plt
import argparse
import sys
def show2D( vecW, x1, x2, ax ):
"""
2次元表示
"""
ax.cla() # 描画クリア
ax.grid()
ax.set_xlim(0,1)
ax.set_yli... | true |
dda75e98ea2b0a147905e5f389e07a251d57e000 | heitorchang/learn-code | /battles/arcade/intro/longestWord.py | UTF-8 | 242 | 3.4375 | 3 | [
"MIT"
] | permissive | import re
def longestWord(text):
# remove non alpha
p = re.compile('[^\w\s]')
s = p.sub(' ', text)
words = s.split()
return sorted(words, key=len)[-1]
def test():
testeql(longestWord("ready, steady, go!"), "steady")
| true |
de9296d3682d35e6c4d965cc2dc2e1b101f6896f | bretuobay/fileutils | /exercises11.py | UTF-8 | 893 | 4.375 | 4 | [] | no_license | '''
Define a function generate_n_chars() that takes an integer n and a character c and returns a string, n characters long, consisting only of c:s. For example, generate_n_chars(5,"x") should return the string "xxxxx". (Python is unusual in that you can actually write an expression 5 * "x" that will evaluate to "xxxxx... | true |
0e86e5e7d69d7a75f13f6b1cb2ab124dae4d18d1 | otM23/OptiCtrlLimitOrder | /ctrlopti/BasicFunctions.py | UTF-8 | 7,381 | 2.640625 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Wed Nov 23 20:15:20 2016
@author: Otm
"""
##############################################################################################################
##############################################################################################################
##############... | true |
c2d0fb5e38810fee5098defa25e8785c96e395c8 | makoslayer13/gatoloco | /whitespace.py | UTF-8 | 320 | 4.09375 | 4 | [] | no_license | #\n will add a new line to the string after
#\t will add a new tab to the string
print("Languages:\nPython\nC\nJavascript")
print("Languages:\n\tPython\n\tC\n\tJavascript")
#Whitespace can be used as such
favorite_language = ' Python '
favorite_language = favorite_language.rstrip()
print(favorite_language)
| true |
4869958d5556442d4d125242446dcd453115e5b5 | Omunoz02/TallerN4 | /Agenda.py | UTF-8 | 2,473 | 3.84375 | 4 | [] | no_license | class Agenda:
def __init__(self):
print(">>>>>>>PROBLEMA 2: AGENDA<<<<<<<")
self.contactos=[]
def menu(self):
print()
menu=[
['------ Agenda ------'],
['1. Añadir Contacto',"anadir"],
['2. Lista de contactos'],
['3. Buscar contacto'],
['4. Editar contacto'],
['5. Cerrar agenda']
]
... | true |
6dc617c510b919e7c50a72250890d0bb59146542 | puneet76-sharma/generate_thumbnail_in_python | /thumbnail/generate_video_thumbnail.py | UTF-8 | 939 | 2.65625 | 3 | [] | no_license | import os
ABS_PATH = os.path.abspath(__file__)
BASE_DIR = os.path.dirname(ABS_PATH)
MY_VID_FILE = os.path.join(BASE_DIR, "inputs") # create input folder inside BASE DIR
THUMBNAIL_PATH = os.path.join(BASE_DIR, "output") # same
from moviepy.editor import * # NOTES:- PLEASE install this moviepy module
# pip instal... | true |