blob_id stringlengths 40 40 | language stringclasses 1
value | repo_name stringlengths 5 133 | path stringlengths 2 333 | src_encoding stringclasses 30
values | length_bytes int64 18 5.47M | score float64 2.52 5.81 | int_score int64 3 5 | detected_licenses listlengths 0 67 | license_type stringclasses 2
values | text stringlengths 12 5.47M | download_success bool 1
class |
|---|---|---|---|---|---|---|---|---|---|---|---|
a6b14ab0e5a78ae9f9b88c8085ed074fa598fa30 | Python | sanjeevs/lottery | /lottery.py | UTF-8 | 1,601 | 3.765625 | 4 | [] | no_license | #!usr/bin/env python
import random
def is_jackpot(winner, my_card):
for digit in winner:
if(digit not in my_card):
return False
return True
def is_deuce(winner, my_card):
win_lst = [char for char in winner]
num_matches = 0
for i in win_lst:
if i in my_card:
... | true |
5f362e91efc60b610b23f7cf94022903dc39a709 | Python | Booharin/lesson_1 | /task_5.py | UTF-8 | 528 | 3.703125 | 4 | [] | no_license | revenue = int(input('Ваша выручка: '))
costs = int(input('Вашы расходы: '))
profit = revenue - costs
if profit > 0:
print(f"Ваша прибыль составила: {profit}")
print(f"Рентабельность: {(profit / revenue) * 100:.3f}%")
staff_number = int(input('Количество сотрудников: '))
print(f"Прибыль на одного сотр... | true |
257c6705a44b8fa4da1308645b9cafebfd772c9c | Python | jgeltch/dumb | /dumb.py | UTF-8 | 128 | 3.328125 | 3 | [
"MIT"
] | permissive | import time
before = time.time()
for i in range(0,2**32):
if i%1000000 == 0:
print(i)
print(time.time()-before) | true |
3478ff1c404906da49fb5e98ced8ebc8b90eb7b0 | Python | skydownacai/DGA-Domain-Detection | /DataStructure.py | UTF-8 | 472 | 2.515625 | 3 | [] | no_license | from typing import NamedTuple, List, Optional
import torch.tensor as Tensor
class Example(NamedTuple):
domain_name : str #域名
label : Optional[bool] #是否为恶意地址
char_ids : List[int] #每个字符在vocab中的id
domain_len : int #域名长度
class BatchInputFeature(NamedTuple):
domain_names : List[str] #域名
labels : Tensor #是否为恶意地址
... | true |
252cc798520d3c09df62b7296b38a610af268af0 | Python | flyingGH/synthtext | /tools/filter_word.py | UTF-8 | 1,442 | 3.34375 | 3 | [
"Apache-2.0"
] | permissive | import sys
import random
def get_alpha_word(fp):
raw_words = []
with open(fp, 'r') as fd:
for line in fd:
segs = line.split()
raw_words.extend(segs)
raw_words = set(raw_words)
alpha_words = []
for word in raw_words:
if word.isalpha():
alpha_words... | true |
50f8f7bbb898e8a54522bce3f72f314e991f34df | Python | xiemeigongzi88/PyTorch_learning | /Dive into Deep Learning PyTorch/code/3.8 多层感知机.py | UTF-8 | 623 | 3.0625 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Sat Oct 31 20:11:48 2020
@author: sxw17
"""
# 3.8 多层感知机
# 3.8.1 隐藏层
# 3.8.2 激活函数
# 3.8.2.1 ReLU
ReLu(x) = max(x, 0)
import torch
import numpy as np
import matplotlib.pylab as plt
import sys
import d2lzh_pytorch as d2l
def xyplot(x_val, y_va... | true |
173b07667b878347ba13a0d86d55b5b0b59e4627 | Python | LukeCroteau/rsl-equip | /mainapp/Models/hero_data.py | UTF-8 | 621 | 2.6875 | 3 | [] | no_license | from sqlalchemy import Column, Integer, String
from mainapp.database import Base
class Hero(Base):
''' Base class for Hero data '''
__tablename__ = 'heroes'
id = Column(Integer, primary_key=True, index=True)
name = Column(String, index=True)
hero_type = Column(String)
hp = Column(Integer)
a... | true |
2f93f957f883b48ee014fa8c784279333acad3e2 | Python | Mr4x3/competition_mania | /lookup/static_lookups.py | UTF-8 | 31,368 | 2.53125 | 3 | [] | no_license | COUNTRY_CHOICES = [
('AF', 'Afghanistan'),
('AX', 'Aland Islands'),
('AL', 'Albania'),
('DZ', 'Algeria'),
('AS', 'American Samoa'),
('AD', 'Andorra'),
('AO', 'Angola'),
('AI', 'Anguilla'),
('AQ', 'Antarctica'),
('AG', 'Antigua and Barbuda'),
('AR', 'Argentina'),
('AM', 'A... | true |
2b2ce7a072f3f65793f96129ffb457aedf616573 | Python | wjidea/pythonExercise | /10_plu_list_in_dict.py | UTF-8 | 797 | 3.59375 | 4 | [] | no_license | #! /usr/bin/python
# 10_plu_list_in_dict.py
# parse the fruit and vegies file using the split function,and store them
# in a dictionary. Key is the PLU code, and price and names will be in a list
# Jie Wang
# September 1, 2016
# Read the file and parse them into Dict
filePath = '../fruits_veggies.txt'
FILE_1 = open... | true |
bb0b5e9775ecdfe6eae3354899b31dc5d23b5a13 | Python | moming2k/TradingProjects | /HKHorseDB/library/horseDataCache.py | UTF-8 | 1,580 | 2.5625 | 3 | [] | no_license | import os
import sys
import urllib
sys.path.append(os.path.join(os.getcwd(), '..'))
# sys.setdefaultencoding('utf-8')
from bs4 import BeautifulSoup
from selenium import webdriver
from constant import path_info
class HorseDataCache():
def __init__(self):
self.browser = None
self.encoding = 'utf-... | true |
373f008723d6a14e48c298dc2f7afc8972aeee43 | Python | trungne/dictionary | /dictionary/test.py | UTF-8 | 779 | 2.84375 | 3 | [] | no_license | import requests
r = requests.get('https://api.dictionaryapi.dev/api/v2/entries/en_US/set')
my_obj = r.json()
for i in my_obj[0]['meanings']:
print(f"part of speech: {i['partOfSpeech']}")
for definition in i['definitions']:
if key == "definition":
print(value)
elif key == "example"... | true |
c2223503feec171ec0c9db7281ca9d9dee576d66 | Python | jas10220831/SWEA-Algorithm | /0819/4871_그래프경로/s1.py | UTF-8 | 371 | 2.765625 | 3 | [] | no_license | import sys
sys.stdin = open('sample_input.txt')
# 경로 행렬만들기
T = int(input())
dot, line = map(int, input().split())
road = [[0] * (dot+1) for _ in range(dot+1)]
for _ in range(line):
dot1, dot2 = map(int, input().split())
road[dot1][dot2] += 1
start, goal = map(int, input().split())
def find_road(road, dot, sta... | true |
b32994b1286f36919c881afa1a3d450c09b915e1 | Python | zongqi-wang/Beer-Advocate-Scraper | /beer_scraper/pipelines.py | UTF-8 | 1,689 | 2.609375 | 3 | [] | no_license | # -*- coding: utf-8 -*-
# Define your item pipelines here
#
# Don't forget to add your pipeline to the ITEM_PIPELINES setting
# See: https://doc.scrapy.org/en/latest/topics/item-pipeline.html
from scrapy.exceptions import DropItem
from scrapy.exporters import CsvItemExporter
import csv
class BeerScraperPipeline(objec... | true |
95d81c3c2e5b5dded18c3aae6c0e6a70ccb9eee6 | Python | zhang2639/docker_dedup | /storage/io.py | UTF-8 | 1,089 | 2.828125 | 3 | [] | no_license |
def read_chunks_from_file(path, length):
with open(path, 'rb', buffering=1024*64) as fin:
for i, j, k in length:
piece = fin.read(j)
if not piece:
return
yield piece
def write_chunks_to_file(pa... | true |
1d8a0f171f640df4dbcdf226ffddd0f9474195bc | Python | pratikshirsathp/YTseries-dsalgo | /binary_search.py | UTF-8 | 498 | 4 | 4 | [] | no_license | #should have sorted list
def binary_search(list, target):
first = 0
last = len(list)-1
while first<=last:
midpoint = (first+last)//2
if list[midpoint] == target:
return midpoint
elif list[midpoint] < target:
first = midpoint +1
else:
last = midpoint -1
return None
def ... | true |
ff646d101df1be526fb9bf0d65a59155618d7037 | Python | cenbow/UESTC-FinalProject | /src/utils/test_cached.py | UTF-8 | 600 | 2.828125 | 3 | [] | no_license | from unittest import TestCase
import os
import pickle as pkl
from cached import cached
import shutil
class TestCached(TestCase):
def setUp(self):
shutil.rmtree('./cache')
os.mkdir('./cache')
def test_cached(self):
@cached('test')
def build_tuple(n):
return tuple(ra... | true |
f8bbc827d96cbf36560cb041c86e6ff83929e935 | Python | zhouwangyiteng/python100 | /t14.py | UTF-8 | 429 | 3.53125 | 4 | [] | no_license | # _*_ coding: UTF-8 _*_
import math
def isNotPrime(num):
k = int(math.sqrt(num)) + 1
for i in range(2, k):
if num%i == 0:
return True
return False
n = int(raw_input('Input n:'))
print n, '=',
result = []
t = 2
while(n!=1):
while(n%t==0):
n /= t
result.append(t)
... | true |
0ae6f431dbd05ae13919b12c669990c9e4b92a66 | Python | hchandaria/UCB_MIDS_W261 | /hw3/combiner.py | UTF-8 | 797 | 3.34375 | 3 | [] | no_license | #!/usr/bin/python
#HW3.2c In this question, we will emit a counter for everytime the combiner is called.
#the combiner will do intermediate aggregation of data and is similar to reducer in terms of logic
import sys
from csv import reader
sys.stderr.write("reporter:counter:HW_32c,num_combiners,1\n")
last_key = None
wo... | true |
310279601a4afd2acf51c784b7552e2d34305fb5 | Python | PsychicWaffle/4156project | /code/tests/test_validity_checker.py | UTF-8 | 2,046 | 2.71875 | 3 | [] | no_license | import unittest
from app import validity_checker
class ValidityCheckerClass(unittest.TestCase):
def setUp(self):
pass
def tearDown(self):
pass
def test_valid_history_date_range_1(self):
start_date = -1
end_date = 100
valid_date_range = validity_checker.valid_histo... | true |
e160da307538f15ac09bd0bdd955198ad383d9c4 | Python | danielfrg/dbplot | /dbplot/calculations.py | UTF-8 | 833 | 2.71875 | 3 | [
"Apache-2.0"
] | permissive | import ibis
import numpy as np
import pandas as pd
def hist(table, column, nbins=10, binwidth=None):
if nbins is None and binwidth is None:
raise ValueError("Must indicate nbins or binwidth")
elif nbins is None and binwidth is not None:
raise ValueError("nbins and binwidth are mutually exclusi... | true |
9af3d1655e72b8c45da52483e95302c2e9b0daae | Python | HBinhCT/Q-project | /hackerearth/Math/Number Theory/Basic Number Theory-1/Candy Distribution 3/solution.py | UTF-8 | 433 | 2.640625 | 3 | [
"MIT"
] | permissive | from sys import stdin
mod = 1000000007
toffees = []
t = int(stdin.readline())
for _ in range(t):
toffees.append(int(stdin.readline()))
size = max(toffees) + 2
comb_x2 = [1, 2]
comb_x3 = [1, 3]
for i in range(2, size):
comb_x2.append(comb_x2[i - 1] * 2 % mod)
comb_x3.append(comb_x3[i - 1] * 3 % mod)
for n i... | true |
ee51a7f65e741bb86a01299489ddbd847606aead | Python | karolinanikolova/SoftUni-Software-Engineering | /2-Python-Fundamentals (Jan 2021)/Course-Exercises-and-Exams/07-Dictionaries/01_Lab/01-Bakery.py | UTF-8 | 653 | 4.34375 | 4 | [
"MIT"
] | permissive | # 1. Bakery
# This is your first task in your new job. You were tasked to create a list of the stock in a bakery and you really don't want to fail at you first day at work.
# You will receive a single line containing some food (keys) and quantities (values).
# They will be separated by a single space (the first element... | true |
899d606ee645f82405a9967bc98c2d5320a62312 | Python | HUANGZHIHAO1994/climate_change | /wosspider2.2/wosspider/seleniumurl.py | UTF-8 | 3,090 | 2.515625 | 3 | [] | no_license | from selenium import webdriver
import time
from selenium.webdriver.support.wait import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
from selenium.webdriver.common.by import By
from selenium.webdriver.common.keys import Keys
from scrapy.http.response.html import HtmlResponse
from seleni... | true |
17e88847dc47a9879f337be4f05c62cf54604447 | Python | GangLi-0814/PyStaData | /Python/Python_NLP_Basic/社调行业和职业自动编码/社会经济调查行业和职业自动编码模型代码/基于卷积神经网络的社会经济调查行业和职业自动编码模型/splitClass.py | UTF-8 | 3,137 | 2.96875 | 3 | [] | no_license | # coding=utf-8
import pandas as pd
import numpy as np
# 职业训练集,验证集和测试集
occfiles = [r'data/occ/occ_train.txt',r'data/occ/occ_val.txt',r'data/occ/occ_test.txt']
# 分割为高2位,中2位和低2位
count = 0
for occfile in occfiles:
count = count+1
df = pd.DataFrame(pd.read_table(occfile,sep='\t',encoding="utf_8_sig",names=['1',... | true |
9d322987ff50195fc7d33094b6766b4995c462b2 | Python | kidonrage/FESTU_Web | /PR_12/cgi-bin/my_database/add_entry.py | UTF-8 | 2,382 | 2.953125 | 3 | [] | no_license | #!/usr/bin/env python3
print("Content-type: text/html")
print()
print("<!DOCTYPE html>")
print("<html lang='en'>")
print("<head>")
print("<meta charset='UTF-8'>")
print("<title>Добавить запись</title>")
print("</head>")
print("<body>")
print("<form action='add_entry_handler.py' method='post' enctype='multip... | true |
edc37208a2ccd3f4833a04950446166c5c1727b6 | Python | yuri10/TCC_TCE | /tcc_lsi_grupos.py | UTF-8 | 13,324 | 3.109375 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Fri Apr 5 09:59:35 2019
@author: yoliveira\
"""
import pandas as pd #dataframe manipulations
import nltk #tokenizer
import re #re.sub() - Data Cleaner
import unidecode #remover acentos
import gc #garbage collector (para remover variaveis da memória que não estão sendo mais util... | true |
4793ee3b0e6ded2b9751bb2e5a1a73e87f6afc4a | Python | bugrahan-git/ML-IAGFP | /Transform.py | UTF-8 | 2,098 | 3.15625 | 3 | [] | no_license | import random
import cv2
import imgaug.augmenters as iaa
import numpy as np
"""Class to transform images with features random_rotation, random_noise, horizontal_flip"""
class Transform:
def __init__(self):
self.ctr = 0
self.available_transformations = {
'rotate': self.ra... | true |
9c2201971ce043cb1fcad12027a848a2900f20e2 | Python | uu64/leetcode | /solution/python3/83.remove-duplicates-from-sorted-list.py | UTF-8 | 656 | 2.9375 | 3 | [] | no_license | #
# @lc app=leetcode id=83 lang=python3
#
# [83] Remove Duplicates from Sorted List
#
# @lc code=start
# Definition for singly-linked list.
# class ListNode:
# def __init__(self, val=0, next=None):
# self.val = val
# self.next = next
class Solution:
def deleteDuplicates(self, head: ListNode) ->... | true |
edba730b323f03d97d414b377cea5d8b72fc10e1 | Python | datasigntist/mlforall | /scripts/iris_python_Script_Chapter_6.py | UTF-8 | 1,175 | 3.25 | 3 | [] | no_license |
#
# Created : 6-Dec-2016
#
import numpy as np
import matplotlib.pyplot as plt
####Script Part 6.1
from sklearn import datasets
iris = datasets.load_iris()
print(iris.feature_names)
X = iris.data
print(iris.target_names)
y = iris.target
print('Shape of X %d rows %d columns'%X.shape)
print(X[0],iris.target_names[... | true |
02894b03c4d4b293759a0ab7022c445c086ba562 | Python | anthonywritescode/aoc2018 | /day22/part2.py | UTF-8 | 3,380 | 2.59375 | 3 | [] | no_license | import argparse
import enum
import functools
import sys
from typing import Dict
from typing import Generator
from typing import Set
from typing import Tuple
import pytest
from support import timing
class Tool(enum.IntEnum):
TORCH = 1
CLIMBING_GEAR = 2
NOTHING = 3
REGION_ROCKY = 0
REGION_WET = 1
REGION... | true |
f92d9488797c04e26fc142721f5dbebc5e42ce48 | Python | citizen-stig/coverage-jinja-plugin | /jinja_coverage/plugin.py | UTF-8 | 2,415 | 2.625 | 3 | [] | no_license | # -*- encoding: utf-8 -*-
"""
Coverage Plugin for Jinja2 Template Engine
"""
import coverage.plugin
debug = True
class JinjaPlugin(coverage.plugin.CoveragePlugin):
def file_tracer(self, filename):
if filename.endswith('.html'):
return FileTracer(filename)
class FileTracer(coverage.plugin.F... | true |
63a7f36dbcba8e8b41625109d0cd11b75d66d55e | Python | psusmit/algorithms | /algorithms/stringOps/palindrome.py | UTF-8 | 133 | 2.765625 | 3 | [
"MIT"
] | permissive | #@author susmit
#program to check palindrone in python for strings and integer numbers
def palindrome():
return s == s[::-1]
| true |
a184a1599eccc996bdf9b6edd773d9fd01bdd3a0 | Python | gilsonsantos03/PythonWebCoursera | /semana2/regex.py | UTF-8 | 842 | 3.125 | 3 | [] | no_license | import re
string = 'oi eu sou o 1 goku e tambem O 3 goku'
y = re.findall('[aeiou]+',string)
z = re.findall('[0-9]+',string)
print(y)
print(z)
#############################################333
string2 = 'From: Using the : character'
y2 = re.findall('^F.+:', string2)
print(y2)
correct = re.findall('^F.+?:', string2)
p... | true |
4c2030a379e4f3ca246ecb56f3bfaccf71fe825f | Python | DOGEE7/Python | /5高级特性.py | UTF-8 | 4,800 | 4 | 4 | [] | no_license | # ======================切片Slice=========================
L = ['a', 'b', 'c', 'd', 'f', 'e', 'g', 'f']
L1 = list(range(17))
r = []
n = 5
for i in range(n):
r.append(L[i])
print(r) # ['a', 'b', 'c', 'd', 'f']
print(L1[:]) # [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16]
print(L[1:3]) # ['b', 'c']
print... | true |
f5c5c2ac690dff9e6a5ba11f3eb4bccbc0f0f124 | Python | MifengbushiMifeng/pyanalyze | /multi_process/my_except.py | UTF-8 | 311 | 2.953125 | 3 | [] | no_license | def base_exception():
print('base_exception start')
middle_func()
print('base_exception finish')
def middle_func():
try:
raise_exception()
except:
print('An exception occurred!')
def raise_exception():
raise IOError;
if __name__ == '__main__':
base_exception()
| true |
a12cc4fa4fb964311fdf22d7c117f1c0c72b67ce | Python | AlexMabry/aoc20 | /day01/d1a.py | UTF-8 | 190 | 3.015625 | 3 | [
"MIT"
] | permissive | numbers = [int(n) for n in open('d1in.txt').read().splitlines()]
numberSet = {n for n in numbers}
for n in numberSet:
if (2020-n) in numberSet:
print((2020-n)*n)
break
| true |
15990e908c663a1ebeece9e8c264bfcaef3c0c0a | Python | markvassell/Summer_2016 | /corn_model.py | UTF-8 | 1,272 | 3.0625 | 3 | [] | no_license | from csv import DictReader
import pandas as pd
import scipy as sy
import matplotlib.pyplot as plt
import numpy as np
# Years
starting_year = 2014
ending_year = 2023
years = range(starting_year, ending_year + 1)
def main():
count = 0
# name of the file
file = "data.csv"
all_rows = []
try:
... | true |
d049ced202c1984920dd4a2d22469676f66c1476 | Python | ivivan/Imputation_Review | /paper_related/change_gap_size.py | UTF-8 | 1,601 | 2.703125 | 3 | [
"MIT"
] | permissive | import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
from matplotlib.patches import Circle, RegularPolygon
from matplotlib.path import Path
from matplotlib.projections.polar import PolarAxes
from matplotlib.projections import register_projection
from matplotlib.spines import Spine
from matplotlib.tra... | true |
005657837012aeb17f24ff1d723c2e9dfd41521d | Python | XuejieSong523920/Artificial_Intelligence_Course_Code | /prob1.py | UTF-8 | 14,417 | 2.921875 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Wed Dec 4 16:05:06 2019
@author: Xuejie Song
"""
from sklearn.datasets import load_breast_cancer
from sklearn.datasets import load_iris
from sklearn.datasets import load_wine
from sklearn.datasets import load_digits
from sklearn.utils import shuffle
from sklearn.lin... | true |
78ca29c50b81cdd01f61882aeb53eb63d95c5da8 | Python | pingansdaddy/newtempo | /src/growing_file.py | UTF-8 | 692 | 2.875 | 3 | [] | no_license | #coding:utf-8
import os, sys, time
class GrowingFile(object):
def __init__(self, fn):
self._fn = fn
self._fd = os.open(self._fn, os.O_RDONLY)
self._max_size = 1024
def run(self):
buf = ''
while True:
res = os.read(self._fd, self._max_size)
i... | true |
91007434f66aa36b973faa5caa466d39e0cd6c59 | Python | AbhishekDoshi26/python-programs | /Panda/retrieve row values.py | UTF-8 | 107 | 2.53125 | 3 | [] | no_license | import pandas as pd
bond = pd.read_csv('Datasets\jamesbond.csv')
data = bond.loc[[0, 1, 25]]
print(data)
| true |
a6123f6a7d429bd19aafd9b1f7966cf4102a50c1 | Python | Steven-Eardley/lcd_screen | /uptimePlz.py | UTF-8 | 348 | 2.84375 | 3 | [] | no_license | from ScreenController import ScreenController
import sys
def main():
screen = ScreenController()
for line in sys.stdin:
uptime = line.split()
screen.println1(uptime[0][:-3] + " " + uptime[1] + " " + uptime[2][:-1])
print(uptime[0][:-3] + " " + uptime[1] + " " + uptime[2][:-1])
if __name_... | true |
91802dd9054646385ce1a5c8ca02af19c86fdcb3 | Python | pybites/pyplanet-django | /articles/test.py | UTF-8 | 176 | 2.65625 | 3 | [] | no_license | from urllib.parse import urlencode, quote_plus
payload = {'username':'administrator', 'password':'xyz das dasdd'}
result = urlencode(payload, quote_via=quote_plus)
print(result)
| true |
8652a03b519e4271f547a3c7d7de5e4690f0e051 | Python | git-wsf/crawler_project | /haodaifu/haodaifu/utils/deal_excel.py | UTF-8 | 1,381 | 2.6875 | 3 | [] | no_license | #!/usr/bin/python3
# -*- coding: utf-8 -*-
# @time : 18-6-13 下午2:24
# @author : Feng_Hui
# @email : capricorn1203@126.com
import pandas as pd
import os
class CsvToDict(object):
now_path = os.path.dirname(__file__)
def __init__(self, file_name):
super(CsvToDict, self).__init__()
self.file_... | true |
9f077ff1b0995636201eea8a6238cc0cf4adc6e2 | Python | rkurti/NetSci-RediYuchenSun | /src/League.py | UTF-8 | 1,543 | 3 | 3 | [] | no_license | class League:
def __init__(self, league_name):
self.league_name = league_name
self.transfers_for_year = {}
self.clubs = set()
self.all_transfers = set()
self.front_transfers = set() # all front transfers
self.midfield_transfers = set() # all midfield transfers
... | true |
62aa95ef0a6fcb9ba4e5f1d84681a23ff8f630f7 | Python | sk187/IntermediatePython | /excercises.py | UTF-8 | 2,803 | 4.53125 | 5 | [] | no_license | # Exercise Code
# Write a method called e() that
# 1. Determines what data type the input is
#
# 2. It returns the input and datatype in a string
# only for strings.
# " INPUT is a <type DATATYPE>"
#
# e('hi')
# => "hi is a <type 'str'>"
#
# If the input is a int or float retur... | true |
1eb63fd4709078d5d0519a2a39871a57c4e0dcd4 | Python | Axonify/muffin.io | /skeletons/gae/apps/decorators.py | UTF-8 | 1,445 | 2.828125 | 3 | [
"MIT"
] | permissive | from google.appengine.api import memcache
import json
from apps import DEBUG
#
# Decorators
#
def memcached(age):
"""
Note that a decorator with arguments must return the real decorator that,
in turn, decorates the function. For example:
@decorate("extra")
def function(a, b):
...
... | true |
cdc1220a59bc68f04f8f3e4394e53cc555ee1742 | Python | vonum/style-transfer | /color_transfer.py | UTF-8 | 1,371 | 2.890625 | 3 | [
"MIT"
] | permissive | import cv2
import numpy as np
from PIL import Image
class ColorTransfer:
# content_img - image containing desired content
# color_img - image containing desired color
def __init__(self, content_img, color_img):
self.content_img = content_img
self.color_img = color_img
def luminance_transfer(self, conv... | true |
bd2cea490068f55b3ceac7da893c8af8cefc628e | Python | marvinboe/DownstreamReplAge | /plothelpers.py | UTF-8 | 5,120 | 2.734375 | 3 | [
"Apache-2.0"
] | permissive | #######################################################################
#filename: 'plothelpers.py'
#Library with useful functions for plotting.
#
#Copyright 2018 Marvin A. Böttcher
#
#Licensed under the Apache License, Version 2.0 (the "License");
#you may not use this file except in compliance with the License.
#You ... | true |
06052a9fc324c525d68ccf9953350acd19472552 | Python | seva1232/bot | /StopGame.py | UTF-8 | 1,463 | 2.921875 | 3 | [] | no_license | import requests
import pprint
import re
from urllib.parse import quote_plus
import asyncio
import aiohttp
class StopError(Exception):
def __init__(self, code):
self.code = code
def formater_of_sg(dictionary, key):
if key in dictionary.keys():
return ", " + str(dictionary.get(k... | true |
983f43121a99fc2dbf32d68ec65c4307f5513ef2 | Python | Aasthaengg/IBMdataset | /Python_codes/p03471/s287821378.py | UTF-8 | 323 | 2.8125 | 3 | [] | no_license | N, Y =map(int, input().split())
c = 0
for n in range(N+1):
if c == 1:
break
for m in range(N-n+1):
l = N -n - m
if Y ==( n*10000 + m *5000 + l *1000) and (n + m + l) == N:
print(n , m , l)
c = 1
break
if c != 1:
print(-1 , -1 , ... | true |
ad25c202478c205d86d2dd807547e16fc9d1e3ad | Python | ThiruSundar/Python-Tasks | /picdiff.py | UTF-8 | 208 | 2.59375 | 3 | [] | no_license | from PIL import Image, ImageChops
img1 = Image.open('pic1.jpg')
img2 = Image.open('pic2.jpg')
diff = ImageChops.difference(img1 , img2)
# print(diff.getbbox())
if diff.getbbox():
diff.show() | true |
f2b73a84db08cb59b790e2ce15c3044a37811faf | Python | cassianasb/python_studies | /fiap-on/8-5 - CaptureTemperatureJson.py | UTF-8 | 720 | 3.328125 | 3 | [] | no_license | import serial
import json
import time
from datetime import datetime
connection = ""
for port in range(10):
try:
connection = serial.Serial("COM"+str(port), 115200)
print("Conectado na porta: ", connection.portstr)
break
except serial.SerialException:
pass
if connection != "":
... | true |
fcc363802675bdd5ea0e46ae8b5d9c1c2d14bff6 | Python | simonedeponti/CorsoPython-WPFExample | /ExampleWpfApp/ExampleWpfApp.py | UTF-8 | 449 | 2.8125 | 3 | [] | no_license | import wpf
from System.Windows import Application, Window
class MyWindow(Window):
def __init__(self):
wpf.LoadComponent(self, 'ExampleWpfApp.xaml')
self.greetButton.Click += self.greet
def greet(self, sender, event):
name = self.nameTextBox.Text
greeting = "Hello {name}".for... | true |
eed9e3c5784097a60c2a0d6c942303bb1808cfa8 | Python | nathanesau/data_structures_and_algorithms | /_courses/cmpt225/practice4-solution/question14.py | UTF-8 | 407 | 3.546875 | 4 | [] | no_license | """
write an algorithm that gets two binary trees
and checks if they have the same inOrder traversal.
"""
from binary_tree import in_order, build_tree7
def are_equal_in_order(tree1, tree2):
in_order1 = in_order(tree1)
in_order2 = in_order(tree2)
return in_order1 == in_order2
if __name__ == "__main__":
... | true |
50fd20e964720e7c5c049cdccc5ce32ecc4512a8 | Python | greenrazer/deep-vis | /base/trianglecollection.py | UTF-8 | 1,037 | 3.75 | 4 | [] | no_license | class TriangleCollection:
def __init__(self, triangles):
self._triangles = triangles
def __iter__(self):
return iter(self._triangles)
def __add__(self, other):
temp = self.copy()
temp += other
return temp
def __iadd__(self, other):
for i in range(len(se... | true |
5427e381f30c5d8216d54c8a7aa7d5b786075d52 | Python | mingsalt/START_UP_PYTHON | /6st/hw1.py | UTF-8 | 882 | 3.71875 | 4 | [] | no_license | #hw1 기계와 다른숫자를 가지고 있는 카드게임
jay=input("Jay가 선택한 카드(1~9에서 5장):").split()
jay2=list(map(int,jay))
emily=input("Emily가 선택한 카드(1~9에서 5장):").split()
emily2=list(map(int,emily))
from array import array
import random
com=random.sample(range(1,10),3)
com1=com[0]
com2=com[1]
com3=com[2]
print(f"기계가 선택한 카드(1~9에서 3장... | true |
6f8eed9c506b76d0f9bf3a120355eff27f3b8be8 | Python | chika-ibegbu/wine_quality | /wine project.py | UTF-8 | 3,769 | 3.1875 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Thu Aug 12 21:41:26 2021
@author: Dell
"""
#import the libraries
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
import seaborn as sns
%matplotlib inline
#import the dataset
df=pd.read_csv(r"C:\Users\Dell\Downloads\winequality-red.csv")
#u... | true |
8b15cf8a455e7199288f699baed76ac94719f1a8 | Python | jiandie012/python | /.idea/Homework/9x9.py | UTF-8 | 136 | 2.875 | 3 | [] | no_license | print('\n'.join([' '.join(["%2s x%2s = %2s"%(j,i,i*j) for j in range(1,i+1)]) for i in range(1,10)]))
#print ([i for i in range(10)])
| true |
21c0519f4186b2c8015d6f285d3501c39816bd17 | Python | Spidey03/covid_19_dashboard | /covid_dashboard/interactors/storages/.~c9_invoke_wj8lk6.py | UTF-8 | 927 | 2.515625 | 3 | [] | no_license | from abc import ABC
from abc import abstractmethod
from covid_dashboard.interactors.storages.dtos\
import (DailyStateDataDto, CumulativeStateDataDto,
DailyDistrictDataDto, CumulativeDistrictDataDto)
class CovidStorageInterface(ABC):
@abstractmethod
def is_state_id_valid(self, state_id: int):
... | true |
f5c0b13b7aad7c787c5f95ef4a78ccf3a96e5d6b | Python | c-moon-2/Universal_Specification_Verification_Program | /pylib/lan_search.py | UTF-8 | 394 | 2.859375 | 3 | [] | no_license | import psutil
def lan_info():
# LAN
print ("--------- LAN INFO ------------------------------------------------------------------")
lanInfo=psutil.net_if_addrs()
for card_name in lanInfo:
print("LAN 이름 : ", card_name)
print(" - IP 주소 : ", ... | true |
b5acbc78d32226149fc59994092977a01a5abb3a | Python | peterts/adventofcode2020 | /adventofcode2020/day4.py | UTF-8 | 2,241 | 2.6875 | 3 | [] | no_license | from functools import partial
from typing import Literal
from more_itertools import quantify
from pydantic import BaseModel, ValidationError, conint, constr, validator
from adventofcode2020.utils import (
DataName,
fetch_input_data_if_not_exists,
pattern_extract_all,
print_call,
read,
... | true |
2660cd2892c54dcb6abe99a15beb21ca9b5ff816 | Python | dcs4cop/xcube | /test/test_mixins.py | UTF-8 | 3,628 | 2.734375 | 3 | [
"MIT"
] | permissive | import unittest
from test.mixins import AlmostEqualDeepMixin
class AlmostEqualDeepMixinTest(unittest.TestCase, AlmostEqualDeepMixin):
def test_int_and_float_7_places_default(self):
self.assertAlmostEqualDeep(0, 0.8e-8)
with self.assertRaises(AssertionError):
self.assertAlmostEqualDeep... | true |
b148c13a5210e95d91d0c2f5ff6799b5f66970e8 | Python | DevlinaC/Testing_clustering | /plot_agglomerative_dendrogram.py | UTF-8 | 5,251 | 3 | 3 | [] | no_license | """
=========================================
Plot Hierarchical Clustering Dendrogram
=========================================
This example plots the corresponding dendrogram of a hierarchical clustering
using Agglomerative Clustering and the dendrogram method available in scipy
The one in sklearn doesn't work!
"""
... | true |
7578e6fc6ac68abcfdeb56e9d2a2442a9a8a8f41 | Python | rishabhgit0608/FaceRecognition | /face_detection.py | UTF-8 | 509 | 2.640625 | 3 | [] | no_license | import cv2
cam=cv2.VideoCapture(0)
classifier=cv2.CascadeClassifier("haarcascade_frontalface_alt.xml")
while True:
ret,frame=cam.read()
if not ret:
continue
faces=classifier.detectMultiScale(frame,1.3,5)
for face in faces:
x,y,w,h=face # tuple unpacking
cv2.rectangle(frame,(x... | true |
f13b41ddfa3e946147e6b5e06b15fe56102d6283 | Python | MoCuishle28/blogproject-LearnDjango | /comments/models.py | UTF-8 | 932 | 2.8125 | 3 | [] | no_license | from django.db import models
from django.utils.six import python_2_unicode_compatible
# Create your models here.
# python_2_unicode_compatible 装饰器用于兼容 Python2
@python_2_unicode_compatible
class Comment(models.Model):
"""
保存评论用户的 name(名字)、email(邮箱)、url(个人网站)
用户发表的内容将存放在 text 字段里 created_time 记录评论时间
这个评... | true |
748b94d4c533dd90895386657bc3c9acceeca617 | Python | natanaelfelix/Estudos | /Sessão 4/Desafio POO/classes/contacorrente.py | UTF-8 | 529 | 2.859375 | 3 | [] | no_license | from conta import Conta
class ContaCorrente(Conta):
def __init__(self, agencia, nconta, saldo, limite = 1000):
super().__init__(agencia, conta, saldo)
self.agencia = agencia
self.nconta = nconta
self.saldo = saldo
def saque(self, valor):
if (self.saldo + self.limite) ... | true |
38daf30c715781252b9c3396cade106d9b271b77 | Python | merlin2181/Coffee-Machine | /Problems/Small scale/task.py | UTF-8 | 164 | 3.453125 | 3 | [] | no_license | lowest = float(input())
while True:
num = input()
if num == ".":
print(lowest)
break
if lowest > float(num):
lowest = float(num) | true |
98e30eec27a2709fff295f516c86a4b684957513 | Python | kyithar/class | /dataset_clean/python/ratingcsv_reader.py | UTF-8 | 1,104 | 2.96875 | 3 | [] | no_license | import pandas as pd
import numpy as np
def ratingreader(condition_tmp):
hourly = 3600
daily = 86400 # second to day
yearly = 31536000
condition = condition_tmp # choose 1) hourly, 2)daily, 3) yearly
##### load rating.csv ##########
print("Start cleaning 'ratings.csv'")
df_rate = pd.read_cs... | true |
b8f4b96b88405d50eb51987b5cfd18cbf0621428 | Python | thuliosenechal/Codewars | /Counting Duplicates Letters/test_duplicated_letters.py | UTF-8 | 1,166 | 3.4375 | 3 | [] | no_license | import unittest
from duplicated_letters import duplicate_count
class TestDuplicatedLetters(unittest.TestCase):
def test_case_a(self):
string = ''
self.assertEqual(duplicate_count(string), 0)
def test_case_b(self):
string = 'abcde'
self.assertEqual(duplicate_count(string), 0)... | true |
7405c5c43fa1fc005a248818e00a49747a4b361e | Python | github/codeql | /python/ql/test/experimental/dataflow/typetracking/test.py | UTF-8 | 4,831 | 2.96875 | 3 | [
"MIT",
"LicenseRef-scancode-python-cwi",
"LicenseRef-scancode-other-copyleft",
"GPL-1.0-or-later",
"LicenseRef-scancode-free-unknown",
"Python-2.0"
] | permissive | def get_tracked():
x = tracked # $tracked
return x # $tracked
def use_tracked_foo(x): # $tracked
do_stuff(x) # $tracked
def foo():
use_tracked_foo(
get_tracked() # $tracked
)
def use_tracked_bar(x): # $tracked
do_stuff(x) # $tracked
def bar():
x = get_tracked() # $tracked
use... | true |
b0faaa978fd6117a596abc563a2e8296777af5ff | Python | sampaioveiga/python_network_tutorial | /examples/03/client.py | UTF-8 | 245 | 2.625 | 3 | [] | no_license | import socket
server = "192.168.116.1"
port = 12345
client = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
client.connect((server, port))
client.send(b"Hi from client!")
response = client.recv(4096)
print(response.decode())
client.close() | true |
03d2379418e38349224af6b10e844edf9b682118 | Python | makovalab-psu/NoiseCancellingRepeatFinder | /reproduce/map_onto_simulated_reads.py | UTF-8 | 9,352 | 2.984375 | 3 | [
"MIT"
] | permissive | #!/usr/bin/env python
"""
Map intervals from a "genome" to positions on simulated reads.
"""
from sys import argv,stdin,stdout,stderr,exit
from gzip import open as gzip_open
def usage(s=None):
message = """
usage: cat <intervals_file> | map_onto_simulated_reads [options]
--cigars=<filename> (mandatory) cigar ... | true |
09ca13387e545e18ed7448776f25ed1bf0382915 | Python | harkiratbehl/PyGM | /src/codegen.py | UTF-8 | 21,493 | 2.75 | 3 | [
"MIT"
] | permissive | #!/usr/bin/python
"""Generate Assembly code from 3AC"""
import sys
from code import Code, ThreeAddressCode
from registers import Registers
from symbol_table import SymbolTable
three_addr_code = ThreeAddressCode()
assembly_code = Code()
registers = Registers()
input_file = ''
start_main = 0
start_param = 0
def conv... | true |
ad6902ea54982790803383cd7621c88d9f84f0e7 | Python | AdamZhouSE/pythonHomework | /Code/CodeRecords/2595/59140/256525.py | UTF-8 | 116 | 3.3125 | 3 | [] | no_license | T=int(input())
for i in range(0,T):
example=input().split(" ")
print(pow(int(example[1]),int(example[0])-1)) | true |
d06064d3da1c87d3522491c6036bf605de67397b | Python | kukosek/dotfiles | /.config/polybar/forest/scripts/playerctl-display.py | UTF-8 | 863 | 2.765625 | 3 | [] | no_license | #!/usr/bin/python3.9
import subprocess
import textwrap
try:
playing = subprocess.check_output(['playerctl', 'status'], stderr=subprocess.STDOUT).decode('utf-8').strip() == "Playing"
except subprocess.CalledProcessError:
playing = False
if playing:
track_title = ""
track_author = ""
metadata = subpr... | true |
fc3fb1a13c2bbcc81e0b581dc7fb33390b5ba100 | Python | guozhengpku/package_function | /multi_match.py | UTF-8 | 1,929 | 3.140625 | 3 | [] | no_license | #-*-coding:utf-8-*-
from gensim.models import Word2Vec
class PrefixQuery(object):
def __init__(self, words={}):
self.prefix_dict = {}
self.label_dict = {}
self._init(words)
# print(self.prefix_dict)
def _init(self, words):
for word in words:
self.insert(word... | true |
a8220535bb24b0dc33c6427095c0da4fdebc331f | Python | IzaakPrats/beginning_python | /basic_calculator.py | UTF-8 | 421 | 4.0625 | 4 | [
"MIT"
] | permissive | x = int(input("Enter your first number: "))
y = int(input("Input your second number: "))
o = str(input("Enter the operator: "))
def add(x, y):
return x + y
def subtract(x, y):
return x - y;
def multiply(x, y):
return x * y;
def divide(x, y):
return x / y;
if o is "+":
print(str(add(x, y)))
if o is "-":
prin... | true |
a4261837adfa810db7075e3e0dcfd3e626d45a59 | Python | frc-5160-the-chargers/lebot-james | /components/loader.py | UTF-8 | 658 | 2.53125 | 3 | [] | no_license | from ctre import WPI_TalonSRX
from modes import LoaderPosition
class LoaderConstants:
K_POWER_UP = 0.25
K_POWER_DOWN = -0.25
class Loader:
loader_motor: WPI_TalonSRX
def __init__(self):
self.reset()
def reset(self):
self.enabled = False
self.position = LoaderPosition.UP
... | true |
494e02127ec143eccde29e937390a7dce62e4700 | Python | inergoul/boostcamp_peer_session | /coding_test/pass_42576_완주하지못한선수/solution_LJH.py | UTF-8 | 379 | 3.015625 | 3 | [] | no_license | # https://programmers.co.kr/learn/courses/30/lessons/42576
def solution(participant, completion):
sorted_p = sorted(participant)
sorted_c = sorted(completion) + [0] # 길이가 다르기때문에 마지막에 맞춰줌
answer = 0
for p, c in zip(sorted_p, sorted_c):
if p != c:
answer = p
break
... | true |
1e2a900c4a7c45c5511e46a4bda663d516df6c53 | Python | BejeweledMe/TReNDS-Neuroimaging | /3D_CNN/losses.py | UTF-8 | 727 | 2.75 | 3 | [] | no_license | from torch import nn
import torch
class W_NAE(nn.Module):
def __init__(self, w=[0.3, 0.175, 0.175, 0.175, 0.175]):
super().__init__()
self.w = torch.FloatTensor(w)
def forward(self, output, target):
if not (target.size() == output.size()):
raise ValueError('Target size ({}... | true |
f489f7b3b754f21afcf5ea657301d1a880d3acc0 | Python | spacetime314/python3_ios | /extraPackages/matplotlib-3.0.2/examples/text_labels_and_annotations/fonts_demo.py | UTF-8 | 2,915 | 3.3125 | 3 | [
"BSD-3-Clause"
] | permissive | """
==================================
Fonts demo (object-oriented style)
==================================
Set font properties using setters.
See :doc:`fonts_demo_kw` to achieve the same effect using kwargs.
"""
from matplotlib.font_manager import FontProperties
import matplotlib.pyplot as plt
plt.subplot(111, fa... | true |
d54c9d5846b1d912d71851d4fae4f588bc999461 | Python | russellmacshane/learn_day_01may20 | /utils/utils.py | UTF-8 | 605 | 2.65625 | 3 | [] | no_license | class Utils:
def summary_output(self, json):
return {
'NewConfirmed': json['NewConfirmed'],
'TotalConfirmed': json['TotalConfirmed'],
'NewDeaths': json['NewDeaths'],
'TotalDeaths': json['TotalDeaths'],
'NewRecovered': json['NewRecovered'],
... | true |
f345e85a421862125d5d0a758e4397c1ca4e9746 | Python | Iigorsf/Python | /ex038.py | UTF-8 | 454 | 4.4375 | 4 | [
"MIT"
] | permissive | #Escreva um programa que leia dois números inteiros e compare-os, mostrando na tela uma mensagem:
#O primeiro valor é maior
#O Segundo valor é maior
#Não existe valor maior, os dois são iguais
num= int(input("Digite um número: "))
num2= int(input("Digite outro número: "))
if num > num2:
print("O primeiro valor é ... | true |
346809e14ab97f0ce532728a204caec1afde2556 | Python | kimnakyeong/changeToAWS | /Dr.Foody/scraper/so.py | UTF-8 | 2,006 | 3.09375 | 3 | [] | no_license | import requests
from bs4 import BeautifulSoup
LIMIT = 50
URL = f"https://stackoverflow.com/jobs?q=python&sort=i"
def get_last_page():
result = requests.get(URL)
soup = BeautifulSoup(result.text,"html.parser")
pages = soup.find("div", {"class":"s-pagination"}).find_all("a")
last_page = pages[-2].get_te... | true |
4a8f665e808f0190d3ea45747b784689d04bd86d | Python | ace-racer/ContextualRecommender | /modeling/tag_generation/TagGeneratorBase.py | UTF-8 | 2,540 | 2.625 | 3 | [] | no_license | import math
import pandas as pd
import numpy as np
import os
import configurations
import constants
from base_operations import base_operations
class TagGeneratorBase(base_operations):
def __init__(self):
self._nan = "nan"
def get_stream_details(self):
print("Reading the stream details...")
... | true |
70de54b1cbc995d0cdbb9f8869a7f204dc12c467 | Python | jean/reg | /reg/predicate.py | UTF-8 | 11,071 | 2.859375 | 3 | [] | no_license | from .sentinel import NOT_FOUND
import inspect
from .argextract import KeyExtractor, ClassKeyExtractor, NameKeyExtractor
from .error import RegistrationError
class Predicate(object):
"""A dispatch predicate.
"""
def __init__(self, name, index, get_key=None, fallback=None,
default=None):
... | true |
84f35f95dbe1404546f5723eee9072e3783611c7 | Python | Nicolas810/Programacion2-clase30-03 | /Ejecicio2-clase3.py | UTF-8 | 93 | 3.359375 | 3 | [] | no_license | edad= int(input("Ingrese su edad:"))
i=1
for i in range(edad+1):
print(i)
i=i+1
| true |
c1c9b5d4ceebcdb459b4809c632391e77e934806 | Python | drbrhbym/III_Python_class | /1218Demo/rps2.py | UTF-8 | 315 | 3.6875 | 4 | [] | no_license | import random
my = int(input("[0] 蟲 [1] 雞 [2] 老虎 [3] 棒子"))
com = random.randint(0, 2)
trans = ["蟲", "雞", "老虎", "棒子"]
print("my:", trans[my])
print("com:", trans[com])
if my == (com + 1 ) % 4:
print("you win")
elif com == (my + 1) %4:
print("you lose")
else:
print("平手")
| true |
f492f3f464bd5301255800d2e266bb513625c9d5 | Python | hwngenius/leetcode | /hot_100/101.py | UTF-8 | 792 | 3.34375 | 3 | [] | no_license | # Definition for a binary tree node.
class TreeNode:
def __init__(self, x):
self.val = x
self.left = None
self.right = None
class Solution:
def isSymmetric(self, root: TreeNode) -> bool:
def myfun(node1:TreeNode,node2:TreeNode)->bool:
if node1 and node2:
... | true |
2b85f2c9333448eb6120bcda905545322ce1285d | Python | kangli-bionic/leetcode-1 | /384.py | UTF-8 | 961 | 4 | 4 | [
"MIT"
] | permissive | #!/usr/bin/env python
# coding=utf-8
'''
学到了:
1、如何使用python中的lambda表达式: lambda 参数:操作(参数),lambda表达式就是一个函数而已,
多用于短的函数。lambda同样可以不带参数,就如此题中的那样
2、random.sample([list],length of samples)
'''
import random
class Solution(object):
def __init__(self, nums):
"""
:type nums: List[int]
"""
... | true |
6be5a388888de8c4aa31e1b9c589716eb1da1245 | Python | 17mirinae/Python | /Python/DAYEA/수학2/소수 구하기.py | UTF-8 | 280 | 3.34375 | 3 | [] | no_license | import math
def prime(x):
y = int(math.sqrt(x))+1
if x == 1:
return False
for i in range(2, y):
if x % i == 0:
return False
return True
M, N = map(int, input().split())
for j in range(M, N+1):
if prime(j) == True:
print(j)
| true |
7eeaafb157d169508787479b7dec04e11aab1e7e | Python | bluesky/bluesky-kafka | /bluesky_kafka/tests/test_basic_consumer.py | UTF-8 | 2,841 | 2.78125 | 3 | [
"BSD-3-Clause"
] | permissive | import pytest
from bluesky_kafka.consume import BasicConsumer
@pytest.mark.parametrize(
"bootstrap_servers, consumer_config_bootstrap_servers",
[
([], ""),
(["localhost:9092"], "localhost:9092"),
(["localhost:9091", "localhost:9092"], "localhost:9091,localhost:9092"),
],
)
def tes... | true |
6d08480f34b83680861bd26a617e2cb3aa85b2ee | Python | kurtrm/predicting_equipment_failure | /notebooks/frag_tools.py | UTF-8 | 12,820 | 3.140625 | 3 | [
"MIT"
] | permissive | """
Various functions and classes made while developing
pipelines and/or cleaning data.
"""
import json
from typing import List, Text, Callable
import yaml
from sklearn.base import BaseEstimator, TransformerMixin
from sklearn.preprocessing import StandardScaler, LabelBinarizer
import googlemaps
import pan... | true |
bdeaf89956e9c11ee7ad098ea120920a0660e921 | Python | harshitsharmaiitkanpur/cs251_exam | /CS 251/ASSIGNMENTS/assignment 3/160283/QN2.py | UTF-8 | 3,535 | 2.578125 | 3 | [] | no_license |
# coding: utf-8
# In[1]:
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import sys
import os
# In[2]:
data = pd.read_csv(sys.argv[1])
# In[3]:
data=np.array(data)
# In[4]:
x_train = data[:,0]
y_train = data[:,1]
# In[5]:
xx= np.zeros((x_train.size,2))
# In[6]:
xx
# In[7... | true |
bfecd78ab8b66554c766d362768129d2c41d8512 | Python | Rifleman354/Python | /Python Crash Course/Chapter 9 Exercises/techpriestDatabase4.py | UTF-8 | 2,469 | 3.296875 | 3 | [] | no_license | class TP_Database():
'''Tech priest database class'''
def __init__(self, name, rank):
'''Initializes the name and rank attributes'''
self.name = name
self.rank = rank
self.login_attempts = 0
def describe_TP(self, *extraDesc):
'''Summarizes the information about the tech priest'''
print(se... | true |
563fb4e90b582da7d3945033d629108e68252d44 | Python | gdogpwns/RespireBookScanner | /HaitiBookScanner.py | UTF-8 | 7,385 | 3.265625 | 3 | [] | no_license | # isbntools documentation found at https://isbntools.readthedocs.io/en/latest/info.html
# Using this too: https://stackoverflow.com/questions/26360699/how-can-i-get-the-author-and-title-by-knowing-the-isbn-using-google-book-api
import sys
import openpyxl
import datetime
from isbntools.app import *
# Service set for Go... | true |
3e942e48fc2da2c8573f8160b298f4a474379457 | Python | Aaaronchen/JS_Encrypt | /天气/test.py | UTF-8 | 3,931 | 3.078125 | 3 | [] | no_license | import execjs,time,json,base64
'''
sss0 = "你好siri,今天天气30摄氏度!...++/=1"
sss1 = "你好siri,今天天气30摄氏度!...++/=1"
sss2 = sss1.encode('utf-8')
print(sss2,type(sss2))
print(base64.encodestring(sss2))
print(base64.b64encode(sss2))
'''
from Crypto.Cipher import DES,DES3
from Crypto.Cipher import AES
from binascii import b2a_hex... | true |
8f5bdb6cbd950b0f5e69781eda12a40d9d6f35db | Python | xiaochuan-cd/leetcode | /multiply.py | UTF-8 | 1,036 | 3.109375 | 3 | [
"MIT"
] | permissive | class Solution:
def multiply(self, num1, num2):
"""
:type num1: str
:type num2: str
:rtype: str
"""
value = [0]*(len(num1)+len(num2))
for i in range(len(num1)-1, -1, -1):
for j in range(len(num2)-1, -1, -1):
value[i+j+1] += int(n... | true |
4ce0891bf873eac480883808880ffac083810e0a | Python | LimSangSang/python_study | /chapter_04_02.py | UTF-8 | 3,368 | 4.03125 | 4 | [] | no_license | # 시퀀스 형
# 컨테이너(Container: 서로 다른 자료형[list, tuple, collections.deque])
# 플랫(Flat: 한개의 자료형[str, bytes, bytearray, array.array, memoryview])
# 가변(list, bytearray, array.array, memoryview, deque)
# 불변(tuple, str, bytes)
# Tuple Advanced
# Unpacking
# b, a = a, b (다른 언어는 임시 변수를 만들어서 a, b를 각각 할당했다가 그 다음 교차해주는게 필요한데 python은 ... | true |