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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
1117447268 | import os
from natsort import natsorted
from packages import downloader_functions as df
from packages.column_builder import build_column_layout
from packages.zip_functions import extract_issue_number
from packages.readcomiconline_single_issue import *
def grab_issues(selected_series):
full_url = f'https://readc... | edimusxero/Comic-Grabber | packages/readcomiconline_processor/__init__.py | __init__.py | py | 5,796 | python | en | code | 0 | github-code | 90 |
25041180159 | from itertools import count
# vlastny sposob hashovania stavov
def hash_layout(layouts):
hash = ""
for layout in layouts:
hash += layout.color[:1]
hash += str(layout.y)
hash += str(layout.x)
return hash
class Layout:
def __init__(self, color, size, y, x, direction):
s... | schrehor/IDDFS | main.py | main.py | py | 10,146 | python | en | code | 0 | github-code | 90 |
22591402534 | import struct
import random
from immlib import *
class ioctl_hook(LogBpHook):
def __init__(self):
self.imm = Debugger()
self.logfile = "C:\ioctl_log.txt"
LogBpHook.__init__(self)
def run(self, regs):
"""
We use the following offsets from the ESP register to trap the
... | Grazfather/GrayHatPython | ioctl_fuzzer.py | ioctl_fuzzer.py | py | 2,354 | python | en | code | 12 | github-code | 90 |
44872390168 | import sys
import collections
import copy
def bfs(table, virus_loc, size):
chart = copy.deepcopy(table)
queue = collections.deque()
dx = [0, 0, 1, -1]; dy = [1, -1, 0, 0]
while virus_loc:
temp = virus_loc.pop()
chart[temp[0]][temp[1]] = 2
queue.append(temp)
time = 0
... | Quinsie/BOJ | Python/BOJ_17141_연구소 2.py | BOJ_17141_연구소 2.py | py | 1,929 | python | en | code | 0 | github-code | 90 |
18211162639 | import sys,math,collections,itertools
input = sys.stdin.readline
N,M = list(map(int,input().split()))
road = [[] for _ in range(N+1)]
flag = [-1 for _ in range(N+1)]
flag[1]=0
for i in range(M):
a,b = map(int,input().split())
road[a].append(b)
road[b].append(a)
q = collections.deque([1])
while q:
now ... | Aasthaengg/IBMdataset | Python_codes/p02678/s069228969.py | s069228969.py | py | 501 | python | en | code | 0 | github-code | 90 |
32826131696 | def division():
try:
suma = 3000
contador = 0
resultado = suma / contador
print(resultado)
except ZeroDivisionError as e:
print(f'Error: {e} no permitido') #Error: division by zero no permitido
division() #invocando a la funcion division() | adrianedutecno/Python-II | 6-S6/rebound.py | rebound.py | py | 305 | python | pt | code | 1 | github-code | 90 |
1962126180 | # Given an array of integers nums which is sorted in ascending order, and an integer target, write a function to search target in nums. If target exists, then return its index. Otherwise, return -1.
# You must write an algorithm with O(log n) runtime complexity.
# 배열과 숫자하나를 파라미터로 준다면 내어준 숫하 나가의 값이 배열안에 있다며 해당 배... | yohan-kang/CodeTestSite | LeetCode/Day7_Binary Search/Day7_1 Binary Search.py | Day7_1 Binary Search.py | py | 2,464 | python | en | code | 0 | github-code | 90 |
17554996166 | import tkinter
from pip import main
root = tkinter.Tk()
root.geometry("600x600")
root.title("hello world")
def loop_start(e):
print("hello world")
canvas.after(0,loop)
def loop():
canvas.after(10,loop)
def loop2():
canvas.after(10,loop2)
canvas = tkinter.Canvas(width=600,height=600)
canvas.... | Tom-game-project/2D-City | city_system/sub.py | sub.py | py | 465 | python | en | code | 1 | github-code | 90 |
31872069239 | #Знайти добуток всіх елементів масиву дійсних чисел, менших заданого
#числа. Розмірність масиву - 10. Заповнення масиву здійснити випадковими числами
#від 50 до 100.
#Дудук Вадим
import numpy as np
import random
while True:
x=int(input('Введіть число для порівняння:'))
b=np.zeros(10,dtype=float)
count=1
... | MiraDevelYing/colloquium | 21.py | 21.py | py | 911 | python | uk | code | 0 | github-code | 90 |
18534228949 | a, b, c, d = [int(i) for i in input().split()]
ab = abs(a - b) <= d
ac = abs(a - c) <= d
bc = abs(b - c) <= d
if ac or (ab and bc):
print("Yes")
else:
print("No") | Aasthaengg/IBMdataset | Python_codes/p03351/s410467693.py | s410467693.py | py | 172 | python | en | code | 0 | github-code | 90 |
7212387476 | import asyncio
import websockets
PORT = 8080
connected = set()
async def echo(websocket, path) -> None:
print('Client connected')
connected.add(websocket)
try:
async for message in websocket:
print(f'Received message: {message}')
for conn in connected:
if ... | refractiOOn/python_websockets_client_server | server.py | server.py | py | 851 | python | en | code | 0 | github-code | 90 |
24999382865 | # 给定一个整数序列:a1, a2, ..., an,一个132模式的子序列 ai, aj, ak 被定义为:当 i < j < k 时,ai < ak < aj。设计一个算法,当给定有 n 个数字的序列时,验证这个序列中是否含有132模式的子序列。
#
# 来源:力扣(LeetCode)
# 链接:https://leetcode-cn.com/problems/132-pattern
# 著作权归领扣网络所有。商业转载请联系官方授权,非商业转载请注明出处。
def find132pattern(nums: [int]) -> bool:
l = len(nums)
for i in range(l-2):
... | Lycorisophy/LeetCode_python | 简单题/456.132模式.py | 456.132模式.py | py | 849 | python | zh | code | 1 | github-code | 90 |
22775011180 | import tkinter as tkr
class Root(tkr.Tk):
#This class is for creating an object that serves as a component for the application.
"""
It is the main window.
"""
def __init__(self):
"""
Initialize the object.
self: It is to access any attribute or method of the cl... | LuisanaHenmary/AppProductsPython | components/root.py | root.py | py | 567 | python | en | code | 0 | github-code | 90 |
15874147043 | import json
import csv
def calcu_acc(pred, sign):
if sign == 'a':
label = json.load(open('data/data_a/valid_label.json'))
else:
label = json.load(open('data/data_b/valid_label.json'))
result = []
for i in pred:
if i[0] > i[1]:
result.append(0)
else:
... | shentielin/mrc | utils.py | utils.py | py | 1,785 | python | en | code | 0 | github-code | 90 |
39802773049 | import scrapy
import re
from scrapy.loader import ItemLoader
from scrapy.loader.processors import TakeFirst
from ..items import MarchfelderebankItem
pattern = r'(\r)?(\n)?(\t)?(\xa0)?'
class SpiderSpider(scrapy.Spider):
name = 'spider'
start_urls = ['https://www.marchfelderbank.at/private/news']
def par... | SimeonYS/Marchfelder-Bank-eG | marchfelderebank/spiders/spider.py | spider.py | py | 982 | python | en | code | 0 | github-code | 90 |
15992668445 | import os
import random
import start_stop_ec2
import time
from mcstatus import JavaServer
from pprint import pprint
import subprocess
import discord
from discord.ext import commands
from dotenv import load_dotenv
load_dotenv()
client = commands.Bot()
TOKEN = os.getenv('DISCORD_TOKEN')
player_name... | orrockjs2/EC2DiscordBot | main.py | main.py | py | 9,481 | python | en | code | 1 | github-code | 90 |
18098583449 | def gcd(aa, bb):
if aa % bb == 0:
return bb
return gcd(bb, aa % bb)
import sys
for line in sys.stdin.readlines():
ab = list(map(int, line.split()))
a = max(ab)
b = min(ab)
g = gcd(a, b)
print(g, a * b // g)
| Aasthaengg/IBMdataset | Python_codes/p00005/s603801780.py | s603801780.py | py | 245 | python | en | code | 0 | github-code | 90 |
15757290761 | import sys
import os
from database import Database
from workon_adder import add_path
from delete import delete_entry
from manual import arg_dict
# err= 'Error Occurred Contact Developer'
class Arguments:
@staticmethod
def limit_argumeent(limit=3):
if len(sys.argv) > limit:
pri... | DumiduPramith/workon-manager | module/base.py | base.py | py | 5,464 | python | en | code | 0 | github-code | 90 |
19255202595 | from sys import stdin
moving_dir = [
[1, 0],
[-1, 0],
[0, 1],
[0, -1]
]
class Main:
def __init__(self):
self.board = [[0] * 101 for _ in range(101)]
self.main()
def main(self):
stdin = open("./input.txt", "r")
num_of_recs = int(stdin.readline())
for ... | ag502/algorithm | Problem/BOJ_2567_색종이 - 2/main.py | main.py | py | 1,081 | python | en | code | 1 | github-code | 90 |
71165097256 | import torch
import torch.nn as nn
import torch.functional as F
from torch.autograd import Variable
import matplotlib.pyplot as plt
from scipy.misc import imsave
import numpy as np
import random
class AttentionModule(nn.Module):
""" Online attention Layer"""
def __init__(self):
super(AttentionModule, ... | jpainam/self_attention_grid | attention.py | attention.py | py | 2,081 | python | en | code | 8 | github-code | 90 |
18427546087 | # Merge k sorted linked lists and return it as one sorted list.
# Analyze and describe its complexity.
#
# Example:
#
# Input:
# [
# 1->4->5,
# 1->3->4,
# 2->6
# ]
# Output: 1->1->2->3->4->4->5->6
# Definition for singly-linked list.
class ListNode:
def __init__(self, x):
self.val = x
self... | Web-Dev-Collaborative/PYTHON_PRAC | leetcode/Merge_k_Sorted_Lists.py | Merge_k_Sorted_Lists.py | py | 1,108 | python | en | code | 6 | github-code | 90 |
40685703680 | #! /usr/bin/python3
import numpy as np
def mean_var_stddev(sequence):
mean = np.mean(sequence)
var = np.var(sequence)
stddev = np.std(sequence)
return mean, var, stddev
print('Start.....')
seq = input('Enter a list: ')
seq = [int(x) for x in seq.split()]
mean, var, std_dev = mean_var_stddev(seq)
print('Result i... | fishmanbmt/VEF_FundamentalML | week_1/problem_8/problem8.py | problem8.py | py | 440 | python | en | code | 0 | github-code | 90 |
15298449391 | from typing import List, Callable
from PyQt5 import QtWidgets, QtCore
from PyQt5.QtWidgets import QVBoxLayout, QFrame, QToolBox
from config import Project, Rule, Config
from gui.project_widget import ProjectWidget
from gui.ui.settings import Ui_settingsWindow
from config import ConfigStorage
class SettingsWindow(Qt... | 2e3s/spytrack | spytrack/gui/settings_window.py | settings_window.py | py | 3,741 | python | en | code | 2 | github-code | 90 |
20368859901 | class Solution:
def totalNQueens(self, n: int) -> int:
MATRIX = [[0]*n for i in range(n)]
return self.backTracking(MATRIX,0,0,0)
def updateMartixWithQueenPos(self,M,x,y):
edgeX = len(M)
edgeY = len(M[0])
VTU = [(x,y)]
VTU += [(x,z) for z in range(ed... | RishabhSinha07/Competitive_Problems_Daily | 52-n-queens-ii/52-n-queens-ii.py | 52-n-queens-ii.py | py | 1,278 | python | en | code | 1 | github-code | 90 |
74628611815 | """
Support AppDir style folders: Add to menu
darkoverlordofdata
"""
from urllib.parse import urlparse, unquote
from gi.repository import GObject, Nautilus
import os
from appdir_utils import get_icon
class AppDirAddToMenuProvider(GObject.GObject, Nautilus.MenuProvider):
def add_to_menu(self, menu, file):
... | darkoverlordofdata/nautilus-appdir-extension | appdir_menu.py | appdir_menu.py | py | 1,501 | python | en | code | 0 | github-code | 90 |
33707671513 | from django.views.generic import DetailView, ListView, UpdateView, CreateView, TemplateView
from braces.views import AnonymousRequiredMixin
from django.core.urlresolvers import reverse_lazy
from .models import Recording, Schedule
from .forms import RecordingForm, ScheduleForm
class HomepageView(AnonymousRequiredMixi... | uucastine/soundbooth | soundbooth/apps/booth/views.py | views.py | py | 1,146 | python | en | code | 0 | github-code | 90 |
34266927819 | from concurrent import futures
import grpc
import service_pb2
import service_pb2_grpc
class MyService(service_pb2_grpc.MyServiceServicer):
def MyMethod(self, request, context):
# Обработка запроса и формирование ответа
response = service_pb2.Response(result="Hello, " + request.message + request.id... | noemabbbg/factorial | factorial/hz chto/test1.py | test1.py | py | 737 | python | en | code | 0 | github-code | 90 |
43010084256 | import serial
from subprocess import Popen
from config import cfg
import argparse
import time
import Object as _
import io
import datetime
import numpy as np
parser = argparse.ArgumentParser(description='Process some integers.')
parser.add_argument('--model', dest='model', default='DarkNetYOLO', type=str)
parser.add_a... | innovationgarage/epimp-brain | jevois.py | jevois.py | py | 2,229 | python | en | code | 0 | github-code | 90 |
18452235059 | N = input()
A, B, C = [input() for _ in range(3)]
ans = 0
for a, b, c in zip(A, B, C):
if a == b == c:
continue
elif a != b and b != c and c != a:
ans += 2
elif a == b or b == c or c == a:
ans += 1
print(ans) | Aasthaengg/IBMdataset | Python_codes/p03140/s793352190.py | s793352190.py | py | 244 | python | en | code | 0 | github-code | 90 |
5174427335 | # Создайте метод класса для работы с БД, который добавляет новую запись в таблицу.
# Метод должен принимать два аргумента: id (INT) и name (TEXT).
# Запись должна быть добавлена только в том случае, если такого id в таблице еще нет.
import sqlite3
def add_info(id:int, name: str):
cursor.execute('''SELECT count(*)... | matveykaa/SQL_requests | 16_2.py | 16_2.py | py | 1,324 | python | ru | code | 0 | github-code | 90 |
18186350079 | D = int(input())
C = list(map(int, input().split()))
S = [None] * D
for i in range(D):
S[i] = list(map(int, input().split()))
T = [None] * D
for i in range(D):
T[i] = int(input())
lasts = [0] * 26
score = 0
for d in range(D):
t = T[d]-1
score += S[d][t]
d += 1
lasts[t] = d
score -= sum(C[i]... | Aasthaengg/IBMdataset | Python_codes/p02619/s335323405.py | s335323405.py | py | 375 | python | en | code | 0 | github-code | 90 |
19590306656 | # Example 1
# WAF to count total words in your text file.
def wordCount():
f = open("source.txt", "r")
str1 = f.read()
f.close()
print("Total number of words is: ", len(str1.split()))
#wordCount()
def countVowels():
f = open("source.txt", "r")
str1 = f.read()
f.close()
count = 0
... | pshimanshu/AdvPython | day_3/file_handling/file_handle.py | file_handle.py | py | 799 | python | en | code | 0 | github-code | 90 |
14061789066 | from sqlalchemy.orm import Session
from . import models, schemas
def get_watchlist(db: Session, watchlist_id: int):
return db.query(models.Watchlist).filter(models.Watchlist.id == watchlist_id).first()
def get_user_watchlists(db: Session, user_id: int):
return db.query(models.Watchlist).filter(models.Watch... | belikx5/template-python-fastapi-sqlalchemy-project | app/watchlist/crud.py | crud.py | py | 2,571 | python | en | code | 0 | github-code | 90 |
19984722520 | import discord
import queue
import asyncio
import sys
import requests
import urllib
import urllib.request
import mysql.connector
import copy
from mysql.connector.cursor import MySQLCursorPrepared
from bs4 import BeautifulSoup
from random import randint
class voiceServer():
def __init__(self, client, mys... | 0xicl33n/jet-bot | vserver.py | vserver.py | py | 10,028 | python | en | code | null | github-code | 90 |
2179658331 | # Definition for a binary tree node.
# class TreeNode:
# def __init__(self, val=0, left=None, right=None):
# self.val = val
# self.left = left
# self.right = right
class Solution:
def averageOfSubtree(self, root: Optional[TreeNode]) -> int:
self.answer = 0
def it... | wlyu1208/Leet-Code | 2265-Count_Nodes_Equal_to_Average_of_Subtree/code.py | code.py | py | 810 | python | en | code | 1 | github-code | 90 |
43040736807 | '''
(4) For a given data of heights of a class, the heights of 15 students are recorded as
167.65, 167, 172, 175, 165, 167, 168, 167, 167.3, 170, 167.5, 170, 167, 169, and 172.
Develop an application that computes;
explore if there are any packages supported in your platform that depicts these measures / their cal... | KausikN/BTech_BigData_Files | ProblemSet_1/4.py | 4.py | py | 2,317 | python | en | code | 1 | github-code | 90 |
72042672616 | # Definition for a binary tree node.
# class TreeNode:
# def __init__(self, val=0, left=None, right=None):
# self.val = val
# self.left = left
# self.right = right
### method1: bfs
class Solution:
def rightSideView(self, root: Optional[TreeNode]) -> List[int]:
if not root:
... | chaoting-sun/leetcode | 0199-binary-tree-right-side-view/0199-binary-tree-right-side-view.py | 0199-binary-tree-right-side-view.py | py | 1,172 | python | en | code | 0 | github-code | 90 |
6694957910 | '''
Created on Sep 16, 2014
@author: ayan
'''
# focusing on california
# discharge/reservoir data
# drought
# snowpack
# fire
# economic damage
# 2001 - Present
import csv
import pandas as pd
from matplotlib.pylab import plt
def convert_to_float(element):
try:
float_val = float(element... | DOI-USGS/CIDA-Viz | ca_crop_yield/dataset_parse.py | dataset_parse.py | py | 2,138 | python | en | code | 61 | github-code | 90 |
18297681109 | from itertools import accumulate
from bisect import bisect_left
def main():
n,m=map(int,input().split())
A=list(map(int,input().split()))
A.sort()
def count(k):
cnt=0
for a in A:
cnt+=bisect_left(A,k-a)
return cnt
ok=0
ng=2*10**5+1
while ng-ok>1:... | Aasthaengg/IBMdataset | Python_codes/p02821/s283463453.py | s283463453.py | py | 691 | python | en | code | 0 | github-code | 90 |
1389422336 | # get all facebook fosts and save them as yyyy-mm-dd.lnk files
#
# https://www.facebook.com/Cottenham-Baptist-Church-162430413816133/
# https://pypi.org/project/facebook-scraper/
#
# pip install facebook-scraper
# https://m.facebook.com/story.php?story_fbid=2698578470201302&id=162430413816133
# https://m.fa... | zaphodikus/Powershells | get_facebook_links.py | get_facebook_links.py | py | 2,357 | python | en | code | 0 | github-code | 90 |
12263171826 |
from plotly.subplots import make_subplots
import numpy as np
import dash
from dash import dcc
from dash import html
import plotly.graph_objects as go
import pandas as pd
import plotly.express as px
import plotly
import random
from urllib.request import urlopen
import json
with urlopen('https://raw.githubu... | Patrick844/Data-Viz-Start-Up | main.py | main.py | py | 9,111 | python | en | code | 0 | github-code | 90 |
1633943405 | from tensorflow.keras.models import Model
from tensorflow.keras.layers import *
def build_Unet(prm):
'''
Input: A dictionary containing parameters
Output: Unet model
Documentation:
https://arxiv.org/pdf/1505.04597.pdf
'''
inputs = Input(prm['input_shape'])
zero_padding = Zero... | louisletoumelin/wind_downscaling_cnn | train/Models/UNet.py | UNet.py | py | 6,215 | python | en | code | 1 | github-code | 90 |
9601309225 | from tkinter import *
from PIL import Image, ImageTk
tk=Tk()
tk.title("Ядерный реактор Брянска модели BR-41245")
tk.geometry("600x140")
tk.resizable(False, False)
canvas = Canvas(tk, height=450, width=600)
image = Image.open("D:\\zest.jpg")
photo = ImageTk.PhotoImage(image)
image = canvas.create_image(0, -15... | xorsov/bryansk | bryansk_reactor.py | bryansk_reactor.py | py | 1,263 | python | ru | code | 1 | github-code | 90 |
18341888569 | def rolling_hash(s):
l = len(s)
h = [0]*(l + 1)
v = 0
for i in range(l):
h[i+1] = v = (v * base + ord(s[i])) % mod
return h
def setup_pw(l):
pw = [1]*(l + 1)
v = 1
for i in range(l):
pw[i+1] = v = v * base % mod
return pw
def get(h, b, l, r):
return (h[r] - h[l] *... | Aasthaengg/IBMdataset | Python_codes/p02913/s039705819.py | s039705819.py | py | 1,431 | python | en | code | 0 | github-code | 90 |
18430470117 | #!/usr/bin/env python
"""
Solution to Project Euler Problem 22
http://projecteuler.net/
by Apalala <apalala@gmail.com>
(cc) Attribution-ShareAlike
http://creativecommons.org/licenses/by-sa/3.0/
Using names.txt (right click and 'Save Link/Target As...'), a 46K text file
containing over five-thousand first names, begi... | Web-Dev-Collaborative/PYTHON_PRAC | projecteuler/euler022.py | euler022.py | py | 1,266 | python | en | code | 6 | github-code | 90 |
74024673256 | # --- coding: utf-8 ---
"""
実行するためのの抽象クラスモジュール
"""
import re
from abc import ABCMeta, abstractmethod
class AbstractRunner(metaclass=ABCMeta):
"""
実行するための抽象クラス
"""
domainPattern = ''
"""
サポートするドメインの正規表現のパターン
"""
patterns = []
"""
サポートするパスの正規表現のパターンリスト
"""
checkers = ... | amu-kuroneko/K-VideoDownloader | src/AbstractRunner.py | AbstractRunner.py | py | 1,727 | python | ja | code | 0 | github-code | 90 |
39627503405 | import boto3
# =======================================================
# Boto3 resource is more low-level-control than Boto3 client
# =======================================================
# Get the service resource
sqs = boto3.resource('sqs')
# Get the queue
queue = sqs.get_queue_by_name(QueueName='QueueName')
pri... | pkgit123/aws-sqs-example | aws-sqs-example.py | aws-sqs-example.py | py | 637 | python | en | code | 0 | github-code | 90 |
262912205 | import os
from typing import cast
from PySide6.QtCore import Qt
from PySide6.QtGui import QPixmap, QIcon, QFocusEvent
from PySide6.QtWidgets import (
QMainWindow,
QLabel,
QPushButton,
QToolButton,
QWidget
)
from PySide6.QtUiTools import QUiLoader
from .Menu import Menu
from .actions import get_qui... | xroah/bing-wallpaper | wallpaper/Window.py | Window.py | py | 4,234 | python | en | code | 0 | github-code | 90 |
40433171779 | #!/usr/bin/python3
"""Find simple interest.
User chooses if to borrow or invest.
Invest:
simpple interest
rate
time(years)
Borrow:
rate
amount to return
time
"""
# choose either borrow or invest
def enter_choice(name):
"""User chooses option which he wants to select"""
action = int(input(f'Hello {name} ... | Titus210/Python-High-level | worldly_programs/4-simple_interest.py | 4-simple_interest.py | py | 1,754 | python | en | code | 3 | github-code | 90 |
41872690466 | import os
import warnings
from train_module import *
from experimental_setup import *
warnings.filterwarnings("ignore", category=UserWarning)
def run(mode: str, path="experiments.json"):
#launch_tensorboard()
errors = []
if mode == "dev":
exp_setup = load_experiments()
exp_setup = exp_se... | j-ehrhardt/peppr | model/main.py | main.py | py | 1,423 | python | en | code | 0 | github-code | 90 |
25215303788 | import tensorflow as tf
from setup import *
from numpy import product
from os.path import isfile
__all__ = ['y_conv', 'train_step', 'accuracy',]
# create the weight and bias variables for FCLs
def weight_variable(shape):
initial = tf.truncated_normal(shape, stddev=0.3)
return tf.Variable(initial)
def bias_va... | codythecoder/AI_scanner | tools/network.py | network.py | py | 6,347 | python | en | code | 6 | github-code | 90 |
35219268679 | n = int(input())
count = 0
def func(num, step):
global count, n
if step == 0:
count += 1
if count == n:
print(num)
return
for i in range(10):
if num and num[-1] > str(i):
func(num + str(i), step-1)
elif not num:
func(num + str(i),... | yongwoo97/algorithm | gold/1174_줄어드는 수.py | 1174_줄어드는 수.py | py | 413 | python | en | code | 0 | github-code | 90 |
3896424326 | import tkinter as tk
from tkinter import messagebox
from tkinter import ttk
from PIL import Image,ImageTk
# from tkinker import StringVar
#from tk import *
import tkinter.font as font
import pyodbc
from PIL import Image,ImageTk
import numpy as np
import cv2
from Controller import Global_Class
#<-----... | OmarAhmed8581/Face-recoginze-Attendance-system | Controller/image_detection.py | image_detection.py | py | 2,183 | python | en | code | 1 | github-code | 90 |
11361521490 | #!/usr/bin/python
import logging
import os
import io
import time
import tempfile
import sys
import self
import twitter
import json
import re
import emoji
import graypy
import matplotlib.pyplot as plt
import numpy as np
import datetime
import pandas as pd
import itertools
import seaborn as sns
from stop_words import get... | aperezdev/OsintTool | etc/modosint/analyzers/analyzer-twitter.py | analyzer-twitter.py | py | 19,290 | python | en | code | 7 | github-code | 90 |
33123987329 | budjet = float(input())
flour_price = float(input())
egg_price = 0.75 * flour_price
milk_price = 1.25 * flour_price / 4
price_per_loaf = flour_price + egg_price + milk_price
loaves_quantity = int(budjet // price_per_loaf)
money_left = budjet - loaves_quantity * price_per_loaf
egg_count = 0
for i in range(1, loaves_quan... | nikivangelov/My-SoftUni-Education | Fundamentals Python/codes/01_basic_syntax_conditional_statements_and_loops_exercise/11_easter_bread.py | 11_easter_bread.py | py | 518 | python | en | code | 0 | github-code | 90 |
712758372 | from matplotlib import pyplot as plt
import io
plt.figure()
plt.plot([1, 2])
plt.title("test")
buf = io.BytesIO()
plt.savefig(buf, format='png')
print(buf.read())
buf.close() | ferv3455/Bookkeeper-Server | test.py | test.py | py | 176 | python | en | code | 0 | github-code | 90 |
26034637436 | import string
import sys
import unittest
from test_support import test_env
test_env.setup_test_env()
from components.auth import b64
from test_support import test_case
URL_SAFE_ALPHABET = set(string.letters + string.digits + '-_')
class Base64Test(test_case.TestCase):
"""Tests for base64_encode and base64_deco... | luci/luci-py | appengine/components/components/auth/b64_test.py | b64_test.py | py | 1,369 | python | en | code | 74 | github-code | 90 |
33342738130 | from time import sleep
from pettingzoo.test import api_test
import mutorere
def mock_game(env, render=False):
env.reset()
steps = [0, 7, 8, 4, 3, 8, 2, 3, 8]
for step in steps:
if render:
env.render()
sleep(1)
env.step(step)
if render:
env.render()
... | Aroksak/MuTorere | mutotere_env_test.py | mutotere_env_test.py | py | 483 | python | en | code | 0 | github-code | 90 |
16143606965 | import cv2
from tkinter import messagebox
global pnum
pnum = 0
def model() :
while(True):
if cv2.waitKey(1) == ord('c'):
global pnum
pnum+=1
return True
else :
return False
def camera() :
cam = cv2.VideoCapture(0)
if cam.isOpened() == Fa... | FLAG-OSS/Hand-Pose-Recognition | mediapipe-0.7.5/pocket/camera.py | camera.py | py | 991 | python | en | code | 0 | github-code | 90 |
24299541774 | import pygame,sys,Graphics,Classes,BridgeData,Save
from pygame.locals import *
def loadBridge(bridgeID):
jointList = []
bridgeFile,dif,land = BridgeData.getBridgeFile(bridgeID)
bridgeFile = eval(bridgeFile.strip("'"))
jointNum = len(bridgeFile)
materialStack = []
added = False
for joint in ... | kiran-darji/bridge-builder | BridgeBuilder/Build.py | Build.py | py | 10,158 | python | en | code | 1 | github-code | 90 |
18413663149 | def dfs(now,val,cost):
if now == n:
return val - cost
else:
return max(dfs(now+1,val+v[now],cost+c[now]),dfs(now+1,val,cost))
n = int(input())
v = list(map(int,input().split()))
c = list(map(int,input().split()))
print(dfs(0,0,0))
| Aasthaengg/IBMdataset | Python_codes/p03060/s991049479.py | s991049479.py | py | 257 | python | en | code | 0 | github-code | 90 |
31683911813 | #Q1 Write a program in Python to perform the following operation:
number = int(input("Enter a number: "))
#check if number is divisible by both 3 and 5
if number % 3 == 0 and number % 5 == 0:
print("Consultadd - Python Trainning")
elif number % 3 == 0: #check if number is divisible by 3
print("Consultadd")
el... | arjunkp5016/innovationWithPython_arjun | python_assingments/task2.py | task2.py | py | 6,302 | python | en | code | 0 | github-code | 90 |
18023704609 | import sys
readline = sys.stdin.readline
MOD = 10 ** 9 + 7
INF = float('INF')
sys.setrecursionlimit(10 ** 5)
def main():
x = int(readline())
if x < 1200:
print("ABC")
else:
print("ARC")
if __name__ == '__main__':
main()
| Aasthaengg/IBMdataset | Python_codes/p03813/s921776769.py | s921776769.py | py | 258 | python | en | code | 0 | github-code | 90 |
2527316544 | import random
personas = []
pares = []
total = int(input("Ingrese la cantidad de personas que van a jugar: "))
for i in range(total):
nom = input(f"Ingrese la persona numero {i+1}: ")
personas.append(nom)
mitad = total // 2
for i in range(mitad):
nom1 = random.choice(personas)
personas.remove(nom1)
... | blacksnk7/CursoProgramacionATE | Practica4/Ejercicio9.py | Ejercicio9.py | py | 533 | python | es | code | 0 | github-code | 90 |
5796831469 | """
This file contains wrapper classes of tree-sitter nodes. In general,
the wrapper classes are designed following the following rules:
1. Naming Convention. The class is named based on the type of tree-sitter
node. For example, the wrapper class of tree-sitter node 'function_definition'
is named FunctionDefinitionNo... | PeiweiHu/cinspector | cinspector/nodes/basic_node.py | basic_node.py | py | 33,848 | python | en | code | 8 | github-code | 90 |
18950630107 | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('competition', '0002_auto_20150407_1524'),
]
operations = [
migrations.AddField(
model_name='competition',
... | hqpr/fame | apps/competition/migrations/0003_auto_20150407_1544.py | 0003_auto_20150407_1544.py | py | 668 | python | en | code | 0 | github-code | 90 |
18416412178 | # -*-coding:utf-8 -*-
u"""
:创建时间: 2021/12/19 4:12
:作者: 苍之幻灵
:我的主页: https://cpcgskill.com
:QQ: 2921251087
:爱发电: https://afdian.net/@Phantom_of_the_Cang
:aboutcg: https://www.aboutcg.org/teacher/54335
:bilibili: https://space.bilibili.com/351598127
"""
import re
build_file_check = re.compile(r".*\.py$")
import ast
imp... | cpcgskill/CPCLI | src/CPCLI/overall_processing_function/_future_top.py | _future_top.py | py | 1,636 | python | en | code | 3 | github-code | 90 |
18901532225 | from optparse import make_option, NO_DEFAULT
from collections import OrderedDict
import django
from django.apps import apps
from django.core.management.commands.migrate import Command as MigrateCommand
from django.core.management.base import BaseCommand, CommandError
from django.db import connection
from django.conf im... | alexjillard/django-tenant-schemas | tenant_schemas/management/commands/migrate_schemas.py | migrate_schemas.py | py | 4,675 | python | en | code | null | github-code | 90 |
27409636471 | from __future__ import print_function, division
import time
import numpy as np
from sklearn.model_selection import cross_val_score
from sklearn.feature_selection import SelectPercentile, chi2
from sklearn.metrics import confusion_matrix, classification_report, \
roc_curve, roc_auc_score, precision_recall_curve, auc... | wjlei1990/SentimentAnalysis | classifier.py | classifier.py | py | 5,440 | python | en | code | 0 | github-code | 90 |
27117747174 |
def read_file():
ndvi_train="./data/Sequoia/SequoiaMulti_30/trainNDVI.txt"
nir_train="./data/Sequoia/SequoiaMulti_30/trainNir.txt" #Contains annotation too
red_train="./data/Sequoia/SequoiaMulti_30/trainRed.txt"
ndvi_test="./data/Sequoia/SequoiaMulti_30/testNDVI.txt"
nir_test="./data/Sequoia/Sequ... | Deceptrax123/Weed-Detection-in-Crop-Fields | data_script.py | data_script.py | py | 1,720 | python | en | code | 1 | github-code | 90 |
15209768086 |
from text_game.game_data import *
from text_game.game_gui import *
import random
# Spielfeld erzeugen (Länge, Breite, Schatz-Position X, Schatz-Position Y)
feld = Feld(10, 10, 9, 8)
# Player erzeugen (Position X, Position Y, hp, Waffe, Waffenstärke)
spieler = Spieler(1, 1, 100, "Knüppel", 10)
labels[spieler.x_pos - ... | KScholze/text_game_gui | game_logic.py | game_logic.py | py | 6,004 | python | de | code | 0 | github-code | 90 |
71464673576 | def match(s, w):
if not s or not w:
print("Input is invalid!")
return -1
n = len(s)
m = len(w)
if m > n:
print("The word cannot be longer than the s str.")
return -1
si = 0
wi = 0
delta = 0
while si + delta < n:
if wi < m:
if s[si + ... | juliali/ClassicAlgorithms | str_match/regular_match.py | regular_match.py | py | 888 | python | en | code | 4 | github-code | 90 |
4083104948 | import os, platform, logging
if platform.platform().startswith('Windows'):
logging_file = os.path.join(os.getenv('HOMEDRIVE'), \
os.getenv('HOMEPATH'), \
'test.log')
else:
logging_file = os.path.join(os.getenv('HOME'), 'test.log')
print('SAving i... | TonyCoopeR-62/Python-temp | use_logging.py | use_logging.py | py | 585 | python | en | code | 0 | github-code | 90 |
5099943928 | import math
N=int(input())
MOD = (10 ** 9) + 7
def factorization(n):
x = 2
pw = 0
factlist = []
while(n != 1):
if(n%x == 0):
n = n // x
pw += 1
elif(pw > 0):
factlist.append([x,pw])
pw = 0
x += 1
else:
x +=... | WAT36/procon_work | procon_python/src/atcoder/abc/past/C_052_FactorsofFactorial.py | C_052_FactorsofFactorial.py | py | 516 | python | en | code | 1 | github-code | 90 |
74048230698 | N = int(input("Enter a number: "))
sum_of_Odd = 0
avg_of_Even = int
sum_of_Even = 0
how_Many_Even = 0
for i in range(1,N+1):
if(i % 2 != 0):
sum_of_Odd += i
else:
sum_of_Even += i
how_Many_Even += 1
avg_of_Even = sum_of_Even / how_Many_Even
print("Sum of odd numbers u... | hubbm-bbm101/lab5-exercise-solution-b2210765044 | exercise1.py | exercise1.py | py | 427 | python | en | code | 0 | github-code | 90 |
17594751830 | import urllib
from django.conf import settings
from django.conf.urls import url
from django.core.urlresolvers import NoReverseMatch
from tastypie.utils import trailing_slash
from forge import fts
from forge.resources.base import ModelResource
from oracle.models import CardFace, CardImage, CardImageThumb
def get_art_... | satyrius/mtgforge | backend/forge/resources/card.py | card.py | py | 4,918 | python | en | code | 0 | github-code | 90 |
24032459748 | import u_net
import tensorflow as tf
import matplotlib.pyplot as plt
from PIL import Image
import numpy as np
import cv2
from libtiff import TIFF
import scipy
import random
import os
import shutil
def read_tif(file_path, resize=None, print_log=True):
"""
参数
file_path tif文件路径
resize 对加载进来的图片进行r... | vicchu/SSVM_RoadExtraction | SSVM_Unet/u_net_batchtest.py | u_net_batchtest.py | py | 3,324 | python | en | code | 0 | github-code | 90 |
1622709965 | import torch
import numpy as np
import torch.nn as nn
from typing import List
from typing import Tuple
from torch import Tensor
from typing import Optional
from itertools import chain
from containers import Batch
from torch.optim import AdamW
from containers import Metrics
from decoder import LSTMDecoder
from attentio... | LGirrbach/sigmorphon-2023-inflection | model.py | model.py | py | 31,454 | python | en | code | 0 | github-code | 90 |
7106942168 | # notationx merging and max len are done in fram: /cluster/projects/nn9603k/icml_seq/mat/abdb/3did/take2/merged_files
# import stuff
import pandas as pd
import sys
# set display to max
pd.set_option('display.max_column', None)
# one to three letter amino acid dict
aafile = '../datasets/amino_acids/the_twenty.txt'
aa... | GreiffLab/manuscript_ab_epitope_interaction | src/abdb_prepdata_sup_fig6.py | abdb_prepdata_sup_fig6.py | py | 7,338 | python | en | code | 20 | github-code | 90 |
27834465474 | from manimlib.imports import *
def curva_eliptica(self, t, n):
if n:
return self.coords_to_point(t, math.sqrt(t**3 - 2*t + 3))
else:
return self.coords_to_point(t, -math.sqrt(t**3 - 2*t + 3))
def posicion(self, t, func, letra, dir = UP):
punto = Dot(
self.input_to_graph_point(t,func)*RIGHT + self.... | Alfredo-Unal/Mathematica_y_Manim | Curvas_Elipticas.py | Curvas_Elipticas.py | py | 7,543 | python | en | code | 0 | github-code | 90 |
18258498569 | a, b = map(int,input().split())
a_list = []
b_list = []
flag = 0
for i in range(1,1009):
if int(i*1.08)-i == a:
a_list.append(i)
for j in a_list:
if int(j*1.1)-j == b:
print(j)
flag = 1
break
if flag != 1:
print('-1')
| Aasthaengg/IBMdataset | Python_codes/p02755/s740441181.py | s740441181.py | py | 265 | python | en | code | 0 | github-code | 90 |
25271971328 | from statistics import mean
from reportlab.lib.pagesizes import A4
from reportlab.pdfgen import canvas
from math import ceil
from DATABASE import *
class PDFGASTO():
def __init__(self, general:ComprasGeneral):
c = canvas.Canvas("documents/polizas/reporte_poliza.pdf", pagesize=A4)
width, he... | jesuscalderondev/deploy | PDFGASTO.py | PDFGASTO.py | py | 9,061 | python | es | code | 0 | github-code | 90 |
32173459538 | from django.db import models
from ckeditor.fields import RichTextField
import unidecode
def teammember_image_directory_path(instance, filename):
# Author images will be uploaded to MEDIA_ROOT/TeamMember/<author_name>/<filename>
unaccented_teammember_name = unidecode.unidecode(instance.name)
return 'TeamMe... | jeremiecoullon/knowitwall-django | knowitwall/team/models.py | models.py | py | 771 | python | en | code | 0 | github-code | 90 |
18169357349 | def mod_max(loop, mod):
if mod == 0:
return 0
loop_len = len(loop)
mm = min(loop)
for start in range(loop_len):
current_sum = 0
for i in range(mod):
current_sum += loop[(start + i) % loop_len]
mm = max(current_sum, mm)
return mm
def main():
n, k ... | Aasthaengg/IBMdataset | Python_codes/p02585/s277445727.py | s277445727.py | py | 1,170 | python | en | code | 0 | github-code | 90 |
18463750949 | # -*- coding: utf-8 -*-
"""
Created on Sun Jul 26 14:22:54 2020
@author: Maruthi Srinivas
"""
import sys
sys.setrecursionlimit(1000000)
def dfs(node,graph,dp):
temp=0
if dp[node]!=-1:
return dp[node]
for i in graph[node]:
temp=max(temp,dfs(i,graph,dp)+1)
dp[node]=temp
return temp
... | Aasthaengg/IBMdataset | Python_codes/p03166/s068689601.py | s068689601.py | py | 551 | python | en | code | 0 | github-code | 90 |
17823146197 | from django.contrib import admin
from django.urls import path,include
from . import views
from .views import category_detail, product_detail
from django.conf import settings
from django.conf.urls.static import static
urlpatterns = [
path('',views.Bhomepage,name="Homepage"),
path('categories/', views.category_... | PasutK/Django-corgi | corgi/buyer/urls.py | urls.py | py | 1,074 | python | en | code | 0 | github-code | 90 |
18473919149 | import sys
# sys.setrecursionlimit(100000)
from functools import lru_cache
def input():
return sys.stdin.readline().strip()
def input_int():
return int(input())
def input_int_list():
return [int(i) for i in input().split()]
def main():
n, x = input_int_list()
layer_size = [1]
p_cnt = [1]... | Aasthaengg/IBMdataset | Python_codes/p03209/s637097694.py | s637097694.py | py | 961 | python | en | code | 0 | github-code | 90 |
2939212109 | import asyncio
import uuid
from temporalio.client import BuildIdOpAddNewCompatible, BuildIdOpAddNewDefault, Client
from temporalio.worker import Worker
from worker_versioning.activities import greet, super_greet
from worker_versioning.workflow_v1 import MyWorkflow as MyWorkflowV1
from worker_versioning.workflow_v1_1 ... | temporalio/samples-python | worker_versioning/example.py | example.py | py | 4,811 | python | en | code | 68 | github-code | 90 |
28816780847 | # Iterative server with sleep
import socket
import time
SERVER_ADDRESS = (HOST, PORT) = '', 8888
REQUEST_QUEUE_SIZE = 5
def handle_request(client_connection):
request = client_connection.recv(1024)
print(request.decode())
http_response = b"""\
HTTP/1.1 200 OK
Hello, World!
"""
client_connection.sendall(htt... | tpgmartin/basicWebServer | webserver3b.py | webserver3b.py | py | 1,004 | python | en | code | 0 | github-code | 90 |
8722494216 | import random
from framework import CardType, DeckList, Manager, Card, Game
class OrcustManager(Manager):
redeployment = Card("Machina Redeployment", CardType.SPELL)
knightmare = Card("Orcust Knightmare", CardType.MONSTER)
girsu = Card("Orcust Mekk-Knight Girsu", CardType.MONSTER)
cymbal = Card("Orcu... | nisegami/dart-consistency-checker | orcust.py | orcust.py | py | 22,483 | python | en | code | 0 | github-code | 90 |
70625878057 | import os, sys, re, datetime, random, gzip, json, copy
from tqdm import tqdm
import pandas as pd
import numpy as np
from time import time
from math import ceil
from pathlib import Path
from collections import OrderedDict
import itertools
import argparse
from sklearn.preprocessing import StandardScaler
from sklearn.pip... | hoangntc/DyHNet | DyHNet/src/prediction.py | prediction.py | py | 9,377 | python | en | code | 1 | github-code | 90 |
2522528345 | from flask.globals import request
from flask_restx import Namespace, fields, reqparse
from werkzeug.datastructures import FileStorage
import enum
authorization = reqparse.RequestParser()
authorization.add_argument("Authorization", location="headers", required=True)
upload_parser = reqparse.RequestParser()
upload_parse... | aakanshu/data-Collection-backend | app/main/utils/dto.py | dto.py | py | 7,530 | python | en | code | 0 | github-code | 90 |
73620641898 | import numpy as np
import pygame as pg
from numba import njit
RENDER_STEP = 1
@njit(fastmath=True, parallel=True)
def draw(screen_array, screen_width, screen_height, points, target):
for x in range(0, screen_width, RENDER_STEP):
for y in range(0, screen_height, RENDER_STEP):
min = 10 ** 10
... | Reklle/spbau | voronoi_diagram/render.py | render.py | py | 2,106 | python | en | code | 1 | github-code | 90 |
13454952118 | # https://leetcode.com/problems/search-a-2d-matrix/
def has_target(one_dimension_array: List[int], target: int) -> bool:
start = 0
end = len(one_dimension_array) - 1
while start <= end:
mid = (end - start)//2 + start
if one_dimension_array[mid] == target:
return True
elif... | petercrackthecode/LeetcodePractice | search_2d_matrix/my_solution.py | my_solution.py | py | 1,942 | python | en | code | 1 | github-code | 90 |
8981027512 | from PIL import Image, ImageDraw
# Load the image you want to manipulate
image = Image.open("E:\Projects\Image manupulator\image.jpg")
# Create a drawing object
draw = ImageDraw.Draw(image)
# Define the coordinates for the different parts of the face
face_coords = (100, 100, 500, 500)
nose_coords = (250, 2... | Rachit-Agarwal-Official/Main-Website-and-python-files | Image_maupulator.py | Image_maupulator.py | py | 1,249 | python | en | code | 0 | github-code | 90 |
23160278359 | from collections import defaultdict, OrderedDict
class LFUNode:
def __init__(self, key, object, count):
self.key = key
self.object = object
self.count = count
class LFUCache:
"""Least frequently used cache for repeating bullshit"""
def __init__(self, capacity: int, callback = None):
self.capacit... | Nuullll/nullbot | nullbot/plugins/repeater/model.py | model.py | py | 1,449 | python | en | code | 12 | github-code | 90 |
14182400664 | # Question 1: How many titles of each type are in the IMDB dataset?
# Keywords: Dataframe API, SQL, group by, sort
# check ./log/section_1.log for the output
## Housekeeping: setup code to read intermediate dataset
import pyspark, logging
from pyspark.sql import *
from pyspark.sql.functions import *
def script_filter... | rrrrrrockpang/CSE547-Accessible | colab/colab-0/section_1.py | section_1.py | py | 2,575 | python | en | code | 0 | github-code | 90 |
74761314536 | # -*- coding: utf-8 -*-
from odoo import http
class Academy(http.Controller):
@http.route(['/my/','/my/home/'], auth='user', website=True)
def index(self, **kw):
# instructors = http.request.env['res.partner'].sudo() # ici si on fait sudo() on va recevoir tt les res.partner
# instructors = ht... | azizabahich/OpenAcademyAzizaBahich | academy/controllers/controllers.py | controllers.py | py | 2,330 | python | en | code | 0 | github-code | 90 |
17716172894 | from django.core.management.base import BaseCommand, CommandError
import time
import sys
import os
from django.conf import settings
from raffle.models import Purchase, Ticket
# spawn a new thread to wait for input
import smtplib
from email.mime.multipart import MIMEMultipart
from email.mime.text import MIMEText
class... | rich-hart/GIS | raffle/management/commands/purchase_email.py | purchase_email.py | py | 1,801 | python | en | code | 0 | github-code | 90 |
17445273912 | from typing import Dict, List, Optional, Any
from pydantic import BaseModel, Field
from enum import Enum
from f2ai.common.utils import read_file
from .offline_store import OfflineStoreType
from .features import FeatureSchema
class Source(BaseModel):
"""An abstract class which describe the common part of a Source... | ai-excelsior/F2AI | f2ai/definitions/sources.py | sources.py | py | 2,468 | python | en | code | 18 | github-code | 90 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.