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 |
|---|---|---|---|---|---|---|---|---|---|---|
5857847f9c6e83c3a9110d6f841260ce3b8532ff | exemplos/criptografia-rsa | /criptografar_rsa.py | UTF-8 | 1,397 | 3.671875 | 4 | [] | no_license |
tabela = {'a': 1, 'b': 2, 'c': 3, 'd': 4, 'e': 5, 'f': 6, 'g': 7, 'h': 8, 'i': 9, 'j': 10, 'k': 11, 'l': 12, 'm': 13, 'n': 14, 'o': 15, 'p': 16, 'q': 17, 'r': 18, 's': 19, 't': 20, 'u': 21, 'v': 22, 'w': 23, 'x': 24, 'y': 25, 'z': 26}
tabela_inv = dict((v,k) for k,v in tabela.items())
def converter(palavra):
res... | true |
5a9200c5acaeae129b945ee26e05e669eeb0180b | marcelinorc/semantic-recovery | /semantic_codec/corruption/corruption.py | UTF-8 | 9,003 | 3 | 3 | [] | no_license | import random
import math
import json
import sys
from semantic_codec.architecture.bits import Bits, BitQueue
from semantic_codec.architecture.capstone_instruction import CAPSInstruction
from semantic_codec.architecture.instruction import Instruction
class InstructionEncoder(json.JSONEncoder):
def default(self, ... | true |
3121e897cc60934153124006dea78bc6e777825b | VanczaTiti/ontanulo_robot | /dobas.py | UTF-8 | 2,465 | 3.125 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Egy egyszerű szimulációja a robotnak.
@author: Titi
"""
import math
l= 0.05 # a kar hossza (a forgás középpont és a golyó tömegközéppontjának távolsága) [m]
A=80 # a kar végének szöge: 0-> egyenes ród 90-> golyóval érintkező egyik lap merőleges a sugárra
fi_0 = 0*math.pi/6 #a ka... | true |
8ff8eeb8953a4abcd81fde85a79b64d41ca0334c | VitBomm/CSC | /Module1/Bai4/4_6.py | UTF-8 | 237 | 3.1875 | 3 | [] | no_license | dtb = eval(input("Nhập điểm trung bình: "))
if dtb > 8:
loai = "Giỏi"
elif dtb > 6.5:
loai = "Khá"
elif dtb > 5.0:
loai = "Trung Bình"
elif dtb > 0:
loai = "Yếu"
print("Xếp loại học sinh: %s" % (loai)) | true |
49578056f606280dfa2218085d5e3d2432dac621 | sqayum/StudyGroups | /StudyGroupNotes/Extra/dashboards.py | UTF-8 | 2,103 | 3.3125 | 3 | [] | no_license | #####################################################
### Creating Dashboards with Python - Plotly Dash ###
#####################################################
# Import libraries
import dash
import dash_core_components as dcc
import dash_html_components as html
import pandas as pd
import plotly.graph_objs as go
from... | true |
aa6628f3079dbb6d6fe000fa7ae41cab8630eb73 | netz39/automate-spendenquittungen | /donorsjson.py | UTF-8 | 331 | 2.734375 | 3 | [] | no_license | import sys
import json
donors = dict()
donors['year'] = sys.argv[1]
donors['donors'] = []
lines = sys.stdin.readlines()
for i in range(0, len(lines), 4):
d = dict()
d['name'] = lines[i]
d['address'] = ''.join(lines[i+1:i+3])
donors['donors'].append(d)
json.dump(donors, sys.stdout, indent=4, ensure_as... | true |
c11c9e5e3422092949628fb803b089dfc37ceb03 | chizhang529/traffic-sign-classifier | /model.py | UTF-8 | 2,918 | 2.515625 | 3 | [] | no_license | import tensorflow as tf
from tensorflow.contrib.layers import flatten
def model(x, keep_prob):
mu = 0
sigma = 0.1
# 1x1x3 conv (in: 32x32x3, out: 32x32x3)
conv1_W = tf.Variable(tf.truncated_normal(shape=(1, 1, 3, 3), mean = mu, stddev = sigma), name="con1_W")
conv1_b = tf.Variable(tf.zeros(3), nam... | true |
f3cbec1ff50895ead0e5a670b8ae7c02c881cc2e | yeshwanth2812/Python_Week2 | /Week2_basic/Convert_value_list.py | UTF-8 | 339 | 3.421875 | 3 | [] | no_license | # -*- coding: utf-8 -*-
# @Author: Yeshwanth
# @Date: 2021-01-04 18:58:12
# @Last Modified by: Yeshwanth
# @Last Modified time: 2021-01-09 12:30:53
# @Title: convert numbers to list and tuples
values = input("Input some comma seprated numbers : ")
list = values.split(",")
tuple = tuple(list)
print('List : ',list)
prin... | true |
9a29c877f60326cb2b0e97d70ecee0a78db1810a | lilmonk3y/isw1-tps | /09-TusLibros.com/Python/Carrito.py | UTF-8 | 1,837 | 3.03125 | 3 | [] | no_license | # coding=utf-8
from datetime import datetime, timedelta, date, time
from random import random
class Carrito:
ERROR_ELEMENTO_FUERA_DEL_CATALOGO = "El producto agregado no pertenece al catalogo"
ERROR_CANTIDAD_APARICIONES_NO_POSITIVO = "La cantidad de apariciones es menor o igual a 0"
ERROR_CANTIDAD_APARICIONES_NO_EN... | true |
802dfb90515869606ba380d016b40fd9fe761ded | axellbrendow/python3-basic-to-advanced | /aula057-getters-e-setters/aula57.py | UTF-8 | 1,300 | 3.90625 | 4 | [
"MIT"
] | permissive |
class Produto:
def __init__(self, nome, preco):
self.nome = nome
self.preco = preco
def desconto(self, percentual):
self.preco -= self.preco * (percentual / 100)
# Getter
@property
def nome(self):
return self._nome # O nome com underline é apenas uma convenção. Po... | true |
3aa212283673659f74e7a313f811558f5ba3d148 | corgiTrax/Modular-Reinforcement-Learning | /reinforceClass.py | UTF-8 | 5,035 | 3.03125 | 3 | [] | no_license | #Module training and agent
#Modular RL Project
#Ruohan Zhang
#Modular RL Algorithm
#The idea is to have one Qtable for one type (same object with same reward)
#and one active module for one object
#In very large evironment, agent may have too many active modules
#May introduce 'vision range', i.e., agent can only sen... | true |
85f9efa2bfe726d87101c1dd2ce4d6faab450321 | HemrajBhatt/Machine-Learning | /Naive_Bayes, Random_Forest, Decision_Tree, KNN, Logistic_Regression, SVM, Perceptron, SGD.py | UTF-8 | 17,790 | 3.828125 | 4 | [] | no_license | #!/usr/bin/env python
# coding: utf-8
# # Predicting whether a passenger on the titanic would have been survived or not.
# ## 1. Importing the Important libraries
# In[1]:
## Importing linear alzebra, data processing, data visualization
import pandas as pd
import numpy as np
import seaborn as sns
from matplotlib ... | true |
0810645f7c2de9fc6804b314d04a1afd2efbaf88 | SteenJennings/Wrestling-Matchups | /wrestler.py | UTF-8 | 4,786 | 3.78125 | 4 | [] | no_license | # implementation of an undirected graph using Adjacency Lists
class Wrestler:
"""This modified class includes references from an adjanceny list class found on github
this was the first result in searching for adjaceny list implementations in python and it was
it fits the requirements well at this link https... | true |
20021d215ed3c5a1d44f1b48bccb47f99268b50a | hongyong3/TIL | /Algorithm/Swea/D1_6313.py | UTF-8 | 113 | 3.015625 | 3 | [] | no_license | import sys
sys.stdin = open("D1_6313_input.txt", "r")
N = int(input())
print("ASCII {} => {}".format(N, chr(N))) | true |
e953e2f6d54fefe6dd86f6a847aa069abc714716 | Jade-KR/Food-Curation | /backend/api/management/commands/initialize.py | UTF-8 | 4,872 | 2.625 | 3 | [] | no_license | from pathlib import Path
import pandas as pd
from django.core.management.base import BaseCommand
from backend import settings
from api import models
class Command(BaseCommand):
help = "initialize database"
DATA_DIR = Path(settings.BASE_DIR).parent / "data"
DATA_FILE = str(DATA_DIR / "dump.pkl")
def _... | true |
cdd8bb0e492b29e6e0d5f8de50c79ca562e40d68 | Andrzejdab/katowice_01_02_2020 | /dzien_5/k4.py | UTF-8 | 197 | 3.875 | 4 | [] | no_license | def double_letters(tekst):
for i in range(len(tekst) -1):
if tekst[i] == tekst[i+1]:
return True
else: return False
tekst = "Alla"
print(double_letters(tekst))
| true |
8e9647618554fc585ec1e0517b6140c691d6458e | hostjbm/py_gl | /T2. OOP/Class decorator/practice_solution.py | UTF-8 | 359 | 2.96875 | 3 | [] | no_license |
def debug(func):
def wrapper(*args, **kwargs):
print(func.__name__)
return func(*args, **kwargs)
return wrapper
class CWrapper:
def __init__(self, func):
self.func = func
def __call__(self, *args, **kwargs):
print("Class wrapper for {}".format(self.func.__name__))
... | true |
70786e2094828bc32eb88ccfa83b438b9dc2daa7 | snunes97/distributed-tetris | /dt_ui/ui/client.py | UTF-8 | 3,746 | 3.296875 | 3 | [] | no_license | import time
from stubs.client_stub import ClientStub
from ui.gui import Gui
import threading
from pynput.keyboard import Listener
class Client:
def __init__(self, server):
self.BOARD_UPDATE_RATE = 1
self.server = server
self.name = ""
self.lock = threading.Lock()
self.in_ga... | true |
82374a53fcbbc41ebe707865572a3793c0cd483b | ritikeshvali/open-cv-projects | /read-an-image.py | UTF-8 | 964 | 3.046875 | 3 | [] | no_license | import numpy as np
import cv2
#the 2nd parameter denotes the imreadmodes:16 means greyscale,reduced to 1/2 size
# imread(filename, flags=None) returns the image after applying the flag
# filename is the name of input image with proper extension
# flags is takes a value of cv::imreadmodes
# cv::imreadmodes specifies t... | true |
356bb3703cfc5adc7fe54f9bff820dc8fea13d90 | jlschicho/QARTOD | /ioos_qartod/qc_tests/auxillary_checks.py | UTF-8 | 965 | 3.25 | 3 | [
"Apache-2.0"
] | permissive | import numpy as np
def check_timestamps(times, max_time_interval=None):
"""
Checks that the times supplied are in monotonically increasing chronological
order, and optionally that time intervals between measurements do not exceed
a value `max_time_interval`. Note that this is not a QARTOD test, but
... | true |
2975eac147035fb1d911abfd48ac9914c3efb1db | DJAXYN/biosys-analytics | /assignments/13-hamm/fizzbuzz.py | UTF-8 | 148 | 3.375 | 3 | [
"MIT"
] | permissive | #!/usr/bin/env python3
for i in range(1,101):
if i%3==0:
print('fizz')
if i%5==0:
print('buzz')
else:
print(i) | true |
20477ed91c3d7936c1e2023a2c3645ca87a3722e | solwish/TIL | /python/pandas/ex16.py | UTF-8 | 2,363 | 3.890625 | 4 | [] | no_license | # 정렬과 순위
# 행의 색인이나, 열의 색인 순으로 정렬하는 등의 기준 필요
import pandas as pd
from pandas import Series, DataFrame
import numpy as np
df = DataFrame(np.random.randn(4,3), columns=list('bde'),
index=['seoul','busan','daegu','incheon'])
format = lambda x: '%.2f' % x
print(df['e'].map(format))
s1 = df['e'].map(format)
pri... | true |
1dde3d7d33db17ef6be7147abe7646f370aca3be | RacleRay/DeepLearningFoundation | /PGM/hmm.py | UTF-8 | 8,683 | 3.3125 | 3 | [] | no_license | # -*- coding: utf-8 -*-
import os
import sys
import numpy as np
class HMM:
"""
Hidden Markov Model. Viterbi for decoding, Baum-welch for learning.
Attributes
----------
A : numpy.ndarray
State transition probability matrix
B: numpy.ndarray
Output emission prob... | true |
5ea01ba3237cf787152c6fad01df5703128a1aa7 | juanferdeleon/Examen-Parcial-5-Logica | /examen-parcial-5.py | UTF-8 | 4,013 | 3.640625 | 4 | [] | no_license | import time
def printProgressBar (iteration, total, prefix = '', suffix = '', decimals = 1, length = 100, fill = '█', printEnd = "\r"):
percent = ("{0:." + str(decimals) + "f}").format(100 * (iteration / float(total)))
filledLength = int(length * iteration // total)
bar = fill * filledLength + '-' * (lengt... | true |
7990ef9c4ad5dcf681f5b7d12856c416b84a7cb0 | NiuLab/multivbs | /libvbs/config.py | UTF-8 | 720 | 2.953125 | 3 | [] | no_license | import yaml
try:
from yaml import Cloader as Loader, CDumper as Dumper
except ImportError:
from yaml import Loader, Dumper
class Config:
def __init__(self, path):
"""VBS configuration parser"""
self.general = {}
self.bts_lists = []
self.filepath = path
self.read_file... | true |
bd0ed161fd3f715fe5fba33eb94a2b0000777d6a | Huchengxi/Programming-Exericises | /value_test/queue_test.py | UTF-8 | 198 | 2.640625 | 3 | [] | no_license | # -*- coding:utf-8 -*-
__date__ = '2018/5/14 15:28'
from Queue import Queue
test = Queue()
c = {"c": 3}
test.put({"a": 1, "b": 2})
test.put({"c": c.get("c")})
print test.get()
print test.get()["c"] | true |
9556b6905f11c7c97b06eab2afbe0ebd93988111 | Rollbear-bot/HelloDBMS | /src/entity/relation.py | UTF-8 | 9,399 | 3.359375 | 3 | [] | no_license | # -*- coding: utf-8 -*-
# @Time: 2020/3/16 17:34
# @Author: Rollbear
# @Filename: relation.py
from .exceptions import *
from .row import Row
class Relation(object):
"""关系类"""
def __init__(self, field_names):
"""构造方法"""
self.rows = [] # 用一个列表来存放记录行
self.cols = field_names # 属性名
... | true |
563f385a0c52031f7f367901c324f514f7dd5179 | ucgmsim/visualization | /cybershake/scenario_epsilon.py | UTF-8 | 6,931 | 2.8125 | 3 | [
"MIT"
] | permissive | """
Script for generating scenario epsilon plots as a ratio between different models.
The script will compare each model found in the scenario data directory and generate a epsilon ratio im_csv.
These im_csvs will then be broken down into single IM fault files and then into xyz files.
After the xyz files have been gen... | true |
7d80c30fcf4da0c6e83fe83740ce124d39bacb65 | ccqpein/Arithmetic-Exercises | /Merge-Sort/MS.py | UTF-8 | 478 | 3.46875 | 3 | [
"Apache-2.0"
] | permissive | def mergeInner(l1, l2):
if l1 == []:
return l2
if l1[0] <= l2[0]:
return [l1[0]] + mergeInner(l1[1:], l2)
else:
return [l2[0]] + mergeInner(l2[1:], l1)
def mergeSort(l1):
a = [l1[i] for i in range(len(l1) // 2)]
b = [l1[i] for i in range(len(l1) // 2, len(l1))]
if len... | true |
9ce5a91e759f6487a48831fc001b69ebed37c6f2 | Hanpeng-Chen/python-learning | /5-字符串/string_demo_1.py | UTF-8 | 497 | 4.3125 | 4 | [] | no_license | # 字符串的写法
name = 'zhang san'
city = "Fujian"
s1 = 'hello world'
s2 = "hello world"
s3 = """hello world"""
print(s1 == s2 == s3) # 返回True说明s1 s2 s3完全一样
# 函数注释用三引号字符串
def function_notes(value1, value2):
"""
args:
value1: number
value2: number
return
value1 + value2
"""
return value1 + value2
# 转... | true |
d78ae3e1a1a38e8e673f81e8b33f7c740edc19d1 | cadmusgo/Python-002 | /week01/home_work1.py | UTF-8 | 1,898 | 3.59375 | 4 | [] | no_license | """
作業要求:
1. 安装并使用 requests、bs4 库
2. 爬取猫眼电影()的前 10 个电影名称、电影类型和上映时间
3. UTF-8 字符集保存到 csv 格式的文件中。
開發說明:
"""
__authoer__ = 'cadmus'
import requests
from bs4 import BeautifulSoup
# parse html
def parse(html):
soup = BeautifulSoup(html, 'html.parser')
movie_list = []
for div in soup.find_all('div'... | true |
df6f685b63c77b62fd0b144bd4df8c134a48581f | arunraman/Code-Katas | /Interview/Utility Functions/cidr_ip_address_range.py | UTF-8 | 361 | 2.65625 | 3 | [] | no_license |
import sys, struct, socket
str = '192.168.1.0/24'
(ip, cidr) = str.split('/')
cidr = int(cidr)
host_bits = 32 - cidr
i = struct.unpack('>I', socket.inet_aton(ip))[0] # note the endianness
start = (i >> host_bits) << host_bits # clear the host bits
end = i | ((1 << host_bits) - 1)
for i in range(start, end):
pri... | true |
41292ecb7414c871b83f140107f116c7f5e3bff0 | YoloForDream/NLP_ngram_model | /n-gram-model.py | UTF-8 | 3,528 | 3.078125 | 3 | [
"Apache-2.0"
] | permissive | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Tue Aug 18 20:56:22 2020
@author: wangwei
"""
import re
from collections import Counter, namedtuple
from nltk.util import ngrams
import nltk
def read_data(path):# read from corpus
file = open(path, 'r', encoding='utf-8').read()
pattern = re.compil... | true |
e565f8f65b225ea094070a2a298b2726285b0a8a | Aasthaengg/IBMdataset | /Python_codes/p03862/s365865190.py | UTF-8 | 361 | 2.625 | 3 | [] | no_license | import sys
def input(): return sys.stdin.readline().strip()
def mapint(): return map(int, input().split())
sys.setrecursionlimit(10**9)
N, x = mapint()
As = list(mapint())
last = As[0]
ans = 0
for i in range(1, N):
a = As[i]
if last+a>x:
diff = (last+a)-x
ans += diff
last = max(0, a-di... | true |
eb53bde3c3426866935a6b1aa554855fba63b689 | meraki-analytics/cassiopeia | /examples/item.py | UTF-8 | 416 | 2.671875 | 3 | [
"MIT"
] | permissive | import cassiopeia as cass
from cassiopeia import Items, Item
def get_items():
items = cass.get_items(region="NA")
for item in items:
print(item.name)
items = cass.get_items(region="NA")
print(items[10].name)
dagger = Item(name="Dagger", region="NA")
print(dagger.name, dagger.id)
it... | true |
76d752d2f167fadf154226545d07588d6be7d85d | Wuziyi123/PointnetLearningEWC_LWF | /core/parse_args.py | UTF-8 | 1,722 | 2.546875 | 3 | [] | no_license | import argparse
def parse_args():
parser = argparse.ArgumentParser()
parser.add_argument(
'-e',
'--epochs',
type=int,
default=2,
help='Maximal number of epochs to train network',
dest='max_epochs'
)
parser.add_argument(
'-bn',
'--batch_no... | true |
1d9e05441b849a219d83d53c08c1943e0dbd3f6f | MengSunS/daily-leetcode | /newLeecode/803.py | UTF-8 | 1,542 | 2.8125 | 3 | [] | no_license | class Solution:
def hitBricks(self, grid: List[List[int]], hits: List[List[int]]) -> List[int]:
def dfs(i, j):
count = 1
grid[i][j] = 2
for di, dj in dirs:
ni, nj = i + di, j + dj
if m > ni >= 0 <= nj < n and grid[ni][nj] == 1:
... | true |
d37092edbc108cfa888659d1a6032ea8f6e91bf6 | livrbecca/PythonScrimba | /introduction/index.py | UTF-8 | 4,873 | 4.78125 | 5 | [] | no_license | # Datatypes:
# strings - "hello"
# interger / floats - 2, 2.4
# boolean - True or False
# Naming variables
# use underscores, no capitalization
# my_first_variable = "Olivia"
# Escaping
# example: want to save the word 'it's' as a variable
# 'it/'s' - the back slash tells use the character you see, not interpret it a... | true |
bc8c0268e5469562e591066905c4a0f1437a28cb | rajashekharreddy/second_repo | /practice/1_tests/2_3sum.py | UTF-8 | 803 | 3.1875 | 3 | [] | no_license | class Solution(object):
def threeSum(self, nums):
"""
:type nums: List[int]
:rtype: List[List[int]]
"""
self.nums = nums
self.sum_array = list()
for i in range(len(self.nums)):
for j in range(i+1, len(self.nums)):
... | true |
c6d7b179328c055580299b9981f339d3b612f9e7 | ijockeroficial/Python | /CursoEmVídeo/Mundo 3/TUPLAS/tabela_precos.py | UTF-8 | 630 | 3.875 | 4 | [] | no_license | #Correção:
produtos = ["Livro", 12.00, "Caneta", 2.00, "Carne", 22.00, "Suco", 2.00, "Macarrao", 6.00, "Ferro", 40.00]
print('-' * 40)
print(f'{"PRODUTOS":^40}')
print('-' * 40)
for pos in range(0, len(produtos)):
if pos % 2 == 0:
print(f'{produtos[pos]:.<30}', end=' ')
else: print(f'R${produtos[pos]:>... | true |
d52c258a4f9dd20c38f3d1fe6a7379c89da87f80 | ZhouXiaorui1993/Python_learn_demos | /popular_built_in_module/itertools_demo2.py | UTF-8 | 611 | 4.25 | 4 | [] | no_license | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
# 利用itertools模块,计算圆周率(通过计算序列的前n项和)
import itertools
def cal_pi(N):
"""
step1: 创建一个奇数序列:1, 3, 5, 7, 9...
step2: 取该序列的前n项: 1, 3, 5,..., 2*N-1
step3: 添加正负号并用4除: 4/1, -4/3, 4/5, -4/7, ...
step4: 求和
"""
# 创建一个奇数序列
odd = itertools.count(1, 2)
... | true |
a071304d8461eedb96ca3687cb85df17e1317d80 | Iswaria-A/ishu | /python/assign32.py | UTF-8 | 155 | 3.453125 | 3 | [] | no_license | def file_lengthy(fname):
with open(fname) as f:
for i,l in enumerate(f):
pass
return i+1
print("Number of lines in file:",file_lengthy("text.txt")) | true |
490b7d21c1bb956f47fea0be6ddced40963cb58f | npalcaux/Projet-calendrier-NSI | /calendrier/outils_dessin.py | UTF-8 | 6,256 | 3.140625 | 3 | [] | no_license | from enum import Enum
from typing import List, Tuple
from PIL import Image, ImageDraw, ImageFont
from calendrier.constantes import COULEUR_PAR_DEFAUT_TEXTE, Couleur
def sauvegarde_image(image: Image, fichier='calendrier.png'):
"""
autheur: Lucas
fonction déstinée à sauvegarder une image dans le fichier... | true |
0bbbf2dd8e7df275fd41f57e77bad769f91f57fe | Heimine/Sparse_Deconvolution-Capstone | /Optimization/gen_data_2D_with_time.py | UTF-8 | 6,888 | 3.140625 | 3 | [] | no_license | # generate the groudtruth data
# y = sum_{k=1}^K a0k conv x0k + b*1 + n
import numpy as np
def gen_data_2D_with_time(arg, pattern = False):
"""
Parameters:
----------------
arg should include the following items {
theta: the threshold for generating spike train X_0
x_grid: a length 2 lis... | true |
85c797672a9ba3a1e724a5d345137eba6c5e5956 | Greyscale13/Python_learn | /wanday.py | UTF-8 | 1,619 | 2.75 | 3 | [] | no_license | from wand.image import Image
from wand.display import display
from wand.color import Color
from wand.drawing import Drawing
image_background = "./scorebola.jpg"
filename_output = "./TEST2.png"
# filename_logo = "./liverpool.png"
# filename_logo1 = "./totenham2.png"
font_text = "./oswald.ttf"
with Image(filename=ima... | true |
0cbead822a524563f1f1be550a2680f31c1e78e8 | yu5shi8/AtCoder | /ABC_A/ABC075A.py | UTF-8 | 380 | 3.671875 | 4 | [] | no_license | # -*- coding: utf-8 -*-
# A - One out of Three
# https://atcoder.jp/contests/abc075/tasks/abc075_a
a, b, c = map(int, input().split())
if a in (b, c):
print(b + c - a)
elif b == c:
print(a)
else:
print(b)
# ^(ハット記号)を用いたXOR(右辺と左辺が異なる場合のみTrue)で書くと速い
# abc = eval(input().replace(' ', '^'))
# print(abc)
| true |
64c051a1a9b1a72c0d81732e5b20e3da2375e384 | codintag/pythonExamples | /cours/globalVariables.py | UTF-8 | 790 | 4.0625 | 4 | [] | no_license | #global variable can be used by everyone, inside a function or outside
x = "merveilleux" #global
def myFunctionGlb():
print("Python est " + x)
myFunctionGlb()
#local variable with the same name inside myFunctionLcl()
def myFunctionLcl():
x = "magnifique" #local
print('Python est ' + x)
myFunctionLc... | true |
40b5bc5feb7b2e688205dea1c890a094a0a134e9 | Pandinosaurus/ensae_teaching_cs | /src/ensae_teaching_cs/helpers/geo_helper.py | UTF-8 | 2,798 | 2.90625 | 3 | [
"MIT"
] | permissive | # -*- coding: utf-8 -*-
"""
@file
@brief Helpers about longitude, latitude.
"""
import math
def lambert93_to_WGPS(lambertE, lambertN):
"""
Converts coordinates given in
`Lambert 93 <https://fr.wikipedia.org/wiki/Projection_conique_conforme_de_Lambert>`_
system, this system is used by `IGN <http://http... | true |
56d2a65f5b2f10605620245b7907a1251518a4e7 | Mahendra710/Python_Programs_Examples | /23.3-Matrix Transpose.py | UTF-8 | 571 | 3.6875 | 4 | [] | no_license | p=int(input("Enter the row number:"))
q=int(input("Enter the column number:"))
print("Enter the elements for Matrix:")
matrix=[[int(input()) for i in range(q)]for j in range(p)]
print("matrix is:",matrix)
for i in range(p):
for j in range(q):
print(format(matrix[i][j],"<4"),end=" ")
print()
... | true |
2fc698dd6f90ad6f5cb896d1dc849f206e8be7db | NightNineNeighbor/WriteUP | /pwnable.kr/coin_pwn.py | UTF-8 | 1,364 | 2.640625 | 3 | [] | no_license | #! /usr/bin/python
# -*- coding : utf-8 -*-
from pwn import *
import time
import sys
host = "pwnable.kr"
port = 9007
r = remote(host, port)
time.sleep(3) # wait for 3 sec.
print r.recv()
cnt = 0
for i in range(100):
r.recvuntil('N=')
n = int( r.recvuntil(' ') )
r.recvuntil('C... | true |
6d08dee23bf36be0908e19958f044b355a5252aa | BKMSIII/ProjectEuler | /pythagorean_triples.py | UTF-8 | 332 | 3.609375 | 4 | [] | no_license | #!usr/bin/python3
# Find a, b, c where a^2 + b^2 = c^2 and a + b + c = 1000
def find_pythag_triple():
for a in range(1, 1001):
for b in range(1, 1001):
for c in range(1, 1001):
if (a**2 + b**2) == c**2 and (a + b + c) == 1000:
return a, b, c
print(find_pytha... | true |
7941f37e6db285447979060a3a74915431f4354a | Alex-ZL/MyPythonCode | /2012/August/simple_unittest.py | UTF-8 | 389 | 2.671875 | 3 | [] | no_license | #!/usr/bin/env python
import unittest
class DefaultTestCase(unittest.TestCase):
def setUp(self):
self.what = 'ever'
def tearDown(self):
self.what = ''
def testrun1(self):
#self.assert_(self.what == 'foo', 'incorrect default size')
assert self.what == 'for', 'failed testRun1'
def testrun2(self):
self.... | true |
fb7464e070caf22c999165ecf8b0d155aa957a78 | abeerzreeke/Currency | /currencies.py | UTF-8 | 1,218 | 3.71875 | 4 | [] | no_license | class Currency():
def __init__(self, coin, value):
self.coin = coin
self.value = value
def __str__(self):
return f'{self.value} {self.coin}'
def __int__(self):
return self.value
def __repr__(self):
return f'{self.value} {self.coin}'
def __a... | true |
26d116eab59b79352578c0631e8ea7521c446029 | ilkutkutlar/gene-grn-simulator | /src/input_output/sbml_saver.py | UTF-8 | 2,704 | 2.6875 | 3 | [] | no_license | import libsbml
from libsbml._libsbml import parseL3Formula
from models.formulae.custom_formula import CustomFormula
from models.formulae.transcription_formula import TranscriptionFormula
from models.formulae.translation_formula import TranslationFormula
class SbmlSaver:
@staticmethod
def network_to_sbml(net)... | true |
8734ddf84c73a2bd43ca34297d43a771004d90e9 | Invalid-coder/Data-Structures-and-algorithms | /Labyrinths/Tasks/eolymp(4001).py | UTF-8 | 878 | 3.296875 | 3 | [] | no_license | #https://www.e-olymp.com/uk/submissions/7821900
WALL = '*'
EMPTY_CELL = '.'
di = [0, -1, 0, 1]
dj = [-1, 0, 1, 0]
def get_room_area(maze, start):
n = len(maze)
m = len(maze[0])
visited = [[False for i in range(m)] for j in range(n)]
visited[start[0]][start[1]] = True
counter = 0
queue = [start... | true |
88c899a5d7293745f3f83070a79bd47548227cc2 | WhenIsBetter/Project | /src/main/spm_bot/Event.py | UTF-8 | 1,526 | 3.1875 | 3 | [] | no_license | class Event:
# public variables. If need be, we can make them properties for verification.
eid = ""
start = None
end = None
eventOrganizer = None
attendees = []
# Note: how the event is reported probably makes more sense
# in the DiscordBot class -- eg a "display times" command or so... | true |
f3988df9f4477d93ae855e3e5b149424bc47ed4a | ptejaprasanna/facebook_encryption_clone | /client.py | UTF-8 | 2,541 | 2.71875 | 3 | [] | no_license | import socket, binascii, nacl, hashlib
from nacl.public import PrivateKey, Box
from ecdsa import SigningKey, NIST192p, VerifyingKey
from Cryptodome.Cipher import AES
def ecc():
privatekey = PrivateKey.generate()
publickey = privatekey.public_key
return privatekey, publickey
priv, pub = ecc()
pub_client = ... | true |
47c3d3450bc776da8096350f09972dbb2866877e | RamanPreetBains/PythonSessions | /venv/Session17.py | UTF-8 | 1,219 | 3.140625 | 3 | [] | no_license | import mysql.connector
class Customer:
def __init__(self, cid, name, phone, age, address):
self.cid = cid
self.name = name
self.phone = phone
self.age = age
self.address = address
def showCustomer(self):
print("===",self.cid,"|", self.name, "===")
print("... | true |
16a2f4477efb739556ef71367aab9f277dfce9f3 | YanpingDong/leetcodeSolution | /PowerOfTwo.py | UTF-8 | 502 | 3.671875 | 4 | [] | no_license | class PowerOfTwo(object):
def isPowerOfTwo(self, n):
"""
:type n: int
:rtype: bool
"""
return n > 0 and bin(n).count('1') == 1
def isPowerOfTwoOptimal(self, n):
"""
:type n: int
:rtype: bool
"""
return n > 0 and not(n&n-1)
if __n... | true |
44eb9fa655ea5b843bdc4e97b609ff0da64aea73 | glureau/war30-python | /generateImage.py | UTF-8 | 731 | 3.109375 | 3 | [] | no_license | #!/usr/bin/python
import copy
import libWolfram30
count = int(input("Taille du triangle : "))
bufferInput = [False] * (2 * count + 1)
bufferInput[count] = True
bufferOutput = [False] * (2 * count + 1)
file = open("output.pgm", "w")
file.write("P1\n")
file.write(str(2 * count + 1) + ' ' + str(count) + '\n')
libWol... | true |
5926871e65e1d11d6da0889f02fff9d126468571 | DimpleOrg/PythonRepository | /Python Crash Course/vAnil/Chapter-7/7-10.py | UTF-8 | 905 | 3.515625 | 4 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Fri Jan 8 17:06:36 2021
@author: ANIL
"""
dream_vaction = {}
while True:
print('\n\nInput "quit" if you want to quit.')
user = input('Enter your name: ')
if (user.lower() == 'quit'):
break
vac = input('Enter your dream vacation: ')
if (... | true |
d84c156432999a2e19c54fd6904d1ce9ccfeb072 | nguyk/NetworkSecurity | /spatch/spatch.py | UTF-8 | 1,030 | 2.796875 | 3 | [] | no_license | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import getpass
from acl import Acl
from spatch_client import SSHSpatchClient
acl = Acl()
if __name__ == '__main__':
print "[+] Welcome on spatch proxy."
username = raw_input("[+] Enter your login please (leave blank for {}): ".format(getpass.getuser()))
if username =... | true |
b09febe4dfdd82173ac033830e9ae2af682a464b | phoro3/atcoder | /ABC/ABC_003/problemA.py | UTF-8 | 163 | 3.203125 | 3 | [] | no_license | #coding:utf-8
task = int(raw_input())
sum = 0
for i in range(1, task+1):
sum += i * 10000
average = float(sum) / task
print int(round(average, 0))
| true |
2e3804c697e8633bc7be6e8f6879c4f32536365c | JUDAIhyper/Data_mining | /Chapter5数据清洗及评分系统/daily_Scoring.py | UTF-8 | 630 | 3.078125 | 3 | [] | no_license | import pymysql
import time
db = pymysql.connect(host='localhost', port=3306, user='root',
password='root', database='pachong', charset='utf8')
company = '阿里巴巴'
today = time.strftime("%Y-%m-%d")
# 编写sql语句提取当天目标公司的全部新闻数据
cur = db.cursor()
sql = 'SELECT * FROM article WHERE company=%s AND da... | true |
a599936f4ac75a4e22896b868adde27c462ff523 | skylarw19/python-exercises | /exercise-5.py | UTF-8 | 567 | 4.59375 | 5 | [] | no_license | # exercise-05 Fibonacci sequence for first 50 terms
# Write the code that:
# 1. Calculates and prints the first 50 terms of the fibonacci sequence.
# 2. Print each term and number as follows:
# term: 0 / number: 0
# term: 1 / number: 1
# term: 2 / number: 1
# term: 3 / number: 2
# term: 4 / nu... | true |
668378c819d0ca1614b47f2e69a80f3421153261 | wi34rd/ProblemSolutions | /Питонтьютор/01 Ввод и вывод данных/p07_parti.py | UTF-8 | 148 | 2.65625 | 3 | [] | no_license | # Парты
# http://pythontutor.ru/lessons/inout_and_arithmetic_operations/problems/desks/
print(sum((int(input()) + 1) // 2 for _ in range(3)))
| true |
3f1091a263ed936fc2a32b0fce6443923077d82e | tianyuemylove/tian | /yue/p2月/p6天/对象引用.py | UTF-8 | 464 | 3.5 | 4 | [] | no_license | import sys
class People:
def __init__(self,name,salary):
self.name = name
self.salary = salary
class Worlder:
def __init__(self,name,salary):
self.name = name
self.salary = salary
hua = People('花花',9000)
hua1 = hua
hua02 = hua
hua03 = hua
print(sys.getrefcount(hua)) # 对象被引用了多少次... | true |
79b24fc12aa984661d077067dcd889ef0133a974 | huakeda1/Basic_Programming_Projects | /Microsoft_Nine_Step_AI_Study/lesson_code/combine_sort.py | UTF-8 | 837 | 3.21875 | 3 | [] | no_license | #!/usr/bin/env python
# coding: utf-8
# In[1]:
import random
import numpy as np
import re
# In[2]:
def get_random_data(*arg,samples=20):
np.random.seed(0)
random.seed(0)
total_data=np.array([np.random.choice(choice,size=(samples,),replace=True,p=[1.0/len(choice)]*len(choice)) for choice in arg])
... | true |
7d505f5f82379947bd63e42598ac52cb60445e76 | martinbarry59/Final_PCML | /run.py | UTF-8 | 3,756 | 2.640625 | 3 | [] | no_license | from proj1_helpers import *
import implementations as im
DATA_TRAIN_PATH = r'../train.csv'
y, tX, ids = load_csv_data(DATA_TRAIN_PATH)
# Ridge Regression
def ridge_regression_demo(y, tx,lamb,degree):
# define parameter
tX = im.build_poly(tx, degree)
weight, loss = im.ridge_regression(y , tX , lamb)
... | true |
8578d3300ac3014c252320a2cf5ac79b9f4ba177 | NotYourTypicalDeveloper/project-04 | /controllers/users.py | UTF-8 | 410 | 2.53125 | 3 | [] | no_license | from flask import Blueprint, jsonify
from models.User import User, UserSchema
user_schema = UserSchema()
api = Blueprint('users', __name__)
# ------------- Show user's page ---------------
@api.route('/users/<int:id>', methods=['GET'])
def show(id):
print(id)
user = User.query.get(id)
if not user:
... | true |
c05bb5447ba78eb147fab975ba603c69971db251 | paromad/python | /encryptor.py | UTF-8 | 4,595 | 2.953125 | 3 | [] | no_license | import json
import string
import argparse
import sys
from collections import defaultdict
lowercase = string.ascii_lowercase
uppercase = lowercase.upper()
cycle = len(lowercase)
def caesar_symbol(char, key, letter_type):
return letter_type[(letter_type.index(char) + key) % cycle]
def encryption_caesar_symbol(ch... | true |
c355f79d6bdbeb0b6e0b1c218258e541f75f9add | maxwang09/ark-invest-history | /src/init.py | UTF-8 | 478 | 2.515625 | 3 | [] | no_license | import pandas as pd
for ticker in ['ARKK', 'ARKQ', 'ARKW', 'ARKG', 'ARKF', '']:
df = pd.read_csv(f'../fund-holdings/latest{ticker}.csv')
df['date'] = pd.to_datetime(df['date'])
df.to_csv(f'../fund-holdings/latest{ticker}.csv', index=False)
for ticker in ['ARKK', 'ARKQ', 'ARKW', 'ARKG', 'ARKF']:
df = p... | true |
d76ea284eab78b78955613b3b29661fc1e48e1de | prashilbhimani/YelpRecommendationSystem | /TFID.py | UTF-8 | 1,184 | 2.5625 | 3 | [] | no_license |
# coding: utf-8
# In[32]:
import json
from nltk.stem.porter import *
from nltk.stem.snowball import SnowballStemmer
from nltk.tokenize import sent_tokenize, word_tokenize
from autocorrect import spell
from sklearn.feature_extraction.text import CountVectorizer,TfidfVectorizer
import numpy as np
# In[13]:
stemmer ... | true |
f42f7e7c98a0fd42e53c8609738692db9d03fe34 | saberfate/python-test | /register_page.py | UTF-8 | 741 | 2.546875 | 3 | [] | no_license | # -*- coding: utf-8 -*-
from selenium.webdriver.common.by import By
from selenium.webdriver.remote.webdriver import WebDriver
class RegisterPage:
def __init__(self, driver:WebDriver):
self.driver = driver
def register(self):
"""
注册内容填写
:return:
"""
... | true |
879c5e7e78a2a56e1a0dab1d517081f6f13287b3 | rs-ai/python-basics | /Python_Structures_Adv.py | UTF-8 | 850 | 4.5 | 4 | [] | no_license | #Tuples - immutable, you cannot change their values, notice the enclosure syntax
car_companies = ('Fiat','Mercedes-Benz','Vauxhall','Volkswagen')
print(car_companies)
#try deleting a value - you will get an error message
#del (car_companies[0])
# a dictionary is a structure that helps you hold and access key value ... | true |
da4737c85167f8d078bdc49223451b027243a09c | YapHH/WQD7005-Week7 | /WQD7005.W7Assignment.WQD180073.py | UTF-8 | 1,450 | 3.515625 | 4 | [] | no_license | #!/usr/bin/env python
# coding: utf-8
# WQD7005 Data Mining
# Week 7 Online Assessment (8th May 2020)
#
# Yap Hui Hsing, WQD180073 (17039525/2)
#
# Team member: Har Wai San, WQD180025 (17051470/1)
#
# ## 0. Import Lib
# In[1]:
import pandas as pd
import numpy as np
# ## 1. Data Exploration
# ### 1.1 Import th... | true |
16c311668cd2934e542863ff5fcf888ba78ddd9c | cosmicRover/algoGrind | /sliding-window/min-window-sub.py | UTF-8 | 1,391 | 3.4375 | 3 | [] | no_license | from collections import Counter
class Solution:
def minWindow(self, s: str, t: str) -> str:
'''
sliding window anagram approach.
'''
start = 0; matched = 0; sub_start = 0;
min_length = len(s) + 1 #minimum possible in the worst case
p_dic = Counter(t)
... | true |
1519c341657e0d5d44d97994c895cd3b8822e7ce | gerdinard/MLkNN | /mlknn/mlknn.py | UTF-8 | 5,844 | 3.125 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Tue Mar 26 14:02:00 2019
@author: Konstantinos Pliakos
Implementation of the MLkNN algorithm [1].
[1] Zhang, M. L., & Zhou, Z. H. (2007). ML-KNN: A lazy learning approach to
multi-label learning. Pattern recognition, 40(7), 2038-2048.
"""
import numpy as np
import numpy.ma... | true |
f9dedd09f3b390de4d1c0dcda4d8f205e353716c | xiaoxiyouran/20171205python3Grammer | /05-高级特性/05.06 迭代器.py | UTF-8 | 2,426 | 4.15625 | 4 | [] | no_license |
###----------------------------------------------------------------------------------------------------------------- class(begin)
### TODO: 可迭代
# 一类是集合数据类型,如list、tuple、dict、set、str等;
#
# 一类是generator,包括生成器和带yield的generator function。
#
# 这些可以直接作用于for循环的对象统称为可迭代对象:Iterable。
#
# 可以使用isinstance()判断一个对象是否是Iterable对象
from ... | true |
7db37a523a2bdbf407380d4e9924ee0ef369c807 | sanchitdeora/MLProject | /src/utility/musicUtility.py | UTF-8 | 8,308 | 2.5625 | 3 | [] | no_license | import numpy as np
import librosa
import matplotlib.pyplot as plt
import librosa.display
import os
import csv
def display_music_waveform(data, sample_rate, label=None):
plt.figure(figsize=(14, 5))
librosa.display.waveplot(data, sr=sample_rate)
plt.title(label)
def display_music_spectrogram(data, sample_... | true |
ceea23d81c123cb4d0a061cd14ec12c662998ff6 | rajgaurav7800/python_basic_projects- | /my_calculator.py | UTF-8 | 312 | 3.515625 | 4 | [] | no_license | while 1:
o = input("what u want to perform (+)(-)(*)(/)...")
x = (input("enter your first no...."))
y = (input("enter your second no...."))
if o=="-":
print("0")
elif o=="*":
print(int(x)*y)
elif o=="/":
print(int(x)/int(y))
else:
print(str(x)+str(y))
| true |
11e977f6f89382a905b43dbb7361cc0b317b765f | standanley/fault | /fault/util.py | UTF-8 | 147 | 2.890625 | 3 | [
"BSD-3-Clause"
] | permissive | from math import ceil, log2
def clog2(x):
return int(ceil(log2(x)))
def flatten(l):
return [item for sublist in l for item in sublist]
| true |
00502c3787bb4bb8d21b3744837942ef369e4329 | angr/angr | /angr/utils/formatting.py | UTF-8 | 4,217 | 3.234375 | 3 | [
"BSD-2-Clause"
] | permissive | import sys
from typing import Sequence, Optional, Callable
if sys.platform == "win32":
import colorama # pylint:disable=import-error
ansi_color_enabled: bool = False
def setup_terminal():
"""
Check if we are running in a TTY. If so, make sure the terminal supports ANSI escape sequences. If not, disab... | true |
37464323761a6dadaae10926872a8f1c0e991566 | adamchainz/ThreatPrep | /awsthreatprep/s3_checks.py | UTF-8 | 3,597 | 2.59375 | 3 | [
"MIT"
] | permissive | import common
class S3CheckCollection(common.BaseCheck):
"""Checks for basic S3 security settings."""
def __init__(self):
return super(S3CheckCollection, self ).__init__(category='S3')
def collect_tests(self, s3_object):
self.resource_name = s3_object.name
self.subchecks.append(S3... | true |
81a3362423f9e8ade540926919e3d08c24c7fb8e | mrdbourke/streamlit | /lib/tests/streamlit/add_rows_test.py | UTF-8 | 11,308 | 2.515625 | 3 | [
"Apache-2.0"
] | permissive | # Copyright 2018-2020 Streamlit Inc.
#
# 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 by applicable law or agreed to in wr... | true |
4ad8e3df2dcf58a2b8fd2c7f7141d3e9927a47f2 | mohit3011/Document-Classification-and-Clustering | /main.py | UTF-8 | 2,068 | 2.640625 | 3 | [] | no_license | import sys, os
import copy
import math
import math
import numpy as np
import pandas as pd
import random as rand
from numpy import *
from sklearn.decomposition import PCA
from sklearn.mixture import GaussianMixture
from sklearn.cluster import KMeans
from scipy.stats import norm
from create_vector import *
from collectio... | true |
64f588ddd6d419570fc3a52d8739ba3b2aa6ff9b | hwakabh/codewars | /Python/7/FindTheCapitals/test_find_the_capitals.py | UTF-8 | 721 | 3.09375 | 3 | [
"MIT"
] | permissive | from unittest import TestCase, main
from find_the_capitals import capital
class TestFindTheCapitals(TestCase):
def test_capital(self):
ptr = [
([{'state': 'Maine', 'capital': 'Augusta'}], ["The capital of Maine is Augusta"]),
([{'country': 'Spain', 'capital': 'Madrid'}], ["The cap... | true |
a3211e80bc2247c757778bb31806920be740f8db | BIDMAL/codewarsish | /HackerRank/Python/lambdaFibonacci.py | UTF-8 | 181 | 3.5 | 4 | [] | no_license | cube = lambda x: x**3
def fibonacci(n):
l = [0, 1]
for _ in range(2,n):
l.append(l[-2]+l[-1])
return(l[:n])
n = int(3)
print(list(map(cube, fibonacci(n))))
| true |
e9e06efa8d6595610bbd4e825dd9215a6ca78611 | hvardhan878/SANDP500-Predictor-Using-ANN | /ann.py | UTF-8 | 1,502 | 2.921875 | 3 | [] | no_license | import numpy as np
import matplotlib.pyplot as plt
import pandas as pd
#Importing the Dataset
dataset = pd.read_csv('sandp500.csv')
X = dataset.iloc[:,1:5].values
y = dataset.iloc[:,5].values
DateX = dataset.iloc[:,1:5].values
Datey = dataset.iloc[:,5].values
#Test set and train set split
from sklearn.model_select... | true |
a3c9739de9e08dd3ce2f76176bd96bcd0c6aae7b | davidhimer/Homeworks | /betty.py | UTF-8 | 416 | 3.609375 | 4 | [] | no_license | def darab(a):
great = 0
db = 0
for i in range(0,len(a)):
for j in range(i+1,len(a)):
true = 0
for k in range(j,i,-1):
if a[i] < a[j] and a[k] < a[j]:
true += 1
print(k)
if true == k:
d... | true |
3b3caeb40e049f514163dc2a2697cdef75c34d5a | kelly-gilbert/preppin-data-challenge | /2022/preppin-data-2022-41/preppin-data-2022-41.py | UTF-8 | 2,001 | 3.921875 | 4 | [] | no_license | # -*- coding: utf-8 -*-
"""
Preppin' Data 2022: Week 41 - Dynamic Times Tables
https://preppindata.blogspot.com/2022/10/2022-week-41-dynamic-times-tables.html
- Input data
- Create a parameter that allows the user to set the multiplication grid they want
- Output the data
Author: Kelly Gilbert
Created: 202... | true |
20b6be7990c53a7581268c1002d933e95735033c | bendaten/first | /src/first_time.py | UTF-8 | 2,199 | 3.625 | 4 | [] | no_license | from datetime import timedelta
from dateutil.parser import parse
class FirstTime(timedelta):
"""FirstTime adds restrictions to timedelta. It allows only positive values and a has a conversion method"""
def __init__(self, hours=0, minutes=0, seconds=0):
"""
Constructor
:param hours:... | true |
e5886d4aebc306c8ee6c767d00ba2bbc114736f6 | daniel-reich/ubiquitous-fiesta | /ENJTPoWCyEGgnXYjM_19.py | UTF-8 | 146 | 3.15625 | 3 | [] | no_license |
def percent_filled(box):
x = [sum(x.count('o') for x in box), sum(x.count(' ') for x in box)]
return str(int(x[0]/(x[1] + x[0])*100)) + '%'
| true |
d03f642f065832fc705e565a08ba9ae18b914c10 | germal/DL4CV-1 | /011_Under_Over/helpers/preprocessing/imagetoarraypreprocessor.py | UTF-8 | 364 | 3.015625 | 3 | [] | no_license | # Import Needed Packages
from keras.preprocessing.image import img_to_array
class ImageToArrayPreprocessor:
def __init__(self, dataFormat=None):
# Store Image Data Format
self.dataFormat = dataFormat
def preprocess(self, image):
# Apply Keras Utility Function To Correctly Rearrange Dimensions
return img_... | true |
7da21458ab6c606b93485933caf645f5b0d4185d | Pandinosaurus/openvino_training_extensions | /misc/pytorch_toolkit/face_antispoofing/losses/soft_triple.py | UTF-8 | 2,804 | 2.546875 | 3 | [
"Apache-2.0"
] | permissive | """
Copyright (c) 2020 Intel Corporation
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 by applicable law or agreed to in writin... | true |
9671006df332e66abdfafadc4f6b2eb26dc0f1cd | itminha123/jumptopython | /01.jumptopython/pratice all/오류확인.py | UTF-8 | 328 | 3.75 | 4 | [] | no_license |
# if(int(input("3개의 숫자를 입력하세요:").split())== -1):
# print("종료합니다.")
# print("3개의 숫자를 입력하세요:")
# input_number = input()
# input_number_list=input_number.split()
# number = int(input_number_list)
# if(number == -1 ):
# print("종료 합니다.")
# int("1 2 3")
int('123') | true |
eca74d75c83b3f7be1a7b4f28079f84ec90ff509 | jonando93/dqlab-case-studies | /Python/Data Manipulation with Pandas - Slicing.py | UTF-8 | 1,110 | 3.28125 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Mon Aug 17 18:39:40 2020
@author: jonando93
"""
#Import Library
import pandas as pd
#Baca file sample_csv.csv
df = pd.read_csv("https://dqlab-dataset.s3-ap-southeast-1.amazonaws.com/sample_csv.csv")
#Slice berdasarkan kolom
df_slice_col = df.loc[(df["customer_id"] == 18055) & ... | true |
c83cd7a9ae2f8e9573171202cf6996dadc6367de | cubantonystark/Image-and-Video-Dehazing | /Deep Learning/build_dataset.py | UTF-8 | 1,537 | 2.53125 | 3 | [] | no_license | import os
import sys
import numpy as np
from PIL import Image, ImageOps
def _image_preprocessing(filename, xsize, ysize):
im = Image.open(filename)
if filename.endswith('.PNG'):
im = im.convert('YCbCr')
#downsampled_im = ImageOps.fit(im, (xsize, ysize), method=Image.LANCZOS)
norm_im = np.array... | true |
346690f47dceda5e18b4996f469aca12ed269ffc | Maynot2/holbertonschool-higher_level_programming | /0x01-python-if_else_loops_functions/8-uppercase.py | UTF-8 | 261 | 3.828125 | 4 | [] | no_license | #!/usr/bin/python3
def _islower(c):
return 97 <= ord(c) <= 122
def uppercase(str):
str += "\n"
for char in str[:]:
if _islower(char):
print("{:c}".format(ord(char) - 32), end="")
else:
print(char, end="")
| true |
2c29ac607411649e78b5e1bacc77167a0186d240 | rafaelperazzo/programacao-web | /moodledata/vpl_data/439/usersdata/316/99734/submittedfiles/contido.py | UTF-8 | 416 | 3.15625 | 3 | [] | no_license | # -*- coding: utf-8 -*-
def fim(lista):
i=1
qa=input('Digite o número de elementos da primeira lista:')
while i<=qa:
x=int(input('digite um numero:'))
i=i+1
i=1
qb=input('Digite o número de elementos da segunda lista:')
while i<=qb:
y=int(input('digite um numero:'))
... | true |