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
11675785964
from typing import Union class BitReadStream: def __init__(self, some_bytes: bytes = b''): self.some_bytes = some_bytes self.r_pointer = 0 self.r_in_byte_pointer = 0 def read(self, size: int = -1) -> str: bits = [] while size != 0: bit = self.get_bit_at(sel...
Arcimiendar/huffman_python
src/bit_stream.py
bit_stream.py
py
1,972
python
en
code
0
github-code
90
41340613770
from pylsl import StreamInfo, StreamOutlet import random import time import csv import keyboard def main(): # Set up LabStreamingLayer stream. info = StreamInfo(name='PyMarker', type='Markers', channel_count=3, channel_format='double64', source_id='unique113') # Broadcas...
underhood31/AFC-scripts
drive-download-20220321T153410Z-001/pylsl_outlet.py
pylsl_outlet.py
py
957
python
en
code
0
github-code
90
16812631637
n = int(input()) max_n = n*n a = [[0 for j in range(n)] for i in range(n)] step = 1 i, j = 0, 0 i_min, j_min = 0, 0 i_max, j_max = n, n while step <= max_n: while j < j_max: #вправо a[i][j] = step j += 1 step += 1 j -=1 i +=1 while i < i_max: #вниз a[i][j] = step ...
FoxProklya/Step-Python
conclusion_of_the_squares_in_a_spiral.py
conclusion_of_the_squares_in_a_spiral.py
py
707
python
en
code
0
github-code
90
43286245033
from selenium.webdriver.common.by import By from selenium.webdriver.support.ui import WebDriverWait from selenium.webdriver.support import expected_conditions as EC from selenium import webdriver #from selenium.webdriver.support.ui import Select import time import math import pyperclip def calc(x): return ...
sergeykasyan/Stepik---auto-tests-course
lesson2-4_step8.py
lesson2-4_step8.py
py
1,271
python
en
code
0
github-code
90
37926266708
### 1 – Crie um dicionário em que suas chaves serão os números 1, 4, 5, 6, 7, e 9 # (que podem ser armazenados em uma lista) e seus valores correspondentes # aos quadrados desses números. # listaNum = [1, 4, 5, 6, 7, 9] # numDicionario = dict() # for i in listaNum : # numDicionario[i] = i**2 # print(numDicionari...
GarconeAna/aulasBlue
aula11-exercicos/exercicios01.py
exercicios01.py
py
3,878
python
pt
code
0
github-code
90
26515609509
import pymysql def db_login(user, passwd, server_addr, dbname): try: db = pymysql.connect(server_addr, user, passwd, dbname) except pymysql.err.OperationalError: db = None return db def db_showtable(db): cursor = db.cursor() cursor.execute("show tables") tabs = cursor.fetchall(...
Philip-Chang/USTC-2020SPRING
Data Base/python+flask/db.py
db.py
py
6,391
python
en
code
1
github-code
90
19932235322
#Program coded by: Ian McDowell import math import random #makes array for 'songs' global SongList SongList = [] #asks user for how many 'songs' they want in the list and creates the list global SongAmount SongAmount = int(raw_input("How many songs?")) for x in range(0,SongAmount + 1): SongList.insert(0,x) SongList.r...
ianm24/Music-Player-Shuffler
Test/Shuffle/shuffle.py
shuffle.py
py
2,021
python
en
code
0
github-code
90
18536539659
# union-find # こういう问题のときにUnion-Findなのか幅优先探索なのか深さ优先探索なのか迷う。 # ちなみに解说PDFはUnion-Findを挙げている。 n, m = map(int, input().split()) def find_root(x): if par[x] == x: return x else: par[x] = find_root(par[x]) return par[x] def unite(x, y): x = find_root(x) y = find_root(y) if(x == y)...
Aasthaengg/IBMdataset
Python_codes/p03354/s293670845.py
s293670845.py
py
1,241
python
zh
code
0
github-code
90
42039763520
""" You are given a string s that consists of lower case English letters and brackets. Reverse the strings in each pair of matching parentheses, starting from the innermost one. Your result should not contain any brackets. Example 1: Input: s = "(abcd)" Output: "dcba" Example 2: Input: s = "(u(love)i)" Output...
nilay-gpt/LeetCode-Solutions
reve_str_in_brackets.py
reve_str_in_brackets.py
py
887
python
en
code
2
github-code
90
20902854572
from __future__ import absolute_import from __future__ import division from __future__ import print_function import os import sys import argparse import functools import paddle import paddle.fluid as fluid import models from utility import add_arguments, print_arguments parser = argparse.ArgumentParser(description=__...
PaddlePaddle/Research
CV/landmark/inference/convert_binary_model.py
convert_binary_model.py
py
2,544
python
en
code
1,671
github-code
90
36437174249
import pygame from src.components.Coin import Coin from src.utils.drawText import drawText class UserInterface: def __init__(self, screen, colors, level_name, player_info): # Passed attributes self.screen = screen self.colors = colors self.level_name = level_name self.player_info = player_info ...
Luc4r/Rectov
src/components/UserInterface.py
UserInterface.py
py
846
python
en
code
0
github-code
90
42236050129
import mysql.connector import os from timeit import default_timer as timer from datetime import timedelta, date import cred import platform con = mysql.connector.connect(host=cred.host, password=cred.password, user=cred.user, database=cred.database) cursor = con.cursor() cursor.execute('Delete from info2') con.commit()...
Baibhav-Mishra/Ludo
start.py
start.py
py
1,011
python
en
code
0
github-code
90
29581719852
from piano_transcription_inference import PianoTranscription, sample_rate, load_audio import os import time def main(): st = time.time() song = "./audio/seg/Q4_aQ4PIaRMLwE_0.mp3" # Load audio print("### Loading ###") (audio, _) = load_audio(song, sr=sample_rate, mono=True) # Transcriptor...
joann8512/piano_transcription
inference_test.py
inference_test.py
py
805
python
en
code
0
github-code
90
33412833993
import numpy as np import matplotlib.pyplot as plt import math height = 480 width = 640 r = max(height,width) x1 = 50 y1 = -150 x2 = 150 y2 = 150 dx = x2-x1 dy = y2-y1 dr = math.sqrt(dx**2+dy**2) D = x1*y2 - x2*y1 xr1 = (D*dy+np.sign(dy)*dx*math.sqrt(r**2*dr**2-D**2))/dr**2 yr1 = (-D*dx+abs(dy)*math.sqrt(r**2*dr*...
silvasta/centerLine
src/tools/annotation/firstCircleAnnotation.py
firstCircleAnnotation.py
py
1,827
python
en
code
0
github-code
90
42222433505
# Desafio 037 - Escreva um programa que # leia um número inteiro qualquer e peça # para o usuário escolher qual será a base # de conversão: # # 1 para binário; # 2 para octal; # 3 para hexadecimal. n = int(input('Digite um numero inteiro qualquer\n:')) escolha = int(input('Me informe a conversão que deseja fazer\n' ...
jhownny/CursoEmVideoPython
CursoEmVideo-Python/PythonExercicios/Atividade de 31 a 40/ex037.py
ex037.py
py
813
python
pt
code
1
github-code
90
32518048604
from timeit import timeit code1 = """ def calculate_xfactor(age): if age <= 0: raise ValueError("Age cannot be 0 or less.") try: calculate_xfactor(-1) except ValueError as error: pass """ print(timeit(code1, number=10000)) try: age = int(input("Age: ")) xfactor = 10 / age except (Value...
bednarczyk/python-practice
Practice/exceptions.py
exceptions.py
py
496
python
en
code
0
github-code
90
9189273862
#!/usr/bin/env python import os import numpy as np from ase import Atoms from ase.io import read, write from aimdprobe.init_data import init_data, get_raw_traj from aimdprobe.structure_probe.probe_surface_waters import get_adsorbed_h2o from aimdprobe.useful_functions import get_cumulative_avg if __name__ == "__main__...
tjunewson/AIMDprobe
scripts/plot_surface_waters.py
plot_surface_waters.py
py
1,492
python
en
code
4
github-code
90
39159257881
#-*- coding: UTF-8 -*- import common from templates import default from templates import combination logger = common.getLogger(__name__) def isSupport(soup): """indicate if the resume is from zhilian @return true : false""" return soup.head is not None and soup.head.title is not None and soup.head....
yangyraaron/resumeanalysis
zhilian/zlFilter.py
zlFilter.py
py
791
python
en
code
2
github-code
90
19092460360
#coding:utf-8 from selenium import webdriver from selenium.webdriver.chrome.options import Options from bs4 import BeautifulSoup from urllib.parse import urljoin import time def getMoriHpNewsList(base_url): print('## webscrape') # driver = makeDriver(base_url) print('## driver make ok') print('## dr...
meganeJPN/python-web-scrape-twitter-bot
lambda/webscrape.py
webscrape.py
py
2,041
python
en
code
1
github-code
90
5261575188
class MyLinkedList: class Node: def __init__(self,val = 0,next = None): self.data = val self.next = next def __init__(self): self.head = None def isEmpty(self): return self.head == None def size(self): tmp = self.head cnt = ...
ShubhamSinghal12/PythonDSAClassroomApril2022
Lec30/MyLinkedList.py
MyLinkedList.py
py
8,298
python
en
code
1
github-code
90
86592232594
import logging.config from typhoon.core.logger import setup_logging config = """ version: 1 root: level: INFO handlers: [console] handlers: console: class: logging.StreamHandler level: INFO stream: ext://sys.stderr """ def test_logging_config(monkeypatch, tmp_path, capsys): (tmp_path / 'logger...
typhoon-data-org/typhoon-orchestrator
tests/unit/logging_test.py
logging_test.py
py
539
python
en
code
29
github-code
90
5721191277
import sys text = sys.stdin.read() test_data = text.splitlines() for t in test_data[1:]: a, b ,c ,d = map(int , t.split(',')) for i in range(0, a): if b * i + c * (a-i) == d: print(f'{i},{a-i}')
lalalalaluk/python-lesson-ans
ntub/10312.py
10312.py
py
211
python
en
code
0
github-code
90
41036823928
"""The tasks API.""" from __future__ import annotations from typing import Dict, List, Optional, Union import validators # type: ignore # does not have types from pydantic import BaseModel, root_validator, validator from tenacity import RetryError from . import FailedRequestError, _send_request SANDBOX_URL = "htt...
IceBotYT/pynoonlight
src/pynoonlight/tasks.py
tasks.py
py
5,916
python
en
code
1
github-code
90
9776578870
import cv2 import numpy as np img = cv2.imread('Image/Elon_Musk_1.jpg') print(img.shape) imgResize = cv2.resize(img, (480, 640)) imgCropped = img[0:200,200:500] cv2.imshow('img', img) cv2.imshow('imgResize', imgResize) cv2.imshow('imgCropped', imgCropped) cv2.waitKey(0) cv2.destroyAllWindows()
shudeath/DATN
DATN/Face_recognition/Learned/L_Resize.py
L_Resize.py
py
299
python
en
code
0
github-code
90
75166961256
from xgboost import XGBClassifier, XGBRegressor from sklearn.datasets import load_boston from sklearn.model_selection import train_test_split import numpy as np from sklearn.feature_selection import SelectFromModel from sklearn.metrics import r2_score, accuracy_score x, y = load_boston(return_X_y=True) # 데이터 바로 가져오기 ...
lynhyul/AIA
ml/m43_SelectFromModel.py
m43_SelectFromModel.py
py
2,168
python
en
code
3
github-code
90
30139970243
# -*- coding: utf-8 -*- class ChannelService(object): def __init__(self): pass def issueChannelToken(self, channelId="1341209950"): #sqrd = self.DummyProtocol("issueChannelToken", 3, { # 1: (11, channelId) #}).read() sqrd = [128, 1, 0, 1] + self.getStringByt...
alipbudiman/CHRLINE
CHRLINE/services/ChannelService.py
ChannelService.py
py
2,643
python
en
code
null
github-code
90
10203500621
# -*- coding: utf-8 -*- import tornado.web from constant.error import const from constant.tag import const from utility import auth, util from utility.msg_pb2 import * from model import user_data, global_data class LibaoHandler(tornado.web.RequestHandler): @auth.authenticated def post(self, cmsg): if ...
RickyTong1024/mario
trunk/soft/server/server/server/handler/huodong/libao_handler.py
libao_handler.py
py
1,884
python
en
code
0
github-code
90
18068135336
from flask import Flask import pandas as pd from skFunctions import cleaner, sankeyData, nodeNames, sankeyDiagram from skFunctions import smallMultiples import dash import dash_core_components as dcc import dash_html_components as html import base64 server = Flask(__name__) # Dash app app = dash.Dash(name='DockerTes...
kailukowiak/DATA608
Assignment6/dash_app/app.py
app.py
py
4,918
python
en
code
0
github-code
90
2878576814
# -*- encoding: utf-8 -*- ''' @File : 69. x 的平方根.py @Time : 2020/04/22 09:48:50 @Author : windmzx @Version : 1.0 @Desc : For leetcode template ''' # here put the import lib from typing import List import math class Solution: def mySqrt(self, x: int) -> int: if x==0 or x==1: ...
windmzx/pyleetcode
69. x 的平方根.py
69. x 的平方根.py
py
625
python
en
code
0
github-code
90
26594773601
# -*- coding: utf-8 -*- from django.http import HttpResponse, Http404 from django.shortcuts import render, get_object_or_404, redirect from mailinglist.models import MailingList from mailinglist.forms import SubscribeForm def index(request): return HttpResponse('Ahoj Svet.\ Práve ste v ma...
ricco386/zaciname-s-djangom
konferencia/mailinglist/views.py
views.py
py
1,058
python
en
code
5
github-code
90
70070842857
def main(): # Import the library import microdots as mdots from microdots.mini_sequences import MNS, A1, A2 codec4x4 = mdots.AnotoCodec( mns=MNS, mns_order=4, sns=[A1, A2], pfactors=(3, 5), delta_range=(1, 15), ) print(len(MNS), len(A1), len(A2)) main...
cheind/py-microdots
examples/hello_mini.py
hello_mini.py
py
323
python
en
code
4
github-code
90
17882718862
import json import boto3 from json2html import * def lambda_handler(event, context): region = '' if(event["queryStringParameters"] is not None and 'region' in event["queryStringParameters"] and event["queryStringParameters"]["region"] is not None): region = event["queryStringParameters"]["region"...
debongithub/ENIReporter
lambda_function.py
lambda_function.py
py
3,417
python
en
code
0
github-code
90
21943507966
import conf from boltiot import Bolt import json, time mybolt = Bolt(conf.API_KEY, conf.DEVICE_ID) def convert(sensor_value): led_intensity= 255-(sensor_value*255/1024) return led_intensity while True: print ("Reading Sensor Value") response_ldr = mybolt.analogRead('A0') data = json.loads(res...
Rajeswari525/Automatic-Light-Controller
light_automation.py
light_automation.py
py
848
python
en
code
1
github-code
90
18443578639
import numpy as np n = int(input()) a = list(map(int,input().split())) ans = a[0] for i in range(1,len(a)): ans = np.gcd(a[i],ans) print(ans)
Aasthaengg/IBMdataset
Python_codes/p03127/s059556444.py
s059556444.py
py
149
python
en
code
0
github-code
90
2392797718
from collections import deque def math_operations(*args, **kwargs): mapper = { 'a': lambda x, y: x + y, 's': lambda x, y: x - y, 'd': lambda x, y: x / y, 'm': lambda x, y: x * y } args = deque(args) while args: for key, value in kwargs.items(): if no...
grigor-stoyanov/PythonAdvanced
Exam_prep/math_operations.py
math_operations.py
py
700
python
en
code
0
github-code
90
18003758259
n = int(input()) a = list(map(int,input().split())) S1 = 0 S2 = 0 #S1が奇数番目が正の場合、S2が偶数番目が負の場合 cnt1 = 0 cnt2 = 0 for i,num in enumerate(a): S1 += num if i % 2 == 0 and S1 <= 0: cnt1 += 1 - S1 S1 = 1 if i % 2 != 0 and S1 >= 0: cnt1 += 1 + S1 S1 = -1 S2 += num if i % 2...
Aasthaengg/IBMdataset
Python_codes/p03739/s169626438.py
s169626438.py
py
528
python
en
code
0
github-code
90
24552953227
from helper import * @TestInstance def test_atan2(): atanarray = EUDArray(360) for angle in EUDLoopRange(360): x, y = f_lengthdir(1000, angle) atanarray[angle] = f_atan2(y, x) # Value of atan2 may vary by 1 due to rounding error. # Here we check similarity. test_assert( "a...
phu54321/eudplib
tests/unittests/testmath.py
testmath.py
py
470
python
en
code
13
github-code
90
36910425795
import unittest from pychoco.model import Model class TestBoolsIntChanneling(unittest.TestCase): def testBoolsIntChanneling1(self): m = Model() bools = m.boolvars(10) intvar = m.intvar(0, 9) m.bools_int_channeling(bools, intvar).post() while m.get_solver().solve(): ...
chocoteam/pychoco
tests/int_constraints/test_bools_int_channeling.py
test_bools_int_channeling.py
py
859
python
en
code
9
github-code
90
42425353574
""" https://codingbat.com/prob/p104029 """ def stringClean(s): if len(s) < 2: return s s = (s[0], "")[s[0] == s[1]] + s[1:] return (s[0], "")[s[0] == s[1]]+stringClean(s[1:]) print(stringClean("hello"))
vijay2930/HackerrankAndLeetcode
com/CodingBat/recursion-1/stringClean.py
stringClean.py
py
227
python
en
code
0
github-code
90
25871290029
## Spherical subdivision import math import bpy,bmesh import random ## spherical coordinates anglesub = 100 Radius = .2 Iterations = 1000 Height = .0001 invthetainc = (anglesub/2*math.pi) def distance(coord): x,y,z = coord return (x*x+y*y+z*z)**.5 def dotproduct(c1,c2): x1,y1,z1 = c1 x2,y2,z2 = c2 ...
christophermoverton/PyAIRPG
sphericalheightmap.py
sphericalheightmap.py
py
8,257
python
en
code
0
github-code
90
18105558619
def bubbleSort(A, N): flag = 1 cnt = 0 while flag: flag = 0 for j in range(N - 1, 0, -1): if A[j] < A[j - 1]: cnt += 1 A[j], A[j - 1] = A[j - 1], A[j] flag = 1 print(*A) print(cnt) N = int(input()) A = list(map(int, input()....
Aasthaengg/IBMdataset
Python_codes/p02259/s227152819.py
s227152819.py
py
347
python
en
code
0
github-code
90
40418766834
from abc import ABCMeta, abstractmethod import numpy as np import scipy import scipy.optimize as opt from sklearn.gaussian_process import GaussianProcessRegressor from sklearn.gaussian_process.kernels import RBF, ConstantKernel, WhiteKernel from .acquisition_functions import expected_improvement def constraints_all_s...
pjpollot/gp_sandbox
gp_sandbox/bayesian_optimization/models.py
models.py
py
4,367
python
en
code
1
github-code
90
9085945580
# -*- coding: utf-8 -*- """ Created on Sat Jul 27 12:32:15 2019 @author: Guy Mcbride (Keysight) @author: B.Ann (TU-Delft) """ import sys import numpy as np import logging import matplotlib.pyplot as plt log = logging.getLogger(__name__) sys.path.append(r'C:\Program Files (x86)\Keysight\SD1\Libraries\Python') import...
bann-01/Hardware-control
digitizer.py
digitizer.py
py
3,523
python
en
code
0
github-code
90
1421000402
# dumps() convert python object to json string # dump() method is used for writing into json file import json dict = { "id":1, "name":"Tom", "class":"10th" } json_object = json.dumps(dict,indent =4) print(json_object)
AswathiMohan23/Python_Basics
json/python_json.py
python_json.py
py
231
python
en
code
0
github-code
90
5260552991
from environment.simulation import Simulation class MazeSim(Simulation): """ A class to simulate an environment based on an Maze. Inherits the run() function from the Simulation class. """ def __init__(self, model): super().__init__( model.state_names, ...
yyimingucl/Temporal-Gradient-Correction-in-RL
environment/maze_sim.py
maze_sim.py
py
4,328
python
en
code
2
github-code
90
1790261928
import base64 import os import subprocess import xlrd import string import json from openpyxl import load_workbook,Workbook import openpyxl as op workingPath = "" # 批量生成用来修改的html文件对应的txt文件,之后用下一个函数将.html后缀改为.txt。 #用来生成之前的记录在表格中的内容 def generateHtmlold(): f1 = open("/home/liu/桌面/gumtree_tmp/special_html/1.txt", ...
HighBe/SolidityWorm
test/function.py
function.py
py
30,482
python
zh
code
0
github-code
90
18349148879
m,d=map(int,input().split()) cnt=0 for i in range(1,m+1): for j in range(1,d+1): da=j%10 db=j//10 if da>=2 and db>=2: if i==da*db: cnt+=1 print(cnt)
Aasthaengg/IBMdataset
Python_codes/p02927/s039663546.py
s039663546.py
py
204
python
en
code
0
github-code
90
2392192539
###===--- MesiSols NFT Minter ---===### ###===--- Imports ---===### ### General ### import os, glob from replit import db import requests import json import re ### Algo API ### from natsort import natsorted from algosdk import mnemonic from algosdk.v2client import algod from algosdk.future.transaction import AssetCo...
dbchristenson/mesisols
minting/mint.py
mint.py
py
4,332
python
en
code
2
github-code
90
15566806562
"""Chaneg name Revision ID: c327b22bdc90 Revises: 2d36a1563a4b Create Date: 2021-12-09 15:13:17.020567 """ from alembic import op import sqlalchemy as sa # revision identifiers, used by Alembic. revision = 'c327b22bdc90' down_revision = '2d36a1563a4b' branch_labels = None depends_on = None def upgrade(): # ##...
Sabuhi0/MyPortfolio
migrations/versions/c327b22bdc90_chaneg_name.py
c327b22bdc90_chaneg_name.py
py
814
python
en
code
0
github-code
90
72764467177
# This is a dice faking module from random import randint def roll(max): r = randint(1, max) return r def roll_a_bunch(max, numOfDice=3): rolls = [] for i in range(numOfDice): rolls.append(roll(max)) return rolls def roll_distro(max, numOfDice=3): rolls = roll_a_bunch(max, numOfDice)...
PDXDevCampJuly/atifar
die/die.py
die.py
py
624
python
en
code
0
github-code
90
10938529593
from fluent.migratetb.helpers import TERM_REFERENCE from fluent.migratetb.helpers import transforms_from # This can't just be a straight up literal dict (eg: {"a":"b"}) because the # validator fails... so make it a function call that returns a dict.. it works about_replacements = dict( { "&brandShorterNam...
mozilla/releases-comm-central
python/l10n/tb_fluent_migrations/completed/bug_1816532_about_dialog_migration.py
bug_1816532_about_dialog_migration.py
py
3,891
python
en
code
144
github-code
90
40573172911
import logging import os import sys from typing import Union import colorlog import colorlog.escape_codes from trak._info import __version__ COLORLOG_FORMAT = '%(log_color)s%(bold)s%(levelname)s | %(asctime)s | %(name)s: %(thin)s%(message)s%(reset)s' UNCOLORED_FORMAT = '%(levelname)s $(asctime)s %(name)s: %(message)s...
trakmod/trakmod
trak/internal/logs.py
logs.py
py
1,029
python
en
code
3
github-code
90
33666888425
""" Задача 8 Дан список кортежей grades = [(‘Ann’, 9), (‘John’, 7), (‘Smith’, 5), (‘George’, 6)]. Вывести информацию об оценках по возрастанию в виде: ‘Hello Ann! Your grade is 9’ """ # from operator import itemgetter grades = [('Ann', 9), ('John', 7), ('Smith', 5), ('George', 6)] # grades.sort(key=itemgetter(1)) # g...
AlesyaKovaleva/IT-Academy-tasks
tasks_4/tuple_8.py
tuple_8.py
py
680
python
en
code
0
github-code
90
39835526409
# -*- coding: utf-8 -*- from xml.dom import ValidationErr from odoo import api, fields, models class Property(models.Model): _name = 'realestate.property' _description = 'Real Estate Property' # Fields name = fields.Char(string='Name', required=True) description = fields.Text(string='Description...
AlejandroBelloIglesias/odoo-model-realstate
models/property.py
property.py
py
4,409
python
en
code
0
github-code
90
18061854189
import sys read = sys.stdin.read readline = sys.stdin.readline readlines = sys.stdin.readlines sys.setrecursionlimit(10 ** 9) INF = 1 << 60 MOD = 1000000007 def main(): N, K, X, Y = map(int, read().split()) if N <= K: ans = X * N else: ans = X * K + (N - K) * Y print(ans) retur...
Aasthaengg/IBMdataset
Python_codes/p04011/s177244822.py
s177244822.py
py
362
python
en
code
0
github-code
90
46022182170
import numpy as np import pandas as pd from sklearn.cluster import KMeans import glob # 用来读取文件夹中的所有文件 from sklearn.preprocessing import StandardScaler from scipy.spatial.distance import cdist from fastdtw import fastdtw # 定义读取bvh文件中手臂部分数据的函数 def read_arm_data(filename): # 打开文件 with open(filename, 'r...
panda697196/ArmsClustering
armcluster.py
armcluster.py
py
3,557
python
zh
code
0
github-code
90
21331624431
import pyautogui as p #controle de mouse e teclado #usar print(p.position()) para encontrar a posição do mouse # p.sleep(tempo) para dar 2 segundos para posicionar o mouse # p.sleep(2) # print(p.position()) # p.moveTo(x=710, y=1056, duration=1) # p.sleep(1) # p.click(x=13, y=1068) p.hotkey('win','r') #combinação de ...
qmclouca/RPAPython
Robot01.py
Robot01.py
py
554
python
pt
code
0
github-code
90
18358050089
import collections N, M, P = [int(_) for _ in input().split()] ABC = [[int(_) for _ in input().split()] for _ in range(M)] cd = collections.defaultdict Ga = cd(set) Gb = cd(set) G = [] ok = cd(int) for a, b, c in ABC: Ga[a].add(b) Gb[b].add(a) #dfs for pair in [[1, Ga], [N, Gb]]: S = pair Gn = pair.pop(...
Aasthaengg/IBMdataset
Python_codes/p02949/s068138506.py
s068138506.py
py
1,030
python
en
code
0
github-code
90
16151381216
import json import logging import os from collections import OrderedDict import yaml from timon.conf.grpby import cnvt_grpby_to_nested_dict from timon.conf.grpby import cnvt_nested_grpby_to_lst_dict logger = logging.getLogger(__name__) # next two vars needed for ordering generated json # order in which fields shal...
feenes/timon
timon/configure.py
configure.py
py
8,885
python
en
code
0
github-code
90
31951004757
import json import re from terminaltables import AsciiTable counts = {} def do_inc(val): global counts if val in counts: counts[val] = counts[val] + 1 else: counts[val] = 1 with open('sbom-hashes.json') as fh: rpt = json.load(fh) for k in rpt.keys(): v = rpt[k] ...
mwhitecoverity/sbom-tools
sbom-hash-incidence.py
sbom-hash-incidence.py
py
1,069
python
en
code
5
github-code
90
19858623398
# main.py import os from config.logger_config import setup_logger from input_module.epub import process_epub from input_module.other import process_srt # 配置日志 logger = setup_logger() def main(): # 获取用户输入 epub_filename = r"test file/繁中调试文件.epub" file_type = os.path.splitext(epub_filename)[1].lstrip('.')....
Hellohistory/Machine_Translation_ebook
main.py
main.py
py
1,427
python
zh
code
3
github-code
90
26852806310
import os import sys import shutil import re from datetime import datetime import numpy as np import pandas as pd #import matplotlib.pyplot as plt import yaml from astropy.io import fits from astropy.wcs import WCS from shutil import which set_type ='evaluation' #set_type ='development_small' #set_type= 'debug' run_f...
jmoldon/verification_sdc2
scripts/analysis.py
analysis.py
py
14,308
python
en
code
0
github-code
90
72836187818
import numpy as np import os import time import h5py import random import matplotlib.pyplot as plt import collections import utils def data_gen(config): hdf5_file = h5py.File(config.val_file, mode='r') audios = hdf5_file["waveform"] if config.model=="spec": act = hdf5_file["new_act"] else: ...
aframires/drum-loop-synthesis
data_pipeline.py
data_pipeline.py
py
1,804
python
en
code
20
github-code
90
18655445578
#! /usr/bin/env python3 import os from enum import Enum, auto import numpy as np import hebi import rospy from rospy.timer import TimerEvent from nav_msgs.msg import Odometry from microstrain_inertial_msgs.msg import FilterHeading from geometry_msgs.msg import Twist, PoseStamped from std_srvs.srv import Trigger, Trig...
HebiRobotics/environmental_robots
gps_navigation/scripts/routine_manager.py
routine_manager.py
py
14,681
python
en
code
0
github-code
90
29881391230
import sys import heapq from collections import defaultdict def huffman_encoding(data): if not data: return "", {} frequency = defaultdict(int) for symbol in data: frequency[symbol] += 1 if len(frequency) == 1: tree = {symbol: '0' for symbol in frequency} encoded_dat...
lleonardogr/EstruturasDeDadosEAlgoritimos
DataStructures/Lesson3.py
Lesson3.py
py
3,856
python
en
code
0
github-code
90
22761962069
from __future__ import absolute_import from __future__ import division from __future__ import print_function import collections import functools import os from dragon.vm import torch from seetadet.core.config import cfg from seetadet.core.engine.build import build_lr_scheduler from seetadet.core.engine.build import ...
seetaresearch/seetadet
seetadet/core/engine/train_engine.py
train_engine.py
py
5,896
python
en
code
1
github-code
90
17993248429
HW = input().split() H = int(HW[0]) W = int(HW[1]) lst = [] for i in range(H): lst.append('#' + input() + '#') print('#' * (W+2)) for s in lst: print(s) print('#' * (W+2))
Aasthaengg/IBMdataset
Python_codes/p03712/s162628563.py
s162628563.py
py
183
python
en
code
0
github-code
90
41948841519
from flask import render_template,request,redirect,url_for from . import main from ..request import get_newsource,get_articles,search_article from ..models import Source,Article # Views @main.route('/') def index(): ''' View root page function that returns the index page and its data ''' #Getting news...
Pixel-0/arg-news
app/main/views.py
views.py
py
1,781
python
en
code
1
github-code
90
41771624328
#!/usr/bin/python3 from json import loads, load, dumps from sys import argv, exit def error_handler(exit_on_error=True): def decorator(func): def main(*args, **kwargs): try: return func(*args, **kwargs) except Exception as e: print(f"Error : {e.args[...
Simatwa/cookie-hunter
main.py
main.py
py
2,139
python
en
code
0
github-code
90
14012053658
from dataclasses import dataclass from typing import Dict, List, Optional import torch import torch.distributed as dist from torch.distributed import ProcessGroup from elixir.cuda import gpu_device from elixir.parameter import FakeTensor from .memory_pool import MemoryPool, PrivateBlock, PublicBlock, TensorBlock fro...
hpcaitech/Elixir
elixir/chunk/core/chunk.py
chunk.py
py
21,263
python
en
code
8
github-code
90
37479444259
import numpy as np import theano import theano.tensor as T import matplotlib.pyplot as plt from sklearn.utils import shuffle from util import relu, error_rate, getKaggleMNIST, init_weights def T_shared_zeros_like32(p): # p is a Theano shared itself return theano.shared(np.zeros_like(p.get_value(), dtype=np.f...
RKorzeniowski/Lazy_programmer_projects
unsupervised_ml/my_autoencoder.py
my_autoencoder.py
py
4,546
python
en
code
0
github-code
90
18815199297
from spatula import HtmlPage, XPath from openstates.models import ScrapeCommittee import re leader_re = re.compile(r"(.+),\s+(.*Chairman)") class Committees(HtmlPage): def process_page(self): chamber = XPath(".//house//text()").match(self.root)[0] committees = XPath(".//committee").match(self.ro...
openstates/openstates-scrapers
scrapers_next/ms/committees.py
committees.py
py
1,494
python
en
code
820
github-code
90
18303655599
import sys, re from collections import deque, defaultdict, Counter from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians from itertools import accumulate, permutations, combinations, product from operator import itemgetter, mul from copy import deepcopy from string import ascii_lowercase, ascii_uppercase...
Aasthaengg/IBMdataset
Python_codes/p02834/s668196214.py
s668196214.py
py
1,532
python
en
code
0
github-code
90
13648863460
# coding:utf-8 import jieba import xlrd import numpy as np import re import string #(Begin), I 表示内部(inside), O 表示外部(outside), E 表示这个词处于一个实体的结束为止, S 表示,这个词是自己就可以组成一个实体(Single) def Creat_Txt(): f=open('../资料/全部/jieba_data.txt','a+',encoding='utf-8') return f def Add(): print("添加字典进入jieba\n--------") # 将字典添加到jieba ...
srx-2000/traditional_Chinese_medicine
实体标注/伪_实体标注.py
伪_实体标注.py
py
9,547
python
en
code
69
github-code
90
17990757489
import sys sys.setrecursionlimit(2147483647) INF=float("inf") MOD=10**9+7 input=lambda :sys.stdin.readline().rstrip() def bisection(l,r,f,left=True,discrete=True): eps=1 if discrete else 10**-12 if((not left)^f(r)): return r if left else r+1 elif(left^f(l)): return l-1 if left else l while(r-l>eps): ...
Aasthaengg/IBMdataset
Python_codes/p03700/s079932158.py
s079932158.py
py
774
python
en
code
0
github-code
90
18107750969
n = int(input()) *s1, = input().split() s2 = s1[:] def bubbleSort(s): flag = True while flag: flag = False for i in range(n-1): if int(s[i][1]) > int(s[i+1][1]): s[i],s[i+1] = s[i+1],s[i] flag = True return s def selectionSort(s): for i in ra...
Aasthaengg/IBMdataset
Python_codes/p02261/s905976896.py
s905976896.py
py
645
python
en
code
0
github-code
90
29450560909
#!/usr/bin/env python from parseTweet import parse_tweets from operator import itemgetter import helper from collections import defaultdict """ makes the various chunks, depending on number of chunks K """ def makeChunks(trainingExList, K): numChunk = (len(trainingExList) / K)+1 dictChunk = [] chunkCounte...
dyelsey/SemEval
crossval.py
crossval.py
py
1,591
python
en
code
0
github-code
90
44354538268
#!/usr/bin/python3 import pprint import time from datetime import datetime, date, timedelta import pickle import os.path from googleapiclient.discovery import build from google_auth_oauthlib.flow import InstalledAppFlow from google.auth.transport.requests import Request ############# ## Globals ## ############# pp =...
ZeGhost/test-support-calendar
test.py
test.py
py
8,526
python
en
code
0
github-code
90
575406817
import models import schemas from typing import List from database import engine, SessionLocal from fastapi import FastAPI, Depends, status, Response, HTTPException from sqlalchemy.orm import Session from Hashing import Hash app = FastAPI() models.Base.metadata.create_all(bind=engine) def get_db(): db = Session...
Pratik180198/fast-api-demo
New Project/demo.py
demo.py
py
2,871
python
en
code
0
github-code
90
22811406879
from synthnet import * from simulation import * from detcom import * import matplotlib.pyplot as plt import numpy as np from networkx.generators.community import LFR_benchmark_graph def af(G): G = add_feature_vector(G, [('uniform', (0, 1))]*5) def av(G, l=0, u=1): G = add_vulnerability_of_node(G, 'uniform', l...
sagalpreet/Evolution-of-Clusters
Code/usagsp.py
usagsp.py
py
2,125
python
en
code
3
github-code
90
15212740603
import os from waflib import Logs, Utils, Options, TaskGen, Task from waflib.Errors import WafError import wutils def options(opt): opt = opt.add_option_group ('ccnSIM Options') opt.add_option('--enable-ccn-plugins', help="""Enable CCN plugins (may require patching). topology plugin enable...
chris-wood/SCoNet
ns-3-dev/src/ccnSIM/wscript
wscript
12,022
python
en
code
0
github-code
90
42106072020
import random print("Let's play Rock Paper Scissors!") play_again = "Y" options = ['r','p','s'] options_dict = {'r':'rock', 'p':'paper', 's':'scissors'} conditions_dict = {'r': 1, 'p': 2, 's': 3} user_win_count = 0 computer_win_count = 0 #loop back here while play_again == "Y" or play_again == "y": selection = inp...
DenverSherman/terminal_games
rock_paper_scissors/rock_paper_scissors.py
rock_paper_scissors.py
py
1,210
python
en
code
0
github-code
90
6242569695
from os import name from seaborn.matrix import heatmap import streamlit as st import numpy as np import pandas as pd import pydeck as pdk import plotly.express as px import plotly.graph_objects as go from plotly.subplots import make_subplots import matplotlib.pyplot as plt import seaborn as sns from sklearn import prep...
sidharrth2002/covid-streamlit-2
pages/Classification.py
Classification.py
py
20,753
python
en
code
2
github-code
90
13025006643
# STATEMENT: https://www.codingame.com/training/medium/the-grand-festival---i import sys import math # Total prize starting on day d with rest r. def prize(d,r): if(d == N): return 0 if(r == 0): return prize(d+1,R) if memo[d+1][R] == -1: prize_excluded = prize(d+1,R) m...
gabrielrodcanal/codingame-sols
grand-festival-i.py
grand-festival-i.py
py
893
python
en
code
1
github-code
90
6316396741
import keras.backend as K from utils import data_generator from tcn import tcn def get_activations(model, model_inputs, print_shape_only=False, layer_name=None): print('----- activations -----') activations = [] inp = model.input model_multi_inputs_cond = True if not isinstance(inp, list): ...
cxz/keras-tcn
mnist_pixel/main.py
main.py
py
2,584
python
en
code
null
github-code
90
74736464937
import os,time pid = os.getpid() import pyjit #os.chdir("C:\\Dev\\PyJit\\buildtest") srcs=["helloworld.cpp"] #srcs=["*.cpp>[cppcompiler.cpp,buildsystem.cpp]"] src =pyjit.expand(srcs) target_name ="hello_pyjit" output_dir ="." target_type ="exe" target_lang = "c++" m1 = [("YAML_CPP_STATIC_DEFINE",None),("WIN32",1)] ...
Galaxy3DVision-Inc/PyJit
buildtest/simple.py
simple.py
py
1,024
python
en
code
0
github-code
90
46181072400
"""Paranthesis checker.""" from stack import Stack def paranthesis_checker(symbol_string): """Paranthesis checker.""" s = Stack() is_balanced = True index = 0 # Navigate character by character through the symbol_string. while index < len(symbol_string) and is_balanced: symbol = symbol_...
dhanraju/python
data_structures/probl_sol_with_algs_and_ds/ch03_basic_ds/paranthesis_checker.py
paranthesis_checker.py
py
1,618
python
en
code
0
github-code
90
13000161809
ones = { 0: "", 1: "one", 2: "two", 3: "three", 4: "four", 5: "five", 6: "six", 7: "seven", 8: "eight", 9: "nine" } teens = { 0: "ten", 1: "eleven", 2: "twelve", 3: "thirteen", 4: "fourteen", 5: "fifteen", 6: "sixteen", 7: "seventeen", 8: "eigh...
jwmortensen/project-euler
017/num_to_text.py
num_to_text.py
py
1,013
python
en
code
0
github-code
90
17939534428
from typing import List, Tuple import numpy as np import pandas as pd NUMERIC_DTYPES = [ np.float64, np.float32, np.float16, np.int64, np.int32, np.int16, np.int8, np.uint8, np.uint16, np.uint32, np.uint64, np.complex64, np.complex128, ] def split_columns_types(da...
octopize/avatar-python
avatars/lib/split_columns_types.py
split_columns_types.py
py
931
python
en
code
1
github-code
90
71546438377
for _ in range(int(input())): s=input() arr=[0]*257 ans="" for i in range(len(s)): ind=ord(s[i]) if(arr[ind]==0): arr[ind]=1 ans+=s[i] print(ans)
anirudhkannanvp/GeeksForGeeksSolutions
remove-duplicates.py
remove-duplicates.py
py
205
python
en
code
0
github-code
90
18212749739
import sys #入力する名前S S = input() #新しいID T T = input() #print(S) #print(type(S)) #print(T) #print(type(T)) if S == T[:-1]: print("Yes") sys.exit() else: print("No")
Aasthaengg/IBMdataset
Python_codes/p02681/s035110291.py
s035110291.py
py
196
python
ja
code
0
github-code
90
25958502434
import node node1 = node.Node("John") print(node1.get_name()) print(node1.get_next()) node2 = node.Node("Krish") node1.set_next(node2) print(node1.get_next().get_name()) node3 = node.Node("Anything") node2.set_next(node3) print("while loop") new_node_list = [] n = node1 while n is not None: print(n.get_name(...
krishras23/WebApp
testnode.py
testnode.py
py
474
python
en
code
0
github-code
90
14796108109
import os, random, torch import argparse import multiprocessing as mp import numpy as np import pickle import shutil from functools import partial import lmdb from tqdm.auto import tqdm from utils.data import PDBProtein, parse_sdf_file from scripts.binana_script.detect_interactions import run_binana_command AA_NAME_SY...
zephyrdhb/InterDiff
scripts/data_preparation/extract_pockets_prompts.py
extract_pockets_prompts.py
py
8,008
python
en
code
3
github-code
90
23175961141
import asyncio from bergen.registries.ward import get_ward_registry from bergen.wards.default import MainWard from bergen.config.types import ArkitektConfig, HerreConfig from bergen.schemas.herre.types import User from bergen.schema import Transcript from bergen.hookable.base import Hooks from pydantic.main impo...
jhnnsrs/bergen
bergen/clients/base.py
base.py
py
12,589
python
en
code
0
github-code
90
8131651935
import streamlit as st import os def set_page_title(title): st.sidebar.markdown(unsafe_allow_html=True, body=f""" <iframe height=0 srcdoc="<script> const title = window.parent.document.querySelector('title') \ const oldObserver = window.parent.titleObserver if (oldObse...
cnsdqd-dyb/Yubo_Dong_Work_Share_Platform
scripts/st_temp_scripts.py
st_temp_scripts.py
py
1,332
python
en
code
0
github-code
90
32888160254
# -*- coding: utf-8 -*- """ Created on Fri Sep 18 17:33:58 2020 @author: Cheng Rong """ import numpy as np import xlrd import import_data data=import_data.import_data() import assignment from assignment.assign import * from assignment.line import * from assignment.graph import * import random import copy import time ...
hkujy/HHbike
enumeration.py
enumeration.py
py
11,146
python
en
code
0
github-code
90
18158169639
#!/usr/bin/python3 #coding: utf-8 S = int(input()) memo = {} def rec(n): if n < 3: return 0 ret = 1 if n in memo: return memo[n] for i in range(n-3): ret += rec(n-3-i) ret %= 10**9 + 7 memo[n] = ret return ret print(rec(S))
Aasthaengg/IBMdataset
Python_codes/p02555/s452158188.py
s452158188.py
py
284
python
en
code
0
github-code
90
12181651376
# -*- coding: utf-8 -*- """ Created on Fri Jun 18 23:17:29 2021 @author: Harshu """ import requests url = 'http://localhost:5000/results' r = requests.post(url) print(r.json()) #json={'rate':5, 'sales_in_first_month':200, 'sales_in_second_month':400
Harshu2032000/Loan-prediction-web-app
request.py
request.py
py
266
python
en
code
0
github-code
90
18306380569
import numpy as np N=int(input()) A=np.array([int(x) for x in input().split()]) ans=0 M=pow(10,9)+7 for i in range(100): one=int(np.sum((A>>i)&1)) zero=N-one ans+=(one*zero)*pow(2,i) ans%=M #print(one,zero) print(ans)
Aasthaengg/IBMdataset
Python_codes/p02838/s066560585.py
s066560585.py
py
229
python
en
code
0
github-code
90
21897323280
import ecmcJinja2 import ecmcAxes def main(): """ render axis configuration to `cli.outFile` based on yaml-config `cli.cfgFile` The script will lint the input and validate the axis against the configured type In case a PLC is defined within the axis config, the PLC will be validated and added to the p...
paulscherrerinstitute/ecmccfg
scripts/jinja2/axisYamlJinja2.py
axisYamlJinja2.py
py
550
python
en
code
6
github-code
90