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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
18342222129 | n=int(input())
s=input()
suc=[0]*(n-1)
ans=0
for i,c in enumerate(s):
for j in range(n-1):
idx=(i+1+j)%n
if idx==0:
suc[j]=0#またぐのは禁止
if c==s[idx]:
suc[j]+=1
suc[j]=min(suc[j],j+1,n-1-j)#最大j+1を超えると重なるため
ans=max(ans,suc[j])
else:
... | Aasthaengg/IBMdataset | Python_codes/p02913/s439336138.py | s439336138.py | py | 382 | python | ja | code | 0 | github-code | 90 |
5704967890 | class Solution(object):
def subsets(self, nums):
"""
:type nums: List[int]
:rtype: List[List[int]]
"""
dp = []
def sub_p(nums):
if nums in dp:
return
else:
dp.append(nums)
if nums:
... | lll109512/LeetCode | Array/Subsets.py | Subsets.py | py | 746 | python | en | code | 0 | github-code | 90 |
73363062055 | from rm_cloud.single_model_methods.trainer import Trainer
from lib.loss.mse_loss import get_mse_loss_function
import torch.nn as nn
from lib.loss.L1_loss import get_l1_loss_function
from lib.loss.loss_ssim import SSIM
class MSPFTrainer(Trainer):
def __init__(self, model, optimizer):
super().__init__(model, ... | cloudybai/ThinCloudRemoval | rm_cloud/single_model_methods/mspf_trainer.py | mspf_trainer.py | py | 2,285 | python | en | code | 0 | github-code | 90 |
18043360439 | h, w = map(int, input().split())
a = []
for _ in range(h):
a.append(input())
pos = (0, 0)
pre = 1
nxt = 0
while True:
x, y = pos
if x<w-1 and a[y][x+1]=='#':
nxt += 1
pos = (x+1, y)
if y<h-1 and a[y+1][x]=='#':
nxt += 1
pos = (x, y+1)
if x>0 and a[y][x-1]=='#':
... | Aasthaengg/IBMdataset | Python_codes/p03937/s257337046.py | s257337046.py | py | 556 | python | en | code | 0 | github-code | 90 |
29497178538 | #!/usr/bin/env python
##----From raw images' folder, it will refine image whit fixed interval, ant in these chose images it will divide it with fixed rate---##
import os
import argparse
parser = argparse.ArgumentParser(description='refine from raw pig images')
parser.add_argument('data', metavar='root_path',default... | Aaron9477/tiny_code | JD_contest/old/fix_refine.py | fix_refine.py | py | 3,173 | python | en | code | 1 | github-code | 90 |
469888874 | import subprocess
import yaml
from Main import main
path_to_yaml = 'cfg.yaml'
class Infomation():
def __init__(self,config):
self.model = config['model']
self.lr = config['lr']
self.batch_size = config['batch_size']
self.test_batch_size = config['test_batch_size']
self.epoc... | PQuartzRBz/CNN | run.py | run.py | py | 714 | python | en | code | 0 | github-code | 90 |
18517515979 | n,m,d = (int(i) for i in input().split())
ans = 0.
if d == 0:
ans = ( m - 1 ) / n
else:
ans = 2 * ( n - d ) * ( m - 1 )
ans = ans / (n * n )
print(ans) | Aasthaengg/IBMdataset | Python_codes/p03304/s722764112.py | s722764112.py | py | 158 | python | en | code | 0 | github-code | 90 |
10445458048 |
from django import template
register = template.Library()
@register.simple_tag
def Calculate_Discount_Price(Price, Discount):
Price = int(Price)
Discount = int(Discount)
if Discount == '' or Discount is None:
return Price
Discount = int(Discount)
if Discount == 0:
... | devsharmanitin/Ns-Market | NsMarkat/Shopx/XMarket/templatetags/Tags.py | Tags.py | py | 668 | python | en | code | 0 | github-code | 90 |
17125675008 | from django.shortcuts import get_object_or_404, render, reverse
from django.views import generic
from django.http import HttpResponse, HttpResponseRedirect
# from django.template import loader
from .models import City, Hotel
from .forms import CityForm
def index(request):
"""
Use of generic view to list all c... | bofo90/hotel-admin | hotels/views.py | views.py | py | 1,976 | python | en | code | 0 | github-code | 90 |
8741014951 | import logging
import os
import shutil
import subprocess
import sys
import tempfile
import threading
import uuid
import requests
def copy_tree(src, dst, symlinks=False, ignore=None):
for item in os.listdir(src):
s = os.path.join(src, item)
d = os.path.join(dst, item)
if os.path.isdir(s):
... | pepov/ambari-docker | ambari_docker/utils.py | utils.py | py | 2,467 | python | en | code | 0 | github-code | 90 |
18341912779 | n = int(input())
S = input()
ans = 0
for d in range(n):
cnt = 0
for i in range(n-d):
if S[i] == S[d+i]:
cnt += 1
else:
cnt = 0
ans = max(ans, min(cnt, d))
print(ans)
| Aasthaengg/IBMdataset | Python_codes/p02913/s069005315.py | s069005315.py | py | 222 | python | en | code | 0 | github-code | 90 |
18371903589 | def main():
l, r = map(int, input().split())
ans = 2019
for i in range(l, min(l+2019, r+1)):
for j in range(l+1, min(l+2019, r+1)):
if i < j:
tmp = (i * j) % 2019
#print(tmp)
if tmp < ans:
ans = tmp
print(ans)
if _... | Aasthaengg/IBMdataset | Python_codes/p02983/s250140586.py | s250140586.py | py | 354 | python | en | code | 0 | github-code | 90 |
29347585100 | from src.util import dateTime
from src.reportGenerator import searchSummaryGenerator
from src.responseBuilder import drivingLicenseResponseBuilder, errorResponseBuilder
from src.constant import constant
from . import backendService
from . import redisPublishService
from src.dbService import esService as es
from flask i... | mahmudur-rahman-dev/flask-elasticsearch-caching | src/services/drivingLicenseService.py | drivingLicenseService.py | py | 2,023 | python | en | code | 0 | github-code | 90 |
14032850120 | # Importar o módulo TKinter
import tkinter
class View():
"""
Classe View - Responsável pela construção
e apresentação da interface gráfica
"""
def __init__(self):
# Inicializar o gerenciador de Janelas
self.root = tkinter.Tk()
# loop principal
#
# Operação... | diogoolsen/TKinter | 01-Inicializando_o_TKinter/view_v1.py | view_v1.py | py | 388 | python | pt | code | 0 | github-code | 90 |
31414053707 | from rest_framework.test import APITestCase
from tictactoe.games.models import Game, Move
from django.contrib.auth import get_user_model
User = get_user_model()
class TestGameModel(APITestCase):
def setUp(self) -> None:
self.player_1 = User.objects.create(
username="player_3", email="p1@exam... | sunnyfloyd/tic-tac-toe-api | tictactoe/games/test/test_models.py | test_models.py | py | 2,051 | python | en | code | 0 | github-code | 90 |
18015239179 | n, c, k = map(int, input().split())
from collections import deque
t = [int(input()) for _ in range(n)]
t.sort()
t=deque(t)
ans = 1
bus=t[0]+k
cnt = 0
while t:
i=t.popleft()
if i>bus:
bus=i+k
ans+=1
cnt=1
elif cnt==c:
bus=i+k
ans+=1
cnt=1
else:
c... | Aasthaengg/IBMdataset | Python_codes/p03785/s424176215.py | s424176215.py | py | 339 | python | en | code | 0 | github-code | 90 |
710391168 | #!/usr/bin/env python3
import rospy, numpy as np, math as m
from geometry_msgs.msg import Twist
from rospy.exceptions import ROSInterruptException
pubTwist = rospy.Publisher('/move_bot_info', Twist, queue_size=1)
var = False
if __name__=="__main__":
ctrl_c = False
twist = Twist()
try:
... | evmehok/CSE_460_Final | bot_teleop/src/test_Twist.py | test_Twist.py | py | 1,203 | python | en | code | 0 | github-code | 90 |
18456114039 | Num,K=map(int,input().split())
L=[[]for i in range(Num+1)]
for i in range(Num):
t,d=map(int,input().split())
L[t].append(d)
for i in range(1,Num+1):
L[i].sort(reverse=True)
M=[]
m=[]
for i in range(1,Num+1):
if len(L[i])>=1:
M.append(L[i][0])
if len(L[i])>=2:
for j in range(... | Aasthaengg/IBMdataset | Python_codes/p03148/s588983470.py | s588983470.py | py | 1,129 | python | en | code | 0 | github-code | 90 |
9256434933 | import os
vars = Variables(None, ARGUMENTS)
env = Environment(variables = vars, ENV = os.environ)
conf = Configure(env)
env["CXX"] = 'g++'
env.Append(CCFLAGS = ["-O3", "-Wall", "-std=c++11"])
env = conf.Finish()
env.Program('meshGen', ['main_all.cpp'])
| precice/fem-shell | src/meshgen/SConstruct | SConstruct | 256 | python | en | code | 10 | github-code | 90 | |
16041042715 | import json
file = open("names2.txt", "w", encoding="utf8")
# file.write("张三")
# write时,只能写入字符串或者二进制
# file.write(12)
# 类似字典、列表、数字等都不能直接写入到文件里
# 想要写入上述内容的话有两种方法:
# 第一种方法:将数据转换成为字符串 使用repr/str 更多的情况是使用json
# json的本质就是字符串,区别在于json里要使用双引号表示字符串
# 第二种方法:将数据转换称为二进制 使用pickle模块
names = ["张三", "tom", "jack", "lily"]
# json里将... | EricWord/PythonStudy | 16-file/file_demo8.py | file_demo8.py | py | 1,317 | python | zh | code | 0 | github-code | 90 |
19274315196 | """ The entrypoint - core methods and classes"""
import sys
import threading
import time
import pystray as ps
from PIL import Image
from src import logger
from src import ui, exceptions
from src.logger import Logger
from src.processing import storage, processing
class SystemTray:
""" The system stray, the main ... | xroix/MCBE-Win10-FOV-Changer | src/core.py | core.py | py | 4,058 | python | en | code | 50 | github-code | 90 |
71830231658 | # Databricks notebook source
print('this is my first ML project on Databricks')
# COMMAND ----------
import os
diabetes = spark.read.format("csv").option("header","True").option("inferSchema","True").load(f"file:{os.getcwd()}/diabetes.csv")
# COMMAND ----------
diabetes.display()
# COMMAND ----------
display(diab... | EnricoTarabini/training_kaggle_db_diabete | test.py | test.py | py | 2,768 | python | en | code | 0 | github-code | 90 |
18581879609 | def main():
N = int(input())
trains = [list(map(int, input().split(' '))) for _ in range(N - 1)]
ans = [0 for _ in range(N)]
for i in range(N - 1):
t = 0
for train in trains[i:]:
c, s, f = train
wait_time = s - t if t <= s else (f - t) % f
t += wait_ti... | Aasthaengg/IBMdataset | Python_codes/p03475/s472665529.py | s472665529.py | py | 420 | python | en | code | 0 | github-code | 90 |
10021446878 | from PySide2 import QtGui, QtCore
class StylesMainWindow ():
def __init__ (self,mainWindow):
self.widget = mainWindow
self.window = self.widget.window
# self.widget.window = mainWindow
self.set_colors()
self.set_theme()
# self.setIcons()
def set_colors(se... | manjarga/CovidRX | scr/views/style.py | style.py | py | 3,973 | python | en | code | 0 | github-code | 90 |
15943602849 | tools = [
"Acid flask",
"Animal scent",
"Antitoxin",
"Astrolabe",
"Backpack",
"Bandolier",
"Bear trap",
"Bedroll",
"Beeswax",
"Bell",
"Bellows",
"Birdcage",
"Blank book",
"Blanket",
"Block and tackle",
"Boltcutters",
"Bottle",
"Bucket",
"Bullse... | philippe-lemaire/knave | game_logic/tables/tools.py | tools.py | py | 1,646 | python | en | code | 0 | github-code | 90 |
38874069381 | import h5py
from jax import jit, numpy as jnp, vmap, random
import jax
import json
from itertools import chain
from rotations import batched_randomly_rotate
import numpy as np
def h5_name(name):
return f"./data/shapenet/train{name}.h5"
def json_name(name):
return f"./data/shapenet/train{name}_id2name.json"
... | mzguntalan/mercury | data/__init__.py | __init__.py | py | 2,109 | python | en | code | 3 | github-code | 90 |
18347155589 | N=int(input())
A=list(map(int,input().split()))
bef=99999999999999
count=0
max=0
for i in range(N):
l=A.pop()
if l >= bef:
count +=1
else:
count=0
if max <= count:
max=count
bef=l
print(max)
| Aasthaengg/IBMdataset | Python_codes/p02923/s592160904.py | s592160904.py | py | 218 | python | en | code | 0 | github-code | 90 |
524503947 | #!/usr/bin/env python3
import re
'''A valid credit card has the following characteristics:
* It must start with a 4, 5 or 6
* It must contain exactly 16 digits
* It must only consist of digits (0-9)
* It may have digits in groups of 4, separated by one hyphen "-"
* It must NOT use any other separator like ' ', '_', ... | joez/letspy | lang/regex/card.py | card.py | py | 762 | python | en | code | 0 | github-code | 90 |
73525569255 | # -*- coding: utf-8 -*-
"""
Created on Mon Feb 18 15:39:20 2019
@author: rober
"""
import games
def steamworks_process_match(match):
"""
Process the match for steamworks.
Parameters:
match: The match to process.
"""
if 'caught_rope' in match:
match = match.copy()
... | FRC830/scouting_data_viewer | games/steamworks.py | steamworks.py | py | 2,251 | python | en | code | 0 | github-code | 90 |
71847113256 | forest = []
with open("input") as f:
for line in f.readlines():
forest.append(line.strip())
slopes = [(1, 1), (3, 1), (5, 1), (7, 1), (1, 2)]
multiplied = 1
for slope in slopes:
x = slope[0]
y = slope[1]
posx = 0
posy = 0
trees = 0
for line in forest:
if posy % y == 0:
... | alfredgamulo/advent_of_code | 2020/03/main.py | main.py | py | 509 | python | en | code | 2 | github-code | 90 |
18566708009 | #%%
H, W = [int(i) for i in input().split()]
maze = [[] for _ in range(H)]
num_black = 0
for i in range(H):
temp = input()
for j in temp:
maze[i].append(j)
if j == "#":
num_black += 1
#%%
import copy, collections
maze_copy = copy.deepcopy(maze)
color = [["W"] * W for _... | Aasthaengg/IBMdataset | Python_codes/p03436/s650703798.py | s650703798.py | py | 976 | python | en | code | 0 | github-code | 90 |
1834639012 | #from itertools import groupby
#from operator import itemgetter
#data = [1,2,3,2,4,5,6,7,8,1,0,4,5,6]
#new_l = []
#for k, g in groupby(enumerate(data), lambda x : x[0] - x[1]):
# new_l.append(list(map(itemgetter(1), g)))
#
#print(max(new_l, key=lambda x: len(x)))
def longest_sub_seq(arr):
#Removing duplicate e... | VenkateshwaranG/pyspark | LargestSequence.py | LargestSequence.py | py | 821 | python | en | code | 1 | github-code | 90 |
74047886378 | import json
import os
from threading import Thread
import time
from unittest import TestCase
from mockery.mocking import MockeryMixin, ok_, eq_
from .. import upload_to_cos
from ..upload_to_cos import Options, TemplateUploader
basic_target = os.path.dirname(__file__) + '/basic_target'
basic_sync_history_path = basi... | HubSpot/cos_uploader | cos_uploader/tests/test_upload_to_cos.py | test_upload_to_cos.py | py | 3,037 | python | en | code | 11 | github-code | 90 |
32589451967 | # -*- coding:utf-8 -*-
# ----------------------------------------------------------------------------------------------------------------------
# Author: Tuozhen
# Date: 2021/8/28
# Description: Leetcode 844. Backspace String Compare
# Given two strings s and t, return true if they are equal when both are typed into e... | TuozhenLiu/Data-Structure-Algorithm | Array/Two_Pointer/Backspace_String_Compare.py | Backspace_String_Compare.py | py | 2,365 | python | en | code | 2 | github-code | 90 |
74326899496 | from workflow import Workflow3
def main(wf):
ckeys = ['exchange.Today', 'exchange.Tomorrow', 'google.Today', 'google.Tomorrow']
for key in ckeys:
print (key + " " + str(wf.cached_data(key)))
if __name__ == '__main__':
wf = Workflow3(libraries=['./lib'],
)
log = wf.logger
... | jeeftor/alfredToday | src/cdump.py | cdump.py | py | 338 | python | en | code | 39 | github-code | 90 |
18480958728 | # encoding: utf-8
from admin import admin
from models import *
from flask import jsonify, request, session, Response
@admin.route('/get/adminInfo/', methods=['POST'])
def adminInfo():
adminId = session.get('adminId')
newAdmin = Admin.query.filter(Admin.id == adminId).first()
if newAdmin: # 如果管理员存在
... | DarcyWep/B2C | B2cWebPy/admin/getInfo.py | getInfo.py | py | 5,622 | python | en | code | 1 | github-code | 90 |
15756924847 | import matplotlib.animation as animation
import matplotlib.pyplot as plt
import numpy as np
import utility
class Rocket:
position = []
width = 0
height = 0
world = [[]]
trajectory = []
velocity = 0
def __init__(self, pos, state, width, height):
self.position = pos
self.wor... | TylersDurden/Simulation | Goal_Based/wk0/rockets.py | rockets.py | py | 2,067 | python | en | code | 0 | github-code | 90 |
32367110016 | """
The count-and-say sequence is a sequence of digit strings defined by the recursive formula:
countAndSay(1) = "1"
countAndSay(n) is the way you would "say" the digit string from countAndSay(n-1), which is then converted into a different digit string.
To determine how you "say" a digit string, split it into the mini... | simranjmodi/leetcode | top-interview-questions-easy/strings/count-and-say.py | count-and-say.py | py | 1,504 | python | en | code | 0 | github-code | 90 |
25194986212 | import os
import sys
PROGRAM_PATH = os.path.abspath(__file__)
PROGRAM_NAME = os.path.basename(PROGRAM_PATH)
if PROGRAM_NAME.endswith(".py"):
PROGRAM_NAME = PROGRAM_NAME[:-3]
BASE_DIR = os.path.dirname(os.path.dirname(PROGRAM_PATH))
if BASE_DIR not in sys.path:
sys.path.append(BASE_DIR)
from dotenv import loa... | gn00672312/pigeon | scripts/timedrived.py | timedrived.py | py | 1,112 | python | en | code | 0 | github-code | 90 |
27603251906 | from PySide6.QtWidgets import QDialog, QListWidgetItem
from pathlib import Path
from ..models.manga_model import Manga
from ..models import database_manager
from ..utilities.manga_scraper import series_scraper, series_search
from ..utilities.library_scanner import LibraryScanner
from ..views.ui_scan_dialog import Ui_S... | jjsmall009/mangecko | mangecko/controllers/scan_library_controller.py | scan_library_controller.py | py | 2,818 | python | en | code | 1 | github-code | 90 |
74749496297 | import time
import webbrowser
import platform
import install
running = True
installing = False
def quit():
varquit = input("Vous voulez vraiment quitter ( y / n )")
if varquit == y:
running = False
elif varquit == n:
running = Ture
print("PyRepo for ", platform.syst... | yubuntu-official/pyrepo | main.py | main.py | py | 752 | python | en | code | 0 | github-code | 90 |
74089083817 | """各模型和损失函数的具体实现"""
import torch
import torch.nn as nn
import torch.nn.functional as F
class CNN(nn.Module):
def __init__(self, data_loader, params):
super(CNN, self).__init__()
#导入数据集对应的词向量
embedding_vectors = data_loader.get_loaded_embedding_vectors()
#文本信息和位置信息的嵌入层
self.word_embedding = nn.Embedding.f... | xuanyyyy/Relation-Extractiono | code/model/net.py | net.py | py | 2,272 | python | en | code | 0 | github-code | 90 |
36724942378 | -"""
-============================
-To Enhance the contrast of input raw satellite image or image with general fromats through various
-enhancement methods such as Linear Streching, enhancement using Standard Deviation, Histogram Equalization, etc.
-============================
-created: 17/08/2015
-auhor: sujitdeokar3... | sujit-deokar/Virtual-Satellite-Image-Processing-and-Analysis-Laboratory | exp2.py | exp2.py | py | 1,750 | python | en | code | 1 | github-code | 90 |
36127310456 | """Email activation
Revision ID: 376542d9939a
Revises: a89502b9c0f3
Create Date: 2020-09-07 11:55:56.655180
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = "376542d9939a"
down_revision = "a89502b9c0f3"
branch_labels = None
depends_on = None
def upgrade():
... | MTES-MCT/mobilic-api | migrations/versions/376542d9939a_email_activation.py | 376542d9939a_email_activation.py | py | 826 | python | en | code | 1 | github-code | 90 |
40335059487 | # m is the number of (2,n-2) bipartitions
# n is the number of leaves
def prob(n, m):
if((n<=2) or (m<=1) or (m>= int(n/2)+1)):
print("Wrong input, n or m is not in the boundary")
else:
if(m==2):
if(n>=6):
return((n/(2*n-5))*prob(n-1, m))
elif((n>=3) and ... | FatemehPouryahya/peripheral_structures | pairs.py | pairs.py | py | 4,671 | python | en | code | 0 | github-code | 90 |
17815759455 | from parse import parse
from lib.helpers import log, get_strings_by_lines
from lib.config import TEST_MODE
def part_1():
earliest, bus_list = get_strings_by_lines('13.txt')
current_time = int(earliest)
busses = [ int(bus) for bus in bus_list.split(',') if bus and bus != 'x']
while True:
log(f'T... | carterjbastian/advent_of_code_2020 | problems/day_13.py | day_13.py | py | 1,466 | python | en | code | 0 | github-code | 90 |
22474166962 | import cv2
cap = cv2.VideoCapture("test.mp4")
# FPS = cap.get(cv2.CAP_PROP_FPS) 어차피 rtsp로 받아오는데 그땐 정상적으로 출력됨 빠르거나 느리지 않음
#print(FPS)
## 이미지 속성 변경 3 = width, 4 = height
##cap.set(3, 1920);
##cap.set(4, 1080);
while (cap.isOpened()):
grabbed, frame = cap.read()
if frame is None:
break
... | MrEnergizer-kr/vestellar | practice/practice.py | practice.py | py | 538 | python | ko | code | 0 | github-code | 90 |
18571668369 | N = int(input())
A = [list(map(int, input().split())) for _ in range(2)]
# 典型経路探索なのでDP、進研ゼミで習った
dp = [[0] * N for _ in range(2)]
for i in range(2):
for j in range(N):
if i == 0 and j == 0:
dp[i][j] = A[0][0]
elif i == 0:
dp[i][j] = dp[i][j - 1] + A[i][j]
elif j ... | Aasthaengg/IBMdataset | Python_codes/p03449/s800394073.py | s800394073.py | py | 532 | python | en | code | 0 | github-code | 90 |
14431247266 | '''Palindrom'''
class Node:
def __init__(self, val=0):
self.val = val
self.next = None
def __str__(self) -> str:
return f"{self.val} -> {self.next}"
cur = list1 = Node(1)
for i in [2, 2, 1]:
cur.next = Node(i)
cur = cur.next
class Solution:
def isPalindrome(self, head) -... | mydevstorage/algorithms | leetcode/linked_list/234.py | 234.py | py | 506 | python | en | code | 0 | github-code | 90 |
4980801136 | import argparse
def get_args():
"""
:return: a dict with the cmd args
"""
arg_parser = argparse.ArgumentParser(
formatter_class=argparse.RawDescriptionHelpFormatter,
description=__doc__)
arg_parser.add_argument(nargs=1, metavar='FILE', dest='input',
help... | sils/graph-analyzer | argparser.py | argparser.py | py | 769 | python | en | code | 0 | github-code | 90 |
30283086243 | # WCZTHTMPS
# BLSGJSDTS
import re
stacks_part1 = []
stacks_part2 = []
for i in range(9):
stacks_part1.append([])
for i in range(9):
stacks_part2.append([])
with open("/home/sabeer-ss/Downloads/input-day5.txt", "r") as f:
input_list = f.readlines()
for idx, line in enumerate(input_list):
line =... | elkrange/advent_of_code | 2022/sabeer_day_5.py | sabeer_day_5.py | py | 1,238 | python | en | code | 0 | github-code | 90 |
28780253337 | # Implied Odds (IO) calculator for EPs
# Created by Roz Turner, 2022
# IO formula = (EP profit/QL) + 1
def calculateIO(x, y):
return (x/y)+1
#Enter values
print("Welcome to the Implied Odds (IO) Calculator!")
while True:
profit = float(input("Enter EP profit: "))
ql = float(input("Enter Q... | rozturner/IOCalculator | IOcalculator.py | IOcalculator.py | py | 611 | python | en | code | 1 | github-code | 90 |
24304569313 | from os import path
from pygame import image, transform, font
from threading import Thread
from setup import window
import bullet
import ground
players = []
font.init()
class Player:
def __init__(self, team):
global players
players.append(self)
self.team = team
self.score = 0
... | pr4x1s/JumpyShoot | venv/player.py | player.py | py | 3,544 | python | en | code | 0 | github-code | 90 |
41799191444 | class CustomLabel:
def __init__(self, text, **kwargs):
self.text = text
self.config(**kwargs)
# for i, j in kwargs.items():
# self.i = j
def config(self, **kwargs):
for i, j in kwargs.items():
setattr(self, i, j)
label = CustomLabel(text="Hello", bd=20, ... | gotcrab/oop_training | CustomLabel.py | CustomLabel.py | py | 525 | python | en | code | 0 | github-code | 90 |
37566037970 | """Earn bitcoin via microtasks."""
import logging
import click
from two1.commands.util import decorators
from two1.commands.util.uxstring import ux
from two1.commands.faucet import _faucet as do_faucet
logger = logging.getLogger(__name__)
@click.command()
@click.option('-i', '--invite', default=None,
... | 21dotco/two1-python | two1/commands/earn.py | earn.py | py | 913 | python | en | code | 366 | github-code | 90 |
32181803988 | import bpy
def pull_text(name: str):
try:
return bpy.data.texts[str(name)].as_string()
except KeyError:
return None
def update_text(name: str, content: str = None, path: str = None):
try:
if path:
with open(path, "r", encoding="utf-8") as f:
... | rynidja/codesync | sync_utils.py | sync_utils.py | py | 922 | python | en | code | 3 | github-code | 90 |
36119025256 | from sys import hash_info
from numpy import histogram
from pygame import KEYUP
import pygame.locals as pl
import pygame.key
import GameMap as gm
import PlayerState as ps
import SaveReload as sr
import Pawn as pw
def add_letter_to_winner_name(letter_key):
letter = pygame.key.name(letter_key)
if len(gm.gameMapSt... | Mtestor/Dame_Alliance | EndProcess.py | EndProcess.py | py | 1,708 | python | en | code | 0 | github-code | 90 |
18423661879 | import collections
import heapq
x,y,z,t = map(int, raw_input().split(' '))
xs = map(int,raw_input().split(' '))
xs.sort(key = lambda x:-x)
ys = map(int,raw_input().split(' '))
ys.sort(key = lambda x:-x)
zs = map(int,raw_input().split(' '))
zs.sort(key = lambda x:-x)
mat = [xs,ys,zs]
heap = [(-mat[0][0]-mat[1][0]-mat[2... | Aasthaengg/IBMdataset | Python_codes/p03078/s330782860.py | s330782860.py | py | 706 | python | en | code | 0 | github-code | 90 |
26749771318 | frase = input("Ingresa una cadena: ")
words = frase.split()
#se estable 0 como indice para posteriormente tener un valor para poder comparar las demas palabras
shortest = words[0]
for palabra in words:
#compara la longitud de las palabras con la funcion "len" en cada iteracion,
#si se cumple la condicion se re... | Luchoc97/ejerciciosPython | PalabraMasCorta.py | PalabraMasCorta.py | py | 535 | python | es | code | 0 | github-code | 90 |
18406510439 | def find(x): #要素がどの集合か判断
if par[x] < 0:
return x
else:
par[x] = find(par[x])
return par[x]
def unite(x,y): #集合に結合
x = find(x)
y = find(y)
if x == y: return False
if par[x] > par[y]: x,y = y,x
par[x] += par[y]
par[y] = x
return True
import bisect
n, m = map(i... | Aasthaengg/IBMdataset | Python_codes/p03045/s135817364.py | s135817364.py | py | 508 | python | en | code | 0 | github-code | 90 |
15589553113 | '''
Объекты для отображения во FreeCAD
sys.path.append("c:\\Users\\dk274\\OneDrive\\dev\\Python\\FreeCAD")
'''
import FreeCAD as App
import Part
from FreeCAD import Base
from pivy import coin
RED = (1.0, 0.0, 0.0)
GREEN = (0.0, 1.0, 0.0)
BLUE = (0.0, 0.0, 1.0)
def objPaint(obj=None, color=RED):
... | Denis2106/FreeCAD-Tools | objects.py | objects.py | py | 3,364 | python | en | code | 0 | github-code | 90 |
24431857428 | from vpython import *
scene = canvas(background=vec(0.8, 0.8, 0.8), width=1200, height=300, center = vec(3,0,10), fov = 0.004)
lens_surface1 = shapes.arc(radius=0.15, angle1=0, angle2=pi)
circle1 = paths.arc(pos=vec(0, 0, 0), radius=0.0000001, angle2=2*pi, up = vec(1,0,0))
lens_surface2 = shapes.arc(radius=0.15, angl... | ChenBingWei1201/GeneralPhysicsVpythonHW | py/HW11/HW11.py | HW11.py | py | 2,283 | python | en | code | 0 | github-code | 90 |
37978329051 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Time : 2022/5/5 11:26
# @Author : WangKai
# @Site :
# @File : Config.py
# @Software: PyCharm
# 请求头json数据 和一些配置
import os
class ConfigView:
LOGIN_HEADER = {
'timestamp': '',
'sign': '',
'noise': '',
'did': '',
'vers... | Wangkaiof21/UI_test_framework | commonlib/baselib/Config.py | Config.py | py | 772 | python | en | code | 1 | github-code | 90 |
35133325869 | from django.contrib.auth.models import User
import copy
settingMenu = [
{'path': 'permission', 'component': 'permission', 'name': 'permission', 'meta': {'title': '权限管理', 'icon': 'permission2'}},
{'path': 'group', 'component': 'group', 'name': 'group', 'meta': {'title': '角色管理', 'icon': 'group'}},
{'... | ydtg1993/shaibao-server-python | system/permission/menu.py | menu.py | py | 4,432 | python | en | code | 0 | github-code | 90 |
17502191541 | class Employee:
raise_amount = 1.04
no_of_emp = 0
def __init__(self, first, second, pay):
self.first_name = first
self.second_name = second
self.pay = pay
self.full_name = '{}:{}'.format(first, second)
Employee.no_of_emp += 1
def name_pay(self):
return ... | eimran-eimon/OpenVINO-MultiCamera-MultiPerson | test.py | test.py | py | 751 | python | en | code | 2 | github-code | 90 |
21477702112 | ## Description:
# This file holds functions for training models
import nltk
from nltk.classify.scikitlearn import SklearnClassifier
from random import shuffle
import pickle
import pandas as pd
import collections
import csv
from sklearn.model_selection import train_test_split
## Sklearn classifies
from sklearn.nai... | DaraghK93/stockApp | machineLearning/sentimentAnalysis/bin/modelTraining/modelFunctions.py | modelFunctions.py | py | 14,422 | python | en | code | 1 | github-code | 90 |
21567663780 | '''Main module of heapify_project'''
from __future__ import print_function
import random
class Heap(object):
'''Binary heap class'''
def __init__(self, element_list=None):
'''Take a list of elements'''
self.heap_list = ["Not used"] + element_list
self.size = len(element_list) - 1 #Not... | mayorovad/startproject | heapify_project/heapify.py | heapify.py | py | 2,119 | python | en | code | 0 | github-code | 90 |
9778660770 | import os
import shutil
import subprocess
import sys
import zipfile
from collections import namedtuple
def system(command, **kwargs):
subprocess.check_call(command, **kwargs)
def specialize_template(template_filename, destination_filename, replacements, remove_template=False):
lines = []
replaced = set()
... | Tinkerforge/brickv | src/build_pkg_utils.py | build_pkg_utils.py | py | 9,151 | python | en | code | 18 | github-code | 90 |
42938191400 | if __name__ == '__main__':
import sys
if len(sys.argv) > 0:
from cpartition import FCC, x2wp
T_C = 375.
c0 = 3.34414e-02
y = dict(Cu=3.55354266E-3, Mn=2.05516602E-3,
Si=5.02504411E-2, Fe=9.4414085022e-1)
tdata_fcc = 'thermo/FoFo/TCFE8/375-fcc.txt'
... | arthursn/cpartition-simulations | calc_mu2w.py | calc_mu2w.py | py | 747 | python | en | code | 0 | github-code | 90 |
17866756557 | import json
import logging
import os
import urlparse
from functools import wraps
import requests
from flask import Flask, jsonify, request, url_for, make_response
from flask import Response
from flask import stream_with_context
from flask_negotiate import consumes, produces
from rdflib import URIRef
__author__ = 'Fer... | oeg-upm/agora-py | agora/server/__init__.py | __init__.py | py | 9,205 | python | en | code | 0 | github-code | 90 |
73206470378 | ieas = open("input.txt").readline().replace('\n','')
im = open("input.txt").read().split()[1:]
def countlightpixels(im):
c = 0
for s in im:
c += s.count('#')
return c
def tostring(im):
return ''.join(s+'\n' for s in im)
def enhance(im,b): #im is image (less border). b is border symbol '.' or ... | lassealfastsen/AdventOfCode | 2021/Day 20/test.py | test.py | py | 863 | python | en | code | 1 | github-code | 90 |
676467575 | import random
repeat = "yes"
money = 1000
while repeat == "yes":
print("Your current available amount is: ")
print(money)
num = random.randint(1, 37)
if num == 37:
color = "green"
else:
if num % 2 == 1:
color = "red"
elif num % 2 == 0:
color =... | Mirecek2011CZ/casino | main.py | main.py | py | 951 | python | en | code | 0 | github-code | 90 |
4119917592 | #!/usr/bin/env python3
import os
from ftplib import FTP
class DunhamFtp(FTP):
"""
Extend ftplib.FTP with some extra functionality.
@author Daniel "MaTachi" Jonsson
@copyright Daniel "MaTachi" Jonsson
@license MIT License
"""
def get_file_list(self, directory):
"""
Return ... | matachi/backup-site | dunhamftp.py | dunhamftp.py | py | 2,446 | python | en | code | 1 | github-code | 90 |
70904629097 | def r_arr(dict):
arr = []
for k, v in (dict):
for _ in range(v):
arr.append(k)
return arr
def solution(p, q):
answer = []
from itertools import combinations
from collections import Counter
for a, b in zip(p, q):
flag = False
arra, arrb = r_arr((Counter(a)... | dohun31/algorithm | 2021/week_08/210827/4.py | 4.py | py | 1,974 | python | ko | code | 1 | github-code | 90 |
18174960534 | from sqlalchemy import and_
from sqlalchemy.exc import IntegrityError
from sqlalchemy.orm import Session
from models import Student, Course
import schemas
from fastapi import HTTPException ,status
def create_student(db: Session, student_data: dict):
try:
db_student = Student(**student_data)
... | Shwetha21031/python_learning | assesment-2/crud.py | crud.py | py | 2,851 | python | en | code | 0 | github-code | 90 |
40401771485 | class Player:
def __init__(self, name):
self.name = name
self.runs = 0
self.fours = 0
self.sixes = 0
self.ballsFaced = 0
self.out = False
self.active = None
self.totalOversBowled = 0
self.runsConceded = 0
self.wicketsTaken = 0
s... | 96shubh96/cricket-score-board-py | cricketScoreBoard/player.py | player.py | py | 486 | python | en | code | 0 | github-code | 90 |
3994485738 | import sys
input = sys.stdin.readline
from collections import deque
dx = [-1, +1, +2, +2, +1, -1, -2, -2]
dy = [-2, -2, -1, +1, +2, +2, -1, +1]
def knight(l, cur, goal):
q = deque([cur])
gx = goal[0]
gy = goal[1]
visited = [[-1 for _ in range(l)] for _ in range(l)]
flag = True
visited[cur... | WonyJeong/algorithm-study | WonyJeong/DFS&BFS/7562.py | 7562.py | py | 1,258 | python | en | code | 2 | github-code | 90 |
35960855871 | def jaden_case(s):
answer = ''
temp = []
lst = s.lower().split(' ')
print(lst)
for i in lst:
temp.append(i.capitalize())
return ' '.join(temp)
def solution(s):
return s.title()
s = "3people unFollowed me"
print(jaden_case(s))
| oko-ha/programmers | 문자열/jaden case.py | jaden case.py | py | 265 | python | en | code | 0 | github-code | 90 |
18198877409 | N = int(input())
A = list(map(int, input().split()))
A.sort()
m = max(A)
sieve = [True]*(m+1)
sieve[0] = False
ct = 0
for i in range(N):
n = A[i]
if sieve[n] == False:
continue
if i < N-1 and n == A[i+1]:
sieve[n] = False
if sieve[n] == True:
ct += 1
for k in range(n*2, m+1, ... | Aasthaengg/IBMdataset | Python_codes/p02642/s776218770.py | s776218770.py | py | 359 | python | en | code | 0 | github-code | 90 |
31888865755 | import inspect
from typing import Any, Callable, Dict, List, Optional, Union
import io
import copy
import torch
import base64
from transformers import CLIPImageProcessor, CLIPTextModel, CLIPTokenizer
from diffusers.image_processor import VaeImageProcessor
from diffusers.loaders import FromSingleFileMixin, LoraLoaderM... | helblazer811/Diffusion-Progressive-Rendering | batched_lcm_pipeline.py | batched_lcm_pipeline.py | py | 20,779 | python | en | code | 1 | github-code | 90 |
18545615639 | # dictionary coordinates of the towns
from pprint import pprint
sites = {
'Moscow': (550, 370),
'London': (510, 510),
'Paris': (480, 480),
}
# make a dictionary of dictionaries of distances between them
# grid distance - root of (x1 - x2) ** 2 + (y1 - y2) ** 2
distances = dict()
moscow = sites['Moscow'... | JohnWick1975/phyton-course | lesson_002/00_distance.py | 00_distance.py | py | 982 | python | en | code | 0 | github-code | 90 |
18261976739 | N,M = map(int,input().split())
ls2 = []
for i in range(M):
ls1 = list(map(int,input().split()))
ls2.append(ls1)
ans = -1
if M == 0:
if N==1:
ans = 0
else:
ans = 10**(N-1)
if N == 1:
for i in range(10):
for j in range(M):
if not i//(10**(N-ls2[j][0]))%10 == ls... | Aasthaengg/IBMdataset | Python_codes/p02761/s036017080.py | s036017080.py | py | 757 | python | en | code | 0 | github-code | 90 |
12483797562 | size=int(input("Enter the size of Queue:"))
from collections import deque
queue=deque([],maxlen=size)
while True:
print("Select the Operation:\n1.Enqueue 2.Dequeue 3. Display 4. Quit")
choice=int(input())
if choice==1:
value=input("Enter the element:")
queue.append(value)
elif choice==2:
queue.popleft()
elif... | krsatyam7/niet_codetantra | Data Structures Lab using Python/6. Queue/QueueUsingArray.py | QueueUsingArray.py | py | 390 | python | en | code | 25 | github-code | 90 |
37119454933 | class Solution(object):
def fibonacci(self, K):
"""
input: int K
return: long
"""
# write your solution here
if K < 0:
return -1
if K == 0 or K == 1:
return K
if K == 2:
return 1
a = self.fibonacci(K - 2)
... | nanw01/python-algrothm | laioffer/Code/12. Fibonacci Number.py | 12. Fibonacci Number.py | py | 558 | python | en | code | 1 | github-code | 90 |
72082509418 | """A class for an overall activity"""
from twothirds import Data, TwoThirdsGame
import seaborn as sns
import matplotlib.pyplot as plt
class Activity:
def __init__(self, filename):
self.raw_data = Data(filename)
self.raw_data.read()
self.data = self.raw_data.out()
self.games = [TwoTh... | drvinceknight/TwoThirds | twothirds/activity.py | activity.py | py | 1,744 | python | en | code | 0 | github-code | 90 |
18356422483 | """GSPH functions"""
from math import sqrt
from compyle.api import declare
def printf(s):
print(s)
def SIGN(x=0.0, y=0.0):
if y >= 0:
return abs(x)
else:
return -abs(x)
def riemann_solve(method=1, rhol=0.0, rhor=1.0, pl=0.0, pr=1.0, ul=0.0, ur=1.0,
gamma=1.4, niter=... | pypr/pysph | pysph/sph/gas_dynamics/riemann_solver.py | riemann_solver.py | py | 28,192 | python | en | code | 390 | github-code | 90 |
19443814705 | from apps.config.services.serviceConfService import ServiceConfService
from apps.config.services.http_confService import HttpConfService
from apps.config.services.businessLineService import BusinessService
from apps.config.services.modulesService import ModulesService
from apps.config.services.sourceService import Sour... | LianjiaTech/sosotest | AutotestWebD/apps/common/func/WebFunc.py | WebFunc.py | py | 15,999 | python | en | code | 489 | github-code | 90 |
73979119655 | import torch
from torch import einsum
import torch.nn.functional as F
from lib.model.network import ImplicitNetwork
from lib.model.helpers import hierarchical_softmax, skinning
class ForwardDeformer(torch.nn.Module):
"""
Tensor shape abbreviation:
B: batch size
N: number of points
J: ... | xuchen-ethz/fast-snarf | lib/model/snarf.py | snarf.py | py | 9,579 | python | en | code | 228 | github-code | 90 |
34093802115 | words = ["cat","bt","hat","tree"]
chars = "atach"
words = ["hello","world","leetcode"]
chars = "welldonehoneyr"
O_map = {}
for i in range(len(chars)):
if chars[i] not in O_map:
O_map.__setitem__(chars[i],1)
else:
O_map[chars[i]] += 1
print(O_map)
count = 0
for i in range(len(words)):
cmap =... | Hotheadthing/leetcode.py | Find words that can be formed by the characters.py | Find words that can be formed by the characters.py | py | 683 | python | en | code | 2 | github-code | 90 |
36760140945 | import re
import collections
def solution(str1: str, str2: str) -> int:
str1s = [
str1[i:i + 2].lower()
for i in range(len(str1) - 1) if re.findall('[a-z]{2}', str1[i:i + 2].lower())
]
str2s = [
str2[i:i + 2].lower()
for i in range(len(str2) - 1) if re.findall('[a-z]{2}', st... | gkatldus1/python-and-java-algorithm | python_solve/18kakao05.py | 18kakao05.py | py | 620 | python | en | code | 0 | github-code | 90 |
73647906856 | # def 객체이름불러오기(xx):
# return [objname for objname, oid in globals().items() if id(oid) == id(xx)][0]
#
#
# class 쿠키틀:
# def 쿠키굽기(self):
# print(f'{객체이름불러오기(self)}가 구워졌어요.')
# pass
#
#
# 빨간_쿠키=쿠키틀()
# 노란_쿠키=쿠키틀()
# 파란_쿠키=쿠키틀()
#
# 빨간_쿠키.쿠키굽기()
# 노란_쿠키.쿠키굽기()
# 파란_쿠키.쿠키굽기()
#
# a = str('a를 넣는다.')
#
# ... | freshmea/weizman_python_class | inclass/2-2_class_list.py | 2-2_class_list.py | py | 1,991 | python | ko | code | 5 | github-code | 90 |
17940675069 | import itertools
n = int(input())
a = tuple(map(int,input().split()))
ans = 0
for l in itertools.product([-1,0,1],repeat=n):
t = 1
for i in range(n):
t*=(a[i]+l[i])
if t%2==0:
ans+=1
print(ans) | Aasthaengg/IBMdataset | Python_codes/p03568/s032322018.py | s032322018.py | py | 208 | python | en | code | 0 | github-code | 90 |
7312509277 | import pyperclip
from pynput.keyboard import Controller, Key, Listener
from typing import Union
KEYS_MAP = {
"Right Ctrl": Key.ctrl_r,
"Esc": Key.esc,
"Right Shift": Key.shift_r,
}
MODES = ["normal", "ace-editor"]
class BDSMTyper:
def __init__(
self,
mode: Union[str, int] = MODES[0],
... | viperadnan-git/bdsm-typer | bdsm_typer.py | bdsm_typer.py | py | 3,908 | python | en | code | 3 | github-code | 90 |
11427590425 | from datetime import datetime
import sqlite3
import database as dbase
import windows as win
def get_current_day():
return datetime.now().day
def get_current_month():
return datetime.now().month
def get_current_year():
return datetime.now().year
def get_current_month_str():
current_month = get_curren... | sc19ag/expense_tracker | time.py | time.py | py | 1,216 | python | en | code | 0 | github-code | 90 |
26157543687 | '''
Oppgave 2: Regning med løkker
'''
#2.1 og 2.2
user_input = int(input("Skriv et tall. 0 avslutter innlesingen: "))
my_list = list()
while user_input != 0:
my_list.append(user_input)
user_input = int(input("Skriv et tall. 0 avslutter innlesingen: "))
#2.3
for i, number in enumerate(my_list):
print(f"my... | 9car/IN1000-2 | assignments/assignment_4/regnelokke.py | regnelokke.py | py | 815 | python | no | code | 0 | github-code | 90 |
70846547496 | import os
from concurrent.futures import ProcessPoolExecutor
import random
from typing import Dict, Iterator, Optional
from tqdm import tqdm
from semantle.data import load_word_vectors
from semantle.game import Semantle
from semantle.solver import Solver
BENCHMARKS_PATH = os.path.join(
os.path.dirname(__file__),... | fkodom/semantle | bin/benchmark_solver.py | benchmark_solver.py | py | 2,459 | python | en | code | 12 | github-code | 90 |
31074016186 | # -*- coding: utf-8 -*-
"""
Created on Thu Aug 22 07:27:52 2019
@author: Omkar Kadam
434. Number of Segments in a String
"""
class Solution(object):
def countSegments(self, s):
"""
:type s: str
:rtype: int
"""
lst = (s.strip()).split(" ")
cnt = 0
for each in... | sicktrick-237/Leetcode-Solutions | 434. Number of Segments in a String.py | 434. Number of Segments in a String.py | py | 458 | python | en | code | 0 | github-code | 90 |
37234385340 | import mysql.connector
import adapter
import credentials
from mysql.connector import errorcode
from json import dumps
CREDENTIALS = {
'user': credentials.USER,
'password': credentials.PASSWORD,
'database': credentials.DBNAME,
'host': credentials.HOST,
'raise_on_warnings': credentials.RAISE_ON_WA... | memoherreraacosta/collab_notes-back | aws_files/app.py | app.py | py | 1,359 | python | en | code | 0 | github-code | 90 |
30944936687 | import os
import uvicorn
from fastapi import FastAPI
from fastapi.middleware.cors import CORSMiddleware
from routers.models import router as models_router
origins = [
"http://localhost:5173",
"http://localhost:8080",
"http://localhost:9099",
"http://localhost:53288"
]
app = FastAPI()
app.add_middlew... | anghelo-code/back-end-chatbot | main.py | main.py | py | 655 | python | en | code | 0 | github-code | 90 |
18240058616 | #! /usr/bin/env python3
import re
from .utils import dotdictify
__all__ = ["HtmlFormatter"]
class HtmlFormatter:
# RegExp detecting blank-only and single-char blocks
blankBlock = re.compile( "^([^\t\S]+|[^\t])$" )
# Messages.
msg = {
'wiked-diff-empty': '(No difference)',
'wiked-d... | lahwaacz/python-wikeddiff | WikEdDiff/HtmlFormatter.py | HtmlFormatter.py | py | 23,366 | python | en | code | 8 | github-code | 90 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.