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 |
|---|---|---|---|---|---|---|---|---|---|---|
1c2bf3c0eb11a2e4772b6ed42e966ce3f5d3d18b | dvopsway/engine-python | /prelert/engineApiClient/EngineApiClient.py | UTF-8 | 26,698 | 2.921875 | 3 | [
"Apache-2.0"
] | permissive | ############################################################################
# #
# Copyright 2015 Prelert Ltd #
# #
# Licensed u... | true |
3e5c2c4ceaff3f857013216dade9d725caa0ca88 | feelwing1314/mybs | /taobaomm.py | UTF-8 | 2,003 | 2.953125 | 3 | [] | no_license | # -*- coding:UTF-8 -*-
########################
#
# Created on 2015-05-02
# @author: zhenfei.wang
# 通过URL地址:http://mm.taobao.com/json/request_top_list.htm?page=1 抓取淘宝平面模特的基本资料
########################
import urllib2
import re
import tool
class Taobao:
def __init__(self):
self.url = "http://mm.taobao.com/... | true |
d50d3120dc8268081227e59f48d35f1a83bda4ae | priyanshurohilla2004/telegram_file_manager_bot | /bot.py | UTF-8 | 16,957 | 2.84375 | 3 | [
"MIT"
] | permissive | import json
from telegram import Update, ParseMode, InlineKeyboardMarkup, InlineKeyboardButton, Bot
import telegram
from telegram.ext import Updater, CommandHandler, MessageHandler, Filters, CallbackContext, CallbackQueryHandler
import sqlite3
import re
# Initialize root directory
data = {}
MAIN_DIR_NAME = 'root' #
... | true |
f6c81a2d78f102424a6b323ffaf6ec91ec6821b1 | AnderGil/TFG_Diccionarios_Inversos | /Scripts/Primer prototipo (Mask-Filling)/dataset.py | UTF-8 | 2,480 | 2.828125 | 3 | [] | no_license | import torch
from torch.utils.data import IterableDataset
from functools import partial
from torch.utils.data import DataLoader
first_batch = True
def blocks(files, size=65536):
while True:
b = files.read(size)
if not b:
break
yield b
def count_lines(input_path: str) -> int:... | true |
3e8df859bd21c9ac829e9b7162ea17411c662e48 | Ctiely/reinforcement_learning | /utils/lr_decay.py | UTF-8 | 1,595 | 3.15625 | 3 | [] | no_license | # https://github.com/Ctiely/A2C/blob/master/utils/lr_decay.py
# https://github.com/openai/baselines/blob/master/baselines/a2c/utils.py
def constant(p):
return 1
def linear(p):
return 1 - p
def middle_drop(p):
eps = 0.75
if 1 - p < eps:
return eps * 0.1
return 1 - p
def double_linear_... | true |
3c0aaaf81e738d1d70bca7a52b67b033da89781e | Khristofor11/algorithms | /task3.3.py | UTF-8 | 327 | 3.296875 | 3 | [] | no_license | from random import random
N = 10
a = [0] * N
for i in range(N):
a[i] = int(random() * 100)
print(a[i], end=' ')
print()
mn = min(a)
mx = max(a)
imn = a.index(mn)
imx = a.index(mx)
print(f'a{[imn + 1]} = {mn}, a{[imx + 1]} = {mx} ')
a[imn], a[imx] = a[imx], a[imn]
for i in range(10):
print(a[i], end=' ')
p... | true |
302aae3459d256a3b54a79f91bc0e675848e88a4 | pebble8888/ecpython | /fp.py | UTF-8 | 304 | 3.453125 | 3 | [] | no_license | #!/usr/bin/env python
ps = [2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53]
for p in ps:
print("p {0}".format(p))
print("(p-1)%3 {0}".format((p-1) % 3))
l = []
for x in range(1, p):
a = (x**3) % p
l.append(a)
print(l)
print(sorted(l))
print("")
| true |
c75f5a16bc2f7a202bd89b55dad70cbe00096711 | mgrau/rico | /engine/plantations.py | UTF-8 | 897 | 2.859375 | 3 | [] | no_license | class Plantation:
def __init__(self, colonists=0, name=""):
self.colonists = colonists
self.name=name
def __repr__(self):
return self.name+"("+str(self.colonists)+")"
class Quarry(Plantation):
def __init__(self, colonists=0):
Plantation.__init__(self,colonists,"quarry")
cl... | true |
2e5e0cc1b6bb3ef15b6f12e5ce97b054aaaad65d | simonholmes001/graph-to-graph | /src/domain/message.py | UTF-8 | 417 | 2.75 | 3 | [
"MIT"
] | permissive | import numpy as np
class Message:
def __init__(self):
self.node_input = None
self.edge_input = None
self.neighbors_input = None
self.value = None
def compose(self):
self.value = np.transpose(self._relu(self.node_input + self.edge_input + self.neighbors_input))
@st... | true |
e16bc72ee00b2a12fc9f64fc9163211a07a8d4b1 | ttung/imgstore | /runner.py | UTF-8 | 1,691 | 2.546875 | 3 | [] | no_license | #!/usr/bin/env python2.7
from driver import *
import sys
def generate_output_fn(in_fn, remove=False):
if (remove == False):
return '%s.png' % (in_fn,)
assert(in_fn.lower().endswith('.png'))
return in_fn[:-4]
def opener(in_fn, write=False):
if (in_fn == '-'):
if (write):
... | true |
fc1f8694685114e9f7aebb11a7a0fdd93ea416da | bhyun/daily-algorithm | /2021/Programmers_쿼드압축 후 개수세기.py | UTF-8 | 782 | 2.75 | 3 | [] | no_license | def solution(arr):
def divide(start_x, start_y, length):
nonlocal zeros, ones
standard = arr[start_x][start_y]
for i in range(start_x, start_x + length):
for j in range(start_y, start_y + length):
if arr[i][j] != standard:
divide(start_x, start... | true |
de14313e50b5934b9bc4ca82f347055675531550 | simpleman383/surveillance-search-optimizer | /evaluation/surveillance.py | UTF-8 | 3,977 | 2.609375 | 3 | [] | no_license | import random
import math
import copy
from primitives.metrics.paths import find_paths, get_shortest_of_paths
from primitives.graph import Graph, GraphNode
from .utils import Logger
class SurveillanceError(Exception):
def __init__(self, message):
self.message = message
class SimpleSurveillanceNode(GraphNode):
... | true |
95b8681d0b91ba847e36dbf1f03950256bcbeab6 | justinclark-dev/CSC110 | /code/Chapter-2/simple_math.py | UTF-8 | 263 | 4.46875 | 4 | [
"MIT"
] | permissive | # Assign a value to the salary variable.
salary = 2500.0
# Assign a value to the bonus variable.
bonus = 1200.0
# Calculate the total pay by adding salary
# and bonus. Assign the result to pay.
pay = salary + bonus
# Display the pay.
print('Your pay is', pay)
| true |
c28c46ff69f3ae90b606af1cb55fe8198e6d22b2 | AuggieLife/Python-snippets | /get_mouse_pos/get_mouse_pos.py | UTF-8 | 367 | 2.875 | 3 | [] | no_license | from Xlib import display
from collections import namedtuple
def get_mouse_pos():
data = display.Display().screen().root.query_pointer()._data
Mouseposition = namedtuple('Mouseposition', ['x', 'y'])
mouseposition = Mouseposition(data["root_x"], data["root_y"])
return mouseposition
if __name__ == '__m... | true |
3e5ec7b224f7e32fc822b05893672d494ccb87d8 | ejspeiro/HackerRank | /all_domains/python/sets/set_mutations.py | UTF-8 | 732 | 2.78125 | 3 | [
"MIT"
] | permissive | if __name__ == "__main__":
numSamples = int(input())
samples = set(map(int, input().split()))
numQueries = int(input())
for query in range(numQueries):
command = list(input().split())
updatingSamples = set(map(int, input().split()))
if command[0] == "intersection_update":
... | true |
abb3c54a56ac3aa160078bd812f925c8a508fb94 | Purushotamprasai/Python | /python_8am/function/002_arti.py | UTF-8 | 318 | 3.25 | 3 | [] | no_license | #wap do all aritimetic function
def add():
a = input("enter a : ")
b = input("enter b : ")
print a," + ",b," = ",a+b
def sub():
a = input("enter a : ")
b = input("enter b : ")
print a," - ",b," = ",a-b
def main():
add()
sub()
if __name__ == "__main__":
main()
| true |
985e8997863ff6cbc1a0fa68eb23c2e5a97b15f4 | gen4438/vtk-python-stubs | /typings/vtkmodules/vtkCommonCore/vtkDebugLeaks.pyi | UTF-8 | 6,789 | 2.609375 | 3 | [
"BSD-3-Clause"
] | permissive | """
This type stub file was generated by pyright.
"""
from .vtkObject import vtkObject
class vtkDebugLeaks(vtkObject):
"""
vtkDebugLeaks - identify memory leaks at program termination
vtkDebugLeaks is used to report memory leaks at the exit of the
program.
Superclass: vtkObject
It us... | true |
b260fbb7d099ebc82db7b928fa735dcd0e3222e8 | marioharper182/ComputationalMethodsFinance | /Homework2/Homework2Main.py | UTF-8 | 1,662 | 3.03125 | 3 | [
"Apache-2.0"
] | permissive | __author__ = 'HarperMain'
import numpy as np
from numpy import random as rand
from scipy.stats import binom
from numpy import zeros
class EuropeanOption(object):
def __init__(self, strike, X, rate, volatility, T, n):
self.strike = strike
self.X = X
self.rate = rate
self.volatility... | true |
30bd73c094ba8928016557166402bb4f73c9d49a | pantaryl/adventofcode2019 | /src/day2.py | UTF-8 | 863 | 3.359375 | 3 | [] | no_license | from intcode import Intcode
with open("../input/day2.txt", 'r') as inputFile:
data = [int(x) for x in inputFile.read().split(",")]
def setInputs(program:list,
noun: int,
verb: int):
program[1] = noun
program[2] = verb
# Part 1
part1 = list(data)
setInputs(part1, 12, 2)
runner ... | true |
1fb68d3fa28159a912cbd2cec500c22119dd0445 | p1lare/smartAPI | /src/api/convertJson4ESindexing.py | UTF-8 | 7,377 | 2.984375 | 3 | [
"MIT"
] | permissive | import argparse
import requests
import os.path
import json
import time
from future.utils import iteritems
from collections import OrderedDict
# Confirm program arguments
def confirmArguments():
parser = argparse.ArgumentParser(description='Program to convert \
Json formatted file from Swagger editor for E... | true |
a850d3889d1ad756c34c00028d3aa4c532032cd6 | leoTiez/vanilla-RNN | /Assignment4-default.py | UTF-8 | 22,478 | 3.359375 | 3 | [] | no_license | import numpy as np
import matplotlib.pyplot as plt
def char_to_ind(char, book_chars):
"""
Function to convert a character to the corresponding index in the vector
:param char: Character
:param book_chars: Characters in the book
:return: index
"""
return np.where(book_chars == char)[0]
de... | true |
eb65b79a955c879663d9c6c90e5800f01c3621fb | pradeepshetty1/python-Pandas-and-Numpy- | /Module3/ex_7_1_math.py | UTF-8 | 109 | 2.6875 | 3 | [] | no_license | import math
print "Math Ceil",math.ceil(10.01)
print "Math Ceil",math.floor(10.01)
print "Math pi",math.pi
| true |
8bef25101dec6eed8fcec2156a1225fbeddd8a70 | Chetan-Goyal/Electric_Field_Calculator | /EF_of_dipole.py | UTF-8 | 7,371 | 3.125 | 3 | [
"MIT"
] | permissive | from mpmath import mp
from math import cos, radians
# * Initializing accuracy level and value of const_k
mp.dps = 100
const_k = mp.fmul(8.9875518, 10**9)
def dipole_moment(charge, a):
'''
Purpose: to calculate the value of dipole moment
Return: returns dipole moment calculated
'''
# Editing Value... | true |
79e253ecd82110877507e0a421bb30d4728dd1ed | omnz/Chess | /chess.py | UTF-8 | 6,212 | 3.140625 | 3 | [] | no_license | import pygame
import game
from pygame.constants import KEYDOWN, QUIT
from board import Board
from player import Player
from Pieces.empty import Empty
from Pieces.pawn import Pawn
# GAME
pygame.init()
pygame.display.set_caption('Chess')
icon = pygame.image.load('Sprites/king_black.png')
pygame.display.set_icon(icon)
SC... | true |
2b72a4bd7d369712aa678c90d1e34b8481acbb4f | brkuhgk/Spoj-solutions | /ATOMS.py | UTF-8 | 228 | 3.46875 | 3 | [] | no_license | T=int(input())
for _ in range(T):
n, k, m = raw_input().split()
n=long(n)
k=long(k)
m=long(m)
t=0
while n<=m:
n=n*k
t+=1
if t<1:
print(0)
else:
print(t-1)
| true |
774b729dc0f88bde5347a706557dc81fd66db7a2 | MatthewRicci12/lemmatizer | /test.py | UTF-8 | 1,368 | 2.78125 | 3 | [] | no_license | file = open('C:\\Users\\matth\\Desktop\\tempe.txt', 'r', encoding = "UTF-8")
the_list = []
for line in file.readlines():
line = line.strip('\n')
if len(line) == 0:
pass
elif "CHI" not in line:
pass
else:
the_list.append(line)
new_file = open('C:\\Users\\matth\\Desktop\\tempo.txt... | true |
40e23642a3219b7ce641409304e40992a7e6902c | Marx314/adventOfCodePython | /src/Year2015/Day1.py | UTF-8 | 412 | 3.421875 | 3 | [] | no_license | class Day1(object):
def __init__(self):
pass
def calc(self, data):
return data.count('(') - data.count(')')
def floor(self, data):
i = 0
count = 0
for direction in data:
if i == -1:
break
count += 1
if direction ==... | true |
36337a2579b373efee660545d400081a31958929 | Wiinterfell/adventofcode2k20 | /day3-2.py | UTF-8 | 727 | 3.09375 | 3 | [] | no_license | import sys
trees1 = 0
trees2 = 0
trees3 = 0
trees4 = 0
trees5 = 0
currentX1 = 0
currentX2 = 0
currentX3 = 0
currentX4 = 0
currentY = 0
with open("day3.txt") as fp:
for line in fp:
if (line[currentX1] == "#"):
trees1 += 1
currentX1 = (currentX1 + 1) % (len(line)-1)
if (line[currentX2] == "#"):
tre... | true |
783494a8e0747eb7a4a108b790eece84a61adc3f | alvaromorales/wikiscout | /scripts/extract_candidates.py | UTF-8 | 2,565 | 2.765625 | 3 | [] | no_license | from collections import namedtuple
from pymongo import MongoClient
from wikiscout import sentence
from wikiscout.infobox_parser import Infobox
from unidecode import unidecode
client = MongoClient('localhost', 27017)
db = client.wiki
Candidate = namedtuple('Candidate', ['cls', 'attribute', 'sentence', 'title', 'value'... | true |
5bb4681c1b1c0a1f305c7b96c7d3131c2dba9218 | bestksl/csdnviewer | /CSDN/GetIp.py | UTF-8 | 676 | 2.578125 | 3 | [] | no_license | import urllib2
from bs4 import BeautifulSoup
User_Agent = 'Mozilla/5.0 (Windows NT 6.3; WOW64; rv:43.0) Gecko/20100101 Firefox/43.0'
header = {}
header['User-Agent'] = User_Agent
url = 'https://www.xicidaili.com/wt/1' #'https://haoxuanli.blog.csdn.net/article/details/102648205'
req = urllib2.Request(url, headers=head... | true |
0804294a46b2835aa3dedbd8af2bfa6db87934d5 | victoriapenasmiro/Programacion20192020 | /python/Simulacro/simulacro2019.py | UTF-8 | 5,013 | 3.5 | 4 | [] | no_license | ## gestión de videoclub
def añadir_pelicula(lista_peliculas):
cantidad=int(input("dame la cantidad de copias que quieres introducir: "))
global contador_peliculas #con global estamos indicando que contador_peliculas
global id_pelicula #es la variable declarada en el programa principal
... | true |
c00328b25f32c462050ef4fbc40cc7e746d2ca46 | mus1cholic/discord-towerrpg | /cogs/mainmenu.py | UTF-8 | 2,624 | 2.796875 | 3 | [] | no_license | import discord
import asyncio
import random
import numpy as np
from discord.ext import commands
class MainMenu:
def __init__(self, bot):
self.bot = bot
@commands.command(name='map')
async def displayMap(self, ctx):
start_cog = self.bot.get_cog('Start')
player = await start_cog.get... | true |
285ed710fd3e0945bbdbef299f34b80fb7348262 | ThatCoolCoder/flask-error-templating | /src/flask_error_templating/main.py | UTF-8 | 1,762 | 2.984375 | 3 | [
"MIT"
] | permissive | from dataclasses import dataclass
from flask import Flask, render_template
@dataclass
class ErrorPage:
error_code: int
message: str
long_message: str = None
class HttpErrorHandler:
def __init__(self, app: Flask, error_page: ErrorPage,
page_template_file: str, template_arguments={}):
... | true |
73bffd34d72d58d91ad3fd38ec2481e21295584b | fgypas/AlignmentExtraction | /docker/python/extract_assembly_versions.py | UTF-8 | 6,640 | 2.625 | 3 | [] | no_license | #!/usr/bin/env python
__version__ = "0.1"
__author__ = "Mihaela Zavolan"
__contact__ = "mihaela.zavolan@unibas.ch"
__doc__ = "Extract the assembly versions for a set of species for which pairwise genome alignments with a reference are available"
# ______________________________________________________________________... | true |
754a0ae4d732bcd9b366a8eb23bd0c2c8e7c04bf | kainpets/Zelle-introduction-to-CS | /convert.py | UTF-8 | 442 | 4.59375 | 5 | [] | no_license | """Modify the convert program with a loop so that it executes 5 times\
before quitting. Each time trough the loop, the program should get
another temperature from the user and print the converted value"""
def main():
for i in range(0,5):
celsius = eval(input("What is the Celsius temperature? "))
... | true |
86b6e3e54ce89cccfd12c0bdd25ad42dc74a9fd9 | luodichen/leetcode-solution | /accepted/93-restore-ip-addresses.py | UTF-8 | 927 | 3.109375 | 3 | [] | no_license | # https://leetcode.com/problems/restore-ip-addresses/
class Solution:
def find_ipaddress(self, digits, stack, result):
if len(stack) == 3 and int(digits) < 256 and not (digits[0] == '0' and len(digits) > 1):
result.append("%s.%s.%s.%s" % (stack[0], stack[1], stack[2], digits))
elif len(s... | true |
843389f633cf68ef75d593cd3c066e1d657f82f6 | sailfish009/bert-fold | /src/mylib/torch/nn/losses/focal_loss.py | UTF-8 | 2,575 | 2.875 | 3 | [] | no_license | import torch
import torch.nn as nn
import torch.nn.functional as F
from torch_scatter import scatter_mean
class BinaryFocalLoss(nn.Module):
def __init__(self, alpha: float = 0.25, gamma=2, reduction: str = 'mean'):
super(BinaryFocalLoss, self).__init__()
self.alpha = alpha
self.gamma = gam... | true |
14ef799acee216585308462f46f1b2daac5a02b0 | whizsail/Script-of-Python | /typora_chevereto/typora_chevereto.py | UTF-8 | 3,218 | 2.71875 | 3 | [] | no_license | from pprint import pprint
from urllib import parse
import mimetypes
import requests
import datetime
import argparse
import logging
import os
def read(f):
'''用来读取文件的'''
try:
# 上传的图片类型
f_type = mimetypes.guess_type(f)[0]
# 以时间戳为命名规则
time = datetime.datetime.now().strftime('%F-%H-... | true |
d02a91a76064fe21160dda16ef58a50fc5538cdc | VitalyGladyshev/Python_Lessons_Part_1 | /hw03_easy.py | UTF-8 | 6,273 | 3.953125 | 4 | [] | no_license | # Внимание!!! Домашнее задание ниже. (Задачи 2, 3, 4)
# Начал делать до начала урока. Не выбрасывать же...
# Задание-1:
# Напишите функцию, округляющую полученное произвольное десятичное число
# до кол-ва знаков (кол-во знаков передается вторым аргументом).
# Округление должно происходить по математическим правилам (0... | true |
becc9b3ae41f37c4b7a1624aee5f5677d4143252 | atas98/CodeWars_scripts | /texas_holdem_test.py | UTF-8 | 2,489 | 3.109375 | 3 | [] | no_license | import unittest
from texas_holdem import hand
class TestTexasHoldem(unittest.TestCase):
def test_nothing(self):
self.assertEqual(
hand(["K♠", "A♦"], ["J♣", "Q♥", "9♥", "2♥", "3♦"]),
("nothing", ["A", "K", "Q", "J", "9"]),
)
def test_pair(self):
self.assertEqua... | true |
8d77ba100ad937c54cf410773256fda5a862aa9d | Br4ggs/SearchPerformance | /program.py | UTF-8 | 1,871 | 3.015625 | 3 | [] | no_license | from lorem_text import lorem
import time
import numpy as np
import matplotlib.pyplot as plt
from search import *
def TextFile_to_list(file_name):
with open(file_name) as f:
word_list = [word.strip('.,!?').lower() for line in f for word in line.split()]
return word_list
def Print_tree(node):
p... | true |
82f65fd5f30333e4aeed0e4ed5c68b56645ec008 | WonkyKong/drawingNetworks | /source/nodes/Node.py | UTF-8 | 1,947 | 3.046875 | 3 | [] | no_license | #!/usr/bin/env python
from source.AttributeFinder import AttributeFinder
class Node (object, AttributeFinder):
def __init__ (self, nodeStruct, grid):
AttributeFinder.__init__ (self, nodeStruct, 'node')
self.position = self.getAttribute ('position', grid.to_xy_array)
self.ARROW_LENGTH =... | true |
407ee31c4225896d31f23c67a365c50eb8c84a7c | gamletovich/Stepik | /PythonForPracticaProblems/Module 5 - Publishing data/Module 5 Step 1 Task 1 - Creating a web server.py | UTF-8 | 2,782 | 3.640625 | 4 | [] | no_license | """
In order for us to present data beautifully, we need to learn how to create html files manually.
We have already analyzed them and have some idea about their structure, but, as usual,
you can find the information you need to create html files in a search engine.
In this task, you need to submit an html file for re... | true |
e13741d763d80bbb6ba88157f46f1baaac39d34a | adil-soubki/modem | /mo.py | UTF-8 | 2,772 | 2.8125 | 3 | [] | no_license | #mo.py
#To Do: Place this all in a nice template so it's just one import statment... no internet to check syntax
import pyaudio
import wave
import sys
import binascii
import math
import numpy
import threading
import time
from modem import BITRATE
from modem import RATE
from modem import HIGH_NOTE
from modem import LOW_... | true |
1970bca436165a164e256a729471da2459301eb5 | PawelPlutaUek20/pp1 | /04-Subroutines/04.29.py | UTF-8 | 359 | 3.234375 | 3 | [] | no_license | tab=[2, 3, 5, 2, 9, 8, 1, 3, 9, 1, 1, 4, 7, 7, 1, 4]
tab.sort()
def mediana():
if len(tab)%2==0:
print((tab[(len(tab)//2)-1]+tab[(len(tab)//2)])/2)
else:
print(tab[(len(tab)//2)])
def dominanta(tab):
return max(tab, key=tab.count)
print('Mediana:',end=' ')
mediana()
print('Domi... | true |
cfc6325ac275b15d17dd2062ca057ada4304f95e | qeedquan/challenges | /codegolf/abandon-all-squares-ye-who-divide-me.py | UTF-8 | 1,539 | 4.15625 | 4 | [
"MIT"
] | permissive | #!/usr/bin/env python
"""
Definitions
A perfect square is an integer which can be expressed as the square of another integer. For example, 36 is a perfect square because 6^2 = 36.
A squarefree number is an integer which is not divisible by any perfect square, except by 1. For example, 10 is a squarefree number. Howev... | true |
4b20decb1c28bdd151ff94794f2d7790d1de1a17 | eugenechia95/blockchain-sutd | /Project1/merkle.py | UTF-8 | 4,269 | 2.859375 | 3 | [] | no_license | from hashlib import sha256
from ecdsa import SigningKey, VerifyingKey, NIST384p
from transaction import *
import json
class ComplexEncoder(json.JSONEncoder):
def default(self, obj):
if hasattr(obj,'reprJSON'):
return obj.reprJSON()
else:
return json.JSONEncoder.default(self,... | true |
708758f82e9690d2494f559e529c11d6176f6973 | rjassef/sims_maf | /tests/testHealpixSlicer.py | UTF-8 | 11,484 | 2.546875 | 3 | [] | no_license | from builtins import zip
import matplotlib
matplotlib.use("Agg")
import numpy as np
import numpy.lib.recfunctions as rfn
import numpy.ma as ma
import unittest
import healpy as hp
from lsst.sims.maf.slicers.healpixSlicer import HealpixSlicer
import lsst.utils.tests
def makeDataValues(size=100, minval=0., maxval=1., ra... | true |
aaaea06066058c782920575e93dc21ec1db82bfd | jasonblog/note | /python/src/pyprogbook/第二版(博碩)課本範例程式/ch5/E_5_13.py | UTF-8 | 118 | 3.578125 | 4 | [] | no_license | # E_5_13 功能: range函數採先放大再縮小產生浮點數。
for i in range(0, 3):
i=i/10
print(i)
| true |
8950a8c01b78f2cc51bcff727f0efa1f79ad626d | itcherokee/Coursera | /An Introduction to Interactive Programming in Python/Mini-projects/06.Blackjack/Blackjack.py | UTF-8 | 6,350 | 3.21875 | 3 | [] | no_license | # Mini-project #6 - Blackjack
import simplegui
import random
# load card sprite - 949x392 - source: jfitz.com
card_size = (73, 98)
CARD_CENTER = (36.5, 49)
card_images = simplegui.load_image("http://commondatastorage.googleapis.com/codeskulptor-assets/cards.jfitz.png")
CARD_BACK_SIZE = (71, 96)
CARD_BACK_CENTER = (35... | true |
97f0e007da18adc4ad0c1e34b81f770ee12aa515 | Yooemy/tieba-img-spider | /spider.py | UTF-8 | 448 | 2.6875 | 3 | [] | no_license | #coding=utf-8
import re
import urllib2
import urllib
html = urllib.urlopen("http://tieba.baidu.com/p/4180696186")
html_read = html.read()
re_rule = r'src="(.+?\.jpg)" size='
re_complie = re.compile(re_rule)
re_findall = re.findall(re_complie,html_read)
print re_findall
x = 0
for getimg in re_findall: #可能会将列表[]初始化为非列表... | true |
dd99f1c7b6a0f2b0ad6c1529b31fba160f361878 | FluffyFu/Leetcode | /825_friends_of_appropriate_ages/test_solution.py | UTF-8 | 1,044 | 2.515625 | 3 | [] | no_license | from solution import num_fast, low_b_inclusive, norm_bs, up_b_inclusive, num_b
import pudb
def test():
ages = [73, 106, 39, 6, 26, 15, 30, 100, 71, 35, 46, 112, 6, 60, 110]
res = num_b(ages)
assert res == 29
# assert res3 == 29
def test_low_b_inclusive():
ages = [2, 2, 2]
t = 2
res = low... | true |
1d346e2b9e02813971a34052f32ef2a7d6f90eb2 | ekeilty17/Personal-Projects-In-Python | /Math/Differential Equations/phase_portrait.py | UTF-8 | 1,233 | 3.1875 | 3 | [] | no_license | import numpy as np
import matplotlib.pyplot as plt
A = [[1, 2], [2, 1]]
G = [0, 0]
def f(Y, t):
return [ A[0][0]*Y[0] + A[0][1]*Y[1] + G[0],
A[1][0]*Y[0] + A[1][1]*Y[1] + G[0]
]
# x-axis
a_x = -5
b_x = 5
# y-axis
a_y = -5
b_y = 5
partitions = 20
# Setting up Grid
Y1, Y2 = np.meshgrid(np... | true |
f02cf7f123abe1649adf981c42b21a9ea07d9f5b | inabhi9/drf-ext | /drf_ext/db/models.py | UTF-8 | 3,738 | 2.578125 | 3 | [
"MIT"
] | permissive | """
======
Models
======
Provides base models for other django.model subclass
"""
from django.contrib import auth
from django.contrib.auth.models import (Permission, _user_get_all_permissions, _user_has_perm,
_user_has_module_perms)
from django.db import models
from django.db.mo... | true |
2a8f9757189cb76bec2460d0aadad8d96fdcceea | Arunsinistersixsix/python-class-cek | /largestof3.py | UTF-8 | 148 | 3.9375 | 4 | [] | no_license | a=int(input("a:"))
b=int(input("b:"))
c=int(input("c:"))
if(a>b) and (a>c):
print("a")
elif(b>a) and (b>c):
print("b")
else:
print("c")
| true |
1c2125a41878f0841e7a6be776e087c83d5534c3 | ericyue/Survey_PortfolioSelection | /OLPS_python/PAMR.py | UTF-8 | 3,648 | 2.640625 | 3 | [
"Apache-2.0"
] | permissive | import numpy as np
import pandas as pd
import math
import time
from datetime import datetime, date
import matplotlib.pyplot as plt
from OLPSResult import OLPSResult
import scipy.optimize as opt
import helper as hp
import BenchMarkStrategy as bms
from Strategy import Strategy,FollowtheLoser
class PAMR(FollowtheLoser):
... | true |
e121677dc4d872b044b580847eea5b6c0871223b | elementbound/jamk-script-programming | /week 4/shoplifting.py | UTF-8 | 1,070 | 3.859375 | 4 | [] | no_license | # 4-5) Simulate the shop queue
#
# Add new persons to the queue from the list and serve them
# in "shop queue":
#
# # initialize list with the values
# clients=['first', 'second', "third", "fourth", "fifth"]
# queue=[]
# # to do - serve a client and then remove them from the queue
# add new client into the queue
impor... | true |
2ef411a57a3a3e1bb09f28585259ab522d67fc7d | bgwines/project-euler | /src/solved/problem70.py | UTF-8 | 1,138 | 3.25 | 3 | [] | no_license |
import copy
import pyprimes
import pdb
def fast_euler_phi(n, totients):
if n == 2:
return 1
if n % 2 == 0:
if (n / 2) % 2 == 0:
return 2 * totients[n / 2]
else:
return 1 * totients[n / 2]
else:
if pyprimes.isprime(n):
return n-1
else:
phi = 1
for (p, a) in pyprimes.factorise(n):
phi *=... | true |
44ee8d043ab3fad36d0eac4f00924e0f27676d71 | Happy-Aztec-Digging-Extraction-System/smile-mobile | /smile_mobile_robot_ws/src/smile_mobile_hardware/src/encoder_imu_driver/encoder_imu_driver.py | UTF-8 | 5,720 | 2.796875 | 3 | [] | no_license | #!/usr/bin/env python
'''
Author: David Pierce Walker-Howell
Date Created: 07/12/2020
Description: This module communicates with the arduino nano collecting
IMU data and encoder data.
'''
import rospy
from std_msgs.msg import Float32MultiArray
import serial
import time
import struct
import math
from sensor_msgs... | true |
aaaa5d0d440215f7fb005e850f31648e78d252c1 | nekohor/gomon | /examples/yapon/test/testAbWithRequests.py | UTF-8 | 1,415 | 2.703125 | 3 | [] | no_license | import json
import requests
import logging
logging.basicConfig(
level=logging.INFO,
format='%(asctime)s - %(name)s - %(levelname)s - %(message)s')
logger = logging.getLogger(__name__)
def request_api(url, params):
try:
r = requests.get(url, params=params, timeout=10)
r.raise_for_status()... | true |
c0a604b6222f76595f897c7f1a82852ff77a4261 | toinehartman/Euler | /32.py | UTF-8 | 264 | 2.921875 | 3 | [] | no_license | #!/usr/bin/env python
import time
pan = ""
for a in xrange(1, 9876543210):
for c in xrange(1, 9876543210):
b = int(c/a)
# print a,b,c
# print b
# time.sleep(0.01)
pan = str(a) + str(b) + str(c)
# pand = True
if len(pan) == 10:
print a, b, c, pan | true |
a960176a40ed1b0761b81f87c3943f530caf0d6a | Wayneplp/PythonLearning | /classx1/ex1.py | UTF-8 | 1,224 | 3.421875 | 3 | [] | no_license | import pygame
SCREENWIDTH = 800
SCREENHEIGHT = 600
pygame.init()
screen = pygame.display.set_mode([SCREENWIDTH,SCREENHEIGHT])
pygame.display.set_caption("Draw A Circle When Click")
keepGoing = True
RED = (255,0,0)
GREEN = (0,255,0)
BLUE = (0,0,255)
color =RED
hasDrawn = False
moving = False
radius ... | true |
616cc817e06ac05adec994fad401e961c9925235 | RDFLib/rdflib | /test/test_conjunctivegraph/test_conjunctivegraph_operator_combinations.py | UTF-8 | 2,775 | 2.953125 | 3 | [
"BSD-3-Clause"
] | permissive | import os
from test.data import TEST_DATA_DIR, cheese, likes, michel, pizza, tarek
from rdflib import ConjunctiveGraph, Graph
sportquadstrig = open(os.path.join(TEST_DATA_DIR, "sportquads.trig")).read()
def test_operators_with_conjunctivegraph_and_graph():
cg = ConjunctiveGraph()
cg.add((tarek, likes, pizza... | true |
7a085cc52968400bb65c1080adc0959b5e74f49f | PhilkaUA/geekhubds-2018 | /math_06 - Methods optimization/MHW06 Task 6 - Gradient descent method.py | UTF-8 | 4,970 | 4.125 | 4 | [] | no_license | #!/usr/bin/env python
# coding: utf-8
# # MHW06 Task 6 - Gradient descent method
#
# #### Method of gradient descent with a constant step.
# In[1]:
import numpy as np
import sympy as sp
# In[ ]:
# In[2]:
# Input function : f(x) = x1**3-x1*x2+x2**2-2*x1+3*x2-4
# Input symbols and symbolyc funtion for 2 va... | true |
2cb11a63834d179c5baf1b64d80e7b822e7ae7ee | Doogie2000/prg1_homework | /practice_code/DictionaryQuiz.py | UTF-8 | 295 | 3.21875 | 3 | [] | no_license | nicknames = {
"douglas" : "doogie",
"Mr. Stadler" : "dj shakes",
}
nicknames ["yoon"] = "groot"
nicknames ["backus"] = "buckus"
nicknames ["crosby"] = "crispy"
final_string = ""
for name in nicknames :
final_string += (name + " goes by the name " + nicknames[name] + ": ")
print(final_string) | true |
9275216066359420a3f2bf7a01e4091c55596a65 | ZacHooper/spaceTraders | /SpaceTraders/db_handler.py | UTF-8 | 4,006 | 2.921875 | 3 | [] | no_license | import sqlite3
import sqlalchemy
import logging
import pandas as pd
DATABASE_LOCATION = 'sqlite:////Users/zachooper/Documents/Personal/Projects/SpaceTraders/spaceTraders/SpaceTraders_DB.sqlite'
logging.basicConfig(format='%(asctime)s - %(levelname)s - %(message)s', level=logging.INFO)
# Init engine, conn & cursor
e... | true |
b41095097ee52cc5a205eed3fac4ab51a849686d | MyHealthyHair/Lesson | /week4_1.py | UTF-8 | 4,099 | 3.65625 | 4 | [] | no_license | #!/usr/bin/env python
# coding: utf-8
# In[1]:
for i in range(1,10):
print('{}^3={}'.format(i,i**3))
# In[3]:
for i in range(0,10):
print(' '*(9-i),'*'*(2*i+1))
# In[6]:
for i in range(0,10):
print('+'*(9-i),'*'*(2*i+1))
# In[10]:
for i in range(0,10):
print('+'*(9-i),'*'*(2*i+1),sep='')
... | true |
3228a19067211228079dc49d31e9f721ea936427 | gyurivukman/szakdolgozat | /server/model/account.py | UTF-8 | 500 | 2.59375 | 3 | [] | no_license | from enum import IntEnum
from dataclasses import dataclass
class AccountTypes(IntEnum):
Dropbox = 0
GoogleDrive = 1
@dataclass
class AccountData:
accountType: AccountTypes
identifier: str
cryptoKey: str
data: dict
id: int = None
def serialize(self):
return {
"id"... | true |
739b67a2bd0b32ddd83ffecb744286b3fe991a4b | ninjamelons/MachineLearningElective | /TensorDNN/RedditTextReader.py | UTF-8 | 3,120 | 2.875 | 3 | [] | no_license | #!/usr/bin/env python
# coding: utf-8
# In[2]:
import praw
import pandas as pd
import datetime
reddit = praw.Reddit(client_id='YKHyzDsxpKV0mg',
client_secret='Ph_adJuGZAkrt2vx8n5MSNCnaWc',
user_agent='scripto by /u/ninjamelons',
username='ninjamelons')
p... | true |
2260c0f014a18d35020341791de5703a641e8651 | italoohugo/Python | /1UNIDADE/Lista2/Q8.py | UTF-8 | 539 | 3.890625 | 4 | [] | no_license | print('Programa PyIdade, sua idade em anos, meses, semanas e dias')
nome = input('Por favor, Digite seu nome: ')
nasc = int(input('Digite seu ano de nascimento: '))
ano = int(input('Ando meio esquecido, em que anos estamos? '))
idade = ano - nasc
meses = idade * 12
semanas = idade * 52
dias = idade * 365
print(nome,',... | true |
96daa2e8548646b3bfc5c3d33b3c8717c38c67d6 | Rhinops-Sela/components | /fennec/fennec_helpers/helper.py | UTF-8 | 2,359 | 2.890625 | 3 | [] | no_license | import json
import os
import shutil
import sys
from pathlib import Path
class Helper:
@staticmethod
def exit(exit_code: int, message: str):
print(message)
sys.exit(exit_code)
@staticmethod
def file_to_object(file_to_convert: str):
try:
file = open(file_to_convert)... | true |
dcd9fb12b8afd917676e92ce1add13563b3790c2 | sraj8/Protogonist-Antagonist-Predictor | /predictor/modules/w2v.py | UTF-8 | 1,511 | 2.671875 | 3 | [] | no_license | import gensim
import os
from modules.common_func import readFile, cleanSplitScript
from nltk.corpus import stopwords
class LinesInDir(object):
def __init__(self, dirname):
self.dirname = dirname
def __iter__(self):
for path, subdirs, files in os.walk(self.dirname):
for fname in fi... | true |
3ecea1bd12e8fc02366e678922a52c0747d2266c | webclinic017/pyalgotrading-1 | /pyalgotrading/order/order_base.py | UTF-8 | 1,742 | 2.671875 | 3 | [
"LicenseRef-scancode-unknown-license-reference",
"MIT"
] | permissive | class OrderBase:
"""
Base class for Regular Order / Bracket Order
"""
def place_order(self):
"""
This is a dummy function with a sole purpose of mimicing the signature of the actual function on the AlgoBulls platform, as described in the documentation.
Returns:
"""
... | true |
95909a3047c00ce268bf5be84efad168e65bf660 | imnishitha/Nptel-solutions-for-DAA-in-python | /The Siruseri Sports Stadium.py | UTF-8 | 317 | 2.703125 | 3 | [] | no_license | a=int(input())
r=[]
f=[]
for i in range(0,a):
b=[int(x) for x in input().split()]
r.append([b[0],b[0]+b[1]-1])
r.sort(key=lambda x: x[1])
while r:
y=[]
f.append(r[0])
for j in range(len(r)):
if r[j][0]<=r[0][1]:
y.append(r[j])
for p in y:
r.remove(p)
print(len(f))
| true |
9fd9d0d57c5b8433a916b3849dd4595d15e72bb8 | seraadam/RealEstatePredictor | /pickling.py | UTF-8 | 1,311 | 2.921875 | 3 | [] | no_license | import quandl
import pandas as pd
import pickle
# To avoid directly listing api on file
api_key = open('quandlapikey.txt', 'r').read().rstrip()
# Read in html page -- This is a list
def state_list():
us_states = pd.read_html('https://simple.wikipedia.org/wiki/List_of_U.S._states')
return us_states[0... | true |
d032780c10d2f903a94558244d4d846e6b410e76 | vlarie/EPIC_team5_Project2 | /app.py | UTF-8 | 2,113 | 3.15625 | 3 | [] | no_license | #######################################################
################ Flask Application #################
################## Dependencies ###################
####################################################
import os
import pandas as pd
import numpy as np
import json
from flask import Flask, jsonify, rend... | true |
c90f68a89b201c9927a97d97ba2d903a5158b5e7 | fedegos/credisuretl | /credisur/debitsgenerator/validators/validateheaders.py | UTF-8 | 778 | 2.515625 | 3 | [
"MIT"
] | permissive | from .errorsiterator import ErrorsIterator
def validate_headers(header_data):
errors = ErrorsIterator()
sheet_name = header_data.sheet_name
if header_data.cuit is None:
errors.add_error("Falta el CUIT en solapa %s" % (sheet_name))
if header_data.prestacion is None:
errors.add_error("F... | true |
83439c21e7eaf3aaccdd80bf8330938184d57be6 | omarelweshy/Age-Calculator | /ageCal.py | UTF-8 | 1,591 | 4.21875 | 4 | [] | no_license | import datetime
import tkinter as tk
class Person:
def __init__(self,birthdate):
self.birthdate=birthdate
def years(self):
today=datetime.date.today()
year = today.year-self.birthdate.year
return year
def month(self):
today=datetime.date.today()
month = toda... | true |
ecfdb11660040907ab548d76b5ff8d3f4800c86d | FanchiniRudolf/RSA | /RSA Encryption.py | UTF-8 | 4,597 | 3.25 | 3 | [
"MIT"
] | permissive | def instalation():
subprocess.call([sys.executable, "-m", "pip", "install", "requests"])
subprocess.call([sys.executable, "-m", "pip", "install", "math"])
try:
import subprocess
import sys
import requests
from math import gcd, ceil
except ImportError:
import subprocess
import sys
... | true |
9cde62b7bd9e1733ff9a7c736ad85dba866d35fe | SantoshKumarSingh64/July-2021-LeetCode-Monthly-Challenge | /D02/PythonSolution.py | UTF-8 | 355 | 3.125 | 3 | [] | no_license | class Solution:
def findClosestElements(self, arr: List[int], k: int, x: int) -> List[int]:
high = len(arr)-1
low = 0
while high-low >= k:
if abs(arr[low]-x) <= abs(arr[high]-x):
high -= 1
else:
low += 1
... | true |
060931177624fbbaca3066adfe9020c039653de7 | qqzmr/pynumbertheory | /pyLanguageProgramming/a08/a011反向字符串.py | UTF-8 | 148 | 3.484375 | 3 | [] | no_license | # -*-coding:utf-8-*-
def reverse(s):
return s[::-1]
if __name__ == "__main__":
s = input("请输入字符串:")
print(reverse(s))
| true |
09f283cb82941a4c4f3734d6d06d04266cc81d6e | abhaykaul8799/DSA_python | /Dynamic-Programming/unbounded-knapsack.py | UTF-8 | 907 | 4 | 4 | [] | no_license | '''
Given two arrays, weights and their respective values, and given
a knapsack with weight W, how can we maximise the value of the
objects inside the knapsack, considering we can take multiple
occurances of any given item.
'''
def unboundedKnapsack(wt,val,W):
dp = [[None]*( W + 1) for _ in range(len(wt) + 1)... | true |
d71a0eea45c82fab35f541b868fa518f6059d55e | voschezang/drum-style-transfer | /src/utils/plot.py | UTF-8 | 10,288 | 2.5625 | 3 | [
"MIT"
] | permissive | """ Midi-plots
Black indicates a note-on msg
Grey indicates a probable note-on msg (intensity correlates with p())
White indicates a rest
"""
from utils import utils, string, io
from midi import pitches, decode
# import scipy, scipy.stats
import numpy as np
from matplotlib import rcParams
rcParams['font.family'] = 's... | true |
4fb24701c356271df70b0af867cf6ea8eb996a65 | Suhird/cryptopals | /fixed_xor.py | UTF-8 | 453 | 3.3125 | 3 | [
"MIT"
] | permissive | ##A function that takes two equal-length buffers and produces their XOR combination.
##
##
##
from utils.cryptopals import hex_to_byte
if __name__ == '__main__':
str1 = '1c0111001f010100061a024b53535009181c'
str2 = '686974207468652062756c6c277320657965'
bytes_arr1 = hex_to_byte(str1)
bytes_arr2 = hex_to... | true |
d7f90b425f8c850e6b64bb7562be421bedce7232 | hj1996/cyse | /senior_project/istheservicedown.py | UTF-8 | 2,272 | 2.734375 | 3 | [] | no_license | import pandas as pd #import the module that
import ssl #import the module for SSl connections
import re #import the module for regulor expression
from bs4 import BeautifulSoup #import the module to parse html
import urllib2 #import the module to connect websites and get data
import time #import the module for time... | true |
cbf37c5feff2673db474c824e1c1aedd57aa260a | OrpingtonClose/daily | /python/nlp_basics.py | UTF-8 | 2,151 | 2.9375 | 3 | [] | no_license | def first():
import re
words = ['my', 'email', 'is', 'classified']
regex = '|'.join(words)
print("regex applied: {}".format(regex))
multi_line = re.M
found = re.findall(regex, 'this email lenght is much to long', multi_line)
print(found)
def second():
import urllib3
from bs4 import BeautifulSoup
po... | true |
fe7c0b2b92230286f1d5254372b38f0f47a27c83 | MoJoVi/Euler_Project | /practice.py | UTF-8 | 6,851 | 3.5 | 4 | [] | no_license | # #*ЗАДАЧИ НА ДЕКОРАТОРЫ
#
# #Написать декоратор, который отменяет выполнение любой декорированной
# #функций и будет писать в консоль: ИМЯ_ФУНКЦИИ is canceled!
#
# def is_closing(function):
# def inner(*arg):
# try:
# raise SyntaxError
# except:
# print(function.__name__,'is... | true |
e2e38cceaefe19a913fd501dd258dc6fae00b5dd | OgieeRakha/learning | /python-learn/HelloWorld/string.py | UTF-8 | 216 | 3.609375 | 4 | [] | no_license | age = 24
print("My age is %d years"%age)
major = "years"
minor = "months"
print("My age is %d %s, %d %s" %(age, major, 6, minor))
print("Pi is approximately %f"% (22/7))
print("Pi is approximately %60.50f"%(22/7))
| true |
edc17e782c9b6219a9947fd5b20ee6d6eef1e2f8 | akrherz/pals | /cgi-bin/daryl_dev/dominator.py | UTF-8 | 6,239 | 2.5625 | 3 | [] | no_license | #!/usr/local/bin/python
# My attempt to "dominate" HTML code from other locations
# Daryl Herzmann 9/11/98
# Python imports
import sys, re, regsub, os, urllib, urlparse, regex, string
from cgi import *
# Define some constants used thoughout
dominator_href = "https://pals.agron.iastate.edu/cgi-bin/daryl_dev/dominato... | true |
e50a365a44b3a429fcc5bc6fabeb80b8f94d3a1c | simonolander/signatures | /storage.py | UTF-8 | 1,871 | 2.828125 | 3 | [] | no_license |
import numpy as np
import json
class NumPyArrayEncoder(json.JSONEncoder):
def default(self, obj):
if isinstance(obj, np.ndarray):
return obj.tolist()
return json.JSONEncoder.default(self, obj)
def load_raw_data():
num_users = 40
num_signatures = 40
file_name_template = "... | true |
a7cd60d99b05782f9e101de7095f816a6287e5b0 | Bredgren/Ninja-Runner | /source/powerups.py | UTF-8 | 2,653 | 2.53125 | 3 | [] | no_license | import game_vars, funcs, objects, data
from constants import *
class BasePowerUp:
def checkDeath(self):
pass
class teleport(BasePowerUp):
def __init__(self, x, y):
self.sprite = data.load_image('teleport.png')
self.xPos = x
self.yPos = y
self.width = self.sp... | true |
4a89d444219e84381465920b8efb46fcad7aa518 | F4r1n/dataScience | /webscraper/getlist.py | UTF-8 | 581 | 3.15625 | 3 | [] | no_license | import requests
import bs4
#request site with list of all scripts
res = requests.get('https://www.imsdb.com/all%20scripts/')
#if request was successfull
if res.ok:
soup = bs4.BeautifulSoup(res.text, features="lxml")
#search for the table
td = soup.select('td')
#Each movie has a link
titles = td[86]... | true |
fa924ef0298b917eb88589328e91a410ce6b1747 | tadejstrah/lineDrawingRobot | /frekvenca.py | UTF-8 | 97 | 2.9375 | 3 | [] | no_license | from time import sleep
a = 15
while True:
sleep(1/(2*a))
#on
sleep(1/(2*a))
#off
| true |
72407448a824cc122dcd48d6187df30950a29ed4 | YannTorres/Python-mundo1e2 | /Desafios/69AnálisedeDados.py | UTF-8 | 871 | 4.09375 | 4 | [] | no_license | totalmais18 = homens = mulheresmenos20 = 0
while True:
print('-=' * 10)
print('Cadastre uma Pessoa')
print('-=' * 10)
idade = int(input('Idade: '))
sexo = str(input('Sexo: [M/F] ')).upper().strip()[0]
print('-=' * 10)
if idade > 18:
totalmais18 = totalmais18 + 1
if ... | true |
ad412bf1af33fdd807b8ee12256b15af6e2540cc | xxchenxx/MixtureOptimizer | /a2c_ppo_acktr/models/rnn_state_encoder.py | UTF-8 | 2,520 | 2.796875 | 3 | [] | no_license | import torch
import torch.nn as nn
from pdb import set_trace as bp
class RNNStateEncoder(nn.Module):
def __init__(self, input_size: int = 1, hidden_size: int = 1, num_layers: int = 1, rnn_type: str = "LSTM"):
r"""An RNN for encoding the state in RL.
Supports masking the hidden state during variou... | true |
5fe1bb37ad3acd484d6f3b847e312aa1540a6a9d | yodiwo/plegma | /Csharp/Projects/RasPiCamera/client.py | UTF-8 | 425 | 2.703125 | 3 | [
"Apache-2.0"
] | permissive | import socket
if __name__ == "__main__":
sock = socket.socket()
sock.connect(("localhost", 50839))
with open("myimg.jpg", "rb") as fd:
buf = fd.read(1024)
'''
file = open("image.png", "rb")
imgData = file.read()
s.send(imgData)
s.close()
... | true |
d01023a9504bed70c95426649439b5f0a69c5ace | fernandovb/ProjetoContabil | /utilidades/federal.py | UTF-8 | 6,318 | 3.578125 | 4 | [] | no_license | # encoding: utf-8
# module federal
# from (built-in)
# version 0.01
# Author: Fernando Vicente Batista
# Contact: fernandovicente.batista@gmail.com
"""
Análise de informações de cadastros federais brasileiros
"""
import re
__version__: str = 'Versão 0.01 - em desenvolvimento'
__all__ = [
'limpa_cadastro',
'f... | true |
72dae9f57d13decb150ac537c9b06ef747cd5ec7 | nanaya-tachibana/sknlp | /sknlp/data/utils.py | UTF-8 | 1,501 | 2.796875 | 3 | [] | no_license | import tensorflow as tf
def _bytes_feature(value):
"""Returns a bytes_list from a string / byte."""
if isinstance(value, type(tf.constant(0))):
value = value.numpy()
return tf.train.Feature(bytes_list=tf.train.BytesList(value=[value]))
def _str_feature(value):
return _bytes_feature(value.enc... | true |
d3a4076b21112e48c66554adfdbc4ba5201d5ad2 | lyf981015/Tensorflow | /resnet_input.py | UTF-8 | 3,111 | 2.734375 | 3 | [
"Unlicense"
] | permissive | #!/usr/bin/python
# -*- coding: UTF-8 -*-
# Copyright 2018 AI Futurelab
#
# 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
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required ... | true |
8ff13158032bbe56c4033da635b9f94f3bacf5a1 | nikhil-likhar/Cities-Dataset-Generator | /Dataset_Generator.py | UTF-8 | 3,924 | 3.140625 | 3 | [] | no_license | # Main Code
#Obtaining Longitude and lattitude of given cities(in data Dictionary) using Geolocator.geocode and storing in the File "Lat_Long.csv" and pring the dictionary of log and latt of Cities
#Obtaining the Distances of Cities using Geopy and storing in "Distances.csv" and Printing the Dictionary of the same.... | true |