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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
a5fb9742eca221d315e6baed5d50c0309eb85094 | Python | noalevitzky/Intro2CS | /02/test_largest_and_smallest.py | UTF-8 | 1,547 | 3.171875 | 3 | [] | no_license | # this function tests function 4 for 5 different cases
from largest_and_smallest import largest_and_smallest
def test_func_4():
large, small = largest_and_smallest(-1, 1, 100)
if large == 100 and small == -1: # case 1 is true
large, small = largest_and_smallest(100, 1, -1)
... | true |
adf4a1278746dad0ab2cc4cf375a5b4c11861199 | Python | XomakNet/teambuilder | /utils/metrics.py | UTF-8 | 11,671 | 2.78125 | 3 | [] | no_license | from utils.math import normalized_vector_distance
from typing import List
from typing import Set
from math import ceil
from numpy import mean
from models.user import User
__author__ = 'Xomak'
class TeamMetric:
pass
class MetricTypes:
LISTS = "lists"
DESIRES = "desires"
COMMON = "common"
class ... | true |
632071363ce6c84af97622aba324c74ecf31529e | Python | burnbrigther/py_practice | /ex11_ex2.py | UTF-8 | 272 | 3.71875 | 4 | [] | no_license | print "What is your name?",
name = raw_input()
print "What is your favorite sport?",
fav_sport = raw_input()
print "What is your favorite team?",
fav_team = raw_input()
print "Hello %r. Your favorite sport is %r and your favorite team is %r?" % (name, fav_sport, fav_team) | true |
53ee519096cfd85c4776d37dcdde3e820e5262da | Python | pengguanjun/imagepy | /sciwx/widgets/menubar.py | UTF-8 | 2,205 | 2.890625 | 3 | [
"BSD-2-Clause"
] | permissive | import wx
def hot_key(txt):
sep = txt.split('-')
acc, code = wx.ACCEL_NORMAL, -1
if 'Ctrl' in sep: acc|= wx.ACCEL_CTRL
if 'Alt' in sep: acc|= wx.ACCEL_ALT
if 'Shift' in sep: acc|= wx.ACCEL_SHIFT
fs = ['F%d'%i for i in range(1,13)]
if sep[-1] in fs:
code = 340+fs.index(sep[-1])
e... | true |
926aa9fe4b5a33cc0d3c40102f23496473fb446b | Python | Milan-Chicago/ds-guide | /house_robber.py | UTF-8 | 1,882 | 3.90625 | 4 | [] | no_license | """
House Robber I
You are a professional robber planning to rob houses along a street. Each house has a certain amount of money stashed,
the only constraint stopping you from robbing each of them is that adjacent houses have security system connected and
it will automatically contact the police if two adjacent houses ... | true |
7cfb2cc28b45807ff97a02c28f73032b28487fb4 | Python | Samarkina/PythonTasks | /FirstTasks/3.py | UTF-8 | 179 | 3.078125 | 3 | [] | no_license | x = int(input())
h = int(input())
m = int(input())
go_to_sleep = h*60 + m
timer = x + go_to_sleep
print("{} часов".format(timer//60))
print("{} минут".format(timer%60))
| true |
42a56f1a1e7ea642b6151f5628191c8910ec1719 | Python | cduck/qutrits | /cirq/ops/reversible_composite_gate.py | UTF-8 | 3,031 | 2.65625 | 3 | [
"Apache-2.0"
] | permissive | # Copyright 2018 The Cirq Developers
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in ... | true |
b3ef5ec67f31bf480a905c8dea8df089796add83 | Python | codeslord/onlycode | /onlycode.py | UTF-8 | 2,341 | 3.40625 | 3 | [
"MIT"
] | permissive | import os
import tqdm
import sys, token, tokenize
def get_filepaths(directory):
"""
This function will generate the file names in a directory
tree by walking the tree either top-down or bottom-up. For each
directory in the tree rooted at directory top (including top itself),
it yields a 3-tuple ... | true |
4a62d99ee8d4b62355b455576e50ef279f95741f | Python | jorgeaninoc/CodingProblems | /A. Chat room.py | UTF-8 | 308 | 3.34375 | 3 | [] | no_license | s = raw_input()
w = "hello"
aux = ""
length = range(len(s))
index = 0
for i in s:
if i in "hello":
s = s.replace(i,"")
aux += i
aux2 = ""
for i in aux:
if index < len(w) and i==w[index]:
aux2 += i
index+=1
if aux2 == "hello":
print("YES")
else:
print("NO") | true |
5c192d8366bf35614a4f4a5a7fd21d9966d63799 | Python | fillipe-felix/ExerciciosPython | /Lista02/Ex008.py | UTF-8 | 984 | 4.4375 | 4 | [] | no_license | """
Faça um programa que pergunte o preço de três produtos e informe qual
produto você deve comprar, sabendo que a decisão é sempre pelo mais barato.
"""
produto1 = float(input("Digite o valor do primeiro produto: "))
produto2 = float(input("Digite o valor do segundo produto: "))
produto3 = float(input("Digite o valor... | true |
d943c8958a3eb8b1f7ebe6de45a9993fb211c95f | Python | linziyi96/pytorch | /torch/_vmap_internals.py | UTF-8 | 3,880 | 2.703125 | 3 | [
"BSD-3-Clause",
"BSD-2-Clause",
"LicenseRef-scancode-generic-cla",
"Apache-2.0"
] | permissive | import torch
import functools
from torch import Tensor
import warnings
REQUIRE_SAME_MAP_SIZE = (
'vmap: Expected all tensors to have the same size in the mapped dimension, '
'got sizes {sizes} for the mapped dimension'
)
ELEMENT_MUST_BE_TENSOR = (
'vmap({fn}, ...): `{fn}` must only return Tensors, got '
... | true |
94f2bd2af03345e98d7dc02640bac5b60e249724 | Python | panhaichun/panzixuan | /pzx/account.py | UTF-8 | 1,107 | 2.828125 | 3 | [] | no_license | import pzx.user
from security.authentication import AccountNotFoundException
class Account:
'''
表示一个用户账号
'''
def __init__(self, user):
if not user:
raise ValueError('参数[user]不能为空')
self.__user = user
def get_name(self):
return self.__user.username
... | true |
c7f1f99a72f2f5f3ce0d205109d2fbf730e0d5e7 | Python | adamlporter/Fitbit_Analysis | /HRZ_ToCSV.py | UTF-8 | 1,593 | 2.65625 | 3 | [] | no_license | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Sat Oct 19 11:40:19 2019
@author: adam
"""
import json
import pandas as pd
import glob
import time
def processFile(fName):
# open the file, import the json data, and convert data from strings to
# datetime and numeric values
from pandas.... | true |
b8ba4f9a3c6028fdfacfc99a2e35adb631772ca1 | Python | gaw1ik/Visualizers-In-Python | /stars.py | UTF-8 | 6,011 | 3.15625 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Tue Jul 7 00:08:46 2020
This script generates a GIF file which contains an animation
resembling things ranging from stars to planets to biological
cells.
The variables in the Inputs section can
be adjusted to produce a wide range of visual results. The Inputs
section... | true |
449203e0d964e0212d79dbceeec0522838c26245 | Python | ShaheerAhmed2030/Probablisitic-Model | /Decision Tree/ID3.py | UTF-8 | 3,967 | 3.34375 | 3 | [] | no_license | # Importing Libraries
import pandas as pd
import numpy as np
from pprint import pprint
# Functions
# Entropy Function
def Entropy(Target):
Elements,Count = np.unique(Target,return_counts = True)
entropy = np.sum([(-Count[i]/np.sum(Count))*np.log2(Count[i]/np.sum(Count)) for i in range(len(Elements))... | true |
d527677e3409238dca961f5cd033df6f78c8fb22 | Python | sup/mathlib | /mathlib/core/matrix.py | UTF-8 | 26,189 | 4.28125 | 4 | [] | no_license | #matrix.py
#Charles J. Lai
#August 18, 2013
import unimath
"""
======
matrix
======
This module contains a wrapper class that represents a matrix and
functions that can be used to analyze/evaluate a matrix class.
Addition, subtraction, division, and multiplication functionality are
implemented as cases within the ... | true |
55c66a66feecaff04a6d39b148d8852ef3f15a75 | Python | theRealSuperMario/tikzplotlib | /test/test_subplots_with_colorbars.py | UTF-8 | 533 | 2.578125 | 3 | [
"MIT"
] | permissive | def plot():
import numpy as np
from matplotlib import pyplot as plt
data = np.zeros((3, 3))
data[:2, :2] = 1.0
fig = plt.figure()
ax1 = plt.subplot(131)
ax2 = plt.subplot(132)
ax3 = plt.subplot(133)
axes = [ax1, ax2, ax3]
for ax in axes:
im = ax.imshow(data)
f... | true |
e66c58a1daeed7fab59094ef61cef577df604575 | Python | sejin1996/pythonstudy | /ch03/function/17_global_variable.py | UTF-8 | 1,245 | 3.921875 | 4 | [] | no_license | # 전역 변수 (global variable)
# 함수 외부에서 정의된 변수
# 프로그램 내 모든 곳에서 사용 가능
# 함수 내에서 전역 변수의 값을 변경하려면 global 키워드 사용
a=1 # 함수 밖에서 정의된 전역변수 a
def show():
c=a+b # 전역변수 a 모든 곳에서 사용 가능
print(a) # 전역변수 a
print(b)
print(c)
def add():
print(a) # 전역변수 a 모든 곳에서 사용 가능
print(b)
b=2 # 함수 밖에서... | true |
fc78a3d93c26406d8444331ac106d9da08386f2e | Python | pawelmuller/core-wars | /test_warrior.py | UTF-8 | 677 | 2.53125 | 3 | [] | no_license | from warrior import Warrior
from Redcode import Instruction
def test_Warrior_import_from_file():
instructions = [
Instruction("ADD #4, 3"),
Instruction(" MOV 2, @2"),
Instruction("JMP -2"),
Instruction(" DAT #0, #0")
]
warrior = Warrior("Warriors/Dwarf.red")
... | true |
bb4951cbe596c4b5666c6750880b563849d5a6e0 | Python | oesteban/quality-assessment-protocol | /scripts/qap_aws_s3_dict_generator.py | UTF-8 | 3,364 | 2.921875 | 3 | [
"BSD-3-Clause"
] | permissive | #!/usr/bin/env python
def pull_S3_sublist(yaml_outpath, img_type, bucket_name, bucket_prefix, creds_path):
import os
from CPAC.AWS import fetch_creds
import yaml
s3_list = []
s3_dict = {}
bucket = fetch_creds.return_bucket(creds_path, bucket_name)
# Filter for anat/rest
if img_type ... | true |
7f1e2ab4bdb9d0cb688de9cfc92b86389fa5c7fb | Python | tkmanabat/RoboMark | /cogs/translate.py | UTF-8 | 834 | 2.765625 | 3 | [] | no_license | import discord
from discord.ext import commands
import googletrans
from googletrans import Translator
class translate(commands.Cog):
def __init__(self,client):
self.client=client
@commands.command(name="translate", help="Visit https://py-googletrans.readthedocs.io/en/latest/ for languages supported")... | true |
0e158032bdefeb55663c2f4bdb25d6e1bd7c6152 | Python | chseng213/QingCloudTest | /main/utils/request.py | UTF-8 | 1,453 | 2.96875 | 3 | [] | no_license | # encoding: utf-8
import requests
class Request(object):
"""
Simple package requests
"""
MAX_RETRY = 3
def __init__(self, session=None, timeout=5):
"""
:param session: requests session object default:new session obj
:param timeout: requests timeout default:5S
"... | true |
0610c676cda0f00ab360f280c39364e22d784abc | Python | Thxios/ProjectResearch | /Gomoku/game.py | UTF-8 | 2,174 | 3.484375 | 3 | [] | no_license | from lib import *
from .board import Board
from .validation import ThreeChecker, FourChecker, FiveChecker, SixChecker
class Game:
def __init__(self):
# self._board = np.zeros((15, 15), dtype=np.int)
self._board = Board(np.zeros((15, 15), dtype=np.int))
def get(self, x, y):
# if x < 0 ... | true |
31a392285420ad29bf867a31bd3c23c8502597e4 | Python | Photonsnake/Photonsnake.github.io | /second.py | UTF-8 | 296 | 3.9375 | 4 | [] | no_license | num1 = int(input('Введите первое число\n'))
num2 = int(input('Введите второе чилсо\n'))
num3 = int(num1 +num2)
if num3 % 2 == 0:
print('Сумма этих чисел четная')
else:
print('Сумма этих чисел нечетная')
| true |
7e194b09e46bb13fa3a551e52d32b838dc40124c | Python | Vagacoder/Python_for_everyone | /Ch05/2017-8-13.py | UTF-8 | 1,138 | 3.75 | 4 | [] | no_license | ## Ch05 P5.5
def repeat(string, n, delim):
new_string = string + (delim+string)*2
return new_string
print(repeat('ho', 3, ', '))
## Ch05 P5.22
def balance(initial, rate, year):
account_balance = initial * (1 + rate/100)**year
return account_balance
print(balance(1000, 5, 1))
## Ch0... | true |
21d31f827202e1d44d461f2450a0c2929c3f09ca | Python | alexgomezalanis/gkde-loss-function | /gkde_loss.py | UTF-8 | 6,491 | 2.6875 | 3 | [] | no_license | import torch
import torch.nn as nn
import torch.nn.functional as F
import numpy as np
from random import shuffle
from torch.distributions.multivariate_normal import MultivariateNormal
class KernelDensityLoss(nn.Module):
"""
Kernel Density Gaussian loss
Takes a batch of embeddings and corresponding labels.
"""
... | true |
c54fd7a0f4afa21e3ba14b40ff505d2e4ee0aaa3 | Python | uborzz/flask-csgo | /app/competitives/services.py | UTF-8 | 1,137 | 2.84375 | 3 | [] | no_license | from ..db import db
def update_players_and_maps_found_in_competitives():
"""
Exploramos partidas competitivas en el sistema y nos quedamos con el nick más
reciente y el id_steam de las coincidencias con la lista de miembros del clan
de steam, tengan o no abierto el perfil.
"""
matches = db.get... | true |
5da322f185f53a62e256f7ca17fd07b534139ac2 | Python | carol8562/lecture2 | /python_basics/06-loops.py | UTF-8 | 479 | 3.625 | 4 | [] | no_license | name = "Alice"
names = [name, "Bob", "Charlie"]
coordinates = (10.0, 20.0, 30.0)
mixed = [name, 40.0, True]
for i in range(len(name)):
print(name[i])
for i in range(len(names)):
print(names[i])
for i in range(len(coordinates)):
print(coordinates[i])
for i in range(len(mixed)):
print(mixed[i]... | true |
060ab50f944aa5e531f953d2c20382ef9e191364 | Python | dapivei/agua-cdmx-tecnico | /src/utils/funcs_result.py | UTF-8 | 1,054 | 2.875 | 3 | [] | no_license | """
RELEVANT DATA AND INDICATORS
"""
import pandas as pd
def get_imputed_data(df1, df2):
imputed_data = pd.concat([df1, df2[['nom_loc', 'nom_mun']]], axis=1)
imputed_data = pd.concat([df2[['cvegeo', 'geometry']], imputed_data], axis=1)
imputed_data.columns = imputed_data.columns.str.strip().str.lower()
d... | true |
c4a5f3fbd402f59e7f932c38930184774b077e73 | Python | google-code/avaloria | /src/objects/object_search_funcs.py | UTF-8 | 3,573 | 3.140625 | 3 | [
"LicenseRef-scancode-public-domain",
"ClArtistic"
] | permissive | """
Default functions for formatting and processing object searches.
This is in its own module due to them being possible to
replace from the settings file by use of setting the variables
ALTERNATE_OBJECT_SEARCH_ERROR_HANDLER
ALTERNATE_OBJECT_SEARCH_MULTIMATCH_PARSER
Both the replacing functions must have the same ... | true |
30ce91b9d541e891ef03f4704e44098a47a5bf1f | Python | Justintanvo/RecipeProject | /RecipeProject.py | UTF-8 | 12,644 | 3.71875 | 4 | [] | no_license | #!/usr/bin/env python
# coding: utf-8
# # Can We Predict Whether a Recipe Is Vegetarian Based Off of Ratings and Nutrition Values?
# Specifically, we want to predict whether a recipe will be vegetarian based off of 5 features: Ratings, Calories, Fat, Protein, and Sodium using a recipe data set from Epicurious in K... | true |
b7515c151be469bc2e5b179d994fe33ccc029ba2 | Python | IvanaXu/PyTools | /077.Test_BeeWare_windows/beeware-tutorial/helloworld/windows/Hello World/src/app_packages/toga/widgets/switch.py | UTF-8 | 2,586 | 3.234375 | 3 | [
"BSD-3-Clause",
"MIT"
] | permissive | from toga.handlers import wrapped_handler
from .base import Widget
class Switch(Widget):
""" Switch widget, a clickable button with two stable states, True (on, checked) and False (off, unchecked)
Args:
label (str): Text to be shown next to the switch.
id (str): AN identifier for this widget... | true |
6732bc0db416b112544768379769f87ccde8b9e8 | Python | karamveer5/Python-Basic-Programs | /Fibonacci series using function.py | UTF-8 | 166 | 3.625 | 4 | [] | no_license | def fibbo():
k=int(input("Enter a number: "))
a=0
b=1
print(a,end=' ')
print(b,end=' ')
for i in range(3,k+1):
c=a+b
print(c,end=' ')
a=b
b=c
fibbo() | true |
8219894d3e016a6af21a917980a7ff92b529450e | Python | m987/pycode- | /hello.py | UTF-8 | 260 | 2.640625 | 3 | [] | no_license | from flask import Flask
app = Flask(__name__)
@app.route('/')
def hello_world():
return 'Hello World!'
@app.route('/kot')
def kot():
return 'KOT!!!'
@app.route('/potega/<int:a>')
def potega(a):
return str(a*a)
if __name__ == '__main__':
app.run() | true |
5ba40675a07c0ccad919c6959fce8068923aa34a | Python | geesaladurgaakhil/database | /Hospital_Management/Read_details.py | UTF-8 | 2,201 | 3.53125 | 4 | [] | no_license | # Question 2: Fetch Hospital and Doctor Information using hospital Id and doctor Id
import psycopg2
def get_connection():
connection=psycopg2.connect(user="postgres",
password="root",
host="127.0.0.1",
port="5432",... | true |
c523cd13707cc09c195d236e9e7daa3544c027dc | Python | Aasthaengg/IBMdataset | /Python_codes/p03415/s838804804.py | UTF-8 | 64 | 2.953125 | 3 | [] | no_license | a,b,c = input()
d,e,f = input()
g,h,i = input()
print(a + e + i) | true |
643d81dd60279675490b9479e88ebbf111b7507b | Python | nprokhorenko/tonal_classif | /Keras_tonal_classif.py | UTF-8 | 1,376 | 2.59375 | 3 | [] | no_license | import numpy as np
from keras import models
from keras import layers
from keras.utils import to_categorical
from keras.datasets import imdb
np.load.__defaults__= (None, True, True, 'ASCII')
(training_X, training_y), (testing_X, testing_y) = imdb.load_data(num_words=10000)
data = np.concatenate((training_X, testing_X),... | true |
3505dcdb7f7fd253ff3463f5b24f92de037960f3 | Python | lulu2184/11785-vqa | /preprocessing/create_dict.py | UTF-8 | 1,701 | 2.84375 | 3 | [] | no_license | import json
import os
import numpy as np
from word_dictionary import WordDict
EMBEDDING_DIMENSION = 300
def create_dict(data_dir):
word_dict = WordDict()
questions = []
files = [
'v2_OpenEnded_mscoco_train2014_questions.json',
'v2_OpenEnded_mscoco_val2014_questions.json',
'v2_Ope... | true |
88d9a91bd715e76aa203dc13fb5274915693ff72 | Python | luisdrita/RoadSafety | /imagery_dataset/select_lsoa.py | UTF-8 | 547 | 2.515625 | 3 | [] | no_license | from shutil import copyfile
import os
right_files = []
all_files = []
with open('../imagery_dataset/one_img_per_lsoa.txt') as fp:
line = fp.readline()
while line:
line = fp.readline()
right_files.append((line.split("\n")[0]).split(".")[0])
for root, dirs, files in os.walk("yolofinal"):
fo... | true |
40ec400388074a74a034eaebba1ab841850e62a4 | Python | peeyush1999/p3 | /Python Tutorial Sheet/Recursion tutorial sheet/recursion_12.py | UTF-8 | 327 | 3.328125 | 3 | [] | no_license | def sumArray(mylist,msum=0,count=0):
if(count==len(mylist)):
return msum
msum = msum + mylist[count]
return sumArray(mylist,msum,count+1)
num = int(input())
inputs = input().split(' ')
for i in range(num):
inputs[i] = int(inputs[i])
print(sumArray(inp... | true |
a53d6565df9b35b1ce05d38283dc147ec01bd485 | Python | gyoforit/server-with-algorithm | /movies/views.py | UTF-8 | 2,119 | 2.53125 | 3 | [] | no_license | from django.shortcuts import render, redirect, get_object_or_404
from django.views.decorators.http import require_GET, require_POST, require_http_methods
from .models import Movie
from datetime import datetime
from django.contrib.auth.decorators import login_required
from django.http import JsonResponse
from random imp... | true |
f11bf35fd6e7bab60dfafbd0ac89d76ab4d7ba7e | Python | Jiezhi/myleetcode | /src/2279-MaximumBagsWithFullCapacityOfRocks.py | UTF-8 | 1,254 | 3.3125 | 3 | [
"MIT"
] | permissive | #!/usr/bin/env python
"""
CREATED AT: 2022/5/23
Des:
https://leetcode.com/problems/maximum-bags-with-full-capacity-of-rocks/
GITHUB: https://github.com/Jiezhi/myleetcode
Difficulty: Medium
Tag:
See:
"""
from typing import List
class Solution:
def maximumBags(self, capacity: List[int], rocks: List[int], addi... | true |
5725d09b5683256d4626a639cc9f0aaccb062fd0 | Python | drudox/ODE-FORTRAN90 | /plot/eq1_1.py | UTF-8 | 2,442 | 2.609375 | 3 | [] | no_license | #!/usr/bin/env python
'''
comments..
'''
import numpy as np
import matplotlib.pyplot as plt
from matplotlib.ticker import MultipleLocator, FormatStrFormatter
#-----------------------------------------------------------------------------------------------------
#------------------------------------------... | true |
0db07d9872eb3d1406811e6d90962e55f90994d6 | Python | wangzhon150/Personal-RPG | /progress.py | UTF-8 | 13,825 | 2.671875 | 3 | [] | no_license | import pygame
import cal
import log
import json
from datetime import date
from typing import Dict
from math import floor
PROGRESS_BG_COLOUR = (68, 53, 46)
PROGRESS_TITLE_COLOUR = (255, 255, 255)
SUBTITLE_COLOUR = (255, 255, 255)
LINE_COLOUR = (255, 255, 255)
BUTTON_COLOUR = (76, 74, 73)
ICON_TEXT_COLOUR = (255, 255, 2... | true |
6b2bc76ab6f039e99c7e725ed46a2769fba68723 | Python | jimmy74185/CS453 | /TCP_client.py | UTF-8 | 1,588 | 3.203125 | 3 | [] | no_license | import sys
from socket import *
import time
def main():
string = sys.argv[1]
ip = sys.argv[2] # Received input from command
port = int(sys.argv[3]) # Turn the string into int for port number
cID = sys.argv[4]
cSocket = socket(AF_INET, SOCK_STREAM) #Making socket interface
... | true |
26abbd01c5a9f907e8c7eab9fe12d1b6df882c32 | Python | dagrala/vibida | /Python_Scripts/appendIndicators.py | UTF-8 | 2,015 | 3.234375 | 3 | [] | no_license | # -*- coding: utf-8 -*-
import csv, sys
label_ratios = {
1: "Déficit/Superávit per cápita",
2: "Ahorro neto per cápita",
3: "Ahorro bruto per cápita",
4: "Elasticidad presupuestaria",
5: "Gasto público por habitante",
6: "Gasto de inversión per cápita",
7: "Gasto de inversión directa per cápita",
8: "Presion f... | true |
a2f54da97403cea11685c6d0cb4e1d636a33aa84 | Python | vijayendra-g/deeplearning-timeseries | /lstm_model.py | UTF-8 | 2,122 | 2.765625 | 3 | [] | no_license | from keras.models import Sequential
from keras.layers import Dense, LSTM, GRU, Dropout
import numpy as np
class LSTM_RNN:
def __init__(self, look_back, dropout_probability = 0.2, init ='he_uniform', loss='mse', optimizer='rmsprop'):
self.rnn = Sequential()
self.look_back = look_back
self.... | true |
7c97323e6c64a073d556171ec52a4d6901a95bb4 | Python | laurens777/Advent-of-Code-2020 | /day7/part2.py | UTF-8 | 761 | 3.46875 | 3 | [] | no_license | import re
def main():
bags = {}
with open("input.txt") as input:
for line in input:
line = line.strip("\n")
try:
outer = re.search('([a-z]+ [a-z]+) bags contain', line)
inner = re.findall('([1-9] [a-z]+ [a-z]+) bag', line)
except Attri... | true |
540a09878b0135dd4d1155cca1d7dda7bffe2f2c | Python | Anonymous-2611/AdaRec | /models/nas/modules/finetune.py | UTF-8 | 3,025 | 2.59375 | 3 | [] | no_license | import numpy as np
import torch
from torch import nn
from torch.nn import functional as F
from models.bert.embedding.bert import BertEmbedding
from .operators import OPERATOR_CLS, OPERATOR_NAME
class FinetuneEdge(nn.Module):
def __init__(self, num_hidden, alpha):
super(FinetuneEdge, self).__init__()
... | true |
a8c4c98abcacf3f68c6940b8ee3cb225e602ef5a | Python | chucklapress/email_bouncer_dot_fun_domain | /import_data.py | UTF-8 | 1,144 | 2.546875 | 3 | [
"MIT"
] | permissive | #!/usr/bin/env python3
import csv
import psycopg2
import time
import shutil
with open('/home/chucklapress/spam_table/test.csv') as in_file:
with open('/home/chucklapress/spam_table/new_data.csv', 'w') as out_file:
writer = csv.writer(out_file)
for row in csv.reader(in_file):
if any (row... | true |
7789dc72074b9867e35fad468d32ad1eade5ccea | Python | FirebirdSQL/firebird-qa | /tests/bugs/core_5783_test.py | UTF-8 | 1,674 | 2.515625 | 3 | [
"MIT"
] | permissive | #coding:utf-8
"""
ID: issue-6046
ISSUE: 6046
TITLE: execute statement ignores the text of the SQL-query after a comment of the form "-"
DESCRIPTION:
We concatenate query from several elements and use <CR> delimiter only to split this query into lines.
Also, we put single-line comment in SE... | true |
dfccae829d13ee7b354a8e5e3d1b219b1b748a43 | Python | yurireeis/luxoft-python-api | /models/book.py | UTF-8 | 315 | 2.625 | 3 | [] | no_license | class Book():
def __init__(self, _id, data):
info=data.get('volumeInfo')
self.id=_id
self.title=info.get('title')
self.authors=info.get('authors')
self.type='book'
def json(self):
return dict(id=self.id,title=self.title,authors=self.authors,type=self.type)
| true |
36bf1e0a879cb37d5fb5f7e63a23fcbb5b6b2826 | Python | perfectblack999/twitterBigData | /sentiment_weighting.py | UTF-8 | 1,640 | 2.78125 | 3 | [] | no_license | __author__ = 'perfectblack999'
import sqlite3 as sql
connection = sql.connect('/Users/perfectblack999/Documents/Developer/Nkem_Big_Data_Projects/tweets.sqlite')
connection.text_factory = str
weighted_data = []
data_maxes = []
normalized_data_list = []
# Get the twitter data
with connection:
cursor = connection.c... | true |
cce4c1fb0a1539c3b1b485372d22736223b434fd | Python | jtwhite79/my_python_junk | /gather/gathered/rename_array_mp.py | UTF-8 | 1,615 | 2.859375 | 3 | [
"BSD-2-Clause",
"BSD-Advertising-Acknowledgement"
] | permissive | import sys
import os
import multiprocessing as mp
from Queue import Queue
import shutil
def worker(jobq,pid):
'''
args[0] = in file name
args[1] = out file name
'''
while True:
#--get some args from the queue
args = jobq.get()
#--check if this is a sentenial
if... | true |
cff5aba77c5b496089d370f676942eae70a630bf | Python | claireyuan/project-euler-solutions | /12.py | UTF-8 | 951 | 4.25 | 4 | [] | no_license | """
Project Euler
Problem 12: Highly divisible triangular number
Answer: 76576500
"""
import math
def triangularNumberGenerator():
"""
Generator that generates triangle numbers.
"""
i = 1
num = 0
while True:
num += i
i += 1
yield num
def numDivisors(num):
"""
Returns the number of divisors of num.
"""... | true |
51200d48b54418e1bd75cbdfae4e5f80db3c3f50 | Python | gsjkirby/python.core_resources | /machine_learning/Part 1 - Data Preprocessing/data_preprocessing.py | UTF-8 | 2,132 | 3.53125 | 4 | [] | no_license | # Data Preprocessing Template
# Import the libraries
import numpy as np
import matplotlib.pyplot as plt
import pandas as pd
from sklearn.preprocessing import Imputer, LabelEncoder, OneHotEncoder, StandardScaler
from sklearn.model_selection import train_test_split
# Import the dataset
dataset = pd.read_csv('Data.csv')... | true |
39ef72ef129d176cc2a4ead3c8d51f3f0975995f | Python | Christhomas17/Euler-Coding-Problems | /5 - done.py | UTF-8 | 2,391 | 3.640625 | 4 | [] | no_license | '''
2520 is the smallest number that can be divided by each of the numbers from 1 to 10 without any remainder.
What is the smallest positive number that is evenly divisible by all of the numbers from 1 to 20?
'''
### this is a solution for a smaller number but it takes too long for a larger so we need to optimiz... | true |
6d8aea272c2432bb8e807d91eb4b64d7a3a654b7 | Python | Evergreen1992/machine_learning | /svd/svd.py | UTF-8 | 2,133 | 2.9375 | 3 | [] | no_license | #encoding=utf-8
from numpy import *
from numpy import linalg as la
print ".......SVD奇异值分解,进行数据降维处理........."
def loadExData():#用户评分数据
return mat([
[4,4,0,2,2],
[4,0,0,3,3],
[4,0,0,1,1],
[1,1,1,2,0],
[2,2,2,0,0],
[1,1,1,0,0],
... | true |
f7afb48151f63d5e9c0ea37b342b2a0e94333ce9 | Python | saraswathykrk/Udacity_ML | /evaluation/evaluate_poi_identifier.py | UTF-8 | 2,013 | 3.390625 | 3 | [] | no_license | #!/usr/bin/python
"""
Starter code for the evaluation mini-project.
Start by copying your trained/tested POI identifier from
that which you built in the validation mini-project.
This is the second step toward building your POI identifier!
Start by loading/formatting the data...
"""
import pickl... | true |
8ed7e117dfd2899f76a8f95559998a5c733f18b3 | Python | d-realm/python-2 | /testdrive.py | UTF-8 | 891 | 3.328125 | 3 | [] | no_license | #!/usr/bin/python3
from time import sleep
from ev3dev.ev3 import *
# Will need to check EV3 button state
btn = Button()
# Connect motors
rightMotor = LargeMotor(OUTPUT_A)
assert rightMotor.connected, "Error: Right motor not connected"
leftMotor = LargeMotor(OUTPUT_D)
assert leftMotor.connected, "Error: Left motor ... | true |
0d50486490360d16766e750f3f05cf07c1cbef3c | Python | AllanOliveiraM/django-graphql-playground | /tests/integration/apps/core/test_models.py | UTF-8 | 1,749 | 2.53125 | 3 | [] | no_license | import pytest
from django.db import IntegrityError
from django_graphql_playground.apps.core.models import Category
from django_graphql_playground.apps.core.models import Ingredient
@pytest.mark.django_db
def test_should_create_category():
fake_category_name = "fake_name_category"
Category.objects.create(name... | true |
b400e786b9ea8c6f085a0c772b47b43d1738e951 | Python | vmred/Coursera | /coursera/python-basic-programming/week5/hw28.py | UTF-8 | 1,119 | 3.734375 | 4 | [] | no_license | # Петя перешёл в другую школу.
# На уроке физкультуры ему понадобилось определить своё место в строю.Помогите ему это сделать.
# Формат ввода
# Программа получает на вход невозрастающую последовательность натуральных чисел,
# означающих рост каждого человека в строю.
# После этого вводится число X – рост Пети.
# Все ... | true |
e8187b3a62bc87d3d975a81164e8eaa779fedcee | Python | dr-dos-ok/Code_Jam_Webscraper | /solutions_python/Problem_155/2313.py | UTF-8 | 452 | 3.375 | 3 | [] | no_license | def standing_ovation(audience):
tot = 0
req = 0
for s, n in enumerate(audience):
if tot >= s:
tot += n
else:
req += s - tot
tot += n + s - tot
return req
if __name__ == '__main__':
cases = int(input())
for c in range(cases):
line = inp... | true |
22b422af45d643314e75d99b45a59b7a56301f8b | Python | avinash-512/YDV | /extract_senses.py | UTF-8 | 976 | 2.890625 | 3 | [] | no_license | from nltk.corpus import wordnet as wn
import operator
import nltk
def words(text):
token = nltk.word_tokenize(text)
tagged = nltk.pos_tag(token)
need_tag = ["NN","JJ","NMP"]
filtered_tag = [item for item in tagged if item[1] in need_tag]
wordset = set()
for x in filtered_tag:
wordset.ad... | true |
9f4f12a98357a312098ead394c6ed7c681dbc82b | Python | antwan2000arp/pyppet | /pyppet/wnck-helper.py | UTF-8 | 1,765 | 2.53125 | 3 | [
"BSD-3-Clause"
] | permissive | #!/usr/bin/python
# apt-get install python-wnck
# apt-get install gnome-python-extras
# can not be run in the the same process with gtk3 #
import os, sys, time
try:
import wnck
except ImportError:
print('ERROR: wnck not installed - Ubuntu users can: "sudo apt-get install python-wnck"')
sys.exit()
NAME = 'Blender'
u... | true |
11b0b1ed840da20b3b39748aea740874673cb658 | Python | willdickson/virtual_desert | /nodes/rolling_circular_mean.py | UTF-8 | 653 | 3.359375 | 3 | [
"MIT"
] | permissive | import numpy as np
class RollingCircularMean(object):
def __init__(self, size=800):
self.size = size
self.data = []
def insert_data(self,item):
self.data.append(np.deg2rad(item))
if len(self.data) > self.size:
self.data.pop(0)
def value(self):
if self.... | true |
53f0ffafb2eb279387c1553fa65d5c6eca5faf45 | Python | sfpiano/gdbpy | /gui.py | UTF-8 | 3,113 | 2.828125 | 3 | [] | no_license | import gtk
import gdb
import os
OK_CODE = 1
CANCEL_CODE = 2
def end_match(completion, entrystr, iter, data):
modelstr = completion.get_model()[iter][0]
return entrystr in modelstr
class MyWindow(gtk.Window):
def init(self, g):
self.g = g
def on_button_clicked(self, widget):
print "Hell... | true |
91202843e341ef9203d48d762a4bcb65b0cec946 | Python | reidhowdy/solar-system-api | /tests/test_routes.py | UTF-8 | 1,738 | 2.921875 | 3 | [] | no_license | def test_get_all_planets_with_no_records(client):
response = client.get("/planets")
response_body = response.get_json()
assert response.status_code == 200
assert response_body == []
def test_get_one_book(client, three_saved_planets):
response = client.get("/planets/1")
response_body = response... | true |
b90bf802a36f3f1609c7a2068846f7fdd252e2cb | Python | yl812708519/tornado_test_web | /test/common/test_comm.py | UTF-8 | 268 | 2.75 | 3 | [] | no_license | from sqlalchemy.sql import expression
__author__ = 'wangshubin'
a = [1, 2, 3]
b = [4, 5, 6]
c = a+b
# print(c)
class A(object):
a = 1
b = 2
arr = (A.a == "a", A.b == 1, "c" >= "a")
for cri in list(arr):
e = expression._literal_as_text(cri)
print e
| true |
d4582fd71a1c67bdf39fe77a655e694073213933 | Python | thailh12/wier-backend | /cache_utils.py | UTF-8 | 1,034 | 2.59375 | 3 | [] | no_license | import os.path
import pickle as pkl
import requests
import shutil
def get_response(url, enable_dump=False):
global saved_data
if 'res_dict' not in saved_data:
saved_data['res_dict'] = {}
res_dict = saved_data['res_dict']
if url in res_dict:
response = res_dict[url]
else:... | true |
c9dfa4327aaa2af2e49b567c0bc01a3b72de56ff | Python | Fiquee/algo-lab | /Lab1/l1q11.py | UTF-8 | 144 | 3.25 | 3 | [] | no_license | def newList(a):
c = []
c.append(a[0])
c.append(a[len(a)-1])
return c
a = [5, 10, 15, 20, 25]
list_ = newList(a)
print(list_)
| true |
07a8fc8fd7e5c5d96fb1b5d48f8243ad5d863133 | Python | sindusistla/Algorithms-and-Datastructures | /OperatingSystem_Assignment02/Trans_three_pairs.py | UTF-8 | 2,585 | 3.21875 | 3 | [] | no_license | import threading
import time
import pymongo;
class myThread (threading.Thread):
def __init__(self, threadID, TransactionList,Pairs):
threading.Thread.__init__(self)
self.threadID = threadID
self.Pairs=Pairs
self.TransactionList=TransactionList
def run(self):
#print("Starting ", sel... | true |
c9132b759715f0b780d529a339c30b933909a47f | Python | jvpereirarocha/fastapi-fundamentals | /app/schemas.py | UTF-8 | 1,962 | 2.625 | 3 | [] | no_license | from typing import List, Optional, Set
from pydantic import BaseModel, Field, HttpUrl, EmailStr
class Image(BaseModel):
url: HttpUrl
name: str
class Item(BaseModel):
name: str
description: Optional[str] = None
price: float
tax: Optional[float] = None
comments: Optional[List[str]] = []
... | true |
e1b979bbe2fb68ed5fc9f0b99aaadc7354f65136 | Python | Simoniezi/Practice-Python | /Exercise 7.py | UTF-8 | 175 | 3.765625 | 4 | [] | no_license | # Exercise 7
# List Comprehensions
a = [1, 4, 9, 16, 25, 36, 49, 64, 81, 100]
b = [x for x in a if x % 2 == 0]
print(b)
# Made by Simoniezi
# Discord: Simoniezi#7138 | true |
987c890221ebfd5d8f9a970abf3fb21754af90c4 | Python | reshma57/textReader | /login.py | UTF-8 | 1,036 | 2.65625 | 3 | [
"MIT"
] | permissive | import os
from passlib.apache import HtpasswdFile
import json
# function for adding User
def add_user(username,password):
cwd = os.path.abspath(__file__)[:-8]
if os.path.exists(cwd+".htpasswd") == False:
ht = HtpasswdFile(cwd+".htpasswd", new=True)
result = ht.set_password(username, password)
... | true |
a2a5c6501f9fc10c44bdc831fd41eb861bd66ac2 | Python | aanavas/s2project | /lexlearner/src/convert_dictionary_format.py | UTF-8 | 2,132 | 2.921875 | 3 | [] | no_license | # convert_dictionary_format.py
# ============================
# 0.01.001 10-Sep-2007 jmk Created to convert festival to janus dict formats.
# ---------------------------- ... | true |
29bf72973651981327655643de162e615e737af1 | Python | organizejs/brandnewroman | /app/brandnewroman/mailchimp.py | UTF-8 | 1,270 | 2.75 | 3 | [] | no_license | import requests
from mailchimp3 import MailChimp
from urllib3.exceptions import HTTPError
class MailchimpException(Exception):
pass
class MailchimpClient():
client = None
list_id = None
def set_credentials(self, username: str, key: str):
self.client = MailChimp(key, username)
def set_list_id(self, list_id: s... | true |
035abe7eb18f4ba665c5ab1a9a7e9603d681c5b9 | Python | hasnatosman/class_object | /class_object.py | UTF-8 | 1,088 | 3.625 | 4 | [] | no_license | import turtle
tom = turtle.Turtle()
tom.speed(50)
def draw_circle():
tom.left(90)
counter = 0
while counter < 72:
tom.color("red")
tom.circle(140)
draw_circle()
tom.right(5)
counter += 1
counter = 0
while counter < 72:
tom.color("black")
tom.circle(120)
dr... | true |
8a2495f191eb59d986d8261cd70165a0670d34a6 | Python | inprogress/vertebrale | /vertebrale/importer.py | UTF-8 | 1,448 | 2.859375 | 3 | [
"MIT"
] | permissive | import csv
from vertebrale.database import db_session
from vertebrale.models import Category, CategoryTranslation, LanguageCode
def startImport():
with open('data/GenericFoods.csv', newline='') as csvfile:
reader = csv.reader(csvfile)
rows = list(reader)
row = rows[0]
row2index = d... | true |
eed00d3a49fbce9284e870cf51dcd404dd2d89d0 | Python | myton/head_first_python | /ch06/process_data.py | UTF-8 | 706 | 2.984375 | 3 | [] | no_license | def sanitize (time_string):
if '-' in time_string:
splitter = '-'
elif ':' in time_string:
splitter = ':'
else:
return time_string
(mins, secs) = time_string.split(splitter)
return (mins + '.' +secs)
def pross_data(file_name):
try:
with open(file_name, 'r') as data:
_data = (data.read... | true |
63f0d329f975ed6aa7f3b91a4a692c079866b8c5 | Python | GopiKarthi/Hackathon5 | /hackathon5/ApiHandler/views.py | UTF-8 | 2,728 | 2.65625 | 3 | [] | no_license | # Create your views here.
import json
from datetime import datetime as dt
from django.http import HttpResponse
import random
from util.util import dbconnect, randomDate
import pickle
from util.util import *
from hackathon5 import *
import simplejson
import sys
sys.path.append("/host/DataHack/")
def AppRateReal(request... | true |
4530eccbd1b0a1eba33c6bf18eeb096d61592030 | Python | yacoubismus/python | /python-course/homework/seventh/Determinant_matrix.py | UTF-8 | 916 | 3.375 | 3 | [] | no_license | import numpy as np
from copy import copy, deepcopy
det = 0
def matrix_scalar_mul(a, c):
m = len(a) # number of rows of A
n = len(a[0]) # number of cols of A
return [[c * a[i][j] for j in range(n)] for i in range(m)]
def determinant_matrix(m):
global det
for x in list(range(len(m))):
... | true |
f02bbd33823eb2158615a6fee4a43c182ef8969e | Python | neilb14/cryptotracker | /summary.py | UTF-8 | 1,064 | 2.6875 | 3 | [] | no_license | import sys, argparse
import urllib.request
from cryptotracker import row, summary, summary_writer
from cryptotracker.datastore import Datastore
from cryptotracker.price_service import PriceService
def main(args):
parser = argparse.ArgumentParser(description='Summary - prints a summary of your portfolio')
pars... | true |
47ee317a96b6a3b387549e77953433bbde435f58 | Python | NviCoder/machine_learning_ramzor | /ramzor.py | UTF-8 | 3,287 | 2.609375 | 3 | [] | no_license | import pandas as pd
import numpy as np
import math
def get_rank(N, P, G):
k, m = 2.0, 8.0
if (pd.isna(N) or pd.isna(G)):
NGG=1
elif (N==0 or G==0):
NGG=1
elif (math.isinf(N) or math.isinf(G)):
NGG = math.exp(1)
else:
NGG = N*G*G
P = 0 if pd.isna(P) else min(P,1.... | true |
419150efa7b0a55b13963e417853b773f33f9b48 | Python | DanielDynamics/AddressBook | /AddressBook.py | UTF-8 | 1,159 | 3.6875 | 4 | [] | no_license | dict1 = {'Daniel':'1000', 'Lucy':'1001', 'Haha':'1002'}
while 1:
print('-Welcome to book program-\n'+'-1:Find contact number-\n'+'-2:Add new contact-\n'+'-3:Delete contact-\n'+'-4:Edit Contact-\n'+'-5:Exit')
n = int(input("Enter the instruction:"))
if n==1:
name = input("Enter contact name:")
... | true |
d1ffc011daf5da403f8f25d2458315735a8ef92c | Python | Priyojeet/man_at_work | /se2tsk1es1.2.py | UTF-8 | 566 | 3.828125 | 4 | [] | no_license | def myfilter(func, arg):
l = []
for i in arg:
if func(i):
l.append(i)
return l
def isprime(arg):
prime = True
if(arg>1):
for i in range(2, arg):
if(arg%i == 0):
prime = False
if(prime==True):
return True
... | true |
ad1b132535929d3b1a9bc23741a66e87aebbd415 | Python | awant/arae | /models/kenlm_model.py | UTF-8 | 2,046 | 2.59375 | 3 | [] | no_license | import os
import math
import subprocess
import kenlm
from tempfile import TemporaryDirectory
from utils import dump_lines
from batchifier import Batchifier
class KenlmModel(object):
LMPLZ_PATH = '/usr/local/bin/lmplz'
def __init__(self, model):
self.model_path = None
if isinstance(model, str)... | true |
70bbbbf3d6a357881d56c3fbed7bd5cad1c5b2b1 | Python | JMakkonen/Pattern_Discovery_Coursera | /P1026.py | UTF-8 | 3,494 | 3.5625 | 4 | [] | no_license | # P1026. For Pattern Recognition course.
'''
This file contains some functions created for the Pattern
Discovery course on Coursera.
create_dataset(n_tid,n_item,max_item,i_names)
- creates datasets. The names part is only patrially implemented.
save_dataset(data_dict,filename)
- saves a dataset to file.
read_dataset(... | true |
a4a29938ec613dd5b35100fa1e80071bd08e9448 | Python | danmarkfyn/ubicom | /positioning/project2.py | UTF-8 | 4,343 | 3.078125 | 3 | [] | no_license | import math
import os
import csv
import pprint
import pickle
from math import sqrt,pow
################################
# FUNCTIONS TO MAKE DATASET
################################
#Points shape:
#{"x":xval,"y":yval,"d":distance}
def weightedAverage(points):
weightedValueX = 0
weightedValueY = 0
totalWeights = 0
... | true |
2ce0f5c70f3b59716e838ae230b96afdc5983733 | Python | scottstamp/jenni | /modules/stocks.py | UTF-8 | 2,027 | 2.5625 | 3 | [
"EFL-2.0"
] | permissive | #!/usr/bin/env python
"""
stocks.py - jenni Stocks Ticker Module
Copyright 2015, Scott Stamp <scott@hypermine.com>
Licensed under IDGAF
More info:
* jenni: https://github.com/myano/jenni/
* Phenny: http://inamidst.com/phenny/
"""
import json
import urllib
import web
def stocks(jenni, input):
txt = input.group(2)
... | true |
d20311e258c735b77b64344b37671ed15a323d02 | Python | parwell/Scripts | /checkIP.py | UTF-8 | 789 | 3 | 3 | [] | no_license | import urllib.request
import re
import sys
def retrieveIP():
url = "http://checkip.dyndns.org"
query = urllib.request.urlopen(url).read()
return str(query)
def parseIP(query):
ipNumberPattern = "(25[0-4]|2[0-4][0-9]|[01]?[0-9][0-9]?)"
ipRE = "{0}.{1}.{2}.{3}".format(ipNumberPattern,
... | true |
a491ddd9b2f92fe18435f1062e031727b9b4219b | Python | zhuNanyang/deeplearning | /RNN.py | UTF-8 | 5,109 | 2.765625 | 3 | [] | no_license | import copy,numpy as np
import datetime as dt
import numpy as np
import tensorflow as tf
import matplotlib.pyplot as plt
from tensorflow.examples.tutorials.mnist import input_data
mnist=input_data.read_data_sets('F:/pythonNotebook/data/',one_hot=True)
trainimg=mnist.train.images
trainlabel=mnist.train.labels
testimg=mn... | true |
77b3a5382e1421bb769484d557af5f46395f0a39 | Python | edwardkw/seegridtest | /deck.py | UTF-8 | 1,813 | 3.890625 | 4 | [] | no_license | # Edward Kwiatkowski, 10/31/2020, for Seegrid Interview
import random
class Card:
def __init__(self, suit, value):
self.__suit = suit
self.__value = value
def __repr__(self):
return self.__value + ' of ' + self.__suit
class Deck:
# defaults to standard deck, can be used for 'special' cards/decks
... | true |
8fb386044c9a62f69d5226698a9ebc3baa4b2873 | Python | Ebuyuktas/8.hafta_odevler-Fonksiyonlar | /ebob.py | UTF-8 | 328 | 3.734375 | 4 | [] | no_license | #odev 4#
#ebob bulma#
print("""İki sayi giriniz
Ebobunu size verelim\n""")
def ebob():
sayi1=int(input("1.sayi: "))
sayi2=int(input("2.sayi: "))
list=[]
for i in range(1,sayi2+1):
if sayi1%i==0 and sayi2%i==0:
list.append(i)
a=max(list)
return a
prin... | true |
51944f0a4e748c61cd23618c698254298ea4dc76 | Python | essamhamedgaafar/sudoku_with_python | /check_if_get_solution_and_solve.py | UTF-8 | 8,122 | 2.6875 | 3 | [] | no_license | import math
import sys
def is_solved(l):
for x, i in enumerate(l):
for y, j in enumerate(i):
if j == 0:
# Incomplete
return None
for p in range(9):
if p != x and j == l[p][y]:
# Error
... | true |
e1a81b2e7ef31f0fba0c8b044ccf2a7e3d67dd69 | Python | luispedro/mahotas | /mahotas/internal.py | UTF-8 | 5,849 | 3.140625 | 3 | [
"MIT",
"BSL-1.0"
] | permissive | # Copyright (C) 2011-2019, Luis Pedro Coelho <luis@luispedro.org>
# vim: set ts=4 sts=4 sw=4 expandtab smartindent:
#
# License: MIT (see COPYING file)
import numpy as np
def _get_output(array, out, fname, dtype=None, output=None):
'''
output = _get_output(array, out, fname, dtype=None, output=None)
Imple... | true |
9f3f1667188277930ab4f511525b40ea6430a30e | Python | Nahid320/Vehicle-Tracking | /method1.py | UTF-8 | 1,776 | 3.34375 | 3 | [] | no_license | # OpenCV Python program to detect cars in video frame
# import libraries of python OpenCV
import cv2
import time
import numpy as np
# capture frames from a video and count the number of frames
cap = cv2.VideoCapture('object detection.mp4')
frame_count = int(cap.get(cv2.CAP_PROP_FRAME_COUNT))
# load XML ... | true |
2d35cb49e0abaf6a6a1f230c5476c2ab0f5f3587 | Python | haizhiship/PythonLearn | /Lesson/LanguageLesson/Lesson7ClassorPPAttachment.py | UTF-8 | 1,847 | 3.21875 | 3 | [] | no_license | #!/usr/bin/env python
# -*-coding:utf-8 -*-
'''
9. PP附件语料库是描述介词短语附着决策的语料库。
语料库中的每个实例被编码为
PP Attachment对象:
使用此子语料库,建立一个分类器,尝试预测哪些介词是用来连接一对给定的名词。
例如:给定的名词对team 和 researchers,分类器应该预测出介词 of。
更多的使用 PP 附件语料库的信息,参阅http://www.nltk.org/howto 上的语料库HOWTO。
'''
from nltk.corpus import ppattach
import nltk
ppattach.attachments('tra... | true |
6ebf86c49ccbdde81f018bff5ca5a37654769a24 | Python | dparret/strava-cli | /strava/commands/zones_power.py | UTF-8 | 1,135 | 2.734375 | 3 | [
"MIT"
] | permissive | import math
import click
from strava.decorators import format_result
_ZONES_COLUMNS = (
'zone',
'power'
)
@click.command(name='power',
help='Generate power zones and FTP according to the 20 minutes averaged value provided.')
@click.argument('power', required=True, type=int, nargs=1)
@format_re... | true |
650671399dd262d2571241a576c4726b79ddd762 | Python | eltonfernando/trainUnet | /analise_mask.py | UTF-8 | 372 | 2.578125 | 3 | [] | no_license | import cv2
import numpy as np
import os
local="./data/mask"
list_data=os.listdir(local)
soma_mask=0
for nome in list_data:
img=cv2.imread((local+'/'+nome))
soma_mask+=np.sum(img/255)
cv2.imshow("mask",img)
cv2.waitKey(1)
total_px=len(list_data)*480*848
print("total px: ",total_px)
print("total mask: ",... | true |