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 |
|---|---|---|---|---|---|---|---|---|---|---|
35e567b1848a7182cbf540fef600fde126595574 | lcodesignx/pythontools | /tools/get_system_information.py | UTF-8 | 767 | 3.125 | 3 | [] | no_license | #!/usr/bin/env python
# A system information gathering script
import subprocess
# system info
def uname_func():
uname = 'uname'
uname_arg = '-a'
print(f'Gathering system information with {uname} command:\n')
subprocess.call([uname, uname_arg])
# disk info
def disk_func():
diskspace = 'df'
dis... | true |
24e4afa2d4785bc23c6f29d5748b9c83eb930250 | njabswalsh/Hanabi | /card.py | UTF-8 | 180 | 3.578125 | 4 | [] | no_license | class Card:
def __init__(self, color, number):
self.color = color
self.number = number
def __str__(self):
return (self.color.capitalize() + " " + str(self.number)) | true |
af8fe34951a4809d055f75cc33f5bb2f0d9c8a72 | codycollier/advent | /2020/python/day01/day01.py | UTF-8 | 1,075 | 3.890625 | 4 | [] | no_license | #!/usr/bin/env python
# -*- coding: utf-8 -*-
def get_expenses(input_file="./input"):
"""Return all expenses as an ordered iterable"""
inputs = []
with open(input_file, "r") as input:
for line in input.readlines():
line.strip()
inputs.append(int(line))
return tuple(inpu... | true |
a99231631e1c70c7a10892cab7f7fa536de8d670 | cacad101/assignment-neural-network-1 | /problem_1_classifications/questions/question2.py | UTF-8 | 3,150 | 2.65625 | 3 | [] | no_license | from problem_1_classifications.training.softmax_nn import SoftmaxNeuralNetwork
from problem_1_classifications.preprocess.data_preprocess import DataCollector
from problem_1_classifications.postpreprocess.data_visualization import DataVisualizationWithLabels, DataVisualization
if __name__ == "__main__":
# Questio... | true |
1a6ce803b597195ef668b5e32e1e042562e9427e | boiidae/py4me | /count_loop.py | UTF-8 | 124 | 3.03125 | 3 | [] | no_license | zork=0
print('Before', zork)
for tits in [9, 41, 12, 3, 74, 15]:
zork=zork+1
print(zork, tits)
print('After', zork)
| true |
ea7fdf5061b5d1222594f18a6bc9cc144f9aeed9 | INFO253-FL2017/assignment-2-zihao-fan | /webserver.py | UTF-8 | 1,922 | 2.84375 | 3 | [] | no_license | """
webserver.py
File that is the central location of code for your webserver.
"""
from flask import Flask, render_template, request
import requests
import os
# Create application, and point static path (where static resources like images, css, and js files are stored) to the
# "static folder"
app = Flask(__name__, ... | true |
5ce297259106f0e7bf84c8d84b306c12fd35fc0e | antonsmit30/customer-api | /resources/customers.py | UTF-8 | 1,646 | 2.828125 | 3 | [] | no_license | # Create our customer resource
# This class will be interfaced with the API frontend
from flask_restful import Resource, reqparse
from models.customers import customerModel
class Customer(Resource):
# parser parameters
parser = reqparse.RequestParser()
parser.add_argument('probe',
... | true |
aa9b8abf8b048132d2bc74e9f9ba649a2a9291f7 | tanaostaf/python | /lab3_3.py | UTF-8 | 267 | 3.390625 | 3 | [] | no_license | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
zrist = float(input('Введіть зріст, в м : '))
vaga = float (input ('Введіть вагу, в кг: '))
BodyMassIndex = float( vaga / (zrist ** 2))
print('Індекс маси тіла: ',BodyMassIndex)
| true |
faba7f1670b01e6bbd76014306dd3dcedb95f8e8 | clintondurney/ubuquitous-drosophila | /Biochemistry/Build/migration.py | UTF-8 | 2,024 | 2.859375 | 3 | [] | no_license | # biochemical signaling model
# import pydelay and numpy and pylab
from __future__ import absolute_import
import numpy as np
import matplotlib.pyplot as plt
import pylab as pl
from pydelay import dde23
import csv
import json
k1_val = 0.001
qR_val = 0.1
# the model equations
eqns = {
'Ac' : '-k1*R*Ac',
'A... | true |
2a65348d1f71e23bb98c8f26379b5a4cfe61afd5 | Aikufurr/FlaskDemo | /exampleapp.py | UTF-8 | 1,873 | 2.546875 | 3 | [] | no_license | from flask import Blueprint, render_template, request, redirect, url_for, flash
import os
import os.path
import datetime
from werkzeug.utils import secure_filename
exampleapp_bp = Blueprint('exampleapp_bp', __name__)
UPLOAD_FOLDER = "static/files"
@exampleapp_bp.route("/secondpage/")
@exampleapp_bp.route("/secondpag... | true |
f9fd3978f4a1815af29e16f6fd6464ded1b3db4b | hpoisner/assignment_5 | /load_people_assigned.py | UTF-8 | 9,103 | 2.71875 | 3 | [] | no_license | """ Main program that loads related people from a file
:Author: Arthur Goldberg <Arthur.Goldberg@mssm.edu>
:Date: 2018-02-21
:Copyright: 2018, Arthur Goldberg
:License: MIT
Hannah Poisner Version
"""
import argparse
import logging
import os
import sys
import related_person
from related_person import Gender, RelatedPer... | true |
958420407293a85deb5d3350d6810c330c55affd | oceanbei333/leetcode | /257.二叉树的所有路径.py | UTF-8 | 1,899 | 3.109375 | 3 | [] | no_license | #
# @lc app=leetcode.cn id=257 lang=python3
#
# [257] 二叉树的所有路径
#
# @lc code=start
# Definition for a binary tree node.
# class TreeNode:
# def __init__(self, x):
# self.val = x
# self.left = None
# self.right = None
from copy import deepcopy
class Solution:
def binaryTreePaths(self, roo... | true |
5b54171376d7e75858459f30e38591c9768cea45 | Gabriel2409/pytricks | /c4_09_combination_permutations.py | UTF-8 | 388 | 3.890625 | 4 | [] | no_license | #%%
"""
combinations
permutations
"""
#%%
import itertools
items = [1, 2, 3]
for p in itertools.permutations(items):
print(p)
# %%
for p in itertools.permutations(items, r=2):
print(p)
# %%
for p in itertools.permutations(items, 1):
print(p)
# %%
for p in itertools.combinations(items, r=2):
print(p)
# %%
for p in... | true |
ebf1feb01910ac1193d76e2f77fe76b9e630ce8f | rdapaz/csg5126_assignment2_scripts | /count_files_extensions.py | UTF-8 | 2,722 | 3.171875 | 3 | [
"MIT"
] | permissive | #!/usr/bin/python3
'''
This script is used to characterise the output from running
the sorter command against a drive image, where the
output is saved in /home/sansforensics/Desktop/save_dir.
It outputs the filename, the number of entries and the number
of mismatched entries where the file extension does not match th... | true |
50884179280ff47e5306dd1c3975e319ca488fe6 | mathyomama/scripts | /project-euler/euler71.py | UTF-8 | 1,263 | 2.921875 | 3 | [] | no_license | import sys
sys.path.append("/home/mathyomama/Scripts/Spoj/")
from primes import listOfPrimes
def factorization(n):
if n < 2: return (1,)
factors, test, index, exp = [], n, 0, 0
while test > 1:
if test%listOfPrimes[index] == 0:
test /= listOfPrimes[index]
exp += 1
elif exp == 0:
index += 1
else:
fa... | true |
ee97f11b669002def0b595ba6de63a7172969d3a | amey10794/apollofinvest | /isBetter.py | UTF-8 | 17,235 | 2.75 | 3 | [] | no_license | import pandas as pd
import numpy as np
import pickle
import os
def probability(func,df_dict,iter):
path = 'FMCG'
stocknames = os.listdir(path)
# Read the excel sheet to pandas dataframe
df1 = df_dict['Britania'].copy(deep=True)
date_60 = df1.index.values[0:iter*12+12]
# print(len(date_60))
... | true |
8f723882d9f4b9a60d120c80c9c603c212ea6cda | Robin970822/python-learning | /numpy&pandas/pandas_test.py | UTF-8 | 521 | 3.46875 | 3 | [] | no_license | # coding=utf-8
import pandas as pd
import numpy as np
df = pd.DataFrame({'name': np.array(list('aabb')),
'classes': np.array([1, 2, 3, 4]),
'price': np.array([11, 22, 33, 44])},
index=np.array(list('0123')))
# 带有条件判断时,返回类型pd.Series,带索引
price = df.loc[df.classes ... | true |
137271fdfeeee2c64c8e757c472bd4974b414cb2 | atriadhiakri2000/Algorithm | /Doubly Linked List Conversion.py | UTF-8 | 571 | 3.140625 | 3 | [] | no_license | t=int(input())
while(t>0):
t=t-1
n=int(input())
l=list(map(int,input().rstrip().rsplit()))
l.reverse()
print(*[l[x] for x in range(n)], sep='<-')
'''
def makeDoubly(head):
#your code here
if(head==None or head.next==None):
return(head)
cur=head
l=[]
while(... | true |
e0cb858593528c331cb19ca9f1febec9ba8accf2 | kevin115533/projects | /employee_pay.py | UTF-8 | 994 | 4.5 | 4 | [] | no_license | """
Program: Employee pay calculator
Author: Kevin Tran
The purpose of this program is calculate an employees pay considering overtime
1. Get input of employees hours
2. Calculate hourly pay. If there are more than 40 hours then pay is 1.5 times the
hourly rate for those hours
3. Print output of the calculated pa... | true |
69d7cd4b07fe8fb3359b184c32bd0ca345395c5a | y-shindoh/introduction_to_computation_and_programming | /c_03/f_3.5.py | UTF-8 | 461 | 3.96875 | 4 | [] | no_license | #! /usr/bin/env python
# -*- coding: utf-8 -*-
# 「Introduction to Computation and Programming Using Python」の§3.5の例題
# Newton-Raphson for square root
# Find x such that x ** 2 - 24 is within epsilon of 0
epsilon = 0.01
k = 123456789.0
guess = k / 2.0
c = 1
while abs(guess * guess - k) >= epsilon:
print '[' + str(... | true |
09d9b578c74de0314634c0c2599dddba6b903361 | theVmagnificient/radiology_web | /dnn_backend/radio_dep/radio/models/metrics.py | UTF-8 | 9,913 | 3.546875 | 4 | [] | no_license | """ Contain different metrics functions. """
import numpy as np
def log_loss(y_true, y_pred, epsilon=10e-7):
""" Compute log-loss.
Parameters
----------
y_pred : ndarray(batch_size, ...)
numpy array containing predictions of model.
y_true : ndarray(batch_size, ...)
numpy array co... | true |
a0a53db70f177b9501f72213fab85963c5dd0bfc | nehal1989/webscraping | /database_api.py | UTF-8 | 1,331 | 3.09375 | 3 | [] | no_license | import sqlite3
def initialiase_database(database_name='sysk'):
db = sqlite3.connect(f'/Users/Nehal/Programming/python_projects/webscraping/{database_name}.db')
cursor = db.cursor()
try:
cursor.execute("""CREATE TABLE podcastInfo (
id INTEGER PRIMARY KEY,
... | true |
2f209d1164f262a45d62b74c53d91f5b12066b06 | angelnaviavazquez/SVM_spark | /common/lib/ResultsUtils.py | UTF-8 | 1,532 | 2.625 | 3 | [] | no_license | #!/usr/bin/python
# Filename: ResultsUtils.py
from KernelUtils import *
from sklearn.metrics import roc_curve, auc, roc_auc_score
import matplotlib.pyplot as plt
import time
def _predict(data,Bases,Beta,sigma):
vector = kernelMatrix(np.reshape(np.array(data.features),(1,-1)),Bases,sigma)
pred = vector.dot(... | true |
25f28d7d95dcdd0fc11a972ef0ef879f19df6468 | inqubate/tutorialsdojo-cheatsheet-dump | /main.py | UTF-8 | 446 | 2.71875 | 3 | [] | no_license | from tutorialsdojo import TutorialsDojo
def main():
td = TutorialsDojo()
for group in td.get_groups():
print(' [+] {}'.format(group['title']))
for topic in td.get_topics(group):
print(' - {} ({})'.format(topic['title'], topic['url']))
content = td.get_content(topic)
... | true |
57eea10123a391ea855dda26c204ac839898f1c8 | tdicola/sinobit-micropython | /examples/microbit/music.py | UTF-8 | 1,409 | 3.015625 | 3 | [
"MIT"
] | permissive | """
music.py
~~~~~~~~
Plays a simple tune using the Micropython music module.
This example requires a speaker/buzzer/headphones connected to P0 and GND.
"""
from microbit import *
import music
# play Prelude in C.
notes = [
'c4:1', 'e', 'g', 'c5', 'e5', 'g4', 'c5', 'e5', 'c4', 'e', 'g', 'c5', 'e5'... | true |
f580e50d6c6b6b8672d1e7b562accdd82e6d3099 | Ryanshuai/robot_round_catch | /dqn_without_CNN/test.py | UTF-8 | 375 | 3.09375 | 3 | [] | no_license | import numpy as np
import random
a = np.array([1,2,3])
b = np.array([4,5,6])
c = np.array([7,8,9])
d = np.array([10,11,12])
mem = []
mem.append(a)
print(a.shape)
print(mem)
mem.append(b)
print(mem)
mem.append(c)
print(mem)
mem.append(d)
print(mem)
res = np.array(random.sample(mem, 3))
print(res.shape)
print(type(re... | true |
5d5971d50be4446af9bd80308faf3c580ca89539 | adityasaxena-crypto/HackerRank | /Filling Jars.py | UTF-8 | 218 | 2.953125 | 3 | [] | no_license | # Enter your code here. Read input from STDIN. Print output to STDOUT
[N, M] = map(int, raw_input().split())
s = 0
for m in xrange(M):
[a, b, k] = map(int, raw_input().split())
s += (b - a + 1) * k
print s / N
| true |
25b2c841723257b03d1325c134095efb19967d15 | icehuli/Python-for-scientific-computing | /mayavi_demo2.py | UTF-8 | 298 | 2.796875 | 3 | [] | no_license | import numpy as np
from mayavi import mlab
x, y, z = np.mgrid[0:1:20j, 0:1:20j, 0:1:20j]
u = np.sin(np.pi*x) * np.cos(np.pi*z)
v = -2*np.sin(np.pi*y) * np.cos(2*np.pi*z)
w = np.cos(np.pi*x)*np.sin(np.pi*z) + np.cos(np.pi*y)*np.sin(2*np.pi*z)
mlab.quiver3d(u, v, w)
mlab.outline()
mlab.show()
| true |
65aa231e2b94ea91e54176bf2828d2af577c37b9 | FlippinBerger/EarthMath | /calculations.py | UTF-8 | 508 | 3.1875 | 3 | [] | no_license | def calcUpFrontCost(energy, type_list):
up_front_cost = 0
for type in type_list:
up_front_cost += energy * type
return up_front_cost
def calcTotalSystemCost(energy, sys_cost_list):
total_sys_cost = 0
for sys_cost in sys_cost_list:
total_sys_cost += energy * sys_cost
return total_sys_cost
def calcTotalSystem... | true |
1c6e586bc10f8307b993deb2eec435b9083b8312 | zopepy/leetcode | /median_of_sorted.py | UTF-8 | 1,805 | 3.34375 | 3 | [] | no_license | class Solution:
def findMedianSortedArrays(self, nums1, nums2):
"""
:type nums1: List[int]
:type nums2: List[int]
:rtype: float
"""
def get_median(a, l, b):
m = l>>1
if l&1:
return a[b+m]
return (a[b+m-1]+a[b+m])/2
... | true |
1cc53768925ec0b658e01aa6bf5ee8a0a94a6613 | icely88/panda | /44_lc 468.py | UTF-8 | 312 | 3.125 | 3 | [] | no_license | nums=[1,5,2]
n=len(nums)
mem=[[0]* n for i in range(n)]
print(mem)
def select_number (l,r):
if l ==r:
return nums[l]
if mem[l][r]>0:
return mem[l][r]
mem[l][r]=max(nums[l]-select_number(l+1, r),nums[r]-select_number(l, r-1))
return mem[l][r]
print(select_number(0, 2))
print(mem)
| true |
15b12d80c9be13911417e146d1fc38fd78229240 | Shalihrazaq7/TI06-Lab-3-hery20114ti | /main.py | UTF-8 | 2,023 | 3.953125 | 4 | [] | no_license | # DDP LAB-3
# SOAL 1 - Gunting-Batu-Kertas
# Tuliskan program untuk Soal 1 di bawah ini
""""
player1=input("Masukkan Pilihan Player-1 : ")
player2=input("Masukkan Pilihan Player-2 : ")
print(end='\n')
if player1 == "kertas" and player2 == "kertas" :
print ("Permainan Seri")
elif player1 == "kertas" and player2 == "... | true |
caaf7e4c3fd97560b9db709c62665bc55a52071e | willassad/ram | /syntaxtrees/datatypes.py | UTF-8 | 5,068 | 3.578125 | 4 | [] | no_license | """
Overview and Description
========================
This Python module contains data types that are
subclasses of Expr.
Copyright and Usage Information
===============================
All forms of distribution of this code, whether as given or with any changes,
are expressly prohibited.
This file is Copyright (c) 20... | true |
960f79139cc4682bcccb0dcfdaeaad334875a535 | iLobosok/botemilka | /Desktop/quotebot-master/quotes.py | UTF-8 | 4,652 | 2.84375 | 3 | [] | no_license | quotes = [
"Няяяшечка моя, я тебя очень сильно люблю",
"Солнышко, всё будет хорошо",
"Хорошего денёчка, если утро. Хорошего обедика)), если обед и спокойной ночки <3",
"Я очень стеснялся как-то тебе написать в первый раз, но судьба свела нас",
"Ты очень симпатичненькая моя девочка",
"И в 20, 30, 40, 50, 60, 70 и так да... | true |
0479ce4b7971c3467616c79779d6e750ec8f88b8 | Alsouuuu/ProjectPygame | /Project.py | UTF-8 | 19,623 | 2.765625 | 3 | [] | no_license | import os
import pygame
from os import path
pygame.init()
pygame.font.init()
size = width, height = 1100, 619
screen = pygame.display.set_mode(size)
clock = pygame.time.Clock()
def draw(text, h, x, otstup, maxx, sh, play):
global pravila, y_oftext, x_oftext
#Рисую все текста на экране
lenght = ''
te... | true |
d066da354c1ba73f54946b5d38779ef979cbddb2 | JoeMabor/alienems | /backend_api/repositories/team_leader_repository.py | UTF-8 | 1,678 | 2.796875 | 3 | [] | no_license | from domain.usecases.repositories.team_leader_repository import TeamLeaderRepoPort
from domain.entities.team_leader import TeamLeaderEntity
from ..models import TeamLeader
from backend_api.utilities import DataConverters
class TeamLeaderRepoImpl(TeamLeaderRepoPort):
"""
Django implementation of team leader re... | true |
3739218bab76cef186f8978eee7f9e1d51385c00 | Suraj124/python_practice | /AllStringMethods/lower_and_upper.py | UTF-8 | 58 | 2.703125 | 3 | [] | no_license | st="Python Is Awsome"
print(st.lower())
print(st.upper()) | true |
2f16e7d95a1012646634b190f67762503e42af9f | HopeCheung/database | /HW2/dbtest.py | UTF-8 | 1,642 | 2.59375 | 3 | [] | no_license | import pymysql
import json
cnx = pymysql.connect(
host="localhost",
database="lahman2017",
user="dbuser",
password="dbuser",
charset = 'utf8mb4',
cursorclass = pymysql.cursors.DictCursor)
def get_join_column_mapping(schema1, table1, schema2, table2):
q = """
SELECT
TAB... | true |
95c7aba711ad2568d128973064f2a445cacb7239 | 5oe/djangos | /others/homework/core/student_enter.py | UTF-8 | 2,221 | 2.8125 | 3 | [] | no_license | #!/usr/bin/env python
# coding=utf-8
import os
import sys
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
sys.path.append(BASE_DIR)
from lib import bin
from modules.student import Student
from conf.setting import login_info
def login(func):
def wrapper(*args, **kwargs):
if not logi... | true |
d9a29dc3001690f1b6d98acf89744b0fc140f532 | DCAN-Labs/repo-health-checks | /main.py | UTF-8 | 1,200 | 2.796875 | 3 | [] | no_license | import csv
def main():
git_lab_projects = set()
with open('/home/miran045/reine097/projects/repo-health-checks/data/repo_health_checks_GitLab.csv') as csv_file:
csv_reader = csv.reader(csv_file, delimiter=',')
line_count = 0
for row in csv_reader:
if line_count == 0:
... | true |
1c1c7390e9c530c6906133888919835b23c32560 | philipphanemann/phuncs | /phuncs/pandasadd.py | UTF-8 | 760 | 3.890625 | 4 | [] | no_license | from itertools import islice
from numpy import array
def sliding_window(seq, n=2):
"""Returns a sliding window (of width n) over data from the iterable
s -> (s0,s1,...s[n]), (s1,s2,...,s[n+1])
see: daniel-dipaolo (stackoverflow) '[...]sliding-window-iterator-in-python'
"""
it = iter(seq)
resu... | true |
a3a50a39f822093b7427b7933a2906f6fa0cf6c4 | Arheii/LeetCode | /fizz-buzz.py | UTF-8 | 691 | 3.859375 | 4 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Sun Feb 9 16:04:01 2020
return range(n), but //3 = 'Fliz' //5 = 'Buzz'
easy
https://leetcode.com/problems/fizz-buzz/
@author: Arh
"""
import numpy as np
class Solution:
def fizzBuzz(self, n):
ans = list(map(str, range(1, n + 1)))
ans[2:n + 1:3] = ["Fi... | true |
ce790afbbf37e96d9c32b2d95c1a0d22a7b5a67f | yyouyou/-handwritten-numeral-recognition | /pictures-processing/pictures_process.py | UTF-8 | 5,660 | 2.9375 | 3 | [] | no_license | from PIL import Image
import PIL.ImageOps
import os
import numpy
#切割单张图片x*y个
def cut(x,y,id,name):
name1 = name+str(id)+".jpg"
name1 = "E:\\python\\pictures\\"+name+str(id)+".jpg"
im = Image.open(name1)
#偏移量
dx = im.size[0]/x
dy = im.size[1]/y
n = 0
dx = 28
dy = 28
... | true |
df2a25deb9324095155596d81e81c9c530197c9b | shijianjian/OpenVINO_nanodegree | /project_3_Computer Point Controller/controller/models/face_detection.py | UTF-8 | 2,166 | 2.703125 | 3 | [] | no_license | from controller.models.base import BaseModel
class FaceDetection(BaseModel):
'''
Face detector for driver monitoring and similar scenarios.
The network features a pruned MobileNet backbone that includes depth-wise convolutions to reduce
the amount of computation for the 3x3 convolution block. Also som... | true |
87d8adacbdd1e9f0031cfa995060da64fed985af | HideBa/tabelog_nlp | /sushi_proj/get_important_word/analysis.py | UTF-8 | 12,744 | 2.671875 | 3 | [] | no_license | import MeCab
from collections import Counter, defaultdict
import json
import re
import requests
import pandas as pd
class Analyzer:
def __init__(self):
self.tagger = MeCab.Tagger("-Ochasen")
self.tagger.parse("")
def _tokenize_ja(self, text):
node = self.tagger.parseToNode(str(text))... | true |
3fcafc2b8a4b9e5e70ba26bd30ffd9e0c5c0fd20 | Mguilinger/Final-Project-1 | /Hmwk10.py | UTF-8 | 6,215 | 3.125 | 3 | [] | no_license | # 17-1. Other Languages: Modify the API call in python_repos.py
# so it generates a chart showing the most popular projects in other languages.
# Try languages such as JavaScript, Ruby, C, Java, Perl, Haskell, and Go.
import requests
import pygal
from pygal.style import LightColorizedStyle as LCS, LightenStyle as LS
u... | true |
f8032c318ba0b030ad1b3d1aaee39953f1bddfd6 | viniciusdc/Protein-Refinement_prime | /Methods/distance_file_gen.py | UTF-8 | 8,030 | 3.09375 | 3 | [
"MIT"
] | permissive | from Methods.utils import open_pdb_file
import numpy as np
import logging
import os
"O objetivo deste modulo é armazenar a função que cria e gerencia os arquivos de distâncias provenientes do arquivo pdb"
# TODO: translate all the comments and rebuild certain mismatch
# pdb :: arquivo contendo nome, cadeia e posiçã... | true |
930156b9df0648c3c5f6df45b7d274b65b31d4ed | BeomChang/algorithm-100 | /13. [기초-종합] 6077~ 6091/6090.py | UTF-8 | 907 | 4.3125 | 4 | [] | no_license | # 어떤 규칙에 따라 수를 순서대로 나열한 것을 수열(sequences)이라고 한다.
# 예를 들어
# 1 -1 3 -5 11 -21 43 ... 은
# 1부터 시작해 이전에 만든 수에 -2를 곱한 다음 1을 더해 다음 수를 만든 수열이다.
# 이런 이상한 수열을 알게 된 영일이는 또 궁금해졌다.
# "그럼.... 13번째 나오는 수는 뭘까?"
# 영일이는 물론 수학을 아주 잘하지만 이런 문제는 본 적이 거의 없었다...
# 그래서 프로그램을 만들어 더 큰 수도 자동으로 계산하고 싶어졌다.
# 시작 값(a), 곱할 값(m), 더할 값(d), 몇 번째인지를 나타... | true |
b7f9a8ba0e2567bc2bae5c4243c7fdc4b15f3e44 | MoCuishle28/fisher-FlaskPractice | /fisher.py | UTF-8 | 1,832 | 3.09375 | 3 | [] | no_license | """
入口文件 作为启动
"""
# from flask import Flask
from app import create_app
# 创建核心对象
app = create_app()
# # 以下为学习时写
# @app.route('/hello/')
# def hello():
# # 还有基于类的视图(即插视图)
# # 视图函数的返回:
# # status code 如:200 404 301
# # content-type 放在 http 的headers属性中 告诉接收方(如:浏览器)如何解析返回内容
# # 以上为主要内容 还有其他... 全部被封装成Response对象
# #... | true |
de1563e038259f055c05e960a3cd9fb3cac65e36 | kvp246/PUI2015_kvp246_hw2 | /get_bus_info.py | UTF-8 | 1,838 | 2.859375 | 3 | [] | no_license | # Importing python libraries
import sys
import json
import urllib2
import csv
if __name__ == '__main__':
# # Calling BUS MTA API using Key and Bus Number Inputs
url = 'http://api.prod.obanyc.com/api/siri/\
vehicle-monitoring.json?key=%s&VehicleMonitoringDetailLevel=calls&\
LineRef=%s' % (sys.argv[1], sys.argv... | true |
101c434bded9f7abedaa23a5636a9eeeed8ea274 | Wiktor1k3/Python_Zadania | /Matplotlib2/zad4.py | UTF-8 | 841 | 3.078125 | 3 | [] | no_license | import matplotlib.pyplot as plt
import numpy as np
fig = plt.figure(figsize=plt.figaspect(0.5))
c1 = fig.add_subplot(2, 3, 1, projection='3d')
c2 = fig.add_subplot(2, 3, 2, projection='3d')
c3 = fig.add_subplot(2, 3, 3, projection='3d')
c4 = fig.add_subplot(2, 3, 4, projection='3d')
c5 = fig.add_subplot(2, 3, 5, proje... | true |
b699a2ab606523eb82bf21a5774b5268f46273bc | ajwwlswotjd/2020_python_class | /ex16.py | UTF-8 | 703 | 3.71875 | 4 | [] | no_license |
# 베스킨라빈스31
# 1. p1과 p2가 번갈아가면서 1~3을 입력한다.
# 2. br은 p1과 p2의 입력값을 누적해서 저장한다.
# 3. br이 31을 넘으면 게임은 종료된다. (넘긴쪽이 패배)
# 4. 승리자를 출력한다.
#
# 예)
# 1턴 : p1(2) br(2)
# 2턴 : p2(1) br(3)
# 3턴 : p1(3) br(6)
p1 = 0
p2 = 0
br = 0
turn = 0
import random
i = 0
while br < 31 :
if i % 2 == 0 :
p1 = random.randint(1,3)
... | true |
57303131b19ee14ecf31511d753e2862ac990ab0 | maq-622674/python | /廖Py教程/py/5.高级特性/迭代器.py | UTF-8 | 855 | 4.0625 | 4 | [] | no_license | from collections.abc import Iterable
print(isinstance([], Iterable))
print(isinstance({}, Iterable))
print(isinstance('abc', Iterable))
print(isinstance((x for x in range(10)), Iterable))
print(isinstance(100, Iterable))
'''
而生成器不但可以作用于for循环,还可以被next()函数不断调用并返回下一个值,直到最后抛出StopIteration错误表示无法继续返回下一个值了。
可以被next()函数调... | true |
434f37a01146a49086e3be956a47fbe61697d4db | Shehzz/RESTAPITesting | /requests_test.py | UTF-8 | 3,882 | 2.828125 | 3 | [] | no_license | import pytest
import requests
import variables
@pytest.mark.positive
def test_checking_for_active_endpoint(URL):
response = requests.get(URL).json()
assert response['code'] == 200
@pytest.mark.positive
def test_creating_a_new_user_using_POST(URL, auth_token):
response = requests.post(URL, headers=auth_t... | true |
24b242073f41ab06967d2fa6327951eb0ede43f1 | emaksOne/master_degree_diploma_project | /utils.py | UTF-8 | 227 | 3.53125 | 4 | [] | no_license | def createPointsDictionary(points, width, hight):
pointsDict = []
for x in range(width):
for y in range(hight):
item = (points[x,y], (x, y))
pointsDict.append(item)
return pointsDict | true |
e17f69652c57f90e66018ec79a37b7e0f1a0c5a1 | Dunes/json_stream | /jsonstream.py | UTF-8 | 12,781 | 2.78125 | 3 | [
"MIT"
] | permissive | from functools import partial
import io
import re
from json import JSONDecoder, JSONDecodeError, dump, dumps
__all__ = ['load', 'loads', 'dump', 'dumps']
NOT_WHITESPACE = re.compile(r'\S')
KEYWORDS = (
'null',
'true',
'false',
# not in JSON spec, but decoded by Python JSON
'NaN',
'Infinity',... | true |
3843b728f91b0a69e6e5a61ffc37dea71bb5d975 | ActionPackedJack/CodingDojo | /Python/strings_and_lists.py | UTF-8 | 391 | 3.4375 | 3 | [] | no_license | words = "It's thanksgiving day. It's my birthday,too!"
print words.find("day")
print words.replace("day", "month", 1)
x = [2,54,-2,7,12,98]
print min(x)
print max(x)
x = ["hello",2,54,-2,7,12,98,"world"]
x=[x[0],x[len(x)-1]]
print x
x = [19,2,54,-2,7,12,98,32,10,-3,6]
x.sort()
y=[]
for i in range(6):
y.append(x[i])... | true |
31c602326e3cac643d4994e7d5794f7de0e0b223 | jeromeku/Labs | /Python/StandardLibrary/matrix_multiply.py | UTF-8 | 1,285 | 3.921875 | 4 | [
"CC-BY-3.0"
] | permissive | # matrix_multiply.py
"""Volume II Lab 1: The Standard Library (Auxiliary File)
Use this module to complete problem 4. Do not modify this file in any way.
"""
import numpy as np
def load_matrices(filename):
"""Returns two matrices if the correct filename is given."""
files = np.load(filename)
retu... | true |
890d33fa9aa0d883021d38e0456e0965708745c9 | wpk-nist-gov/glassmaker | /old/recipe.py | UTF-8 | 5,237 | 3.21875 | 3 | [] | no_license | # recipe - recipe maker
import functions as F
import glass as G
import os
import json
import copy
class Recipe(object):
def __init__(self):
"""Return a new object to represent a recipe for making a range of glass beads
Each element posses the following, lists of two objects:
beadFileName: file nam... | true |
08a97ded0239f9408bce43130c588d5473b952c5 | sbhadsavle/toxic-comments-classifier | /neural_kernel/persisted_kernel.py | UTF-8 | 2,513 | 2.5625 | 3 | [] | no_license | """Classifier for Toxic Comments.
Authors: Sarang Bhadsavle and Ben Fu
"""
import os
import sys
import pandas as pd, numpy as np
from sklearn.linear_model import LogisticRegression
from sklearn.ensemble import RandomForestClassifier
from sklearn.feature_extraction.text import CountVectorizer, TfidfVectorizer
f... | true |
3bda734c60a8ca318aef5ee5c524f3fd94d009b8 | TOMBowei/FirstGitHubTry | /单体用户画像.py | UTF-8 | 823 | 2.875 | 3 | [] | no_license | import linecache
import tkinter as tk
dataset = []
the_line = linecache.getline('/Users/wubowei/Documents/毕业设计源代码/friend.csv', 47)
print (the_line)
the_line = the_line.strip('\n')
dataset= the_line.split(',')
print(dataset)
window = tk.Tk()
window.title('个人基本信息')
window.geometry('500x300')
list1 = tk.Listbox(window,... | true |
b77070a78127e8f6586a506f614cd098f6c63db9 | s1Sharp/kpfu_parser | /ilsiyar.py | UTF-8 | 4,739 | 2.859375 | 3 | [] | no_license | from bs4 import BeautifulSoup
import tools
import requests
from ildar import get_link_from_menu_list_left, gather_name_link_of_employees
def gather_name_link_of_cathedras_of_phys(link):
html = tools.get_html(link)
soup = BeautifulSoup(html, 'lxml')
div = soup.find('div', class_='visit_link')
serach... | true |
5688e6edf0fb9a0cbcb8080c86d5c0fb6827905d | EduardoVaca/Competitive-Programming | /InterviewBit/partition_list.py | UTF-8 | 1,188 | 3.5 | 4 | [] | no_license | # Definition for singly-linked list.
# class ListNode:
# def __init__(self, x):
# self.val = x
# self.next = None
class Solution:
# @param A : head node of linked list
# @param B : integer
# @return the head node in the linked list
def partition(self, A, B):
current = A
... | true |
569240bb91627bbda2381688233ac3bfd72e5a02 | fwoovla/Game-of-Life | /kingdoms/KingdomsCA2/main.py | UTF-8 | 5,799 | 3.4375 | 3 | [] | no_license | import pygame
import random
width = 200
height = 200
cell_size = 4
last_x = int(width / cell_size)
last_y = int(height / cell_size)
FPS = 20
red = (255, 0, 0)
green = (0, 255, 0)
blue = (0, 0, 255)
colors = [red, green, blue]
class Creature:
def __init__(self, color, home, ID):
self.home = home
s... | true |
0b7cee40b8e4f184bcdd6aeb6a5eb8cebf0f1b77 | MasuqaT-NET/BlogExamples | /Web/gRPC/python_practical_example/cowsay_service/cowsay_service.py | UTF-8 | 959 | 2.765625 | 3 | [
"MIT"
] | permissive | from cowpy.cow import Cowacter, Tux
from grpc import StatusCode
from cowsay_pb2 import QuoteRequest, QuoteResponse
from cowsay_pb2_grpc import CowsayServicer
class CowsayService(CowsayServicer):
def __init__(self):
self.cow = Cowacter()
self.tux = Tux()
def GetQuote(self, request: QuoteReque... | true |
c55a079a0da174fc8bbfa31701509a23f4a70fbb | MasumRana9/cowin-chatterbot-chatbot | /bot_ui.py | UTF-8 | 1,436 | 2.890625 | 3 | [] | no_license | import streamlit as st
from chatterbot import ChatBot
import chatterbot
import spacy
import warnings
from PIL import Image
import pandas as pd
warnings.filterwarnings('ignore')
spacy.load('en_core_web_sm')
df = pd.read_csv("India.csv")
#df = df.rename(columns={'date':'index'}).set_index('index')
def g... | true |
bbf847561b01330a96c74064bcaf6e5bc73f19da | coder46/Data-Mining-Projects | /Wikipedia_Entity_Detection/code/cleaner.py | UTF-8 | 3,578 | 2.625 | 3 | [] | no_license | import re
import urllib
import urllib2
import string
import mechanize
import httplib2
from urlparse import urlparse
from bs4 import BeautifulSoup
from collections import OrderedDict
EntityType = {}
def isAlphamumeric( character ):
if( character >= 'a' and character <= 'z' ):
return 1
if( character >= 'A' and char... | true |
b1b7f03961e0db514d8502a2426e994cf185c51a | hyperforest/gartic-autofill | /autofill.py | UTF-8 | 1,929 | 2.921875 | 3 | [] | no_license | from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.common.action_chains import ActionChains
from selenium.webdriver.common.keys import Keys
import os
url = 'https://gartic.io'
path = "C:\\Users\\asus\\AppData\\Local\\Google\\Chrome\\Application\\chromedriver.exe"
driver ... | true |
cb203c336c65c6a83cc9ba5637fcc00d09583657 | jamesmcm/ClimateChangeTwitter | /dbfs.py | UTF-8 | 8,843 | 2.609375 | 3 | [] | no_license | #Do directed breadth first search to complete path-length/path matrix
import networkx as nx
import numpy as np
import operator
import sys
class BFSstep(object):
''' Class for directed Breadth First Search steps - gets successors for current node, and stores paths to these nodes'''
def __init__(self,node,curpat... | true |
12fb0e001756d6109f998c8200268ee4c3476e13 | renales/Python | /Ejemplos Python/Ejemplo_Funciones_propias_parametros_diccionario.py | UTF-8 | 566 | 3.71875 | 4 | [] | no_license | #!/bin/python3
# coding: utf-8
# Ejemplo de funciones propias con parametro diccionario
# Raul Renales 8/5/2020
def tasa_prod(trabajadores, **seccion):
#Funcion que evalua el % de trabajadores por encima de la productividad
#Exigida por la empresa
total=0
for trab in seccion.values():
... | true |
91e756864e9c1a39908fcb97a132e48616198cc1 | bamibanzai/PiWash | /piwash.py | UTF-8 | 3,636 | 2.59375 | 3 | [] | no_license | #module written for the Raspberry Pi model 3 WiFi
try:
import RPi.GPIO as RaspIO
import time
# import requests
# import http.client, urllib #enables push notifications
import logging #debug
except RuntimeError:
print("Error loading RaspIO")
TIMEDELAY = 120 #Time to wait in seconds... | true |
36456d73a284cc4066f701f2dee18c0f3d369353 | sunavar/Customer-Service-Analysis | /part 3.py | UTF-8 | 2,382 | 3.453125 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Wed Jul 15 17:37:49 2020
@author: singh
"""
# 3. Provide major insights/patterns that you can offer in a visual format (graphs or tables); at least 4 major conclusions that you can come up with after generic data mining.
# Conclusion 1: Frequency of each complain type
... | true |
aac3a1fa8e0615fc7fb75e29aacf8a15f6e933ba | ankitgupta123445/word-detector | /main.py | UTF-8 | 564 | 3.296875 | 3 | [] | no_license | import os
def isBinod(fileName):
with open(fileName, "r") as f:
fileContent = f.read()
if "binod" in fileContent.lower():
return True
else:
return False
if __name__ == '__main__':
dir_contents = os.listdir()
print(dir_contents)
for items in dir_content... | true |
98775bbeea8fdd8db8cd1a8238b01c98c7395b27 | Charlesmutua/Python_Virtual_Bootcamp | /Intro to Python And Data Types/Assignment5.py | UTF-8 | 151 | 4 | 4 | [] | no_license | # 5.Write a python program that checks if a string begins with a capital letter.
sentence = input("Enter a sentence: ")
print(sentence.isupper())
| true |
34b4375e17b4104c124c2092f02ccbf078a7cbf1 | 1264799190/1803 | /11day/12.py | UTF-8 | 182 | 2.75 | 3 | [] | no_license | game = [['传奇','贪玩蓝月'],['QQ飞车','QQ炫舞'],['天天酷跑','天天炫斗'],['王者荣耀','荒野行动']]
for i in game:
for w in i:
print('这个游戏是%s'%w)
| true |
dcfe93f742bb1239025f4bbbf641fb757e4f1fa7 | 4lightyears/demo_reviewbook | /utils.py | UTF-8 | 217 | 2.796875 | 3 | [] | no_license | from passlib.hash import pbkdf2_sha256
def hash_password(password):
hashed = pbkdf2_sha256.hash(password)
return hashed
def check_password(password, hashed):
return pbkdf2_sha256.verify(password, hashed) | true |
64cf03701e446bfa909a0c231cfdbac09aa7a766 | arrancapr/Clases | /Python1ArrancaPr/Samples/InclassExcercise1.py | UTF-8 | 278 | 3.578125 | 4 | [] | no_license |
print("Tell me the name of your file?")
filename = input()
f = open(filename +".txt",'w')
control = ""
while(control != "-done"):
print("Give me a student name:")
control = input()
if(control != "-done"):
f.write(control)
f.write("\n")
f.close()
| true |
9fcd2a879efc59d4002576fa666a6c87f31728a0 | mk-377/bigcall | /R-O_robotsystem.py | UTF-8 | 5,872 | 2.765625 | 3 | [] | no_license | # импортируем библиотеки
import telebot
from telebot import types
import RPi.GPIO as GPIO
from time import sleep
import dht11
# пины для подачи сигнала моторам
ln1 = 26
ln2 = 19
ln3 = 13
ln4 = 6
def setup():
GPIO.setmode(GPIO.BCM)
GPIO.setup(ln1,GPIO.OUT)
GPIO.setup(ln2,GPIO.OUT)
GPIO.setup(ln3,GPIO.O... | true |
38b185ba00220221d33f0b415dfde23bffa623f5 | darlannakamura/denoising-dbt | /denoising/wiener.py | UTF-8 | 1,522 | 2.546875 | 3 | [
"MIT"
] | permissive | import numpy as np
from denoising.utils import *
from scipy.signal import wiener
from denoising import _batch_algorithm_implementation
from tqdm import tqdm
def wiener_filter(noisy_images: np.ndarray, noise_std_dev: float, show_progress:bool = False) -> np.ndarray:
"""
Params:
noisy_images: receive noisy_i... | true |
bc3dea2d0ed0d34796c66f3233428993608cee18 | hasadna/obudget | /data/2010_planned/parse2010.py | UTF-8 | 1,895 | 2.515625 | 3 | [
"BSD-2-Clause"
] | permissive | ### encoding: utf8
import csv
import json
f = csv.reader(file('state-budget.csv'))
out = file('out.json','w')
lengths = [2,4,6,8]
net_p = {}
gross_p = {}
lastcode = None
f.next()
f.next()
parent_titles = {'00': 'המדינה'}
for l in f:
p_codes = ['','','']
p_titles = ['','','']
try:
p_codes[0],p... | true |
eaa5f1a24c0088b86551b9c701e49efe29a84656 | gmblasco/Cisco-Networking | /Create interfaces via restconf/create interface with def.py | UTF-8 | 3,693 | 2.546875 | 3 | [] | no_license | import json
import ipaddress
import socket
import struct
import http.client
import requests
def valid_ip(a):
#Funcion para validar que una ip sea válida
while True:
try:
ipaddress.ip_address(a)
except ValueError:
#si no es válida pide ingrsarla hasta que lo s... | true |
8737b4b66c2c5f314c2c0c456ba4adb7265aa54a | wocks1123/training | /helper/evaluate_helper.py | UTF-8 | 8,189 | 2.59375 | 3 | [] | no_license |
import torch
from tqdm import tqdm
from pprint import PrettyPrinter
pp = PrettyPrinter()
from utils.utils import AverageMeter, calculate_mAP, detect_objects
def calculate_accuracy(model, data_loader, device, data_type):
model.eval() # eval mode disables dropout
accus = AverageMeter()
with torch.no_gr... | true |
7bba9c97d0402e4c6c9bce1be5d5d70b7dec7e88 | lulitados/pgrado | /ancora/impersonal_verbs.py | UTF-8 | 1,084 | 2.71875 | 3 | [] | no_license | import json
import os # os module imported here
def get_verbs_sentence(sentence):
return [
word for word in sentence
if 'is_verb' in word and
'suj' in word and
word['suj']['func'] == 'impers'
]
location = os.getcwd() # get present working directory location here
ancora_file... | true |
8fe2e9bf0487bdaede38802b6e00b0c9908a75ad | suryamak/pokemon-locator | /find.py | UTF-8 | 1,093 | 2.75 | 3 | [] | no_license | import requests
import sys
from bs4 import BeautifulSoup
from lookup import games, all_mons
def find(mon, gen, dex, version):
url = "https://www.serebii.net/{}/{}{}".format(dex, str(all_mons[mon]).zfill(3) if gen < 8 else mon, '.shtml' if gen < 8 else '')
r = requests.get(url, headers={'User-agent': 'Mozilla/... | true |
8dc244d5ab91ec5340d56d4bc2ea3140ee713851 | mercy17ch/python-If-else-statement- | /grading system.py | UTF-8 | 1,030 | 3.6875 | 4 | [] | no_license | #program of a grading system#
#finding the marks of five subjects#
#marks-prompt the user to enter the marks of five subjects#
#if else#
print("subjects and marks")
print("enter marks against subjects")
OOP=int(input("enter the marks for OOP;"))
OOSAD=int(input("enter the marks for OOSAD;"))
MULTIMEDIA=int(inpu... | true |
fe97e7af537beb508cd8dfa723740adb42c6069d | sudhir-j-sapkal/python-basic-examples | /11MethodAndFunctions/nestedstatementAndScope.py | UTF-8 | 471 | 4 | 4 | [] | no_license | x = 20
def printer():
x=10
return x
print(x)
#LEGB
#1. Local(L): Defined inside function/class
#2. Enclosed(E): Defined inside enclosing functions(Nested function concept)
#3. Global(G): Defined at the uppermost level
#4. Built-in(B): Reserved names in Python builtin modules
#Globle
name = "Global Sudhir"
... | true |
ada07b14bd74adfe24666119c6833b68da53a6ee | pluxos/cassandra-sim-cmds | /insert_data.py | UTF-8 | 2,067 | 2.5625 | 3 | [] | no_license | #! /usr/bin/env python
import sys
import logging
log = logging.getLogger()
#log.setLevel('DEBUG')
log.setLevel('INFO')
handler = logging.StreamHandler()
handler.setFormatter(logging.Formatter("%(asctime)s [%(levelname)s] %(name)s: %(message)s"))
log.addHandler(handler)
from cassandra import ConsistencyLevel
from cas... | true |
5e21a41d75dd71cdf0ed0a0e4dd024d91164d169 | Gregwar/quadruped_enseirb | /quadruped/control.py | UTF-8 | 3,260 | 3.46875 | 3 | [] | no_license | import numpy as np
if __package__ is None or __package__ == '':
import interpolation
else:
from . import interpolation
def sandbox(t):
"""
python simulator.py -m sandbox
Un premier bac à sable pour faire des expériences
La fonction reçoit le temps écoulé depuis le début (t) et retourne une po... | true |
243f499e4f8674ea646d4c6873772957494f14d1 | hsjhita1/QAWork | /Python/CoTD/Tests/test_cotd05_05.py | UTF-8 | 202 | 2.828125 | 3 | [] | no_license | import pytest
import math
from Code import CoTD05_05
def test_func():
assert CoTD05_05.factorial(8) == math.factorial(8)
def test_negative():
assert CoTD05_05.factorial(-2) == "Invalid number" | true |
d7c08404de4ad70bc95251dc3d7f8a9db009ab4d | cbess/lionface | /lib/lionface/output.py | UTF-8 | 3,774 | 3 | 3 | [] | no_license | #!/usr/bin/env python
# encoding: utf-8
"""
render.py
Created by Christopher Bess on 2008-05-17.
Copyright (c) 2008 Christopher Bess. All rights reserved.
"""
import sys
import lionfaceobject
import interfaces
from config import CustomRender, CustomOutput, CustomAsyncDelegate
class LFRender(lionfaceobject.LFObject, ... | true |
e0f548ec2e3f89ba7a43b6c4bf9ba5f347f06e04 | andypbarrett/nsidc-seaice | /seaice/nasateam/test/test_trends.py | UTF-8 | 4,796 | 2.53125 | 3 | [
"LicenseRef-scancode-unknown-license-reference",
"MIT"
] | permissive | import datetime as dt
import unittest
import numpy as np
import numpy.testing as npt
import seaice.nasateam as nt
from seaice.nasateam.errors import SeaIceBadSeason
from .util import mock_today
class Test_datetime_index_for_seasonal_trends(unittest.TestCase):
def test_starts_on_the_first_of_the_first_given_mont... | true |
b670a3f8a0bc9737dc867c7ba47626f8b9e6b51a | sergey-msu/made2021-project | /metric.py | UTF-8 | 1,203 | 2.71875 | 3 | [] | no_license | import numpy as np
def metric(y_true, y_pred, y_old, at1=10, at2=30, average=True):
"""
new_prec@10 + new_prec@30 + 1/2 *(prec_@10 + prec@30)
"""
scores = []
for t, p, o in zip(y_true, y_pred, y_old):
t = list(t)
p = list(p)
o = o if isinstance(o, (set, list)) else []
... | true |
a84ec12bc21b3001ebfef31edea50c3a8d5f5af5 | shambog/The_Hobbit_Learns | /Start_Hunting.py | UTF-8 | 1,039 | 3.09375 | 3 | [] | no_license | # Execute this file.
from Map_Environment import Map
from Learning_Engine import QLearningTable
def update():
for attempt in range(50):
# First Observation
observation = env.reset()
while True:
# New Environment
env.render()
# Reinforcement Learning ... | true |
4007697007de3374b168e4cc0925d4a1068c9f08 | L0ganhowlett/Python_workbook-Ben_Stephenson | /50 Roots of Quadratic Function.py | UTF-8 | 592 | 4.375 | 4 | [
"MIT"
] | permissive | # 50 Roots of a Quadratic Function
a = int(input("Enter the value of a :"))
b = int(input("Enter the value of b :"))
c = int(input("Enter the value of c :"))
import math
x = (b**2 - 4*a*c)
if x > 0:
y = math.sqrt(x)
r1 = (-b + y)/(2*a)
r2 = (-b - y)/(2*a)
print("The roots of the quadratic equa... | true |
e64e1e08b00ea7f55dc81700ec904638fa3ece51 | Fancy2000/translation-of-subtitles-telebot | /my_class.py | UTF-8 | 3,958 | 2.71875 | 3 | [] | no_license | from youtube_transcript_api._errors import TranscriptsDisabled
from youtube_transcript_api import YouTubeTranscriptApi
# ------------CLASS----------------------------
class YoutubeSubsTranslate:
no_subs_message = "Это видео не содержит субтитров."
no_transl_message = "Не возможно перевести на ваш язык. Пожалу... | true |
26397ecc14da9e89b242879cfe484650bef396de | wehnsdaefflae/semiotic_modelling | /_framework/systems/predictors/rational/implementations/rational_regression_predictor.py | UTF-8 | 3,098 | 2.75 | 3 | [] | no_license | # coding=utf-8
from typing import Tuple
from _framework.data_types import RATIONAL_INPUT, RATIONAL_OUTPUT, PREDICTOR_STATE
from _framework.systems.predictors.rational.abstract import RationalPredictor
from tools.regression_experiments import LinearRegressor, FullPolynomialRegressor
class RationalLinearRegression(Rat... | true |
b658defee290d531d08f4a58af0016ef5d783a89 | josemariamontero/Ejercicio_JSON_V2 | /ejercicio1.py | UTF-8 | 244 | 3.3125 | 3 | [] | no_license | import json
with open('movies.json','r') as fichero:
doc = json.load(fichero)
#print(doc)
for i in doc:
titulo = i["title"]
año = i["year"]
duracion = i["duration"]
print ("Titulo: %s, Año: %s, Duracion: %s" % (titulo,año,duracion))
| true |
9ac918ef45222512c18515537083f88a8cdef112 | AbelRapha/Python-Exercicios-CeV | /Mundo 2/ex040 Calculo de Media.py | UTF-8 | 394 | 4.0625 | 4 | [
"MIT"
] | permissive | n1 = float(input("Digite sua primeira nota: "))
n2 = float(input("Digite sua segunda nota: "))
def media(n1,n2):
media = (n1+n2)/2
if media < 5:
return f"REPROVADO, SUA MEDIA FOI DE {media:.1f}"
elif media >= 5 and media < 7:
return f"RECUPERACAO, SUA MEDIA FOI DE {media:.1f}"
else:
... | true |
ca28232b7e44752b60d216c2a84f614b62ae2ecf | netfree/fop_lab_05 | /Student.py | UTF-8 | 1,082 | 2.84375 | 3 | [] | no_license | class Student:
__name = ""
__id = 0
__group = 0
@property
def name(self):
return self.__name
@name.setter
def name(self, name):
if isinstance(name, str):
self.__name = name
else:
raise Exception("string expected")
@prop... | true |
85d464266bce1425544255da942203f734b052d4 | PanosPHL/PlayerSeekingPlayer | /server/app/utils/errors.py | UTF-8 | 291 | 3.078125 | 3 | [] | no_license | def format_errors(errors):
errList = []
for error in errors:
if errors[error][0] == 'Not a valid choice':
if error == 'band_id':
errList += ["Please select a valid band"]
continue
errList += errors[error]
return errList | true |