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
10303100554
# https://www.acmicpc.net/problem/9251 if __name__ == '__main__': input = __import__('sys').stdin.readline A = input().rstrip() B = input().rstrip() N = len(A) M = len(B) dp = [[0 for _ in range(M + 1)] for _ in range(N + 1)] for a_index, a_char in enumerate(A): for b_index, b_char...
kjh9267/BOJ_Python
Dynamic Programming/9251.py
9251.py
py
635
python
en
code
0
github-code
90
18517940915
#!/usr/bin/env python3 from ctypes import c_ulong b_word = 32 b_byte = 8 word = 4 def shift_right(bits): return 1 << bits def mask(a, b): return a >> ((b_word - ((b + 1) * b_byte)) & (shift_right(b_bytes) - 1)) # Lookup table (Dictionary) for each Roman symbol to Integer Roman = { "I": 1, "V": 5...
wpdulyea/Projects
python/algorithms/convertNum.py
convertNum.py
py
3,578
python
en
code
0
github-code
90
18039384619
from collections import * N,K,L = map(int,input().split()) def root(x): while 0<=p[x]: x = p[x] return x def unite(x,y): x = root(x) y = root(y) if x==y: return if x>y: x,y=y,x p[x]+=p[y] p[y]=x def g(x): global p p=N*[-1] for _ in range(x): a,b = map(int,input().split()) un...
Aasthaengg/IBMdataset
Python_codes/p03855/s344248155.py
s344248155.py
py
433
python
en
code
0
github-code
90
29867892817
from ray.tune.logger import Logger class RecoverLogger(Logger): """ Base class for logging things with recover. Inherits from ray's logging. Just allows us to also store the Data object along with all the bits ray logging natively stores. """ def __init__(self, config, logdir, data, trial=No...
jyperion/Recover-1
recover/loggers/recover_logger.py
recover_logger.py
py
398
python
en
code
null
github-code
90
22581842274
# Unit 2 | PyRamen import csv import pathlib menu = [] sales = [] menu_file = pathlib.Path('C:/Users/14259/Desktop/Kevin/UW/Python Unit 2 HW/menu_data.csv') sales_file = pathlib.Path('C:/Users/14259/Desktop/Kevin/UW/Python Unit 2 HW/sales_data.csv') with open(menu_file, 'r') as m: menu_data = csv.reader(m) ...
khao2393/python-homework
PyRamen/.ipynb_checkpoints/PyRamen-checkpoint.py
PyRamen-checkpoint.py
py
1,413
python
en
code
0
github-code
90
31950953648
from __future__ import absolute_import from mindspore.ops.op_info_register import op_info_register, TBERegOp, DataType import te.platform.cce_params as cce from te import tik from topi.cce import util # General limitation of the size for input shape: 2**31 SHAPE_SIZE_LIMIT = 2147483648 NoneType = type(None) matmul_cu...
imyzx2017/mindspore_pcl
mindspore/ops/_op_impl/_custom_op/matmul_cube_fracz_left_cast_impl.py
matmul_cube_fracz_left_cast_impl.py
py
20,912
python
en
code
5
github-code
90
15540221205
import glob import os import win32com.client class OutlookHandler: def __init__(self): self.outlook = win32com.client.Dispatch("Outlook.Application") self.newMail = None def create(self): self.newMail = self.outlook.CreateItem(0) def setting(self, argMailformat, argSenderaddress...
dede-20191130/CreateToolAndTest
Commons/OutlookHandler.py
OutlookHandler.py
py
1,631
python
en
code
0
github-code
90
71604940456
import math def InputData(): a=float(input("Nhap a: ")) b=float(input("Nhap b: ")) c=float(input("Nhap c: ")) return a,b,c def GiaiPT(a,b,c): if (a == 0): if (b == 0): print ("Phương trình vô nghiệm!") else: print ("Phương trình có một nghiệm: x = ", + (-c / b...
Dunn8102/python-project
LeDucKhanhDuong/LeDucKhanhDuong/Bai3.py
Bai3.py
py
832
python
vi
code
0
github-code
90
16123310910
#!/usr/bin/env python3 import json graph_id = json.load(open('graph_info.json'))['id'] score_id = json.load(open('score.json'))['id'] run = { "description": "test run!", "graph_id": graph_id, "score_id": score_id, "parameter_set": { "num_suboptimal": 1, "max_overlap": 0, "...
sebwink/deregnet-rest
test/.old/generate_test_run.py
generate_test_run.py
py
391
python
en
code
0
github-code
90
73604975655
def list_div(x,y,a,b): first_exp = tuple({x+(1/y)}) for element in first_exp: first_exp_ans = element ** a second_exp = tuple({x-(1/y)}) for element in second_exp: second_exp_ans = element ** b first_list = [first_exp_ans * second_exp_ans] third_exp = tuple({y+(1/x)}) for ...
akulacharan/Iraitech-assignment
solution3.py
solution3.py
py
744
python
en
code
0
github-code
90
23478405828
#!/usr/bin/env python import argparse import numpy import cv2 import re class Undistorter: def set_alpha(self, a): ncm, _ = cv2.getOptimalNewCameraMatrix(self.intrinsics, self.distortion, self.size, a) for j in range(3): for i in range(3): self.P[j, i] = ncm[j, i] ...
futlab/ros-calib
undistort.py
undistort.py
py
3,218
python
en
code
0
github-code
90
20397242094
""" Name: wiki_jarvis.py Author: Maya Wilson Created: 3/21/23 Purpose: Use wikipedia module to print infomation in OOP and use Text-to-Speech and Speech Recognition to print Wikipedia This program uses wikipedia_class module """ # Install/import pytts3, wiki, speech recognition import speech_recogn...
wilso316/Python-JARVIS-Project
Week 10/jarvis_wiki.py
jarvis_wiki.py
py
3,332
python
en
code
0
github-code
90
73002327018
import boto3 import instaloader from reportlab.lib.pagesizes import letter from reportlab.lib.utils import ImageReader from reportlab.pdfgen import canvas import json import time # Add this import for timestamp generation s3 = boto3.client( 's3', aws_access_key_id='change_it', aws_secret_access_key='chang...
princetechs/servreless-lamdaaws-python-http-api-project
handler.py
handler.py
py
2,144
python
en
code
0
github-code
90
5303251441
#!/usr/bin/python2 # -*- coding: utf-8 -*- from __future__ import division from PyQt4 import QtGui, QtCore import OINKMethods as OINKM import datetime import math from FormattedDateEdit import FormattedDateEdit from CopiableQTableWidget import CopiableQTableWidget import MOSES class LeavePlanner(QtGui.QWidget): de...
stonecharioteer/oink
OINKModules/LeavePlanner.py
LeavePlanner.py
py
9,562
python
en
code
0
github-code
90
8214321018
#OLED import time import sys import Adafruit_SSD1306 import os from datetime import datetime from PIL import Image from PIL import ImageDraw from PIL import ImageFont FONT_SIZE = 14 v1 = sys.argv[1] print(v1) disp = Adafruit_SSD1306.SSD1306_128_64(rst=0) disp.begin() disp.clear() disp.di...
fourdollar-s/ES_raspberryPi_project
ES/Python/I2COLED.py
I2COLED.py
py
875
python
en
code
0
github-code
90
19216571576
import random class Individual: genes = [] fitness = None ID = None def __init__(self, id): self.genes self.fitness self.ID = id def __str__(self): return "ID: %s Fitness: %s Genes: %s" % (self.ID, self.fitness, self.genes) def calculate_fitness(self): ...
William-Blackie/Genetic-Algorithm-Rule-Classification
individual.py
individual.py
py
1,407
python
en
code
2
github-code
90
18550175269
S = input() alf = set([chr(i) for i in range(ord('a'), ord('z')+1)]) if S == "zyxwvutsrqponmlkjihgfedcba": print(-1) elif len(S) < 26: not_used_alf = list(alf - set(S)) ans = S + min(not_used_alf) print(ans) else: tmp = S[-1] for i in reversed(range(26)): if S[i] >= tmp: tm...
Aasthaengg/IBMdataset
Python_codes/p03393/s204194595.py
s204194595.py
py
559
python
en
code
0
github-code
90
7920201716
from os.path import dirname, join import pytest from householdsim import mosaik @pytest.mark.parametrize('data_file_ext', ['', '.gz']) def test_init(data_file_ext): sim = mosaik.HouseholdSim() sim.init('sid') DATA_FILE = join(dirname(__file__), 'data', 'test.data' + data_file_ext) entities = sim.cr...
benaka-tech/mosaik-eth
venv/Lib/site-packages/tests/test_mosaik.py
test_mosaik.py
py
3,437
python
en
code
1
github-code
90
8234138164
import sys def readNumber(file): number = 0 for byte in file.read(4): number <<= 8 number += ord(byte) return number blorb = open(sys.argv[1]) basename = sys.argv[1][:sys.argv[1].rfind('.')] print(basename) iff_magic = blorb.read(4) if (iff_magic != 'FORM'): print('Not an IFF file.') sys.exit(1) total_size...
mdm/chatmachine
tools/blorb.py
blorb.py
py
1,295
python
en
code
3
github-code
90
30294973350
from pathlib import Path with open(Path(__file__).parent / "inputs.txt") as f: data = f.read().splitlines() def get_rating(data, reverse=False): line = 0 while len(data) > 1: ones = list(filter(lambda e: e[line] == "1", data)) zeroes = list(filter(lambda e: e[line] == "0", data)) ...
HitchedSyringe/aoc
2021/03/second.py
second.py
py
715
python
en
code
0
github-code
90
30714336357
import numpy as np import torch from torch.utils.data import DataLoader, Dataset from torch.utils.data._utils.collate import default_collate class MultiObjectDataLoader(DataLoader): def __init__(self, *args, **kwargs): assert 'collate_fn' not in kwargs kwargs['collate_fn'] = self.collate_fn ...
addtt/multi-object-datasets
multiobject/pytorch.py
pytorch.py
py
3,961
python
en
code
7
github-code
90
9032941738
while True: n = int(input("ingresar el numero: ")) if n >= 2: break def factorializador(pa = 0): contador = n - pa while contador > 0: factorial = 1 for i in range(contador, 1, -1): factorial = factorial* i print("el factorial de " + str(contador) + " es: "...
gabrielromerod/Pogra1-Lab
Semana 8 - Guia/p1.py
p1.py
py
436
python
es
code
0
github-code
90
18332188429
def floyd_warshall(G): for k in range(N): for i in range(N): for j in range(N): G[i][j]=min(G[i][j],G[i][k]+G[k][j]) import sys input=sys.stdin.readline INF=10**30 N,M,L=map(int,input().split()) dp1=[[INF]*N for i in range(N)] for i in range(N): dp1[i][i]=0 for _ in range(M)...
Aasthaengg/IBMdataset
Python_codes/p02889/s036290765.py
s036290765.py
py
756
python
en
code
0
github-code
90
17368657170
import sys, os sys.path.append("lib") import math import numpy as np import time import logging from Anchor import anchor_lois_all from Shape import find_corrs_candidates_shape from Texture import get_scores_texture, find_loi_with_insignificant_signal, filter_candidates_with_insignificant_signal from utils import load...
weilunhuang-jhu/LesionCorrespondenceTBP3D
iterative_localization_alg.py
iterative_localization_alg.py
py
18,608
python
en
code
1
github-code
90
18193448989
ma = lambda :map(int,input().split()) ni = lambda:int(input()) import collections import math import itertools gcd = math.gcd n = ni() A = list(ma()) tot = 0 for a in A: tot = tot^a ans = [] for a in A: ans.append(tot^a) print(*ans)
Aasthaengg/IBMdataset
Python_codes/p02631/s114207491.py
s114207491.py
py
242
python
en
code
0
github-code
90
13112816319
from setup_imports import setup_imports # add the parent directory to PYTHON PATH setup_imports() from invokers import RemoteControlWithMethodRefs from receivers import Light, CeilingFan, GarageDoor, Stereo from commands import ( LightOffCommand, LightOnCommand, CeilingFanOffCommand, CeilingFanOnComma...
EricMontague/Head-First-Design-Patterns-In-Python
command_pattern/remote_loader_with_method_refs.py
remote_loader_with_method_refs.py
py
1,798
python
en
code
0
github-code
90
18267593459
n, a, b = map(int, input().split()) mod = 10**9 + 7 def powerDX(n, r, mod): if r == 0: return 1 if r%2 == 0: return pow(n*n % mod, r//2, mod) % mod if r%2 == 1: return n * pow(n, r-1, mod) % mod def combination(n, r, mod=10**9+7): n1, r = n+1, min(r, n-r) numer = denom = 1 for i in range(1...
Aasthaengg/IBMdataset
Python_codes/p02768/s997610599.py
s997610599.py
py
568
python
en
code
0
github-code
90
73131933095
import streamlit as st import openai from dotenv import load_dotenv from langchain.document_loaders import PyPDFDirectoryLoader from langchain.text_splitter import CharacterTextSplitter from langchain.embeddings import OpenAIEmbeddings, HuggingFaceInstructEmbeddings from langchain.vectorstores import FAISS from langcha...
Yisusad/AgroBotDeploy
app.py
app.py
py
3,319
python
en
code
0
github-code
90
10627487583
from time import sleep import pwinput alpha = ["a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z", "A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y",...
dhwanibudhiraja04/py-hangman
hangman.py
hangman.py
py
2,950
python
en
code
0
github-code
90
22318222204
import os import torch import sparseconvnet as scn from models import Autoencoder from module.utils.muon_track_dataset import MuonPose from torch.utils.tensorboard import SummaryWriter from datetime import datetime torch.manual_seed(42) train = MuonPose("/home/jack/classes/thesis/autohas/LArCentroids/train/", return_...
jacknewsom/SGMS
train_autoencoder.py
train_autoencoder.py
py
3,441
python
en
code
0
github-code
90
18539216209
# input H, W = map(int, input().split()) s = [ list(input()) for i in range(H) ] # check for i in range(H): for j in range(W): if s[i][j] == ".": continue else: check = [] append = check.append if i - 1 >= 0: append(s[i - 1][j...
Aasthaengg/IBMdataset
Python_codes/p03361/s634025943.py
s634025943.py
py
611
python
en
code
0
github-code
90
18411694069
from collections import deque H, W = list(map(int,input().split())) A = [input() for _ in range(H)] from collections import deque dx = [0, 1, -1, 0] dy = [1, 0, 0, -1] def bfs(q, a): ret = deque([]) while(q): pop = q.popleft() x, y = pop[0], pop[1] for i in range(4): ...
Aasthaengg/IBMdataset
Python_codes/p03053/s551292486.py
s551292486.py
py
891
python
en
code
0
github-code
90
35617324116
#!/usr/bin/python """ 1337 Strings: Prends une chaîne et la convertit en 1337. Peut être utile pour les mots de passe ;). """ import sys Dic = {"A": "4", "B": "8", "C": "(", "D": "d", "E": "3", "F": "f", "G": "6", "H": "#", "I": "|", "J": "j", "K": "k", "L": "l", "M": "m", "N": "n", "O": "0", "P": "p", "Q": "q...
rnek0/1337
1337.py
1337.py
py
925
python
en
code
0
github-code
90
9657761492
import heapq import time #start = time.time() n = int(input()) for i in range(n): total_toys = int(input()) toys = [] SUM_enjoyment_time = 0 for _ in range(total_toys): toy = [int(s) for s in input().split(" ")] toys.append(toy) SUM_enjoyment_time += toy[0] ...
dgg32/algo
google_toys.py
google_toys.py
py
1,788
python
en
code
0
github-code
90
12754669717
import pymongo client = pymongo.MongoClient('mongodb+srv://loc:1234@cluster0.clyd6.mongodb.net/myFirstDatabase?retryWrites=true&w=majority') db = client['db1'] collection = db['users'] post_count = collection.count_documents({}) print(post_count)
Locchuong96/backend
MongoDB/count_documents.py
count_documents.py
py
255
python
en
code
3
github-code
90
13640381738
"""Get vanilla move data.""" from typing import BinaryIO special_move_prices = [3, 5, 7] gun_price = 3 ins_price = 3 slam_prices = [5, 7] gun_upg_prices = [5, 7] ammo_belt_prices = [3, 5] ins_upg_prices = [5, 7, 9] class MoveType: """Class which stores info about move types.""" def __init__(self, type, inde...
2dos/DK64-Randomizer
base-hack/Build/vanilla_move_data.py
vanilla_move_data.py
py
4,247
python
en
code
44
github-code
90
5223014037
def isWhite(ch): if ch == ' ' or ch == '\t': return True return False def removeWhiteSpaces(text): if len(text) == 0: return '' tmp = '' flag = isWhite(text[0]) for ch in text: if flag: if not isWhite(ch): tmp+=ch flag=False ...
Blackwaveee/lecture5
removeWhiteSpace.py
removeWhiteSpace.py
py
580
python
en
code
0
github-code
90
70172534057
import sys import argparse import pandas as pd import spacy import emoji import re import operator #------------# # Parse Args # #------------# arg_parser = argparse.ArgumentParser(description="Data arguments") arg_parser.add_argument( "--modelname", help = "Subdirectory name in ../data/oupt directory that co...
j7breuer/twitter-analytics
nlp/classification/model_testing/load_testing.py
load_testing.py
py
3,025
python
en
code
0
github-code
90
3665135438
def DecimalToBinary(decimal_number): #make a procedure that converts decimal to binary while decimal_number > 0: #while the decimal number is greater than 0 print(decimal_number % 2) #the remainder of the decimal number divided by 2 is printed decimal_number = decimal_number // 2 #the decimal number...
antcoop096/Binary-Decimal-and-vise-versa-Converter
main (1).py
main (1).py
py
4,921
python
en
code
0
github-code
90
17352498342
import requests import tkinter as tk import customtkinter as ctk import feedparser import random from bs4 import BeautifulSoup from PIL import Image from googleCalendar import GoogleCalendar from iod import Iod import logging logger = logging.getLogger(__name__) class RndWebContent: def __init__(self, webLbl, scr...
zogspat/bedside
rndWebContent.py
rndWebContent.py
py
3,878
python
en
code
0
github-code
90
1958903560
import sys sys.stdin = open('input.txt') N, C = map(int, sys.stdin.readline().split()) home = [0] * N for i in range(N): home[i] = int(sys.stdin.readline()) home.sort() start = 1 end = max(home) ans = 0 while start <= end: mid = (start + end) // 2 cnt = 1 pos = home[0] for i in range(1, N): ...
ycchoi419/baekjun
BOJ2110/boj2110.py
boj2110.py
py
524
python
en
code
0
github-code
90
11189312914
from transformers import GPT2Tokenizer import re def get_pairs(word): """Return set of symbol pairs in a word. word is represented as tuple of symbols (symbols being variable-length strings) """ pairs = set() prev_char = word[0] for char in word[1:]: pairs.add((prev_char, char)) ...
aisingapore/sgnlp
sgnlp/models/csgec/tokenization.py
tokenization.py
py
3,611
python
en
code
32
github-code
90
72211395498
n = int(input()) array = [] for _ in range(n): string_lst = input() string_cnt = len(string_lst) array.append((string_lst, string_cnt)) # 중복 제거 array = list(set(array)) # 랜덤하게 정렬된다 # array 의 원소가 (0, 1) 형태로 있으면 1을 우선적으로 정렬 후 0을 정렬 array.sort(key=lambda word: (word[1], word[0])) for i in array:...
khyup0629/Algorithm
문자열/단어 정렬.py
단어 정렬.py
py
795
python
ko
code
3
github-code
90
41785951267
#!/usr/bin/env python import argparse import torch def get_ctranslate2_model_spec(opt): """Creates a CTranslate2 model specification from the model options.""" with_relative_position = getattr(opt, "max_relative_positions", 0) > 0 is_ct2_compatible = ( opt.encoder_type == "transformer" and...
memray/OpenNMT-kpg-release
onmt/bin/release_model.py
release_model.py
py
2,369
python
en
code
210
github-code
90
14412239570
from typing import Any, Dict, Type, TypeVar, Union import attr from ..types import UNSET, Unset T = TypeVar("T", bound="GetOrderTransporterContract") @attr.s(auto_attribs=True) class GetOrderTransporterContract: """ Attributes: comment (Union[Unset, None, str]): """ comment: Union[Unset, N...
Undefined-Stories-AB/ongoing_wms_rest_api_client
ongoing_wms_rest_api_client/models/get_order_transporter_contract.py
get_order_transporter_contract.py
py
871
python
en
code
1
github-code
90
18317258929
from itertools import accumulate import bisect n = int(input()) a = list(map(int, input().split())) acc = list(accumulate(a)) #idx = bisect.bisect_left(acc,acc[-1]//2) #print(idx) result = [] for i in range(n): result.append(abs((acc[-1] - acc[i] ) - acc[i])) print(min(result))
Aasthaengg/IBMdataset
Python_codes/p02854/s524081880.py
s524081880.py
py
285
python
en
code
0
github-code
90
71721963496
class Persona: def __init__(self, nombre, apellido, edad, sexo): self.nombre = nombre self.apellido = apellido self.edad = edad self.sexo = sexo def mostrarDatos(self): print("Nombre: ",self.nombre) print("Apellido: ",self.apellido) print("Edad: ",self.ed...
juanPabloCesarini/cursoPYTHON2021
Seccion 12/modulo/persona.py
persona.py
py
358
python
es
code
0
github-code
90
6638508104
from util import getFileContents from functools import reduce def countUniqueChars(word): bucket = set(word) return len(bucket) def countUnanimous(group): ledger = {} count = 0 listOfPeople = group.split('\n') groupCount = len(listOfPeople) for person in listOfPeople: for yes in pe...
jacksonal/adventofcode.2020
day6.py
day6.py
py
775
python
en
code
0
github-code
90
24257932941
#-*-coding:utf-8-*- import os import sys import logging from base import utils_cmd, utils_misc from sys import version_info from collections import OrderedDict from platform import machine from base import options_func from multiprocessing import Process from base.utils_misc import waiting_procesor_bar, waiting_spin_pr...
zhenyzha/envtool
ConfigEnv.py
ConfigEnv.py
py
2,035
python
en
code
0
github-code
90
3753676788
def count(sent): vowels=0 cons=0 punc=0 for i in range(0,len(sent)): ch=sent[i] if ( (ch >='a' and ch<='z') or (ch>='A' and ch<='Z')): if sent[i]=='a' or sent[i]=='e' or sent[i]=='o' or sent[i] =='u' or sent[i]=='i': vowels+=1 else: ...
Sounav201/itworkshop
Assignment5_Prog1.py
Assignment5_Prog1.py
py
748
python
en
code
0
github-code
90
12015716035
from datetime import * def LineOfFile(file_name): file1 = open(file_name, "r") count = len(file1.readlines()) file1.close() return count def CalcDays(x, y): # Function to return the Number of days between two dates d1 = x d1 = datetime.strptime(d1, '%d %B %Y') # change the pprivious forma...
mqashoo77/Car-Rental-Company-System
GetStatisticsInfo.py
GetStatisticsInfo.py
py
6,901
python
en
code
0
github-code
90
35223685659
import os.path import subprocess from collections import defaultdict from typing import Tuple, Optional import numpy as np import pandas as pd from chardet.universaldetector import UniversalDetector from Orange.data import ( is_discrete_values, MISSING_VALUES, Variable, DiscreteVariable, StringVariable, Conti...
biolab/orange3
Orange/data/io_util.py
io_util.py
py
10,118
python
en
code
4,360
github-code
90
18004263979
n = int(input()) a = list(map(int, input().split(" "))) def solve(s1, s2): "if start == true, assume the first of the sum is positive." res = 0 sum = 0 for i in range(n): sum += a[i] if sum <= 0 and i % 2 == s1: res += abs(sum) + 1 sum = 1 elif sum >= 0...
Aasthaengg/IBMdataset
Python_codes/p03739/s779724462.py
s779724462.py
py
445
python
en
code
0
github-code
90
34360975600
#Laurel Gordon #3/30/17 #dictionaries dictionary = {"cat": "a fluffy animal that can also be a pet.", "party": "a gathering of people together in one place where they have fun.", "friends": "people that you enjoy talking with and being with them.", "party pooper": "a pe...
jidffy/cvghjdtgj
GordonDictionary.py
GordonDictionary.py
py
1,612
python
en
code
0
github-code
90
24317696588
import time class Node: def __init__(self, data): self.data = data self.next_node = None class LinkedList: def __init__(self): self.head = None self.size = 0 def insert(self, data): self.size = self.size + 1 new_node = Node(data) if not self.h...
dp1706/Python-Data-Structure
Code/RunningTimeLinkedListArray.py
RunningTimeLinkedListArray.py
py
835
python
en
code
1
github-code
90
41417249104
""" Integration testing of OaiData model """ from core_main_app.system import api as system_api from core_main_app.utils.integration_tests.integration_base_test_case import ( IntegrationBaseTestCase, ) from core_oaipmh_provider_app.components.oai_data.models import OaiData from tests.utils.fixtures.fixtures import ...
usnistgov/core_oaipmh_provider_app
tests/components/oai_data/models/tests_int.py
tests_int.py
py
1,315
python
en
code
0
github-code
90
34063929664
from datetime import timedelta from tornado.httpserver import HTTPServer from tornado.options import define, options from tornado.ioloop import IOLoop from tornado.web import Application, RequestHandler, StaticFileHandler from tornado.websocket import WebSocketHandler from tornado.template import Loader import os impor...
hasankoksal/H-zlan.io
__init__.py
__init__.py
py
2,672
python
en
code
0
github-code
90
8042747355
import sys import os import os.path import numpy as np from motifCvUtils import * import argparse import pickle def main(): desc = '''Creates random backgrounds for a given feature matrix. The feature matrix is read from <scandir>/<infile>. You should have a file containing a dictionary from filenames to sizes. Th...
sofiakp/roadmap
motifs/python/createBackgrounds.py
createBackgrounds.py
py
2,338
python
en
code
1
github-code
90
70548558057
from turtle import Screen import time from player import Player from car_manager import CarManager from scoreboard import Scoreboard screen = Screen() screen.setup(width=600, height=600) screen.tracer(0) turtle = Player() scoreboard = Scoreboard() car_manager = CarManager() screen.listen() screen.onkeypress(fun=turt...
GRumbea/turtle-crossing-game
main.py
main.py
py
768
python
en
code
0
github-code
90
11564102617
import pygame import random from config import * from tiles import Tile from player import Player from equipment import Equipment from light import Light class Level: """ Attributes: all_platform (List): all of platforms's object display (TYPE): pygame.display equipment (TYPE): Descript...
Maru-Yasa/sky-parkour
level.py
level.py
py
10,300
python
en
code
0
github-code
90
35183090791
# Записать все 3 файла в один новый общий на одной страницу # Прочитать 3 файла -> записываем в массивы. Записываем массивы в один файл from openpyxl import load_workbook, Workbook from openpyxl.worksheet.worksheet import Worksheet from typing import Any def parse_workbook(workbook: Workbook) -> list[list[Any]]: ...
amina-wq/python-step-academy
13_december/task1.py
task1.py
py
1,341
python
en
code
0
github-code
90
18369477209
import bisect from collections import deque N = int(input()) A = [int(input()) for _ in range(N)] dq = deque([A[0]]) for i in range(1, len(A)): idx = bisect.bisect_left(dq, A[i]) if idx == 0: dq.appendleft(A[i]) else: dq[idx - 1] = A[i] print(len(dq))
Aasthaengg/IBMdataset
Python_codes/p02973/s285066080.py
s285066080.py
py
283
python
en
code
0
github-code
90
18263375539
class UnionFind(): def __init__(self,n): self.n=n self.parents = [i for i in range(n+1)] self.size = [1]*(n+1) def find(self,x): if self.parents[x]==x: return x else: self.parents[x]=self.find(self.parents[x]) return self.parents[x] ...
Aasthaengg/IBMdataset
Python_codes/p02762/s799660039.py
s799660039.py
py
1,283
python
en
code
0
github-code
90
74188173097
import cv2 from PIL import Image import numpy as np from .objects import * import time def main(): t = 0 canvas = Canvas(400, 400) while 1: t += 1 objects = [ Square(300, 100, 1, [0, 0, 0], 20), Circle(200, 200, -1, [255, 255, 0], 200), Square(0, 0, 10, ...
danbatiste/GELib
GE_Libraries/Draw/scene.py
scene.py
py
723
python
en
code
0
github-code
90
17130344847
from io import BytesIO import unittest from underrail_translation_kit.msnrbf_parser.loaders import load_class_with_members_and_types, load_class_with_id from tests.msnrbf_parser.helper import assertEndOfStream, assertEqualToStream class_info_source = b'\r\x00\x00\x00\x01P\x02\x00\x00\x00\x03P:N\x03P:V\x01\x00\x08\x02...
GoYoshino/some_project
tests/msnrbf_parser/records/test_01_class_with_id.py
test_01_class_with_id.py
py
1,073
python
en
code
0
github-code
90
40240742791
import json from django.http import HttpResponse from django.utils.decorators import method_decorator from django.views.decorators.csrf import csrf_exempt from django.views.decorators.http import require_GET from django.views.decorators.cache import never_cache from stagecraft.libs.authorization.http import permissio...
pombredanne/stagecraft
stagecraft/apps/transforms/views.py
views.py
py
6,124
python
en
code
null
github-code
90
71381854058
#escreva um algoritimo que le um nome e uma idade caso o nome digitado seja vinicius escreva isso na tela caso o usuario digite outro nome verfique sua idade se for menr que 18 anos informe que é de menor se for maior que 1000 anos informe que esta pessoa possivlemente nao existe nome = input('qual seu nome? ') idade ...
gabrielwallaceBDS/faculdade-
aula 3 teorica/exercicio5.py
exercicio5.py
py
556
python
pt
code
0
github-code
90
17437938200
from __future__ import absolute_import from __future__ import division from __future__ import print_function from absl.testing import absltest from protobuf import music_pb2 from moonlight.conversions import musicxml from moonlight.protobuf import musicscore_pb2 class MusicXMLTest(absltest.TestCase): def testSma...
tensorflow/moonlight
moonlight/conversions/musicxml_test.py
musicxml_test.py
py
5,418
python
en
code
321
github-code
90
22675752947
from django.contrib import admin from .models import BookInfo,HeroInfo # Register your models here. # 注册booktest的模型 # Register your models here. #定义管理后台 class BookInfoAdmin(admin.ModelAdmin): # list_display:显示字段,可以点击列头进行排序 list_display = ['id', 'bttile', 'bdate'] # list_filter:过滤字段,过滤框会出现在右侧 list_fil...
1807blaoyang/Django1902
demo1/booktest/admin.py
admin.py
py
657
python
en
code
0
github-code
90
41663397552
import pandas as pd import numpy as np from dask_ml.preprocessing import DummyEncoder,StandardScaler from sklearn.decomposition import PCA import dask.dataframe as dd from dask.distributed import Client,LocalCluster from sklearn.feature_extraction import FeatureHasher from dask.diagnostics import ProgressBar from sklea...
MrHuff/KernelFriedTensor
preprocessing_scripts/process_movielens_data_benchmark.py
process_movielens_data_benchmark.py
py
4,793
python
en
code
1
github-code
90
22324530252
# 그룹 단어란 단어에 존재하는 모든 문자에 대해서, 각 문자가 연속해서 나타나는 경우만을 말한다. 예를 들면, ccazzzzbb는 c, a, z, b가 모두 연속해서 나타나고, kin도 k, i, n이 연속해서 나타나기 때문에 그룹 단어이지만, aabbbccb는 b가 떨어져서 나타나기 때문에 그룹 단어가 아니다. # # 단어 N개를 입력으로 받아 그룹 단어의 개수를 출력하는 프로그램을 작성하시오. def group_word(s): l = [] for i in s: k = s.find(i) if k not in l or k...
polkmn222/backjoon-python
chap06/1316.py
1316.py
py
772
python
ko
code
0
github-code
90
5893636414
# -*- encoding: utf-8 -*- from __future__ import print_function, unicode_literals from . logEnvironmentModule import * from . errorObjs import * from heapq import nlargest import random from collections import deque class EVA02(LogAgent): """EVA02 LogAgent by Robert Parcus, 2014""" def __init__(self): ...
MircoT/AI-Project-PlannerEnvironment
agents_dir/EVA02.py
EVA02.py
py
23,359
python
en
code
3
github-code
90
156229570
#!/usr/bin/env python """ A unittest script for the Visit module. """ import unittest import json from datetime import date from cutlass import Visit from CutlassTestConfig import CutlassTestConfig from CutlassTestUtil import CutlassTestUtil # pylint: disable=W0703, C1801 class VisitTest(unittest.TestCase): "...
ihmpdcc/cutlass
tests/test_visit.py
test_visit.py
py
10,265
python
en
code
5
github-code
90
22833553644
""" Zabbix Sender Module """ import logging import os import random import shutil import string import tempfile import protobix from dotmap import DotMap from es_stats_zabbix.helpers.utils import status_map class ZbxSendObject(): """Zabbix Sender Class""" def __init__(self, zbx_conf): self.zabbix = zb...
untergeek/es_stats_zabbix
es_stats_zabbix/helpers/zabbix.py
zabbix.py
py
2,508
python
en
code
11
github-code
90
43984542218
import socket # Create an IPv6 socket s= socket.socket(socket.AF_INET6, socket.SOCK_STREAM) # Bind the socket to a local address s.bind(('localhost', 8000)) # listen for incoming connections s.listen(10) print("waiting------------------- ") c, addr= s.accept() print("connected wqith {addr}") # wait for a conne...
networkanotomy/socket-program.py
import socket.py
import socket.py
py
524
python
en
code
0
github-code
90
7651605296
import sys import json DIANPING_BLOCK_KEYS = { 'total_price', 'total_comments', 'total_shop_num' } LIANJIA_BLOCK_KEYS = { 'total_deal_price', 'total_rent_price', 'total_onsale_price', 'total_lianjia_shop_num' } class GetBlockInfo: """get block information""" def __init__(self, d...
pocoweb/hackcola
scripts/get_block_info.py
get_block_info.py
py
3,864
python
en
code
0
github-code
90
25754102712
import math import torch from torch import nn from torch.nn import functional as F # Copyright 2018 The Sonnet Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at ...
IGLICT/TM-NET
python/networks/networks_vqvae.py
networks_vqvae.py
py
12,807
python
en
code
33
github-code
90
18678889078
import cProfile import heapq import logging import random import re import string import sys import time from argparse import ArgumentParser from dateutil.parser import parse from dateutil.tz import tzutc from functools import cmp_to_key from pprint import PrettyPrinter try: from urlparse import urlparse except Im...
zhan849/argo
devops/src/ax/devops/utility/utilities.py
utilities.py
py
6,875
python
en
code
null
github-code
90
30335861504
import datetime import unittest from ansible_collections.lecontesteur.ganeti_cli.plugins.module_utils.builder_command_options import builder_functions from ansible_collections.lecontesteur.ganeti_cli.plugins.module_utils.builder_command_options.prefixes import PrefixAdd, PrefixModify, PrefixRemove, PrefixStr class Te...
LeConTesteur/ansible-module-ganeti-cli
tests/test_builder_functions.py
test_builder_functions.py
py
9,069
python
en
code
0
github-code
90
74968816295
from __future__ import absolute_import, division, print_function from builtins import range import os import numpy as np import time import pickle import gzip import math import random import pymatgen as mg import rdkit from rdkit import rdBase from rdkit import DataStructs from rdkit.Chem import AllChem as Chem from r...
beangoben/ChemORGAN
model/custom_metrics.py
custom_metrics.py
py
26,572
python
en
code
0
github-code
90
152624971
from effective_tours.constants import Groups, Permissions as BasePermissions, PermissionActions class Permissions(BasePermissions): ALL = 'board.*' BOARD = 'board.calendar.*' BOARD_READ = 'board.calendar.read' RESERVATION = 'board.reservation.*' RESERVATION_READ = 'board.reservation.read' RE...
pmisters/django-code-example
board/permissions.py
permissions.py
py
1,374
python
en
code
0
github-code
90
19600394154
class Solution: def multiply(self, num1: str, num2: str) -> str: n, m = len(num1), len(num2) if not n or not m: return "0" result = [0] * (n + m) for i in reversed(range(n)): for j in reversed(range(m)): current = int(result[i...
rhazra-003/LeetCode_Practice
43-multiply-strings/multiply-strings.py
multiply-strings.py
py
612
python
en
code
0
github-code
90
36498759027
import torch import torch.nn as nn import torch.nn.functional as F import math class TranE(nn.Module): def __init__(self, entity_num, relation_num, dim=100, d_norm=1, gamma=1): """ :param entity_num: number of entities :param relation_num: number of relations :param dim:...
liushizhong123/RPJE
Transe.py
Transe.py
py
2,990
python
en
code
3
github-code
90
5044021362
import sys sys.setrecursionlimit(10**9) def main(): N, M = map(int, input().split()) goings_towns = [[] for _ in range(N)] for _ in range(M): a, b = map(int, input().split()) goings_towns[a - 1].append(b - 1) ans = 0 def dfs(v): if not visited[v]: visited[v] =...
valusun/Compe_Programming
AtCoder/ABC/ABC204/C.py
C.py
py
547
python
en
code
0
github-code
90
17971074759
H, W = map(int, input().split(' ')) N = int(input()) A = list(map(int, input().split(' '))) # A = [10, 5, 5, 3, 2] # H, W = 5, 5 def get_position(H, W): for i in range(H): if i % 2 == 0: for j in range(W): yield i, j else: for j in range(W-1, -1, -1): ...
Aasthaengg/IBMdataset
Python_codes/p03638/s720904785.py
s720904785.py
py
596
python
en
code
0
github-code
90
33174997639
from student import Student class StudentReg(Student): def __init__(self, name, dept, sem, credit): super(StudentReg, self).__init__(name=name, dept=dept) self.__sem = sem self.__credit = credit self.__per_credit_fees = 5000 self.__total_fees = self.__credit * self.__per_c...
jasimdipu/skill_jobs_full_stack_10
python_basic_advance/python_project/student_reg.py
student_reg.py
py
1,502
python
en
code
0
github-code
90
28889308470
# -*- coding: utf-8 -*- from .base import * DEBUG = False ALLOWED_HOSTS = ['127.0.0.1', 'airlines-travel.herokuapp.com'] DB_URL = get_env_variable('DATABASE_URL') db_from_env = dj_database_url.config(DB_URL) DATABASES['default'].update(db_from_env)
dsreliete/airlines-django
airlines/settings/production.py
production.py
py
254
python
en
code
0
github-code
90
32901809312
import csv FDR=0.000001 #FDR=0.001 def fdr(iFile) : dict1=dict() inFile=open(iFile) csvFile=csv.reader(inFile) head=csvFile.next() for fields in csvFile : line='\t'.join(fields) dict1[line]=float(fields[3]) inFile.close() d1=dict1.items() d1.sort(cmp=lambda x,y:cmp...
wanghuanwei-gd/SIBS
GeneFusionsFinal/13_AftOmssa/1_fdr_filter.py
1_fdr_filter.py
py
854
python
en
code
0
github-code
90
201714705
import requests import json def message(): print(f"Output plugin loaded: http") def output_from_main(value, **kwargs): url = f"{kwargs['changing_url']}{value}" payload = {} headers = {} response = requests.request("PUT", url, headers=headers, data=payload) print(f"Set the system to: {respo...
jclayton09/closed_loop_controller
src/plugins/output/http/__init__.py
__init__.py
py
625
python
en
code
0
github-code
90
20705639909
from matplotlib import pyplot as plt import numpy as np import math ## Radar Specifications ########################### # Frequency of operation = 77GHz # Max Range = 200m # Range Resolution = 1 m # Max Velocity = 100 m/s ########################### # Define the target's initial position and velocity. Note : Velocity...
fantauzzi/SFND_radar_target
radar.py
radar.py
py
6,928
python
en
code
2
github-code
90
18588507769
# def rleify(s: str) -> List[Tuple[str, int]]: def rleify(s): if not len(s): return [] i = 0 rle = [] for j in range(len(s) + 1): if j == len(s) or s[i] != s[j]: rle.append((s[i], j - i)) i = j return rle s = input() X, Y = map(int, input().split()) rle = rl...
Aasthaengg/IBMdataset
Python_codes/p03488/s682998812.py
s682998812.py
py
941
python
en
code
0
github-code
90
25744633992
#! /usr/bin/env python3 # # coding=utf-8 ''' write a program to find approximately how much water is in the photo graph Given a high-resolution computer image of a map of an irregularly shaped lake with several islands, determine the water surface area. Assume that the x-y coordinates of every point on the map can be ...
Charlie-Say/CS-161
Labs/lab 8/water.py
water.py
py
1,179
python
en
code
0
github-code
90
25300684456
# # @lc app=leetcode.cn id=34 lang=python3 # # [34] 在排序数组中查找元素的第一个和最后一个位置 # # @lc code=start class Solution: def searchRange(self, nums: List[int], target: int) -> List[int]: l = self.search_left(nums,target) r = self.search_right(nums,target) return [l,r] # 寻找红色区域的最左侧...
HughTang/Leetcode-Python
Binary Search/34.在排序数组中查找元素的第一个和最后一个位置.py
34.在排序数组中查找元素的第一个和最后一个位置.py
py
1,114
python
en
code
0
github-code
90
18033342879
import os,io import heapq INF=10**9 input=io.BytesIO(os.read(0,os.fstat(0).st_size)).readline n,m=map(int,input().split()) edges=[] d=[] for i in range(n+1): d.append([]) for j in range(n+1): d[-1].append(INF) d[i][i]==0 for i in range(m): a,b,c=list(map(int,input().split())) edges.append([a,b,c]) d[a...
Aasthaengg/IBMdataset
Python_codes/p03837/s854477326.py
s854477326.py
py
592
python
en
code
0
github-code
90
34871370820
import numpy as np import pytest import pandas.util._test_decorators as td from pandas import ( DataFrame, DatetimeIndex, Index, IntervalIndex, Series, Timestamp, bdate_range, date_range, timedelta_range, ) import pandas._testing as tm class TestTranspose: def test_transpose_...
pandas-dev/pandas
pandas/tests/frame/methods/test_transpose.py
test_transpose.py
py
6,160
python
en
code
40,398
github-code
90
13832447732
#I just got a new job and there's a really good kibandaski around. #They sell a variety of stuff including: #main dish - Rice, Chapati, Ugali #side dish - Ndengu, Kamande, Peas #soup #greens - sukuma, spinach, cabbage #meat - beef, Nyamchom!!!!!!!!! #fruits - orange, mango, apple, passion #fresh juice - Pineapple mint,...
selewangraig/Elewa-100days
fun_projects/lunch.py
lunch.py
py
2,366
python
en
code
0
github-code
90
18592884399
N = int(input()) S = [] for _ in range(N): s = int(''.join(input().split()), 2) S.append(s) P = [] for _ in range(N): p = [int(i) for i in input().split()] P.append(p) ans = -10**20 for i in range(1, 2 ** 10): c = 0 for j in range(N): c += P[j][bin(S[j] & i).count('1')] ans = max(...
Aasthaengg/IBMdataset
Python_codes/p03503/s067134444.py
s067134444.py
py
340
python
en
code
0
github-code
90
37651144192
#!/usr/bin/env python # This program requires the use of the Pdftk server program. import argparse import os import subprocess def combine_files(opts): """Combine the odd and even pages intoa single file. """ cmd = ['pdftk'] cmd.append('A={}'.format(opts.odd_pages)) cmd.append('B={}'.format(opts...
mareuter/python_scripts
documents/combiner.py
combiner.py
py
1,905
python
en
code
0
github-code
90
27713087142
""" Use named parameters for more complex queries with a lot of parameters, or where some parameters are repeated multiple times within the query. Named parameters are prefixed with a colon (e.g., :param_name). """ import sqlite3 import sys db_filename = "../todo.db" project_name = sys.argv[1] with sqlite3.connect(d...
rakkaalhazimi/Python_Std_Library
Ch7DataPersistent/sqlite3_module/No_5_using_variables_with_queries/sqlite3_argument_named.py
sqlite3_argument_named.py
py
927
python
en
code
0
github-code
90
26209003235
""" An example of Benders Decomposition on fixed charge transportation problem bk4x3. Optimal objective in reference : 350. Erwin Kalvelagen, December 2002 See: http://www.in.tu-clausthal.de/~gottlieb/benchmarks/fctp/ use COPT to calculate it author: JIANG DAPEI """ import sys import coptpy as cp import numpy as np f...
chiangwyz/Operation-Research-Algo
benders decomposition/fixed charge transportation problem/FCTP benders decomposition.py
FCTP benders decomposition.py
py
13,983
python
en
code
2
github-code
90