seq_id stringlengths 4 11 | text stringlengths 113 2.92M | repo_name stringlengths 4 125 ⌀ | sub_path stringlengths 3 214 | file_name stringlengths 3 160 | file_ext stringclasses 18
values | file_size_in_byte int64 113 2.92M | program_lang stringclasses 1
value | lang stringclasses 93
values | doc_type stringclasses 1
value | stars int64 0 179k ⌀ | dataset stringclasses 3
values | pt stringclasses 78
values |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
6440384227 | # -*- coding: utf-8 -*-
"""
Spyder Editor
This is a temporary script file.
"""
import requests
from bs4 import BeautifulSoup
word=input("enter word:")
data =requests.get("https://www.collinsdictionary.com/dictionary/english-hindi/"+word)
soup=BeautifulSoup(data.text,"html.parser")
soup.prettify()
d=soup.fi... | chhn23/myprojects | one word dictionary.py | one word dictionary.py | py | 396 | python | en | code | 0 | github-code | 90 |
36775740182 | import streamlit as st
from PIL import Image
from eval import load_class_data, predict, prepare_model, preprocess_image
def main():
class_data = load_class_data("label_num_to_disease_map.json")
# model selection with string for future drop-down menu
model = prepare_model("INCEPTION")
st.title("Cassav... | p-wojciechowski/cassava-classification | main.py | main.py | py | 970 | python | en | code | 0 | github-code | 90 |
9657056712 | import gym
from gym import spaces
import numpy as np
import math
import pprint
def normalize(board):
n = np.linspace(start=0, stop=1, num=12)
board = [[int(np.log2(j)) if j != 0 else int(j) for j in i] for i in board]
board = [[n[j] for j in i] for i in board]
return np.array(board)
class Gam... | dgg1dbg/g-2048 | g_2048/game_board.py | game_board.py | py | 3,830 | python | en | code | 1 | github-code | 90 |
15594360143 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Fri Dec 21 20:23:53 2018
@author: KushDani
"""
import tensorflow as tf
from tensorflow import keras
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
dataFrame = pd.read_csv('/Users/KushDani/Downloads/data.csv')
B,M = dataFrame.diag... | kdani7777/BreastCancerSmartDiagnosis | diagnosis.py | diagnosis.py | py | 2,797 | python | en | code | 0 | github-code | 90 |
27914046282 | __author__='yuan'
from collections import namedtuple
User=namedtuple('User',['name','age','height','edu'])
# user=User('Tom',28,175)
user_tuple=('Tom',28,175)
user_list=['Tom',28,175]
user_dict={
'name':'Jack',
'age':19,
'height':175,
'edu':'master',
}
user=User(*user_tuple,edu='master')
# print(user)
#... | ningmuning/python | PythonDemo/collection/demo1.py | demo1.py | py | 512 | python | en | code | 0 | github-code | 90 |
29294791154 | #
# Practical Test 4
#
# testAccounts.py - program to test functions of accounts.py
#
# Student Name :
# Student Number :
# Date/prac time :
#
from accounts import BankAccount
def balances():
print('\n#### Balances of All Accounts####\n')
total = 0
for i in range(len(my_accounts)):
print("... | vlanducci/FOP | Random/testAccounts.py | testAccounts.py | py | 609 | python | en | code | 1 | github-code | 90 |
6450068381 | # -*- coding: utf-8 -*-
import sys
def check_printlog(parser, logitdefault, debug):
if parser.has_option('general', 'log_activities'):
logit = parser.get('general', 'log_activities').lower()
if logit == 'yes':
logit = True
if debug:
print >> sys.stderr, ("[... | open-dynaMIX/experms | src/experms/configfile/check_printlog.py | check_printlog.py | py | 1,034 | python | en | code | 2 | github-code | 90 |
35003963617 | from unittest.util import sorted_list_difference
precios = []
for i in range(2):
precios.append(int(input("Introduce un nuevo precio: ")))
print("Los precios son ingresados; ")
print(precios)
preciomax = max(precios)
print(preciomax)
| spmiranda3/ciclos | ejercicio4.py | ejercicio4.py | py | 250 | python | es | code | 0 | github-code | 90 |
18372925789 | from collections import defaultdict as dd
n = int(input())
A = list(map(int, input().split()))
odd_ac = dd(int)
even_ac = dd(int)
for i, a in enumerate(A):
if i % 2 == 0:
even_ac[i] = even_ac[i-2] + a
else:
odd_ac[i] = odd_ac[i-2] + a
#print(odd_ac)
#print(even_ac)
ans = []
for dam in range(n)... | Aasthaengg/IBMdataset | Python_codes/p02984/s518011461.py | s518011461.py | py | 736 | python | en | code | 0 | github-code | 90 |
24221400046 | fname = input("enter file name you want to read: ")
path = "/Users/bigdaddy/Desktop/Python_Data_Science/CourseEra/PythonForEverybody/Course2PythonDataStructure/"
print('file path is : ',path)
try:
filecontent = open(path + fname)
except:
con = input("wrong file name entered: if you want to continue press Y or ... | akkiankit/Practice_DataScience | CourseEra/PythonForEverybody/Course2PythonDataStructure/FileHandling_1.py | FileHandling_1.py | py | 533 | python | en | code | 0 | github-code | 90 |
70458436778 | from collections import defaultdict
from copy import deepcopy
def def_list():
return []
class Elf:
id: int
choices: list[str] = ["N", "S", "W", "E"]
def cycle_decision(self):
tmp = self.choices[0]
self.choices = self.choices[1:]
self.choices.append(tmp)
def get_lines(filen... | Benjababe/Advent-of-Code | 2022/Day 23/d23.py | d23.py | py | 4,354 | python | en | code | 0 | github-code | 90 |
37442069481 | import torch.utils.data as data
import torchvision.transforms as tfs
from torchvision.transforms import functional as FF
import os,sys
from tqdm import tqdm
sys.path.append('.')
sys.path.append('..')
import numpy as np
import torch
import random , glob
from PIL import Image
from torch.utils.data import DataL... | zhilin007/LightEnhancement | net/data_utils.py | data_utils.py | py | 7,047 | python | en | code | 0 | github-code | 90 |
40984449624 | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.contrib import messages
from django.shortcuts import render, redirect, get_object_or_404
from django.urls import reverse
from django.views.generic import TemplateView
from django_celery_beat.models import PeriodicTask, CrontabSchedule
import js... | schMok0uTr0nie/sendmail | sendman/views.py | views.py | py | 7,460 | python | en | code | 0 | github-code | 90 |
69936181738 | import requests
from datetime import datetime, timedelta
import json
import csv
import os
def obtener_temperatura_pronostico(api_key):
# Función para obtener el pronóstico de temperatura
latitud = 40.0271087
longitud = -3.9115161
url_pronostico = f'https://api.openweathermap.org/data/2.5/onec... | rrpp/get_daily_power_prices_by_hour | forecast_s_1.3.py | forecast_s_1.3.py | py | 3,470 | python | es | code | 0 | github-code | 90 |
19444554455 | from django.shortcuts import render,HttpResponse
from all_models.models import *
from apps.common.func.WebFunc import *
import openpyxl,xlrd,json,platform
from django.http import StreamingHttpResponse
from urllib import parse
from apps.ui_task.services.PageObjectService import PageObjectService
from apps.version_mana... | LianjiaTech/sosotest | AutotestWebD/apps/ui_task/views/ui_task_simple.py | ui_task_simple.py | py | 15,890 | python | en | code | 489 | github-code | 90 |
29006934103 | import cvxpy as cvx
import cvxpy.settings as s
from cvxpy.lin_ops.tree_mat import prune_constants
import cvxpy.problems.iterative as iterative
from cvxpy.tests.base_test import BaseTest
import numpy as np
class TestConvolution(BaseTest):
""" Unit tests for convolution. """
def test_1D_conv(self):
"""... | johnjaniczek/SFCLS | venv/lib/python3.5/site-packages/cvxpy/tests/test_convolution.py | test_convolution.py | py | 3,299 | python | en | code | 12 | github-code | 90 |
71061845416 | import random
from typing import Optional
import pygame
from pygame.sprite import Sprite, Group
from src.settings import BackgroundStarSettings as BG_Settings, Settings, PlayerDirection
class BackgroundStars(Sprite):
stars = Group()
star_direction: Optional[PlayerDirection] = None
@staticmethod
def... | Joel-Edem/space_ranger | src/componnets/background_stars.py | background_stars.py | py | 3,776 | python | en | code | 0 | github-code | 90 |
8986864650 | from mpl_toolkits.mplot3d import Axes3D
from matplotlib import cm
from matplotlib.ticker import LinearLocator, FormatStrFormatter
import matplotlib.pyplot as plt
import numpy as np
def plot_surf():
fig = plt.figure()
ax = fig.gca(projection='3d')
x = np.arange(-1, 1.00, 0.05)
y = np.arange(-1, 1.00, 0... | ahmadyan/Duplex | test/plots/surf.py | surf.py | py | 880 | python | en | code | 6 | github-code | 90 |
21888742341 | #coding=utf-8
#Python单元测试框架——unittest
##对Math类进行单元测试
from clator import SS
import unittest
class TestMath(unittest.TestCase):
def setUp(self):
print ("test start")
def test_add(self):
j=SS(5,10)
self.assertEqual(j.add(),15)
def tearDown(self):
print ("test end")
if __name__... | carrotWu/pythonProjrct | unitTest/test_Math.py | test_Math.py | py | 501 | python | en | code | 1 | github-code | 90 |
38235447163 | import math
import time
from abc import ABC
from qgis.core import *
from algorithms.GdalUAV.transformation.coordinates.CoordinateTransform import CoordinateTransform
from ModuleInstruments.DebugLog import DebugLog
from algorithms.GdalUAV.processing.FindPathData import FindPathData
from algorithms.AStarMethodGrid impo... | Vladimir-Voronin/uav_find_path | algorithms/SeparationMethod.py | SeparationMethod.py | py | 10,450 | python | en | code | 0 | github-code | 90 |
35763617074 | #Stock awal
inventory = {
"tehpucukjkt": {'Warehouse': 'jakarta',
'Category': 'FMCG',
'Rack Location': 'J1',
'Product Name': 'teh pucuk',
'Quantity (pcs)' : 1000},
"indomiejkt": {'Warehouse': 'jakarta',
'Category': 'FMCG',
'Rack Location': 'J1',
... | revalderaditya/Warehouse-Inventory-System | Capstone Project Module 1.py | Capstone Project Module 1.py | py | 17,267 | python | ms | code | 0 | github-code | 90 |
34345650673 | import os
AWS_S3_BUCKET_NAME = "Diamond-Price"
MONGO_DATABASE_NAME = "DimondPricePrediction"
MONGO_COLLECTION_NAME = "Diamond_Price"
TARGET_COLUMN = "price"
MONGO_DB_URL="mongodb+srv://pgmahajanott:pgmahajanott@cluster0.mevcvot.mongodb.net/?retryWrites=true&w=majority"
MODEL_FILE_NAME = "model"
MODEL_FILE_EXTENSION... | Prashant9511/DiamondPricePrediction | src/constant/__init__.py | __init__.py | py | 361 | python | en | code | 0 | github-code | 90 |
18398921949 | #13:12
n,q = map(int,input().split())
import heapq
import sys
input = sys.stdin.readline
event = []
for _ in range(n):
s,t,x = map(int,input().split())
heapq.heappush(event,(s-x,t-x,x))
t = 0
now = []
for _ in range(q):
d = int(input())
if event:
while event[0][0] <= d:
tmp = heapq.heappop(event)
... | Aasthaengg/IBMdataset | Python_codes/p03033/s728466019.py | s728466019.py | py | 557 | python | en | code | 0 | github-code | 90 |
29263791521 | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
import colorfield.fields
class Migration(migrations.Migration):
dependencies = [
("app", "0006_sourceline_tags_json"),
]
operations = [
migrations.CreateModel(
name="Diag... | johntellsall/shotglass | shotglass/app/migrations/0007_diagramsymbol.py | 0007_diagramsymbol.py | py | 1,050 | python | en | code | 17 | github-code | 90 |
18562917799 | import sys
readline = sys.stdin.readline
h, w, d = map(int, readline().split())
A = [list(map(int, readline().split())) for _ in range(h)]
q = int(readline())
LR = [tuple(map(lambda x:int(x)-1, readline().split())) for _ in range(q)]
D = dict()
for hi in range(h):
for wi in range(w):
D[A[hi][wi]-1] = [hi,w... | Aasthaengg/IBMdataset | Python_codes/p03426/s950806130.py | s950806130.py | py | 481 | python | en | code | 0 | github-code | 90 |
30750395803 | import os
from sys import path, argv
path.append("/home/hklee/work/mylib")
from hk_plot_tool import Image_Plot
import hk_tool_box
import hk_gglensing_tool
import numpy
import h5py
import hk_FQlib
import time
# import c4py
import galsim
from astropy.cosmology import FlatLambdaCDM
from astropy.coordinates import SkyCoord... | hekunlie/astrophy-research | galaxy-galaxy lensing/simu/segment_file.py | segment_file.py | py | 3,308 | python | en | code | 2 | github-code | 90 |
38865071406 | from PIL import Image
# load both the given images
word_matrix = Image.open("word_matrix.png")
mask = Image.open("mask.png")
# convert both the images into same size
matrix_x,matrix_y=word_matrix.size
mask = mask.resize((matrix_x,matrix_y))
# make mask a bit transparent
mask.putalpha(100)
# put transparent-ish mask... | jonwk/Python-Stuff | Images/Word_Matrix_Problem.py | Word_Matrix_Problem.py | py | 474 | python | en | code | 0 | github-code | 90 |
70093305256 | # !/usr/bin/env python
# -*- coding: utf-8 -*-
if __name__=='__main__':
# Lista 1: Nombre de los jugadores.
players = ['Alvaro Revoredo', 'Mike Frist', 'Paula Jimenez','Gonzalo Chacaltana','Felipe Ayala']
# Lista 2: País de procedencia.
countries = ['Uruguay','Brasil','México','Perú','Chile']
... | gchacaltana/python_snippets | lambda.py | lambda.py | py | 1,943 | python | es | code | 0 | github-code | 90 |
38305024090 |
# this function return a new string which is three copies of the front
# front = three first chars
def front3(str):
s = ""
if len(str) < 3:
s = str + str + str
else:
s = str[:3] + str[:3] + str[:3]
return s
print(front3("Java"))
print(front3("Chocolate"))
print(front3("abc"))
| jemtca/CodingBat | Python/Warmup-1/front3.py | front3.py | py | 289 | python | en | code | 0 | github-code | 90 |
25571688584 | from __future__ import absolute_import
import importlib
import os
import pkgutil
import re
import sys
import unittest
import coverage
TEST_MODULE_REGEX = r"^.*_test$"
# Determines the path og a given path relative to the first matching
# path on sys.path. Useful for determining what a directory's module
# path wil... | grpc/grpc | src/python/grpcio_tests/tests/_loader.py | _loader.py | py | 4,512 | python | en | code | 39,468 | github-code | 90 |
40794457686 | import locale
from flask import Blueprint, Response, render_template, request, session, current_app
from src.blueprints.database import connect_db
from src.blueprints.decode_keyword import decode_keyword
from src.blueprints.format_data import format_requests
from src.blueprints.auth import login_required
from src.blu... | lomohoga/sIMS | src/blueprints/bp_request.py | bp_request.py | py | 10,687 | python | en | code | 0 | github-code | 90 |
5665212462 | import layers
import tensorflow as tf
from datahelper import *
import logging
import time
class network:
reportFrequency = 50
def __init__(self):
self.global_step = tf.Variable(0, trainable=False)
self.dropoutRate = tf.placeholder(tf.float32, name="DropoutRate")
self.session = None
... | plubon/thesis | network.py | network.py | py | 5,823 | python | en | code | 0 | github-code | 90 |
19228942888 | import cv2 as cv
import numpy as np
from matplotlib import pyplot as plt
# 对一副图像进行傅立叶变换,显示频谱,取其5,50,150为截至频率,进行频率域平滑,锐化,显示图像
img = cv.imread('../Project1/lena_top.jpg',0)
dft = cv.dft(np.float32(img),flags = cv.DFT_COMPLEX_OUTPUT)
dft_shift = np.fft.fftshift(dft)
magnitude_spectrum = 20*np.log(cv.magnitude(dft_shi... | mvchain/cryptovault-ios | ToPay/opencvlearn.py | opencvlearn.py | py | 2,628 | python | en | code | 1 | github-code | 90 |
71216821736 | import cv2 as cv
import numpy as np
# from pynput.mouse import Button, Controller
import wx
import math
import time
import ctypes
# mouse = Controller()
app = wx.App(False)
(sx,sy) = wx.GetDisplaySize()
# (camx,camy) = (320,240)
(camx,camy) = wx.GetDisplaySize()/2
cam = cv.VideoCapture(0)
cam.set(3,camx)
cam.set(4,ca... | imvickykumar999/hackathon-iot-car-parking | robocar/controler.py | controler.py | py | 5,169 | python | en | code | 2 | github-code | 90 |
36913949766 | import pytest
from fhepy.polynomials import Polynomials
from fhepy.zmodp import ZMod
ZMod2 = ZMod(2)
ZMod7 = ZMod(7)
ZMod11 = ZMod(11)
@pytest.mark.parametrize('field,coefficients,expected', [
(ZMod2, [0], "0"),
(ZMod2, [1], "1"),
(ZMod2, [3], "1"),
(ZMod7, [6], "6"),
(ZMod7, [7], "0")])
def tes... | benpbenp/fhepy | tests/polynomials/test_str.py | test_str.py | py | 1,378 | python | en | code | 1 | github-code | 90 |
5992803190 | # 引入库
# Import Packages
import cv2
import numpy as np
from moviepy.editor import VideoFileClip
def gray_scale(img):
"""
灰度转换
Applies the Gray scale transform
:param img:
:return: grey image
"""
return cv2.cvtColor(img, cv2.COLOR_RGB2GRAY)
def gaussian_blur(img, kernel_size):
"""
... | Flash-zhangliangliang/Flash-LaneLines-P1 | LaneFindingPipline/LaneFinding.py | LaneFinding.py | py | 4,846 | python | en | code | 0 | github-code | 90 |
18536165749 | def main():
s = input()
k = int(input())
d = len(s)
m = set()
if k >= d:
for i in range(d):
for j in range(1, d - i + 1):
m.add(s[i:i + j])
else:
for i in range(d):
for j in range(1, k + 1):
m.add(s[i:i + j])
m = list(m... | Aasthaengg/IBMdataset | Python_codes/p03353/s819788957.py | s819788957.py | py | 395 | python | en | code | 0 | github-code | 90 |
27631351644 | from selenium.webdriver.support import expected_conditions as EC
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.common.by import By
from selenium import webdriver
import time
# Set the URL of the issue page you want to monitor
url = 'http... | vedant-z/GitHub-Issue-Claimer | main.py | main.py | py | 3,054 | python | en | code | 1 | github-code | 90 |
29391628313 | import os
import sys
class ConfigDict(dict):
def __init__(self, filename):
self._filename = filename
if os.path.isfile(self._filename):
with open(self._filename) as fh:
for line in fh:
line = line.rstrip()
k, v = line.split('=', ... | robinsonleeuk/Python-Beyond-the-Basics---Object-Oriented-Programming-Udemy | Chapter 5/assignment3.py | assignment3.py | py | 941 | python | en | code | 0 | github-code | 90 |
70232296618 | import os
import sys
import cv2
import matplotlib.pyplot as plt
import matplotlib.image as mpimg
from terminaltables import DoubleTable
def get_video_filenames(directory):
"""
Returns a list containing all the mp4 files in a directory
:param directory: the directory containing mp4 files
:return: list... | Adamouization/Content-Based-Video-Retrieval-Code | app/helpers.py | helpers.py | py | 6,090 | python | en | code | 15 | github-code | 90 |
23991340336 | from flask import Flask, render_template, request
import json
app = Flask(__name__)
app.config["TEMPLATES_AUTO_RELOAD"] = True
@app.after_request
def after_request(response):
response.headers["Cache-Control"] = "no-cache, no-store, must-revalidate"
response.headers["Expires"] = 0
response.headers["Pragma"... | eawang02/HackMIT-AsyncLecture | application.py | application.py | py | 1,407 | python | en | code | 0 | github-code | 90 |
3416383134 | #Imports
import pandas as pd
import matplotlib.pyplot as plt
import requests
#Global Variables
url = "https://api.coincap.io/v2/assets"
tracked_currencies = ['bitcoin', 'ethereum']
#Functions
def get_data():
resp = requests.get(url)
if resp.status_code == 200:
data = resp.json()['data']
expor... | AlmirPaulo/crypto_tracker | tracker.py | tracker.py | py | 2,152 | python | en | code | 0 | github-code | 90 |
46182304420 | import database as db
from tkinter import messagebox
class Product:
def __init__(self, name="", price=0.0, quantity=0, discount=0, percentoff=0):
self.name = name
self.originalprice = price
self.quantity = quantity
self.discount = discount
self.percentoff = percentoff
... | djricky5/HFSShoppingCart | business.py | business.py | py | 3,332 | python | en | code | 0 | github-code | 90 |
4302288909 | import numpy as np
import stellargraph as sg
from keras import Sequential
from keras.layers import Dense, Dropout
from keras.models import Model
from sklearn.metrics import accuracy_score
from tensorflow.keras import losses
from sklearn import model_selection
from stellar_graph_demo.visualisation import tsne_plot_emb... | CuriousKomodo/gnn_experiments | stellar_graph_demo/baseline/train_mlp_functions.py | train_mlp_functions.py | py | 3,222 | python | en | code | 4 | github-code | 90 |
18154903979 | import bisect, copy, heapq, math, sys
from collections import *
from functools import lru_cache
from itertools import accumulate, combinations, permutations, product
def input():
return sys.stdin.readline()[:-1]
def ruiseki(lst):
return [0]+list(accumulate(lst))
def celi(a,b):
return -(-a//b)
sys.setrecursi... | Aasthaengg/IBMdataset | Python_codes/p02550/s377178681.py | s377178681.py | py | 887 | python | en | code | 0 | github-code | 90 |
26541269495 | import tensorflow as tf
class LayerNormLSTMCell(tf.keras.layers.LSTMCell):
def __init__(
self,
units,
activation = "tanh",
recurrent_activation = "sigmoid",
use_bias= True,
kernel_initializer= "glorot_uniform",
recurrent_initializer = "orthogonal",
bia... | Z-yq/TensorflowASR | asr/models/layers/LayerNormLstmCell.py | LayerNormLstmCell.py | py | 3,688 | python | en | code | 448 | github-code | 90 |
71726688618 | import random
import os
from datetime import datetime
jug1 = "Jugador 1"
jug2 = "Jugador 2"
def crear_bitacora() -> str:
"""
función: random_boolean()
descripción: Función para obtener un valor aleatorio de True o False
params: N/A
"""
directory = "/Users/robjimn/Documents/Roberto Rojas/Cenfot... | rrojasj/BlackJack | Code/black_jack_functions.py | black_jack_functions.py | py | 11,850 | python | es | code | 0 | github-code | 90 |
1987460595 | '''
PASA_parser was used to parse the gff3 file of Gene Structure Annotation and Analysis Using PASA and reslut into sorted gff3 and pep file.
'''
import sys
import re
input_file = sys.argv[1]
pep_out = sys.argv[2]
gff_out = sys.argv[3]
gff_dict = dict()
uniq_id_list = list()
with open(input_file, 'r') as gff3:
... | Github-Yilei/genome-assembly | Python/PASA_parser.py | PASA_parser.py | py | 4,075 | python | en | code | 2 | github-code | 90 |
22950802607 | import numpy as np
import matplotlib.pyplot as plt
from scipy import ndimage as ndi
from skimage.util import random_noise
from scipy.ndimage import distance_transform_edt
from skimage import feature
# Generate noisy image of a square
def fom (edge_img, edge_gold):
alpha = 1.0/9
dist = distance_transform_edt(np... | vat1kan/hed | example.py | example.py | py | 1,449 | python | en | code | 0 | github-code | 90 |
8886533112 | #!/usr/bin/python2.7
from pyo import *
s = Server(sr=44100, nchnls=2, buffersize=512, duplex=1, audio='offline').boot()
s.recordOptions(dur=30.0, fileformat=0, filename='../../rendered/test_pyo.wav', sampletype=0)
fr = Sig(value=400)
p = Port(fr, risetime=0.001, falltime=0.001)
a = SineLoop(freq=p, feedback=0.08, mul=... | pepperpepperpepper/crunchtime | synth_tests/pyo_tests/test7.py | test7.py | py | 517 | python | en | code | 0 | github-code | 90 |
34670231453 | import unittest
import wsgiref.headers
import wsgiref.util
from .server import application
class StartResponseMock:
def __call__(self, status, headers, exc_info=None):
self.status = status
self.headers = headers
self.exc_info = exc_info
return self.write
def write(self, body_... | aaugustin/sudoku | python/sudoku/test_server.py | test_server.py | py | 4,375 | python | en | code | 15 | github-code | 90 |
24590470736 | import sys, os
import numpy as np
import matplotlib.pyplot as plt
from matplotlib.widgets import Button
if sys.version_info.major == 3:
xrange = range
raw_input = input
sys.path.append( os.path.abspath('..') )
from read_param import *
# import NChan, freq, winSize
winSize = int(freq * 0.5) # 0.5s
A = np.memm... | neurobiofisica/gymnotools | chirpDetector/buscaAleatoria.py | buscaAleatoria.py | py | 2,969 | python | en | code | 2 | github-code | 90 |
35753750001 | #!/usr/bin/env python
import sys
input = sys.stdin.readline
n,m=map(int,input().split())
#li=[]
li={}
for _ in range(n):
a,b=map(str,input().split())
#li.append((a,b))
li[a]=b
#dic=dict(li)
for _ in range(m):
#print(dic[input().rstrip()])
print(li[input().rstrip()])
| hansojin/python | string/bj17219.py | bj17219.py | py | 295 | python | en | code | 0 | github-code | 90 |
20469097373 |
from googletrans import Translator
orgFile = open('test_quotes_english.txt', 'r')
orgFilesLines = orgFile.readlines()
translatorFile = open("test_quotes_punjabi.txt", "a", encoding="utf-8")
translator = Translator()
print("Starting Conversion")
# Strips the newline character
count = 0
for line in orgFilesLines:
r... | verma-rishu/Text_Generation_Indic | GoogleQuoteTranslation.py | GoogleQuoteTranslation.py | py | 516 | python | en | code | 0 | github-code | 90 |
11931685664 | """
"""
import numpy as np
import sympy as sp
import quadpy
import unittest
from opttrj.costarclenjerk import cCostArcLenJerk
from opttrj.opttrj0010 import opttrj0010
from itertools import tee
import sys
def pairwise(iterable):
'''s -> (s0,s1), (s1,s2), (s2, s3), ...'''
a, b = tee(iterable)
next(b, None)
... | rafaelrojasmiliani/gsplines | tests/costarclenjerk.py | costarclenjerk.py | py | 9,057 | python | en | code | 4 | github-code | 90 |
26153791060 | """
Author: Ratnesh Chandak
versions:
Python 3.7.4
pandas==0.25.1
"""
import pandas as pd
#reading input file
data=pd.read_csv("sample_email.csv",encoding='latin1')
#taking user input for adding user define name in email template
user_Defined_Name=input().strip()
#creating email template
template=pd.Series... | ratnesh93/Email_data_extraction_and_template_creation | Email_data_extraction_and_template_creation/phoneExtractionAndTemplateCreation.py | phoneExtractionAndTemplateCreation.py | py | 1,565 | python | en | code | 0 | github-code | 90 |
26496222678 | # https://www.acmicpc.net/problem/10816
# 숫자 카드 2
import sys
n = int(input())
cards = list(map(int, sys.stdin.readline().strip().split()))
m = int(input())
check = list(map(int, sys.stdin.readline().strip().split()))
dict = {}
for i in cards:
if i in dict : dict[i] += 1
else : dict[i] = 1
for i in chec... | hamin2065/PS | 기본문법/10816.py | 10816.py | py | 415 | python | en | code | 0 | github-code | 90 |
18257600109 |
def resolve():
import sys
input = sys.stdin.readline
# row = [int(x) for x in input().rstrip().split(" ")]
# n = int(input().rstrip())
nab = [int(x) for x in input().rstrip().split(" ")]
n = nab[0]
a = nab[1]
b = nab[2]
kurikaesi = n // (a + b)
amari = n % (a + b)
ans = ku... | Aasthaengg/IBMdataset | Python_codes/p02754/s640920419.py | s640920419.py | py | 426 | python | en | code | 0 | github-code | 90 |
74902065256 | from keras.models import load_model
from helpers import resize_to_fit
from imutils import paths
import numpy as np
import cv2
import pickle
from captcha_cleaner import clean_images
def solve_captcha():
# imports the model and the translator
with open('.\\AI_training\\labels_model.dat', 'rb') as translate_file... | KokumaiLuis/artificial_intelligence_captcha_solver | captcha_solver.py | captcha_solver.py | py | 2,202 | python | en | code | 0 | github-code | 90 |
30465393077 | # coding=utf-8
import sys
from utils.api import API
class Solution:
def __init__(self):
'''
Initialize the Solution instance
'''
# Initialize the API object
self.api = API()
def solve_first_question(self):
'''
Solve the first question.
Obtain th... | lagwy/houm | solution.py | solution.py | py | 6,943 | python | en | code | 0 | github-code | 90 |
42919915384 | import sys
import math
def isPrime(z):
if z%2==0:
return 0
for i in range(3,int(pow(z,.5))+1,2):
if z%i==0:
return 0
return 1
test_cases = open(sys.argv[1], 'r')
for test in test_cases:
test=test.split(",")
mini=int(test[0])
maxi=int(test[1])
n=0
for i ... | paulwuertz/CodeEval | Easy/CountingPrimes.py | CountingPrimes.py | py | 418 | python | en | code | 0 | github-code | 90 |
72808990056 | sc_to_user_id = {}#记录每一个用户对应的安全频道
user_id_to_sc = {}#记录用户ID对应的安全频道
#socket_to_sc = {}#句柄为key,value为安全频道
# 不一定是登入状态,只是连接
scs = []
chat_history = []
def remove_sc_from_socket_mapping(sc):
if sc in sc_to_user_id:
uid = sc_to_user_id[sc]
del sc_to_user_id[sc]
if uid in user_id_to_sc:
... | xiefan-guo/wechat | server/memory.py | memory.py | py | 541 | python | en | code | 0 | github-code | 90 |
35891279021 | from micropython import const
import os
import ubinascii
from . import parse_plist_xml
STAT_IDLE = const(0)
STAT_CONNECTING = const(1)
STAT_WRONG_PASSWORD = const(2)
STAT_NO_AP_FOUND = const(3)
STAT_CONNECT_FAIL = const(4)
STAT_GOT_IP = const(5)
STA_IF = const(0)
AP_IF = const(1)
AUTH_OPEN = const(0)
AUTH_WEP = co... | jonathonlui/micropython-extras | micropython_macos/network/__init__.py | __init__.py | py | 5,029 | python | en | code | 1 | github-code | 90 |
11803467 | # -*- coding: utf-8 -*-
import time
from utils import letterbox_image,exp,minAreaLine,draw_lines,minAreaRectBox,draw_boxes,line_to_line,sqrt,rotate_bound,timer,is_in
from line_split import line_split
import numpy as np
import cv2
from PIL import Image
from skimage import measure
import json
# crnn
from crnn.crnn_torch... | zlr20/Table-Structure-Decomposition-OCR | table.py | table.py | py | 9,619 | python | en | code | 7 | github-code | 90 |
31118264068 |
from typing import List
class Transposition:
def __init__(self, width: int = 5):
self.width = width # ширина таблицы
def get_width(self) -> int:
return self.width
def set_width(self, width: int):
self.width = width
def encrypt(self, message: str, width: int = None) -> str... | tsyploff/modern-problems-of-applied-math-and-computer-science | crypto/Transposition/src/transposition.py | transposition.py | py | 1,606 | python | ru | code | 0 | github-code | 90 |
15422939977 | import tkinter
from previous_versions.Version_Before_Refactor.src.backend.iRacing.state import State
from previous_versions.Version_Before_Refactor.src.backend.iRacing.telemetry import Telemetry
from previous_versions.Version_Before_Refactor.src.backend.utils.exception_handler import exception_handler
from previous_ve... | RacingInsights/RacingInsights-V1 | previous_versions/Version_Before_Refactor/src/frontend/overlays/fuelscreen.py | fuelscreen.py | py | 9,554 | python | en | code | 0 | github-code | 90 |
25022315188 | #!/usr/bin/env python3
import sys
from sodacomm.graph import *
def show_scc(g):
n = g.size()
stk = []
dfs_mark(g, stk)
T = transposition(g)
visited = [False] * n
while stk:
i = stk.pop()
if visited[i]:
continue
vex = []
dfs_scc(T, i, visited, vex)... | missingjs/soda | works/ita/c22/q05a.py | q05a.py | py | 1,452 | python | en | code | 0 | github-code | 90 |
29262454591 | # Solution to part 2 of day 8 of AOC 2020, Handheld Halting.
# https://adventofcode.com/2020/day/8
import sys
from computer import Computer
VERBOSE = ('-v' in sys.argv)
filename = sys.argv[1]
for flip, flop in [('jmp', 'nop'), ('nop', 'jmp')]:
if VERBOSE:
print(flip, flop)
change_line = 0
done =... | johntelforduk/advent-of-code-2020 | 08-handheld-halting/part2.py | part2.py | py | 1,176 | python | en | code | 2 | github-code | 90 |
15746770098 | # --------------------------------------
# Development start date: 23 Apr 2021
# --------------------------------------
from tkinter import *
# App main window
root = Tk()
root.geometry("235x328")
root.title('Calculator')
# Class for realization calculator interface and functionality
class Calculator:
def __init... | UAcapitan/code | interesting_projects/Calculator/calculator.py | calculator.py | py | 3,841 | python | en | code | 0 | github-code | 90 |
17830764201 | #!/usr/bin/env python3
from ETA import ETA
times = []
times.append(84.43)
times.append(21.231)
print(ETA(times, 48))
print("Time remaining {0} minutes".format(ETA(times, 48)))
| DavidLutton/Fragments | ETA/ETA_test.py | ETA_test.py | py | 180 | python | ja | code | 0 | github-code | 90 |
2119273136 | import base64
import requests
with open("/Users/quantum/Downloads/u=368725982,2532668121&fm=27&gp=0.jpg", "rb") as f:
# b64encode是编码,b64decode是解码
base64_data = base64.b64encode(f.read())
# base64.b64decode(base64data)
print(base64_data)
result = requests.post("http://ai-api.keruyun.com:5001/face_de... | yuanjungod/StoreLayout | test_base64.py | test_base64.py | py | 444 | python | en | code | 0 | github-code | 90 |
72024095978 | import altair as alt
import numpy as np
import pandas as pd
import streamlit as st
class Plotting:
def __init__(self):
self.FOREST_GREEN = "#1d3c34"
self.SUN_YELLOW = "#FFC358"
def hourly_plot(self, y, COLOR, name):
x = np.arange(8760)
source = pd.DataFrame({"x"... | magnesyljuasen/grunnvarme | old/utils.py | utils.py | py | 1,265 | python | en | code | 2 | github-code | 90 |
1282344194 | import pdftotext
import os
import re
import constants
import csv
import datetime
"""
Luckily, all of the account value and withdrawal/deposit information is on the first page.
Unfortunately, the statements has some inconsistencies. Some statements have this near the top:
Envelope # BLRJWCBBCCJJS
$42.25
... | stevestar888/holistic-portfolio-returns | parse_fidelity.py | parse_fidelity.py | py | 7,803 | python | en | code | 0 | github-code | 90 |
73844658856 | """
# Machine Learning Online Class - Exercise 2: Logistic Regression
"""
from gradient import gradient
from sigmoid import sigmoid
from predict import predict
from plotDecisionBoundary import plotDecisionBoundary
from costFunction import costFunction
from plotData import plotData
import scipy.optimize as op
import m... | hzitoun/machine_learning_from_scratch_matlab_python | algorithms_in_python/week_3/ex2/ex2.py | ex2.py | py | 3,649 | python | en | code | 30 | github-code | 90 |
17955733689 | from collections import Counter
n = int(input())
lst = []
for _ in range(n):
lst.append(int(input()))
C_lst = Counter(lst)
cnt = 0
for i in C_lst.values():
if i % 2 != 0:
cnt += 1
print(cnt) | Aasthaengg/IBMdataset | Python_codes/p03607/s693150002.py | s693150002.py | py | 208 | python | en | code | 0 | github-code | 90 |
10242228549 | # -*- coding: <utf-8> -*-
from datetime import datetime, timedelta
from sqlalchemy import Column, MetaData
from sqlalchemy.schema import UniqueConstraint
from sqlalchemy.orm import sessionmaker, relationship, backref
from sqlalchemy.types import Integer, String, Text, DateTime, Boolean
from .master_import import Categ... | olefriis/simplepvr | python/simplepvr/simple_pvr/programme.py | programme.py | py | 6,194 | python | en | code | 12 | github-code | 90 |
70522259818 | # generator is a function that yield multiple values (not return a single value)
def simple_generator():
yield 1
yield 2
yield 3
def Main():
# generator as a function
for value in simple_generator():
print(value)
# generator as an object
x = simple_generator()
print(x.__next__()... | denny-imanuel/PythonConcept | generator.py | generator.py | py | 408 | python | en | code | 1 | github-code | 90 |
20490144090 | from django.contrib import admin
from django_json_widget.widgets import JSONEditorWidget
from .filters import *
from .models import *
from base.admin import *
from base.filters import *
from base.models import *
from borrowers.filters import *
# Register your models here.
class LoanDataAdmin(JSONBaseAdmin, BaseAdmi... | fasih/lender-integration | app/lenders/admin.py | admin.py | py | 2,120 | python | en | code | 0 | github-code | 90 |
28834228107 | # 1
def multiple_of_three(number):
if number % 3 == 0:
return True
else:
return False
print(multiple_of_three(39))
# 2
def get_currency_symbol_from_code(currency):
uppercase_currency = currency.upper()
if uppercase_currency == "GEL":
return "ლ"
elif uppercase_currency =... | saba-ab/homework26 | app.py | app.py | py | 1,669 | python | en | code | 0 | github-code | 90 |
18386262809 | n=int(input())
if n==1:
print(1)
exit()
x=[]
for i in range(n):
a,b=map(int,input().split())
x.append([a,b])
x.sort()
ans=float("inf")
for i in range(n-1):
for j in range(i+1,n):
p,q=x[j][0]-x[i][0],x[j][1]-x[i][1]
cnt=0
flg=[False for i in range(n)]
for k in range(n)... | Aasthaengg/IBMdataset | Python_codes/p03006/s048356360.py | s048356360.py | py | 788 | python | en | code | 0 | github-code | 90 |
31384103401 | import numpy as np
import torch.nn as nn
import torch.nn.functional as F
from nlplay.models.pytorch.activations import *
from nlplay.utils.utils import human_readable_size
def set_seed(seed: int = 123):
np.random.seed(seed)
torch.manual_seed(seed)
torch.cuda.manual_seed(seed)
def get_activation_func(act... | jeremypoulain/nlplay | nlplay/models/pytorch/utils.py | utils.py | py | 12,577 | python | en | code | 7 | github-code | 90 |
37931170504 | import unittest
from number_of_recent_calls import RecentCounter, RecentCounterOfficial
class TestRecentCounter(unittest.TestCase):
def test_example_1(self):
recent_counter = RecentCounter()
for t, expected in [(1, 1), (100, 2), (3001, 3), (3002, 3)]:
assert recent_counter.ping(t=t) =... | saubhik/leetcode | tests/test_number_of_recent_calls.py | test_number_of_recent_calls.py | py | 524 | python | en | code | 3 | github-code | 90 |
72208033578 | from collections import Counter, defaultdict
class Solution:
def firstUniqChar1(self, s: str) -> str:
counts = Counter(s)
for c in s:
if counts[c] == 1:
return c
return " "
def firstUniqChar2(self, s: str) -> str:
if not s:
return " "
... | Asunqingwen/LeetCode | 剑指offer/第一个只出现一次的字符.py | 第一个只出现一次的字符.py | py | 690 | python | en | code | 0 | github-code | 90 |
18434892629 | import sys
sys.setrecursionlimit(500000)
MOD = 10**9+7
def input():
return sys.stdin.readline()[:-1]
def mi():
return map(int, input().split())
def ii():
return int(input())
def i2(n):
tmp = [list(mi()) for i in range(n)]
return [list(i) for i in zip(*tmp)]
def g(x):
if x <= 0:
retu... | Aasthaengg/IBMdataset | Python_codes/p03104/s270958365.py | s270958365.py | py | 704 | python | en | code | 0 | github-code | 90 |
41679290071 | #!/bin/env python
import sys
import re
from datetime import datetime
r_ldif = re.compile("^ (.*)")
r_attr = re.compile("^(\w*): (.*)")
r_dn = re.compile("^dn: (.*)")
r_entry_time = re.compile("^time: (.*)")
r_modify_time = re.compile("^modifyTimestamp: (.*)")
r_changetype = re.compile("^changetype: (.*)")
entry=[]
... | red-tux/perf-scripts | RHDS/audit_show_latency.py | audit_show_latency.py | py | 1,609 | python | en | code | 1 | github-code | 90 |
74720981416 | def mean(x):
m = sum(x) / len(x)
return m
def addnum():
a = float(input("Please enter the numbers,\nany negative number will terminate the input: "))
if a >= 0:
lst.append(a)
addnum()
lst = []
addnum()
print("The positive numebrs are: ", lst)
print("The sum of the ... | Lumix888/Python_various_exercises | Sum_average_max_minimum.py | Sum_average_max_minimum.py | py | 492 | python | en | code | 0 | github-code | 90 |
75109677095 | # Rock-Paper-Scissors
# Write your code here
import random
def match(user_choice, computer_choice):
result = ""
if user_choice == computer_choice:
result = "draw"
else:
# if user_choice == "paper":
# if computer_choice == "rock":
# result = "win"
# ... | MLohengrin/JetBrains-Academy-Projects | Sources/game.py | game.py | py | 1,911 | python | en | code | 0 | github-code | 90 |
3721899886 | """
从腾讯天气获取气象信息
"http://weather.gtimg.cn/city/01010101.js" 返回数据格式:
sk_wd:对应wt_img.json中的数字,
以便确定图标地址,base url="http://mat1.gtimg.com/weather/2014gaiban/" + "TB_" + ico(wt_img.json中对应) + _baitian/_yejian + .png
背景的地址格式:"http://mat1.gtimg.com/weather/2014gaiban/" + bg + _baitian/_yejian + .jpg
sk_tp:温度,单位 ℃
sk_wd:风向 ... | yiyisf/get_link_python | getWeather.py | getWeather.py | py | 1,382 | python | en | code | 0 | github-code | 90 |
40519840968 | from numpy.core.fromnumeric import size
from numpy.lib.utils import info
from bs4 import BeautifulSoup
from PIL import Image, ImageTk
import plotly.express as ex
from tkinter import Canvas, messagebox
from tkinter.font import Font
from tkinter import ttk
from threading import *
import tkinter as tk
import pandas as pd
... | Gajendra-Sonare/myproject | application/main.py | main.py | py | 8,837 | python | en | code | 1 | github-code | 90 |
18153061329 | import sys
read = sys.stdin.read
readlines = sys.stdin.readlines
def main():
n = int(input())
r = 0
for i1 in range(1, n+1):
for i2 in range(1, n+1):
if i1 * i2 >= n:
break
else:
r += 1
print(r)
if __name__ == '__main__':
main()
| Aasthaengg/IBMdataset | Python_codes/p02548/s081204397.py | s081204397.py | py | 314 | python | en | code | 0 | github-code | 90 |
28554839327 | """Test the exam_env module.
all import and structural testing is done in this module.
"""
from datacenter.model.email import Email
from utilities import create_test_session
try:
import datacenter
except ImportError:
pass
def test_00(capsys):
"""Test module import."""
assert datacenter
assert da... | htlweiz/datacenter | tests/test_01_email.py | test_01_email.py | py | 760 | python | en | code | 0 | github-code | 90 |
72071244138 | # -*- coding: utf-8 -*-
# UTF-8 encoding when using korean
"""통과"""
import sys
from collections import Counter
def sysinput():
return sys.stdin.readline().rstrip()
sysprint = sys.stdout.write
n, m = map(int, sysinput().split())
events = Counter()
for a in range(m):
person_event = list(map(int, sysinput().split()))[... | dig04214/python-algorithm | challenge/7/7_1.py | 7_1.py | py | 750 | python | en | code | 0 | github-code | 90 |
5844226499 | import matplotlib.pyplot as plt
import matplotlib.image as mpimg
import matplotlib.cm as cm
import numpy as np
import cv2, os
import glob, collections
dataset_path = '/root/ffabi_shared_folder/datasets/_original_datasets/synthia/SYNTHIA-SF/'
sample = "0000000"
def depth_converter(depth):
R = depth[:, :, 0]
G ... | ffabi/Project_TDK | dataset_scripts/depth_test.py | depth_test.py | py | 1,166 | python | en | code | 1 | github-code | 90 |
18555826959 | N = int(input())
red = sorted([list(map(int,input().split())) for i in range(N)], key=lambda x: x[0])[::-1]
blue = [list(map(int,input().split())) for i in range(N)]
ans = 0
for i in range(N):
min_ = 10 ** 9 + 7
ind = -1
for j in range(N):
if red[i][0] <= blue[j][0] and red[i][1] <= blue[j][1] and b... | Aasthaengg/IBMdataset | Python_codes/p03409/s148314709.py | s148314709.py | py | 459 | python | en | code | 0 | github-code | 90 |
26811176031 | import sys
from heapq import heappop, heappush
input = sys.stdin.readline
n = int(input())
heap = []
for _ in range(n):
num = int(input())
if num == 0:
try:
print(heappop(heap)[1])
except:
print(0)
else:
heappush(heap, (abs(num), num)) | cyw320712/problem-solving | Baekjoon/python/11286.py | 11286.py | py | 299 | python | en | code | 3 | github-code | 90 |
18113623239 | n, k = map(int, input().split())
l = list(int(input()) for i in range(n))
left = max(l)-1; right = sum(l)
while left+1 < right: #最大値と合計値の間のどこかに考えるべき値が存在する
mid = (left + right) // 2
cnt = 1; cur = 0 #初期化
for a in l:
if mid < cur + a:
cur = a
cnt += 1
else:
... | Aasthaengg/IBMdataset | Python_codes/p02270/s200522536.py | s200522536.py | py | 470 | python | en | code | 0 | github-code | 90 |
27541685878 | import numpy as np
from util.read_aln import ReadSeqs, ReadSeqs2, Die
import pickle
import glob
import sys
input_aln_path = '/Users/ali_nayeem/Projects/MSA/example/bb3_release'
output_aln_path = '../../output/5obj-3iter'
export_file_dir = '../out'
data_list = ['BB11005'] #, 'BB11018', 'BB11033', 'BB11020',
# '... | ali-nayeem/pasta-ext-scripts | py-analysis/src/encode.py | encode.py | py | 1,936 | python | en | code | 0 | github-code | 90 |
23135476484 | # -*- coding: utf-8 -*-
import re
import black
import isort
import nbformat
from .errors import NotPythonNotebookError
_ISORT_SETTINGS = {
"multi_line_output": 3,
"include_trailing_comma": True,
"force_grid_wrap": 0,
"combine_as_imports": True,
"line_length": 88,
}
_BLACK_SETTINGS = {"line_length... | mcflugen/nbblack | nbblack/nbblack.py | nbblack.py | py | 1,612 | python | en | code | 2 | github-code | 90 |
24340771335 | import sys
from datetime import datetime
import scipy.io as sio
import torch
import numpy as np
import wandb
from pybmi.utils import TrainingUtils
sys.path.append("kalmannet")
from kalman_net import KalmanNetNN
from pipeline_kf import Pipeline_KF
torch.set_default_dtype(torch.float32)
device = torch.device("cuda:0... | JapmanGill/BIOMEDE-517-Project | main_kalmannet.py | main_kalmannet.py | py | 3,064 | python | en | code | 0 | github-code | 90 |
18369485279 | import bisect
N = int(input())
A = [int(input()) for _ in range(N)]
dp = [-1] * N
dp[N-1] = A[0]
ans = 0
for i in range(1, N):
target_index = bisect.bisect_left(dp, A[i])
dp[target_index-1] = A[i]
print(N - dp.count(-1)) | Aasthaengg/IBMdataset | Python_codes/p02973/s301734009.py | s301734009.py | py | 231 | python | en | code | 0 | github-code | 90 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.