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 |
|---|---|---|---|---|---|---|---|---|---|---|
83fbfa9c8b14601322e035239c4648e8b34fa057 | NikitaZakharov/MineSweeper | /field.py | UTF-8 | 7,166 | 3.65625 | 4 | [] | no_license | import six
import random
import constants as consts
class Field(object):
"""
`Field` class implements methods to work with field
"""
MINE = '[X]'
HIDDEN = '[ ]'
EMPTY = '[0]'
def __init__(self, width=consts.FIELD_WIDTH, height=consts.FIELD_HEIGHT, mines_count=consts.MINES_TOTAL):
... | true |
5e8d74f61c20f2e794ee0a464c9e556c50551767 | juzhong180236/NewPython | /Demo/Telescopic_boom_2021/coordinate_transform/coordinate_transform.py | UTF-8 | 1,001 | 3.421875 | 3 | [] | no_license | import numpy as np
def translate(_point, dx, dy, dz):
return [_point[0] + dx, _point[1] + dy, _point[2] + dz]
def scale(_point, sx, sy, sz):
return [_point[0] * sx, _point[1] * sy, _point[2] * sz]
def rotateX(_point, angle):
radian = np.pi / 180 * angle
cosa = np.cos(radian)
sina = np.sin(radi... | true |
00a3d21dfd1e176e8487d83a8ab23422ae49d971 | VasquezRW/201800678_TareasLFP | /Tarea 2/interpreteCSV.py | UTF-8 | 258 | 2.953125 | 3 | [] | no_license | import csv
def LeerDatos(ruta):
with open(ruta) as contenido:
reader = csv.reader(contenido)
for row in reader:
print(row[0])
print(row[1])
print(row[2])
print(row[3])
print('') | true |
5745e761ac861e4a9a2c8f865913f705ffbc7374 | jwmng/lpr3 | /app.py | UTF-8 | 12,614 | 2.890625 | 3 | [] | no_license | import configparser
import json
import re
import sys
import time
import cv2
import numpy as np
import matplotlib.pyplot as plt
def _plot(img, title="", **kwargs):
plt.figure()
kwargs.update({'cmap': 'Greys'})
plt.imshow(img, **kwargs)
plt.title(title)
plt.show()
def _check_tol(val, target, tol... | true |
9a7498839bee5fa2616e5d2be7ecaf449ab0658f | IvanIsCoding/OlympiadSolutions | /beecrowd/2158.py | UTF-8 | 449 | 3.28125 | 3 | [] | no_license | # Ivan Carvalho
# Solution to https://www.beecrowd.com.br/judge/problems/view/2158
#!/usr/bin/env python
# -*- coding : utf-8 -*-
molecula = 0
while True:
try:
a, b = [int(i) for i in input().split()]
except EOFError:
break
molecula += 1
print("Molecula #%d.:." % (molecula))
ligacoes... | true |
d92954f85e06c8d3e5c16fb8dd68640373c0850f | varsha512/python_ws | /m3_q/car.py | UTF-8 | 884 | 3.46875 | 3 | [] | no_license | class Car:
def __init__(self,regno,no_gears):
self.regno=regno
self.no_gears=no_gears
self.is_started=False
def start(self):
if self.is_started:
print(f"car with regno {self.regno} is already started...")
else:
print(f"car with regno {self.regno... | true |
9bfb8cfe04e4fe46bf2e450614e6a7ba8282e387 | abhigyanj/Chatbot | /chat/chatbot.py | UTF-8 | 6,141 | 2.9375 | 3 | [] | no_license | import os
import json
import pickle
import random
import nltk
import numpy
import tflearn
from nltk.stem.lancaster import LancasterStemmer
from tensorflow.python.framework import ops
nltk.download('punkt') # Needed for NLTK
class ChatBot:
def __init__(self):
"""
Adding variables needed for lat... | true |
1fefd539b09792da55fb9702f0afb873cfab3fcd | beigerice/LeetCode | /73.py | UTF-8 | 1,077 | 2.984375 | 3 | [] | no_license | class Solution:
def setZeroes(self, matrix):
for i in xrange(len(matrix)):
flag = 0
for j in xrange(len(matrix[i])):
if matrix[i][j] == 0:
for a in xrange(len(matrix)):
if a != i:
if matrix[a][j] ... | true |
609322d1fb5216022d5cdaeba6c812ed9d6a4bf9 | haxsgvnbdus/UPGMA-clustering | /matrixTest.py | UTF-8 | 312 | 2.828125 | 3 | [] | no_license | '''
Created on Mar 15, 2017
@author: Hannie
'''
def matrixToList(table):
matrix = []
for i in range(0, len(A[0])):
row = []
for j in range(0, len(A[0])):
if i>j:
row.append(A[i][j])
matrix.append(row)
# print(pos)
print(matrix)
| true |
fc09e790deade0f70519c59abf5d27220c0325ed | joaocferreira/algorithms | /python/bubble_sort/test_bubble_sort.py | UTF-8 | 302 | 3.296875 | 3 | [] | no_license | import unittest
from bubble_sort import sort
class BinarySearchTest(unittest.TestCase):
def test_sort(self):
test_list = [21, 4, 1, 3, 9, 20, 25, 6, 21, 14]
self.assertItemsEqual(sort(test_list), [1, 3, 4, 6, 9, 14, 20, 21, 21, 25])
if __name__ == '__main__':
unittest.main()
| true |
fb221bcddc3ddf8f41b6ffb3c18f87ee21cc945f | EnriqueSoria/Universidad | /SAR/Practica 1 - Intro a Python/3. El mono infinito/CreadorIndices.py | UTF-8 | 2,016 | 2.984375 | 3 | [] | no_license | # coding=utf-8
import sys
import re
import cPickle as pickle
# Comproba si s'han passat arguments
# Ús: python CreadorIndices.py <nomFitxer1> <nomFitxer2>
if len ( sys.argv ) == 3:
nomFitxerEntrada = sys.argv [ 2 ]
nomFitxerEixida = sys.argv [ 3 ]
else:
nomFitxerEntrada = raw_input ( 'Introdueix el nom d... | true |
87faa5dfb07a8ae7642e9601ce44847311229617 | KangOxford/EMcode | /Connections/process2.py | UTF-8 | 837 | 2.640625 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Wed May 20 22:42:09 2020
@author: hs101
"""
import pandas as pd
connection = pd.read_csv('./output/connection.csv', encoding='gbk').set_index('manager')
# ============================================================================ #
'''归一化处理
'''
def guiyi(connection)... | true |
f956745bd3a691d38ab7e1a818a721eb6f110fd4 | WanNJ/Wiki-QA-Magic | /question_answerer/do_question_answerer.py | UTF-8 | 2,500 | 2.609375 | 3 | [] | no_license | import sys
sys.path.append("..")
import util_service
def localized_statement_pipeline(localized_statement):
localized_dep_parse = util_service.get_dependency_parse(localized_statement)
root_idx = localized_dep_parse.index("ROOT")
ner_tokens = util_service.get_ner_per_token(localized_statement)
return... | true |
deec7b1d7094e79a3147a969567d004994508a7a | zethwillie/froggerPipeline | /Publishing/messageToSlack.py | UTF-8 | 551 | 2.90625 | 3 | [] | no_license | from urllib import request, parse
import json
slackURL = None # this will be the url to the webhook ("https://hooks.slack.com/services/your/slack/URL")
def post_message_to_slack(text, *args):
"""
Example: post_message_to_slack("Posting this message from python!")
"""
post = {"text": "{0}".format(text)}
try:
... | true |
4f0a23677c58823d58664a8551534dc4bab8188e | na-gi/UGATIT-Paddle | /dataset.py | UTF-8 | 17,231 | 2.671875 | 3 | [] | no_license | # import torch.utils.data as data
from PIL import Image
import os
import os.path
import numpy as np
from collections import OrderedDict
import cv2
import random
def has_file_allowed_extension(filename, extensions):
"""Checks if a file is an allowed extension.
Args:
filename (string): pa... | true |
8fd0813a7b8caf70882474f61e883a7570b855f1 | vaishu8747/practiseass2 | /3.py | UTF-8 | 114 | 3.46875 | 3 | [] | no_license | # FIND SECOND MAX ELEMENT IN AN ARRAY
arr=[10,20,30,4,45,50,5]
arr.sort()
print("second max element is:",arr[-2]) | true |
dce5c2023aa280e2df52b3386df20daf3fd4d2dc | rumman07/python | /IT210/stus.py | UTF-8 | 2,734 | 4.78125 | 5 | [] | no_license | '''This example defines a class called "Student", where each Student object
has attributes called first, last, techID, major, credits, and gpts.
Currently the only method in the class are the constructor (_init_), a method
to format some of the attribute value into a string (_str_), and a method to
compute GPA for ... | true |
84885c1eccb13912566f7a294781bd5e432977ff | jvsribeiro/aula | /atividade 5.py | UTF-8 | 243 | 3.734375 | 4 | [] | no_license | aluno1 = float(input('Digite a nota do 1° aluno'))
aluno2 = float(input('Digite a nota do 2° aluno'))
media= aluno1 + aluno2
print(f'O aluno 1 teve a nota {aluno1} o aluno 2 teve a nota {aluno2} a medias de ambos são {media / 2:.2}') | true |
9f124dc396fbbb357ee82fc62562056cb206a79e | pressplay21/Python | /#sum_of_2_elements.py | UTF-8 | 581 | 4.03125 | 4 | [] | no_license | #sum_of_2_elements.py
#Sum of 2 elements = 15
#Array is increasingly sorted
L = [1,2,3,4,5,7,9,12,15,18,20]
def sum2el(L,t):
global found
found = None
if len(L) >= 2: #need at least two elements
first,last = L[0],L[-1]
total = first + last
if total == t:
found = '{} + {}'.format(L[0],L[-1])
elif tota... | true |
bff76750a9aedc64b6c39fb83c765f8e54ff9bd1 | petervenables/fun-py | /word-ladder/test_graph.py | UTF-8 | 5,328 | 3.25 | 3 | [] | no_license | import pytest
from graph import Graph, Edge, Node
class TestNode:
def test_node_value(self):
node1 = Node("one")
assert "one" == node1.value
def test_node_compare(self):
node1 = Node("one")
node2 = Node("two")
assert node1 != node2
assert node1 == node1
de... | true |
c0113ed8d256e7263636fbe404171d675df1bb79 | dracor-org/pydracor | /pydracor/dracor.py | UTF-8 | 41,775 | 3 | 3 | [
"MIT"
] | permissive | import re
import warnings
from collections import defaultdict
from functools import lru_cache
import requests
class DraCor:
"""
Base class used to represent Drama Corpus entity.
DraCor consists of Corpora.
Attributes
----------
_base_url : str
a base API url
_sparql_url : str
... | true |
dd3b56ba961ef6728d13ba928f6045b1c7f7bb30 | alalion/codecademy | /number_guess.py | UTF-8 | 1,045 | 4.625 | 5 | [] | no_license | """
It is Number Guess game that rolls a pair of dice and asks the user to guess the sum. If the users guess is equal to the total value of the dice roll, the user wins!
"""
from random import randint
from time import sleep
def get_user_guess():
guess = int(input('Guess a number: '))
return guess
def roll_d... | true |
9454e4f581605757b7ea2f21b9fd7d36d4a08d37 | KenMercusLai/checkio | /checkio/Home/Xs and Os Referee/x_o_referee.py | UTF-8 | 1,153 | 3 | 3 | [
"MIT"
] | permissive | def checkio(game_result):
check_lines = []
# generate lines need to check
for row in range(3):
line = []
for col in range(3):
line.append((row, col))
check_lines.append(line)
for col in range(3):
line = []
for row in range(3):
line.append(... | true |
f55574a1d5a6328752c685208acb9f4b343a475d | smfried/imdbviz | /data/processdata.py | UTF-8 | 337 | 3.015625 | 3 | [] | no_license | import json
with open("items.json", "r") as f:
data = json.loads(f.read())
data_size = len(data)
for i in range(0, data_size):
while len(data[i]["title"]) > 1:
data[i]["title"].pop()
data[i]["country"] = filter(lambda a: a != "|", data[i]["country"])
with open('new_data.json', 'w') as outfile:
json.dum... | true |
f9916d731c4fc58d647fe0296e7008deed2eefc0 | ultracolde6/e6dataflow | /tools/fittools.py | UTF-8 | 3,118 | 2.515625 | 3 | [] | no_license | import numpy as np
from scipy.optimize import least_squares
from scipy.special import erf
import scipy.stats
def make_fit_param_dict(name, val, std, conf_level=erf(1 / np.sqrt(2)), dof=None):
pdict = {'name': name, 'val': val, 'std': std, 'conf_level': conf_level}
if dof is None: # Assume normal distribution... | true |
3f5df6e4636f284d9374a24f1c374fb374bcf901 | cristi161/eecvf | /Application/Jobs/blur_image.py | UTF-8 | 29,785 | 2.640625 | 3 | [
"MIT"
] | permissive | # noinspection PyPackageRequirements
import cv2
import numpy as np
from numba import jit
from Application.Frame.global_variables import JobInitStateReturn
from Application.Frame.transferJobPorts import get_port_from_wave, Port
from PIL import ImageFilter, Image
from Utils.log_handler import log_error_to_console
"""... | true |
4dea98617e9fbde0cf778c1f53b8cc780554ba5c | Quansight-Labs/numpy.net | /src/PythonUnitTests/ComplexNumberTests.py | UTF-8 | 1,608 | 3.453125 | 3 | [
"BSD-3-Clause"
] | permissive | import unittest
import numpy as np
from nptest import nptest
class ComplexNumbersTests(unittest.TestCase):
def test_F2C_1_COMPLEX(self):
fvalues = [0-1j, 12-1.1j, 45.21+45.3456j, 34+87j, 99.91+789J]
F = np.array(fvalues, dtype=np.complex)
print("Values in Fahrenheit degrees:")
p... | true |
34884172f53cbbd1db2a9365cdeda9cb987bfe6f | AbhilashBalaji/CompCoding | /Euler/16.py | UTF-8 | 142 | 3.265625 | 3 | [] | no_license | #lmaoo
def sumOfDigits(x):
sum = 0
for i in str(x):
# print(i)
sum+=int(i)
return sum
print(sumOfDigits(2**1000)) | true |
cb29988b35168ccaa7eb1c9285c07fa7db404d57 | sfilatov96/cifar10_gesture_prediction | /socket_client.py | UTF-8 | 713 | 2.5625 | 3 | [] | no_license | import json
import base64
import requests
import time
import os
from socket import *
PHOTOS_PATH = '/home/sfilatov96/vk_dataset/'
RATE = 0.01
def test_photo(photo_path):
print photo_path
file = open(photo_path, 'rb')
l = file.read()
print len(l)
sock = socket(AF_INET, SOCK_STREAM)
sock.connec... | true |
87b79abc17b266bac8aba26cf393c2f0c30b3948 | lpelczar/Algorithmic-Warm-Ups | /I-O/7_average_word_length.py | UTF-8 | 411 | 3.828125 | 4 | [] | no_license | """
Write a program that will calculate the average word length of a text stored in a file (i.e the sum of all the
lengths of the word tokens in the text, divided by the number of word tokens).
"""
import re
def avg_word_length(filename):
with open(filename) as f:
words = re.findall('\w+', f.read())
... | true |
050be7ea18a0ad3ed301b384b4ad732d4631da06 | jiangxinyang227/leetcode | /动态规划/121,买卖股票的最佳时机.py | UTF-8 | 1,312 | 4.21875 | 4 | [] | no_license | """
给定一个数组,它的第 i 个元素是一支给定股票第 i 天的价格。
如果你最多只允许完成一笔交易(即买入和卖出一支股票),设计一个算法来计算你所能获取的最大利润。
注意你不能在买入股票前卖出股票。
示例 1:
输入: [7,1,5,3,6,4]
输出: 5
解释: 在第 2 天(股票价格 = 1)的时候买入,在第 5 天(股票价格 = 6)的时候卖出,最大利润 = 6-1 = 5 。
注意利润不能是 7-1 = 6, 因为卖出价格需要大于买入价格。
示例 2:
输入: [7,6,4,3,1]
输出: 0
解释: 在这种情况下, 没有交易完成, 所以最大利润为 0。
"""
class Solution... | true |
03eab78d759eb433032adc9a6d262128f77db502 | liuluyang/openstack_mogan_study | /myweb/test/leetcode/str-medium/longest-uncommon-subsequence-ii.py | UTF-8 | 2,046 | 3.296875 | 3 | [] | no_license | #coding:utf8
class Solution(object):
def findLUSlength(self, strs):
"""
:type strs: List[str]
:rtype: int
"""
#nums = set()
# check = {}
# checked = ''
# for i in strs:
# length = len(i)
# if length not in check:
# ... | true |
31f873c8dd7becc75d6ddd3d4f8db2031466d757 | taisonmachado/Python | /Lista de Exercicios - Wiki_python/Listas/01.py | UTF-8 | 212 | 4.1875 | 4 | [] | no_license | #Faça um Programa que leia um vetor de 5 números inteiros e mostre-os.
vetor = []
i = 0
while i < 5:
vetor.append(int(input("Digite um número: ")))
i+=1
for num in vetor:
print(num, end=" ") | true |
4aa1b17b2e290ad900288df35eee5994372fbac4 | 15831944/HirHide | /Metric/Metric_Figure.py | UTF-8 | 8,393 | 2.53125 | 3 | [] | no_license | import numpy as np
from matplotlib import pyplot as plt
def excute():
figure1()
figure2()
def figure1():
plt.figure(figsize=(10, 4), dpi=120)
#plt.subplot(2,1,1)
plt.title("Results using CYC data sets as reference", fontsize=10)
plt.ylim(0.0,1.6)
plt.yticks(np.linspace(0.0,1.8,5,endpoint=Tru... | true |
6e8be58f6d23ca0b608a48d7fda86d913f21d657 | dr-dos-ok/Code_Jam_Webscraper | /solutions_python/Problem_158/850.py | UTF-8 | 1,224 | 2.6875 | 3 | [] | no_license | from __future__ import division
from cjlib.input import *
from cjlib.runner import TaskRunner, MPQRunner, DummyRunner
from itertools import permutations
import math
get("""4
2 2 2
2 1 3
4 4 1
3 2 3
3 3 3
4 2 2
4 4 2
2 3 3
4 2 4""")
"""
expected
GABRIEL
RICHARD
RICHARD
GABRIEL
GABRIEL
RICHARD
RICHARD
RICHARD
RICHARD
""... | true |
1a612f2c43695d010030434c1d1300798d7ffbb1 | BKIBONZI/PYTHON | /ex02/whois.py | UTF-8 | 390 | 3.5625 | 4 | [] | no_license | import sys
try :
if len(sys.argv) > 2 :
raise ValueError("bad number of arguments")
if len(sys.argv) == 2 :
nombre = int(sys.argv[1])
if int(sys.argv[1]) == 0 :
print("I'm Zero.")
elif int(sys.argv[1]) % 2 == 0 :
print("I'm Even.")
else :
... | true |
f332fb8663081f2b7452070f3f2ab437e6374dfc | rlagusgh0223/Python | /051.py | UTF-8 | 1,352 | 3.953125 | 4 | [] | no_license | class MyClass:
def sayHello(self):
print('안녕하세요')
def sayBye(self,name):
print('%s! 다음에 보자!'%name)
obj = MyClass()
obj.sayHello()
obj.sayBye('철수')
###########################
class MyClass:
#def __init__(self):
# self.var='안녕하세요!'
# print('MyClass 인스턴스 객체가 생성되었습니다.')
def __... | true |
9b0ac25ffd0efc279335d6667909b0823ec25773 | fengges/teacher | /qingxi.py | UTF-8 | 352 | 2.703125 | 3 | [] | no_license |
from teacher.util.mysql import *
mysql=Mysql()
list=mysql.select()
t=0
f=open('text.txt','w+')
for l in list:
it={}
it['id_paper_left']=l[1]
it['id_paper_right']=l[2]
item=mysql.selectItem(it)
le=len(item)
t+=1
# print(le)
for i in range(1,le):
print(i)
temp=str(item[i]... | true |
37d9ed5bd77bc931d3ff3ecbd806242672f8ae9d | wattaihei/ProgrammingContest | /AtCoder/ABC-D/015probD.py | UTF-8 | 573 | 2.640625 | 3 | [] | no_license | import sys
input = sys.stdin.readline
W = int(input())
N, K = map(int, input().split())
AB = []
for _ in range(N):
a, b = map(int, input().split())
AB.append((a, b))
dp = [0 for _ in range((W+1)*(K+1))]
for i in range(N):
a, b = AB[i]
dp_n = [0 for _ in range((W+1)*(K+1))]
for k in range(K):
... | true |
821e8b054772553da102e87896d2506aa949fd84 | Gawaboumga/PyMatex | /tests/node/Exponentiation.py | UTF-8 | 1,527 | 3.015625 | 3 | [
"MIT"
] | permissive | from tests import BaseTest
from pymatex.node import Addition, Constant, Division, Exponentiation, Multiplication, Subtraction, Variable
class ExponentiationTests(BaseTest.BaseTest):
def test_read_normal_exponent(self):
ast = self.parse('x^{2}')
self.assertEqual(ast, Exponentiation(Variable('x'),... | true |
8c17fd558ca29afe961ae79cb585aa02e1ce609f | bambrow/python-programming-notes | /class_basics/01_intro_class.py | UTF-8 | 890 | 3.859375 | 4 | [] | no_license | #!/usr/bin/env python
# coding:utf-8
class Student(): # Python 2: class_basics Person(Object):
"""
Define a student.
"""
def __init__(self, name, age, sex, id_num):
self.__name = name # private variable
self.__age = age
self.__sex = sex
self.__id = id_num
def get_n... | true |
fda55a0ff4495dcf4ecdf489104e37c665bca453 | RasaHQ/rasa | /rasa/engine/exceptions.py | UTF-8 | 437 | 2.5625 | 3 | [
"LicenseRef-scancode-generic-cla",
"Apache-2.0",
"MIT"
] | permissive | class GraphRunError(Exception):
"""Exception class for errors originating when running a graph."""
class GraphComponentException(Exception):
"""Exception class for errors originating within a `GraphComponent`."""
class GraphSchemaException(Exception):
"""Represents errors when dealing with `GraphSchema`... | true |
10121310b01d62aa0f67d8a8ebbdc46db011d966 | Solm0111/CPE695G16_Py | /Code/data.py | UTF-8 | 875 | 2.828125 | 3 | [] | no_license | import pandas as pd
from prmethod import Reader
df = Reader.get_from_data('charts.csv')
df_with_trend = df.groupby(['artist', 'song'])['rank'].apply(list)
df_with_trend = df_with_trend.reset_index()
df_with_trend.rename(columns={'rank': 'trend'}, inplace=True)
df_with_trend.insert(3, 'total_weeks', 0)
df_with_trend.... | true |
04e2ce771c3ae150c288c4323c0834b456c20563 | ktindiana/operational-sep | /read_in_data_standalone.py | UTF-8 | 14,780 | 2.765625 | 3 | [] | no_license | #This is a program that shows how to read in data using read_datasets.py
#The goal of this program is to get the data into arrays that are easily
#used for other purposes.
#Also some plotting code
#CODE EXPECTS THERE TO BE A data/ DIRECTORY
#K. Whitman 2022-02-02
from library import read_datasets_standalone as datas... | true |
87ab402bde39e9e0a7f92ba12fe50755bfcc3ea0 | GhostDovahkiin/Introducao-a-Programacao | /08-Exercício-Aula-8/Lista-3/Fly.py | UTF-8 | 798 | 3.359375 | 3 | [] | no_license | import FlyLib
sim = 'sim'
totalrecife = 0
valor = []
for i in range(5):
while sim == 'sim':
dest = str.lower(input("Digite seu destino: "))
turn = str.lower(input('Digite seu turno: '))
d = FlyLib.validaDadosVoo(dest, turn)
if d == True:
v = FlyLib.calculaValorVoo(dest, t... | true |
85a43e7452e2a2da25d8dfa650f22232028c58a1 | southpush/python | /exercises/protein-translation/protein_translation.py | UTF-8 | 928 | 2.953125 | 3 | [
"MIT"
] | permissive | protein_dict = {
'AUG': 'Methionine',
"UUU": 'Phenylalanine',
'UUC': 'Phenylalanine',
'UUA': 'Leucine',
'UUG': 'Leucine',
'UCU': 'Serine',
'UCC': 'Serine',
'UCA': 'Serine',
'UCG': 'Serine',
'UAU': 'Tyrosine',
'UAC': 'Tyrosine',
'UGU': 'Cysteine',
'UGC': 'Cysteine',
... | true |
95af6dcf5fe28fb3c543cd0f3bc19083616a71e1 | LIAMF-USP/deep_active_learning | /model/input_pipeline.py | UTF-8 | 5,840 | 3.015625 | 3 | [
"MIT"
] | permissive | import tensorflow as tf
class SentimentAnalysisDataset:
def __init__(self, data, batch_size, perform_shuffle, bucket_width, num_buckets):
self.data = data
self.batch_size = batch_size
self.perform_shuffle = perform_shuffle
self.bucket_width = bucket_width
self.num_buckets ... | true |
71d67dab680cd048ab36f196e21c13257a3322b3 | zyall/demo | /Downloads/PycharmProjects/untitled/py/py04.py | UTF-8 | 3,104 | 3.171875 | 3 | [] | no_license | #!/usr/bin/env python3
#coding=utf-8
import random
HANGMANPICS = ['''
+---+
| |
|
|
|
|
=========''', '''
+---+
| |
O |
|
|
|
=========''', '''
+---+
| |
O |
| |
|
|
=========''', '''
+---+
| |
O |
/| |
|
|... | true |
3eddf8497b16d470d48457940d5899f9ddea3366 | WoodenBackpack/book-python | /oop-advanced/src/oop-repr.py | UTF-8 | 649 | 3.3125 | 3 | [
"MIT"
] | permissive | class Astronaut:
def __init__(self, name, agency='NASA'):
self.name = name
self.agency = agency
def __str__(self):
return f'My name {self.name}'
def __repr__(self):
return f'Astronaut(name="{self.name}", agency="{self.agency}")'
jose = Astronaut(name='José Jiménez', agenc... | true |
a2a92db942d40ec8a084a66712df0f505cc8c841 | sheldoan/scrapism-assn3 | /face_similarity.py | UTF-8 | 1,196 | 3.078125 | 3 | [] | no_license | import face_recognition
from glob import glob
import csv
csv_file = open('similarity.csv', mode='w')
csv_writer = csv.writer(csv_file, delimiter=',', quotechar='"', quoting=csv.QUOTE_MINIMAL)
csv_writer.writerow(['image','similarity'])
folder_path = 'big_images/'
similarity_list = []
count = 0
for image_name in sort... | true |
ca4fb4045d0ec136ebe085283d1d28f2b327ced7 | airatk/kaishnik-bot | /bot/platforms/vk/commands/schedule/utilities/keyboards.py | UTF-8 | 4,949 | 2.578125 | 3 | [
"MIT"
] | permissive | from typing import List
from typing import Dict
from typing import Union
from datetime import date
from datetime import timedelta
from vkwave.bots.utils.keyboards import Keyboard
from vkwave.bots.utils.keyboards import ButtonColor
from bot.platforms.vk.utilities.keyboards import menu_button
from bot.utilities.types... | true |
28d80d456e60066de234d330a14b9de9b53b98e9 | meme-vengeance/btm-twitter-bot | /main.py | UTF-8 | 1,626 | 3.265625 | 3 | [] | no_license | import time
import tweepy
from TextSpamBot import TextSpamBot
def read_credentials(fname='credentials.txt'):
"""Reads a file for a list of credentials. Each set of four lines in the
file must contain the items:
CONSUMER_KEY
CONSUMER_SECRET
ACCESS_KEY
ACCESS_SECRET
:param fn... | true |
347b87bb31769d7996a2dde652278a482fa79162 | tranphibaochau/LeetCodeProgramming | /Medium/LinkedList.py | UTF-8 | 2,710 | 4.125 | 4 | [] | no_license | class ListNode:
def __init__(self, val):
self.val = val
self.next = None
class MyLinkedList:
def __init__(self):
"""
Initialize your data structure here.
"""
self.head = None
def get(self, index):
"""
Get the value of the index-th no... | true |
b828e91892e601c7b41320504d104f5e5e1b282b | aiorhiroki/farmer | /farmer/ncc/models/mobilenetv2.py | UTF-8 | 11,859 | 2.546875 | 3 | [
"Apache-2.0"
] | permissive | import os
import tensorflow as tf
from tensorflow.python.keras import backend
from tensorflow.python.keras.models import Model
from tensorflow.python.keras import layers
from tensorflow.python.keras.layers import Input
from tensorflow.python.keras.layers import Activation
from tensorflow.python.keras.layers import Add... | true |
20805d0a309a2ae470077e9d642565d38875b383 | wingspeng/quantpf | /scra/hk_stock_list/hk_stock_list/spiders/hk_stock_list.py | UTF-8 | 1,892 | 2.734375 | 3 | [] | no_license | import scrapy
from scrapy.selector import Selector
from hk_stock_list.items import HkStockListItem
class HkListSpider(scrapy.Spider):
name = "hk_stock_list"
start_urls = ["http://sc.hkex.com.hk/TuniS/www.hkex.com.hk/chi/market/sec_tradinfo/stockcode/eisdeqty_c.htm"]
def parse(self,response):
# 从当前... | true |
2f710a1118fc3e87803aade406fa8bdf3e1bf3b3 | genestack/task-library | /genestack/core_files/dictionary_file.py | UTF-8 | 3,982 | 2.671875 | 3 | [
"MIT"
] | permissive | # -*- coding: utf-8 -*-
from genestack.compression import gzip_file, decompress_file
from genestack.core_files.genestack_file import File
from genestack.frontend_object import StorageUnit
from genestack.genestack_exceptions import GenestackException
from genestack.java import java_object, JAVA_LIST
from genestack.meta... | true |
292a334d0403ac8e05405bfd5d33d96d95405d33 | OCR-D/ocrd_typegroups_classifier | /ocrd_typegroups_classifier/data/qloss.py | UTF-8 | 1,451 | 3.25 | 3 | [
"Apache-2.0"
] | permissive | from io import BytesIO
from PIL import Image
from random import randint
class QLoss(object):
""" Quality loss-based data augmentation method compatible with PyTorch.
Applied a random JPEG compression to the input PIL image. By default,
the quality is between 1 and 100.
"""
def __i... | true |
4956b934dd21a9a26caf8b50eab7956deca19f15 | iModesten/Simple.Tic-Tac-Toe | /Topics/Split and join/CapWords/main.py | UTF-8 | 98 | 3.15625 | 3 | [] | no_license | words = input().split('_')
cap_words = [word.title() for word in words]
print(''.join(cap_words))
| true |
8a9e02b683353bd3df945b9587a82356638b12d3 | NaldoHoracio/tcc_codes | /compare_methods/compare_methods_al.py | UTF-8 | 82,259 | 2.640625 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Título: Comparação de métodos de KDD em dados de Alagoas
@author: edvonaldo
"""
import os
import csv
import math
import random
import numpy as np
import pandas as pd
import datetime as dt
import matplotlib.pyplot as plt
# Funções úteis
# Tempo de execução
def seconds_transform(seconds_tim... | true |
a8c7cddc8395f7d41a7a65cb336f7d52cf06ed16 | bradenmacdonald/astrodendro | /astrodendro/test/test_hdf5.py | UTF-8 | 2,018 | 2.75 | 3 | [
"MIT"
] | permissive | import unittest
from astrodendro import Dendrogram
from astrodendro.components import Branch
import numpy as np
import os
class TestHDF5(unittest.TestCase):
def setUp(self):
n = np.nan
self.data = np.array([[[n,n,n,n,n,n,n,n],
[n,4,n,n,n,n,n,n],
... | true |
c9ff4d7d67f7b594824b0641772ce018f61c0cca | tangtao1999/A_mypy | /机器学习/过拟合2.py | UTF-8 | 941 | 2.59375 | 3 | [] | no_license | from sklearn.datasets import load_digits
import numpy as np
import matplotlib.pyplot as plt
from sklearn.learning_curve import validation_curve # 画图找出最好的参数
from sklearn.svm import SVC
digits = load_digits()
X = digits.data
y = digits.target
param_range = np.logspace(-6, -2.3, 5)
train_sizes, train_loss, test_loss = ... | true |
e0738244e3e89867cd8f4c848de5e12aae0653d8 | 200202iqbal/game-programming-a | /Paiza/D028.py | UTF-8 | 152 | 3.15625 | 3 | [] | no_license | n = input()
nInt = int(n)
rule = nInt>= 1 and nInt<=10000 and type(int)
if(rule):
a = 0
for i in n:
a +=1
print(a)
| true |
d8b7bc005f3e88b943d9b60be48b5ed60f8066c3 | darshan-gandhi/Hackkerank | /sumofsubsets.py | UTF-8 | 196 | 3.125 | 3 | [] | no_license | n=int(input())
s=[]
for i in range(n):
s.append(int(input()))
print(s)
count=0
d=0
for i in range(len(s)):
sum1=0
sum1=sum(s[i:])
if d==sum1:
count=count+1
print(count+1)
| true |
40d5b8e167566a6b141911a5e3ecc5f15050d98f | ashishgupta2014/problem_solving_practices | /hacker_rank_rest_api.py | UTF-8 | 1,044 | 3.078125 | 3 | [] | no_license | import requests
def getHomeTeam(team, year, page=1):
response = requests.get("https://jsonmock.hackerrank.com/api/football_matches?year={year}&team1={team}&page={page}".format(year=year, team=team, page=page)).json()
score=0
for i in response['data']:
score += int(i['team1goals'])
if response[... | true |
e722379cd97b7e1d0f3523c4d271bf093bb79e61 | AdamZhouSE/pythonHomework | /Code/CodeRecords/2534/60785/263555.py | UTF-8 | 188 | 3.046875 | 3 | [] | no_license | List = input().strip('[|]').split('],[')
pairs = [[int(i) for i in element.split(",")] for element in List]
lxy =[]
for i in pairs:
for j in i:
lxy.append(j)
print(sorted(lxy)) | true |
09752753176394739a53672e6f86c75ebf1ad9f4 | su-danny/famdates | /common/templatetags/utils.py | UTF-8 | 1,122 | 3.15625 | 3 | [] | no_license | from django.template import Library
register = Library()
@register.filter
def get_range(value):
"""
Filter - returns a list containing range made from given value
Usage (in template):
<ul>{% for i in 3|get_range %}
<li>{{ i }}. Do something</li>
{% endfor %}</ul>
Results with the HTML:
... | true |
d5fc4997a6f314c87c41f71e5f49570a2d7f7aa3 | devnandito/python3 | /json1.py | UTF-8 | 321 | 3.234375 | 3 | [] | no_license | import urllib.request, urllib.parse, urllib.error
import json
url = input('Enter location:')
data = urllib.request.urlopen(url).read()
info = json.loads(data)
print('Count:', len(info['comments']))
add = 0
for item in info['comments']:
add = add + int(item['count'])
# print(item['name'])
print ('Sum: ', add... | true |
9b4a8af805ca578a3bcdc4f25a57a886914fdb51 | Yanshang1991/colabProject | /crnn_model/converter/NoiseMaker.py | UTF-8 | 6,763 | 2.859375 | 3 | [] | no_license | import os
import wave
import numpy as np
import random
import time
import utils.file_utils as fu
import utils.time_utils as tu
class NoiseMaker:
"""
为wav文件增加噪声
"""
def __init__(self, noise_dir = r""):
"""
构造方法
:param noise_dir: 噪声的wav文件所载的目录。会遍历目录、子目录下的所有wav文件
"""
... | true |
d9105f624021f23865e05c66d4933e979f161e05 | sha314/Alarming | /main/tests/b.py | UTF-8 | 846 | 3.484375 | 3 | [] | no_license | import tkinter as tk
# input format hhmmss
# example 2h3m5s
def decode_to_hms(s):
"""
Decode string to hour minute second
"""
s = s.replace(" ", "")
a = s.split('h')
hr=a[0]
b = a[1].split('m')
mn=b[0]
sec=b[1].split('s')[0]
print(s)
return hr,mn,sec
def timer_clicked():
print("button liecked")
entered_v... | true |
7fd462889941ac12311f0cdab2ceda99cea47811 | Charifou/RBFN-python | /src/clustering_spectral.py | UTF-8 | 607 | 2.640625 | 3 | [] | no_license | import numpy as np
points = np.load("points.npy")
from sklearn.cluster import SpectralClustering
sc = SpectralClustering(n_clusters = 101, assign_labels="discretize")
max_points = 10000
sc.fit(points[:max_points])
print(max(sc.labels_))
labels = sc.labels_
centroids = []
empty = []
for i in range(100):
if la... | true |
d7ab7338a33c3cf4a762153d520e0c1a13d0592e | ambanum/social-networks-graph-generator | /graphgenerator/data_cleaning/export.py | UTF-8 | 3,645 | 2.71875 | 3 | [] | no_license | import pandas as pd
from graphgenerator.config import column_names
from graphgenerator.config.config_export import (
nodes_columns_metadata,
edges_columns_metadata,
edges_columns_export,
nodes_columns_export,
)
def merge_positions2nodes(position, nodes, dim):
"""
Merge positions data calculate... | true |
6be2b684c6b3c0937bf05a759e9d2231ae761bab | YaAk2/DeepfakeDetection | /Experiments_DFirt/data_utils.py | UTF-8 | 1,226 | 2.640625 | 3 | [
"MIT"
] | permissive | import pandas as pd
import torch
from torchvision import transforms, datasets
import torch.utils.data as data
class DFirt(data.Dataset):
def __init__(self, path):
super().__init__()
self.data = datasets.ImageFolder(path, transform=transforms.Compose([transforms.Resize((256, 256)), transforms.ToTen... | true |
f13324e21995fb8755919cc8acde7cec83768e40 | Yussuf101/Simple_Game_text | /cn_game.py | UTF-8 | 1,583 | 3.1875 | 3 | [] | no_license | from cn_game_extras import qa_until, type_print
from nigel import play_yellow_section
from yussuf import play_green_section
from jarrod import play_blue_section
from kat import play_purple_section
player_is_alive = True
playing_game = True
player_name = ""
#Game play loop
while playing_game :
#Ann... | true |
60b96833acb0b2c7115b22a169e4fdc1e9eefd25 | Deepak2478/PythonEssentials | /QuickStart/associativeDictionary.py | UTF-8 | 160 | 3.03125 | 3 | [] | no_license | def main():
d = {'one':1,'two':2,'three':3,'four':4,'five':5}
for k in sorted(d.keys()):
print(k,d[k])
if __name__ == "__main__":main() | true |
8a12a6a95bf0688847b933bdaa148ab5fcf7ee85 | magiciiboy/kdd2010 | /kdd.py | UTF-8 | 1,360 | 2.59375 | 3 | [] | no_license | #!/usr/bin/python
import sys, getopt
from main.extract_data import *
def main(argv):
input_file = ''
output_file = ''
do_extract = True
task = ''
try:
opts, args = getopt.getopt(argv,"hsi:o:",["ifile=","ofile="])
except getopt.GetoptError:
print 'extract_data.py -i <inputfile... | true |
183449cd8a3c0b79d3f2f7765dcf5f6f9e48ea25 | ohduran-attempts/PythonChallengeDotCom | /PC05.py | UTF-8 | 218 | 2.75 | 3 | [] | no_license | import urllib2
import pickle
response = urllib2.urlopen('http://www.pythonchallenge.com/pc/def/banner.p')
banner = pickle.load(response)
for lst1 in banner:
line = [c*no for c,no in lst1]
print "".join(line)
| true |
eff726a107782436fccef7e4ccfdb8865a91b431 | MasatakaShibataSS/lesson | /ドキュメント/segment.py | UTF-8 | 254 | 2.53125 | 3 | [] | no_license | import RPi.GPIO as GPIO
GPIO.setmode(GPIO.BCM)
GPIO.setup((23,18,15,24,25,7,8,14),GPIO.OUT)
GPIO.output((23,18,15,24,25,7,8,14),GPIO.LOW)
ssg = {'A':23, 'B':18, 'C':15, 'D',:24, 'E':25, 'F':7, 'G':8, 'DP':14}
GPIO.output(ssg['A'], 1)
GPIO.cleanup()
| true |
75bbbe96055f0acbdcaa084ff0b6a402062e10ef | faridaatei/python | /python/amina.py | UTF-8 | 242 | 3.09375 | 3 | [] | no_license | def welcome_student(name):
welcome_str="Hi{} welcome to Akirachix"
return welcome_str.format(name)
name=input("enter student_name:")
print(welcome_student (name))
print(welcome_student("farida"))
print(welcome_student("mary"))
| true |
76d62173ef1eaf6c44ca40393fb6824156e70950 | ocozalp/Algorithms | /tests/search/dls_test.py | UTF-8 | 3,420 | 3.1875 | 3 | [
"Apache-2.0"
] | permissive | from unittest.case import TestCase
from common.data_structures import Node
from search.uninformed_search import dls
class DepthLimitedSearchTest(TestCase):
@staticmethod
def prepare_tree1():
node = Node()
node.value = '1'
node2 = Node()
node2.value = '2'
node.add_chil... | true |
3600f959e3f651038e4b8cc4764fdf3f00a868ac | Purk-coder/CP3-Thanadej-Chokasut | /Exercise4_Thanadej_P.py | UTF-8 | 215 | 2.90625 | 3 | [] | no_license | F = 85.5
G = 70.0
I = 50.5
C = 50.0
print("--- Your Score---")
print("Foundation English " , F )
print("General Business", G)
print("Introduction to Computer Systems", I)
print("Computer Programming", C)
| true |
6c9100f355a9c31bcdbe0250efd20a7693069661 | serdush/Django21.12 | /Lec7/blog/tests.py | UTF-8 | 2,306 | 2.890625 | 3 | [] | no_license | from django.test import TestCase
from django.urls import reverse
from .models import Post
from django.contrib.auth import get_user_model # Функция, возвращающая
# модель текущего пользователя
# Create your tests here.
class BlogTests(TestCase):
def setUp(self):
... | true |
8beeab2de2ae5f279417cc9879390ea955d6b1db | johnbomba/lecture-nov-19 | /modules/test.py | UTF-8 | 470 | 2.640625 | 3 | [] | no_license | from app.controller import addtwo
from app import repeatstring
# repeat string is defined in app's __init__.py, things defined in that special file
# act as if they existed in a file called app.py
assert addtwo(5,3) == 8, "addtwo should return the sum of two arguments"
assert repeatstring("Ok ") == "Ok Ok ", "repeats... | true |
d8fbbdff5c3ef7925213e2466ef7c78a3d996396 | StasyaZlato/Home-Work | /kursach_ind_korpus/2.py | UTF-8 | 2,184 | 2.640625 | 3 | [] | no_license | import re
with open('kbbi_kak_zhe_ia_s_nim_zadolbalas.txt', 'r', encoding='utf-8') as f:
dictionary_prev = f.readlines()
regex = re.compile(' / (\w{1,4}) /')
dict_plain = {}
dict_transform = {}
for line in dictionary_prev:
if re.search(regex, line) is not None:
line = line.strip()
line = line.r... | true |
4669780e0b0770aedafced6745cacabcd7c96c49 | gburt/dedupe | /examples/sqlite_example/create_db.py | UTF-8 | 4,829 | 2.515625 | 3 | [
"LicenseRef-scancode-unknown-license-reference",
"MIT"
] | permissive | import sqlite3
import csv
from AsciiDammit import asciiDammit
conn = sqlite3.connect("illinois_contributions.db")
c = conn.cursor()
print 'importing raw data from csv...'
c.execute("DROP TABLE IF EXISTS raw_table")
c.execute("DROP TABLE IF EXISTS donors")
c.execute("DROP TABLE IF EXISTS recipients")
c.execute("DROP T... | true |
7d2801d261be23e2bd265e9fc5270c82f3be4213 | Ovsienko023/Tasks-from-Stepik-Coursera | /Stepik/API_interesting_numb/API_interesting_numb.py | UTF-8 | 698 | 3.234375 | 3 | [] | no_license | import requests
import sys
def intrest_num(numb):
api_url = 'http://numbersapi.com/{}/?'
params = {'trivia': 'trivia', 'default': 'None'}
res = requests.get(api_url.format(numb), params=params)
data = res.content
if data != b'None':
print("Interesting")
else:
intrest_num_2(numb... | true |
c332453d44cad1cfcabc64d0b057326c461e46ed | shellyfung/tools | /path_and_files.py | UTF-8 | 1,074 | 3 | 3 | [] | no_license |
import os
def get_file_path(file_path):
file_paths = []
root_dir = os.walk(file_path)
for sub_dir, folder_name, file_list in root_dir:
for file_name in file_list:
file_path = os.path.join(sub_dir, file_name)
file_paths.append(file_path)
file_paths = sorted(file_paths)... | true |
6cdacb6826c3ab3de6de0490921635070de42271 | rafaelperazzo/programacao-web | /moodledata/vpl_data/173/usersdata/354/82138/submittedfiles/moedas.py | UTF-8 | 175 | 3.5 | 4 | [] | no_license | # -*- coding: utf-8 -*-
a=int(input('digite o a(a>0): '))
b=int(input('digite o b(b>0): '))
c=int(input('digite o c(c>0): '))
if c%a==0 and c%b==0:
print(a)
print(b)
| true |
ad000a02d8c7b997c0182e677dabe3fa8f70926d | saaruuna/ot-harjoitustyo | /src/components/trap.py | UTF-8 | 826 | 3.9375 | 4 | [] | no_license | import pygame
from load_image import load_image
class Trap(pygame.sprite.Sprite):
"""A class which creates a trap to display in the game.
Attributes:
image: The image to be displayed as a trap.
rect: The shape pygame will display as a trap.
rect.x: The x-coordinate of the trap.
... | true |
0d6f52c76b93b0aab9a2e14c162883c02ab7267e | Aslan934/recipe-app-api | /core/tests/test_admin.py | UTF-8 | 1,936 | 2.8125 | 3 | [] | no_license | from django.test import TestCase
from django.contrib.auth import get_user_model
from core import models
def sample_user(email='test@londonappdev.com', password='testpass'):
"""Create a sample user"""
return get_user_model().objects.create_user(email, password)
class TestModels(TestCase):
def test_c... | true |
9a0502f6c870852f3e4ab4c2b550df140072f30e | priyankakumbha/python | /day7/test8.py | UTF-8 | 87 | 2.765625 | 3 | [] | no_license | x = {10, 20, 40, 50, 3000, 55, 65}
print(x)
x.update({'abc', 'test', 56, 33})
print(x)
| true |
cadb728dc884fe9a28d0f2e1b8ee02d4457e3b3a | aliseforlgh/first | /first/first.py | UTF-8 | 479 | 2.8125 | 3 | [] | no_license | import sys
from PyQt5.QtWidgets import QApplication, QMainWindow
class FirstMainWindow(QMainWindow):
def __init__(self):
super(FirstMainWindow, self).__init__()
self.resize(400,300)
self.status = self.statusBar()
self.status.showMessage('五秒钟的记忆',5000)
if __name__ == '__main__':... | true |
859c9d26475bff57d4d69cf298bcfbe6da0a6055 | HandsomeLuoyang/Algorithm-books | /力扣/竞赛/周赛/193周赛/5437. 不同整数的最少数目.py | UTF-8 | 900 | 2.921875 | 3 | [] | no_license | class Solution:
def findLeastNumOfUniqueInts(self, arr: list, k: int) -> int:
if k >= len(arr):
return 0
count_list = []
visited = set()
for i in arr:
if i in visited:
continue
count_list.append(arr.count(i))
... | true |
167006240fc291f026da84d0a2bcdac41305fe2e | shanscendent/adventofcode2019 | /Day 7/day5pavelow.py | UTF-8 | 2,171 | 3.4375 | 3 | [] | no_license | import copy
program = []
with open("Day 5/input.txt") as f:
program = f.read().split(",")
program = list(map(int, program))
def Run(program):
pc = 0 #Program counter
while True:
pc_old = pc
#extract Opcode and Mode
opcode = int(str(program[pc])[-2:])
mode = "000"
... | true |
3e38c97910930b93c92ed4d2a7ab55f5306946f9 | leiurus17/NBSVM-1 | /preprocessing.py | UTF-8 | 2,374 | 3.15625 | 3 | [] | no_license | from nltk.corpus import stopwords
import pandas as pd
import numpy as np
def create_bow(sentence, vocab_list, gram):
word_list = tokenize(sentence, gram)
bow = np.zeros(len(vocab_list))
for word in word_list:
bow[vocab_list[word]] = 1
return bow
def rm_stopwords(word_list):
retur... | true |
67858aac3a10d55c8f963090fb34287fb231fddc | code-in-the-schools/Class_SanaaM | /main.py | UTF-8 | 295 | 3.46875 | 3 | [] | no_license | class FavorieCharacter:
name = ""
personalitytraits = ""
height = ""
tv = []
for r in range(3):
f = FavorieCharacter
f.name = int(input("name?"))
f.personalitytraits = int(input("personalitytraits?"))
f.height = int(input("height?"))
for r in range(3):
print(tv[r].name)
| true |
08a795d4f1c6883efe16554282562c0b1308c9f1 | shamrin/sitewatch | /sitewatch/__init__.py | UTF-8 | 3,723 | 3.28125 | 3 | [
"Apache-2.0"
] | permissive | """Watch web pages and send reports to Postgres (via Kafka)"""
import sys
from datetime import datetime
import logging
import trio
import trio_asyncio
import httpx
from . import kafka
from . import db
from .model import Report, Page, ValidationError, ParseError
from .context import pageid_var
from .log import init_l... | true |
4e4acd527173f297d966dc31a582899703322c6e | Strivema/python_study | /com/ray/algorithm/fibo.py | UTF-8 | 320 | 3.28125 | 3 | [] | no_license | # -*- coding:utf-8 -*-
# @Author: Marie
# @Time: 2019/7/12 19:18
# @Software: PyCharm
def fib(num, temp={}):
if num in (1, 2):
return 1
try:
return temp[num]
except KeyError:
temp[num] = fib(num - 1) + fib(num - 2)
return temp[num]
if __name__ == '__main__':
print(fib(3))
| true |
4cebad3d0e82fb6373d9547b3b172e622d6ce23f | 30nt/IntroPython_16_07_21 | /test.py | UTF-8 | 1,020 | 3.53125 | 4 | [] | no_license | persons = [{"name": "John", "age": 15},
{"name": "JohnSilver", "age": 15},
{"name": "Jack", "age": 45},
{"name": "JackDaniels", "age": 95}]
# ages = [person["age"] for person in persons]
# len_names = [len(person["name"]) for person in persons]
# min_age = min(ages)
# max_len_name = ma... | true |
819b893ceb29c00a7737b9c4596ba7d95c44583f | krasnykh-polina/python_for_analytics | /hw1.py | UTF-8 | 147 | 3.5625 | 4 | [] | no_license | FIO = 'Красных Полина Геннадьевна'
for item in FIO:
print(item)
def in_euro (dollar):
return round(dollar/1.17, 2)
dollar = 100
print(in_euro(dollar))
| true |
76622788722be3cc2bff92780a53cae73d8d7c50 | lucasmbrute2/Blue_mod1 | /Aula10/Exercicio02.py | UTF-8 | 993 | 4.28125 | 4 | [] | no_license | # 2 - Faça um programa que leia nome e altura de várias pessoas, guardando tudo em uma lista,
# depois do dado inserido, pergunte ao usuário se ele quer continuar, se ele não quiser pare o
# programa. No final mostre:
# # Quantas pessoas foram cadastradas
# # Mostre a maior altura
# # Mostre a menor altura
total = 0
... | true |