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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
39129654428 | from __future__ import unicode_literals
from django.db import models
class Device(models.Model):
device_id = models.CharField(max_length=100, unique=True)
class Datum(models.Model):
time = models.DateTimeField('date published')
device = models.ForeignKey(Device, null=False, on_delete=models.CASCADE)
... | angellandros/kiwi | kiwi/reports/models.py | models.py | py | 455 | python | en | code | 0 | github-code | 90 |
73211784618 | #
# @lc app=leetcode id=94 lang=python
#
# [94] Binary Tree Inorder Traversal
#
# @lc code=start
# Definition for a binary tree node.
# class TreeNode(object):
# def __init__(self, val=0, left=None, right=None):
# self.val = val
# self.left = left
# self.right = right
class Solution(object)... | ashshekhar/leetcode-problems-solutions | 94.binary-tree-inorder-traversal.py | 94.binary-tree-inorder-traversal.py | py | 1,625 | python | en | code | 0 | github-code | 90 |
73211763498 | #
# @lc app=leetcode id=658 lang=python
#
# [658] Find K Closest Elements
#
# @lc code=start
import heapq
class Solution(object):
def findClosestElements(self, arr, k, x):
"""
:type arr: List[int]
:type k: int
:type x: int
:rtype: List[int]
"""
# Min heap ex... | ashshekhar/leetcode-problems-solutions | 658.find-k-closest-elements.py | 658.find-k-closest-elements.py | py | 699 | python | en | code | 0 | github-code | 90 |
41364121680 | import random
class Node:
def __init__(self, value = None):
self.value = value
self.parent = None
self.LChild = None
self.RChild = None
class Tree:
def __init__(self):
self.root = None
def insert(self, value):
if self.root == None:
self.root... | SalvadorGuido/Python | CodeWars/Trees.py | Trees.py | py | 5,538 | python | en | code | 0 | github-code | 90 |
15050598167 |
import tensorflow as tf
from tfscat.wavelet import Scattering
def median(x):
mid = x.get_shape()[-1]//2 + 1
return tf.math.top_k(x, mid).values[-1]
class Network(tf.keras.Model):
def __init__(self,
layer_properties,
bins=128,
batch_size=32,
... | NorwegianSeismicArray/tf-waveform-scattering | tfscat/network.py | network.py | py | 2,268 | python | en | code | 0 | github-code | 90 |
25086062812 | from flask import Flask,request,render_template,jsonify
import pickle
import numpy as np
app = Flask(__name__)
model = pickle.load(open('model.pkl','rb'))
@app.route('/')
def home():
return render_template('index.html')
@app.route('/predict',methods = ['POST'])
def predict():
list_input = [x for x in reques... | kabyabasu/heroku_house_price | app.py | app.py | py | 588 | python | en | code | 0 | github-code | 90 |
29362474250 | import setuptools
with open("README.md", "r") as fh:
long_description = fh.read()
setuptools.setup(
name="en-ems",
version="0.2.2",
url="https://github.com/adlzanchetta/en-ems",
author="Andre D. L. Zanchetta",
author_email="adlzanchetta@gmail.com",
description="A package for selecting ense... | adlzanchetta/en-ems | setup.py | setup.py | py | 923 | python | en | code | 0 | github-code | 90 |
10175745198 | import uvicorn
from fastapi import FastAPI
from src.api.http.common import APIFactory, APICreatable
from src.api.http.config import API_DEBUG
from src.api.http.resources import (
TopUpResource,
RegisterResource,
LoginResource)
class AuthAPIFactory(APICreatable):
def __init__(self):
self.__fac... | milkandpie/clean_architecture | src/api/http/run.py | run.py | py | 718 | python | en | code | 0 | github-code | 90 |
72290742378 | from dataclasses import dataclass, field
from typing import List
import matplotlib.pyplot as plt
import seaborn as sns
import numpy as np
from itertools import cycle
from tarpan.shared.info_path import InfoPath, get_info_path
from tarpan.plot.utils import remove_ticks_labels
@dataclass
class ScatterKdeParams:
tit... | evgenyneu/tarpan | tarpan/plot/kde.py | kde.py | py | 9,469 | python | en | code | 2 | github-code | 90 |
27329662771 |
import collections
text_to_count = "Man is fond of counting his troubles, but he does not count his joys. If he counted them upas \
he ought to, he would see that every lot has enough happiness provided for it."
#Main
c = collections.Counter()
print('Initial :{}', format(c))
c.update(text_to_cou... | yitshak/course_advanced_python | Advanced Python Topics/question-1a.py | question-1a.py | py | 354 | python | en | code | 0 | github-code | 90 |
33660957057 | from typing import List
class Solution:
def robotSim(self, commands: List[int], obstacles: List[List[int]]) -> int:
dx = [0, 1, 0, -1]
dy = [1, 0, -1, 0]
x = y = di = 0
obstacleSet = set(map(tuple, obstacles))
ans = 0
for cmd in commands:
if cmd == -2: #... | algorithm004-04/algorithm004-04 | Week 03/id_489/LeetCode_874_489.py | LeetCode_874_489.py | py | 788 | python | en | code | 66 | github-code | 90 |
35125062108 | import socket
from mihome.connector import XiaomiConnector
#Loxone address and port
UDP_IP = '192.168.178.32'
UDP_PORT = 5666
# Open socket connection
sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
# List of supported models
class MODEL:
CUBE = 'cube'
GATEWAY = 'gateway'
MAGNET = 'magnet'
MOTION = ... | chris3600410/Loxberry-Plugin-Mihome | data/scripts/run-mihome.py | run-mihome.py | py | 3,742 | python | en | code | 0 | github-code | 90 |
34290790887 | ## written by xiongbiao
## date 2020-6-3
from Tree.node import TreeNode
'''
给你一棵二叉搜索树(BST)、它的根结点 root 以及目标值 V。
'''
class Solution(object):
'''
递归遍历一条从根节点到叶子节点的路径将路径中小于目标值的与大于目标值的节点分离
'''
def splitBST(self, root, V):
"""
:type root: TreeNode
:type V: int
:rtype: List[Tree... | xb2342996/Algorithm-and-Data-Structure | LeetCode_vII/Tree/776. 拆分二叉搜索树.py | 776. 拆分二叉搜索树.py | py | 785 | python | en | code | 0 | github-code | 90 |
73208976616 | import sqlite3
from BookGUI import *
from SynopsisGUI import *
window = Tk()
window.geometry("335x630")
window.title("Welcome")
#Database
con = sqlite3.connect("book.db")
cur = con.cursor()
try:
cur.execute("""CREATE TABLE book (
`isbn` varchar(13) NOT NULL,
`title` varch... | ConstanceOoi/Book_Rating | AppGUI.py | AppGUI.py | py | 15,087 | python | en | code | 0 | github-code | 90 |
17963580419 | N = int(input())
A = list(map(int,input().split()))
import collections
a = collections.Counter(A)
b = []
for i, j in a.items():
if j >= 2:
b.append([i,j])
b.sort(reverse=True)
if len(b) >= 1 and b[0][1] >= 4:
print(b[0][0] ** 2)
elif len(b) >= 2:
print(b[0][0] * b[1][0])
else:
print(0) | Aasthaengg/IBMdataset | Python_codes/p03625/s434817733.py | s434817733.py | py | 310 | python | en | code | 0 | github-code | 90 |
30940543917 | import time
from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
from selenium.webdriver.common.keys import Keys
import pandas as pd
novoCaminho = ""
def verificar_WPP_loga... | AndreyWBS/botWPP_multiprocessing | verificarCaminhoNavWpp.py | verificarCaminhoNavWpp.py | py | 2,385 | python | en | code | 0 | github-code | 90 |
31682330167 | from django.urls import path
from .views import CreateUserView,CreateTokenView,CreateUerManagerView
app_name="user" #CRITICAL!!
urlpatterns = [
path('create/', CreateUserView.as_view(),name="create"),
path('token/', CreateTokenView.as_view(),name="token"),
path('me/', CreateUerManagerView.as_view(),name="... | BioPyRope/receipe-app-api | app/user/urls.py | urls.py | py | 342 | python | en | code | 0 | github-code | 90 |
18431605449 | MOD = 1000000007
N = int(input())
C = [int(input()) for _ in range(N)]
prev = [None for _ in range(max(C)+1)]
dp = [0 for _ in range(N+1)]
dp[0] = 1
for i in range(N):
if prev[C[i]] is None or prev[C[i]]==i:
dp[i+1] = dp[i]
else:
dp[i+1] = dp[i] + dp[prev[C[i]]]
dp[i+1] %= MOD
prev[C[... | Aasthaengg/IBMdataset | Python_codes/p03096/s248241062.py | s248241062.py | py | 347 | python | en | code | 0 | github-code | 90 |
15276724870 | import html
from telegram import Update, InlineKeyboardMarkup, ParseMode
from telegram.ext import CallbackContext
from database import database
from strings import get_languages, get_string
from utils.specific_helpers import private_helpers
from constants import DECKS_LINK, TRANSLATION_CHAT_LINK, TRANSLATIONS_LINK, H... | TheChameleonBot/Chameleon | handlers/private.py | private.py | py | 4,536 | python | en | code | 20 | github-code | 90 |
1828634778 |
import http.client, urllib.parse
import json
import pprint
import os
import runad as pushad
def send_message(endpoint, message):
conn = http.client.HTTPConnection("localhost", 18080)
conn.request("PUT", endpoint, json.dumps(message).encode('utf-8'))
response = conn.getresponse()
data = response.read()
#print(da... | idlelearner/score | score.py | score.py | py | 3,094 | python | en | code | 0 | github-code | 90 |
44074232199 | import pytest
from selenium import webdriver
driver = webdriver.Firefox()
driver.get("https://letskodeit.teachable.com/p/practice")
driver.implicitly_wait(3)
elements = driver.find_elements_by_xpath("//table[@id='product']//td")
driver.implicitly_wait(3)
print(len(elements))
finalilist = [element.text for element... | amit17kumar/SeleniumTutorials | tablesread.py | tablesread.py | py | 374 | python | en | code | 0 | github-code | 90 |
24982599953 | import multiprocessing
import numpy as np
# asked at:
# https://stackoverflow.com/questions/71322856
def run_mp(images, f_work, n_worker):
def f_worker(worker_index, data, q, result_q):
print("worker {} started".format(worker_index))
while True:
image_idx = q.get() # Blocking get
... | HiroIshida/snippets | python/std_examples/multi_process/example_queue.py | example_queue.py | py | 1,530 | python | en | code | 6 | github-code | 90 |
23595646789 | def binary_Search(sorted_List, target_Value):
low = 0
high = len(sorted_List) - 1
mid = len(sorted_List) // 2
while low <= high:
mid = low + (high - low) // 2
if sorted_List[mid] == target_Value:
return True
elif sorted_List[mid] < target_Value:
low = mid... | yesi2023/afs-210 | week5/binarysearch.py | binarysearch.py | py | 789 | python | en | code | 0 | github-code | 90 |
930430480 | """
Given an integer array nums, find a contiguous non-empty subarray
within the array that has the largest product, and return the product.
It is guaranteed that the answer will fit in a 32-bit integer.
A subarray is a contiguous subsequence of the array.
Input: nums = [2,3,-2,4]
Output: 6
Explanation: [2,3] has the... | xavifeds8/competative-programming | dynamic programiming/max product subarray.py | max product subarray.py | py | 690 | python | en | code | 0 | github-code | 90 |
24864519786 | def greet():
print("_______________")
print(" Приветствуем\n В игре \nКрестики-Нолики")
print("Формат ввода: x y\nx - номер строки \ny - номер столбца")
field = [[" "] * 3 for i in range(3)]
def view():
print()
print(f" | 0 | 1 | 2 |")
print(" ---------------")
for i, r... | SergeiSSH/skillfactory | Krestiki Noliki.py | Krestiki Noliki.py | py | 2,277 | python | en | code | 0 | github-code | 90 |
12291884885 | import logging
import requests
import shutil
import zipfile
import struct
import os
import re
import traceback
import uuid
import subprocess
import configparser
import glob
import json
import base64
import pickle
from io import BytesIO, TextIOWrapper
from urllib.request import urlopen
from telegram.ext import Updater, ... | HouseAlwaysWin/LineSticker2TGBot | main.py | main.py | py | 11,985 | python | en | code | 0 | github-code | 90 |
42900208521 | from datetime import timedelta
from decimal import Decimal
from flask import current_app
from lin import db
from lin.exception import ParameterException, NotFound
from sqlalchemy import Column, Integer, String, DECIMAL, SmallInteger, Text, DateTime
from app.libs.enum import OrderStatus
from app.libs.utils import date... | zcxyun/snack-api-lin | app/models/order.py | order.py | py | 6,412 | python | en | code | 0 | github-code | 90 |
3850212966 | from django import forms
from django.contrib.auth.forms import UserCreationForm, UserChangeForm
from django.contrib.auth.models import User
from .models import Profile, Address, CreditCard
from localflavor.us.forms import USStateSelect, USZipCodeField
from django.forms import inlineformset_factory
class SignUpU... | cen4010/geek-text-webapp | webapp/geek_text/forms.py | forms.py | py | 4,494 | python | en | code | 1 | github-code | 90 |
43698151212 | from __future__ import annotations
from functools import partial
from typing import TYPE_CHECKING, Callable, TypeVar, overload
from .. import _exceptions
from .._types import ExceptionType
from ._contracts import Contracts
from ._dispatch import Dispatch
from ._has_patcher import HasPatcher
from ._inherit import Inhe... | life4/deal | deal/_runtime/_decorators.py | _decorators.py | py | 17,293 | python | en | code | 637 | github-code | 90 |
18536364809 | # 参考URL https://note.nkmk.me/python-union-find/
class UnionFind():
# 各要素の親要素の番号を格納するリスト
# 要素が根(ルート)の場合は-(そのグループの要素数)を格納する
def __init__(self, n):
self.n = n
self.parents = [-1] * n
# 要素xが属するグループの根を返す
def find(self, x):
if self.parents[x] < 0:
return x
else... | Aasthaengg/IBMdataset | Python_codes/p03354/s089361965.py | s089361965.py | py | 1,443 | python | ja | code | 0 | github-code | 90 |
29966325296 | def guess(num: int, pick: int = 0) -> int:
if num > pick:
return -1
if num < pick:
return 1
return 0
class Solution:
def guess_number(self, n: int) -> int:
# Как и в классическое задаче по бинпоиску,
# выставляем границы
left, rigth = 0, n
while left ... | DushnoAndTochka/solutions_algorithmic_problems | solutions/guess_number_higher_or_lower/solution/solution.py | solution.py | py | 828 | python | ru | code | 16 | github-code | 90 |
8990471948 | ran = int(input("Enter the range of array: "))
arr_src = []
for i in range(0, ran):
temp = int(input(f"Enter the value of array[{i}]: "))
arr_src.append(temp)
print("You created an array as: ", arr_src)
"""
#Program to find the frequency of each value in the array
arr_cou = [None] * len(arr_src)
fo... | gsivabe/PythonTutorials | array_basic.py | array_basic.py | py | 2,461 | python | en | code | 0 | github-code | 90 |
40716019981 | from django.contrib import admin
from website.apps.eventbro.forms import DateAdminForm
from website.apps.eventbro.models import Convention, Event, Registration, Sponsor, EventType
from sorl.thumbnail.admin import AdminImageMixin
from import_export.admin import ImportExportModelAdmin
def make_published(modeladmin, req... | LANtasy/website | website/apps/eventbro/admin.py | admin.py | py | 4,428 | python | en | code | 2 | github-code | 90 |
82824845 | """ Functions for preprocessing data."""
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
import seaborn as sns
from itertools import combinations
from scipy.spatial.distance import cdist
# Extract the numeric data in the fields of imported
numerics = ['int16', 'int32', 'int64', 'float16', 'float3... | JQGoh/jqlearning | script/preprocess.py | preprocess.py | py | 13,049 | python | en | code | 0 | github-code | 90 |
70193377896 | # -*- Mode: Python -*-
import sys
import gc
import unittest
import warnings
import weakref
import platform
import pytest
from gi.repository import GObject, GLib, Gio
from gi import PyGIDeprecationWarning
from gi.module import get_introspection_module
from gi import _gi
import testhelper
from .helper import capture_... | GNOME/pygobject | tests/test_gobject.py | test_gobject.py | py | 33,702 | python | en | code | 144 | github-code | 90 |
5132818341 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Thu Mar 3 09:56:48 2022
@author: levent.ozparlak
"""
#!/bin/python3
import math
import os
import random
import re
import sys
#
# Complete the 'countApplesAndOranges' function below.
#
# The function accepts following parameters:
# 1. INTEGER s
# 2. INT... | levback/HackerRank_AI | Algorithms/AppleandOrange.py | AppleandOrange.py | py | 1,298 | python | en | code | 0 | github-code | 90 |
18353748779 | from collections import deque
n,q = map(int,input().split())
l = [[] for _ in range(n)]
for _ in range(n-1):
a,b = map(int,input().split())
a -= 1
b -= 1
l[a].append(b)
l[b].append(a)
value = [0 for _ in range(n)]
for _ in range(q):
p,q = map(int,input().split())
value[p-1] += q
bit = [0 ... | Aasthaengg/IBMdataset | Python_codes/p02936/s735126038.py | s735126038.py | py | 648 | python | en | code | 0 | github-code | 90 |
19292039605 | import vapoursynth as vs
import h5py
import mvsfunc as mvf
import numpy as np
import gc
import random
def get_data_from_frame(frame, dim):
assert isinstance(frame, vs.VideoFrame)
assert isinstance(dim, int)
arr = frame.get_read_array(0)
returnList = []
for i in range(0, 10):
for j in range(... | invisiblearts/VapourSynth-Naobu | train.py | train.py | py | 2,446 | python | en | code | 1 | github-code | 90 |
608055348 | def length(word_lengths, i, j):
return sum(word_lengths[i- 1:j]) + j - i + 1
def break_line(text, L):
# wl = lengths of words
wl = [len(word) for word in text.split()]
# n = number of words in the text
n = len(wl)
print(n)
# total badness of a text l1 ... li
m = dict()
m[0] = 0 ... | blodstone/Analisis-dan-Desain-Algoritma | code/13-text-justification-dp.py | 13-text-justification-dp.py | py | 638 | python | en | code | 1 | github-code | 90 |
16249057724 | import scrapy
from crawlers.utils import SpiderBase
from jinja2 import Template
from crawlers.utils.group_alarm import catch_except
from crawlers.utils.humanize import humanize_float_en
class TVLChange(SpiderBase):
name = 'idx-tvl-change'
start_urls = ['https://api.llama.fi/lite/protocols2']
@catch_ex... | metadimensions/indicators_factory-king-data | crawlers/indicators/spiders/tvl_change_monitoring_of_top_defi_projects/tvl_change_spider.py | tvl_change_spider.py | py | 3,092 | python | en | code | null | github-code | 90 |
38159263831 | '''
Programa que mostra os números pares existentes entre dois valores informados. Versão otimizada que usa um range com passo 2.
'''
inicio, fim = input("Informe o início e o fim do intervalo: ").split(" ")
inicio, fim = int(inicio), int(fim)
if inicio % 2 != 0: # Garante que o primeiro valor do intervalo é par
i... | Only-S/aulas-atitus | AulasBackendPython/1º Semestre/1.Códigos Fontes das Aulas/32 (Lucas) Código-Fonte Aula 05/13-pares-v2.py | 13-pares-v2.py | py | 398 | python | pt | code | 0 | github-code | 90 |
25770076010 | from __future__ import (
absolute_import,
unicode_literals,
)
import unittest
from conformity.error import (
ERROR_CODE_INVALID,
ERROR_CODE_UNKNOWN,
)
from conformity.fields.country import CountryCodeField
class CountryCodeTest(unittest.TestCase):
"""
Tests the Country Code field.
"""
... | JuanCuello/conformity | tests/test_fields_country.py | test_fields_country.py | py | 1,209 | python | en | code | 0 | github-code | 90 |
71899712618 | from django.conf.urls import url, include
from django.urls import path
from .views import *
# namespacing this file so that you can tell reverse to lookup 'libraryapp:books to return books url
app_name = "libraryapp"
urlpatterns = [
#url v path
#url has to take a regular expression
#path can take the str... | dhobson21/Library-Project | libraryapp/urls.py | urls.py | py | 1,115 | python | en | code | 0 | github-code | 90 |
8928354539 | class primes:
user_input = int(input("Enter a number to have checked. "))
count = user_input - 1
not_prime = False
if user_input % 2 != 0:
while not not_prime:
if count == 1:
print("Prime")
break
if user_input % count == 0:
... | danFbach/pycharmProjects | practice11.py | practice11.py | py | 484 | python | en | code | 0 | github-code | 90 |
24926040169 |
import logging
import logging.handlers
import multiprocessing as mp
from .gpio import Gpio
from .sound import Sound
from .Communicator import Communicator
from .Workers import Workers
from .StateMachine import StateMachine
from .events.ErrorEvent import ErrorEvent
from .events.Event import Event
from .dis... | Tharnas/rc-eres-speaker | eres/main.py | main.py | py | 4,552 | python | en | code | 0 | github-code | 90 |
70609722538 | valorproduto = float(input('Qual é o valor das compras: '))
print('MENU DE PAGAMENTOS:')
print('''
[ 1 ] à vista no dinheiro ou cheque
[ 2 ] à vista no cartão
[ 3 ] 2x no cartão
[ 4 ] 3x ou mais no cartão''')
opcao = int(input('Sua opção: '))
if opcao == 1:
total = valorproduto - (valorproduto * (10/1... | lcsantosdc/Curso-Em-V-deo-Python | desafio044.py | desafio044.py | py | 1,211 | python | pt | code | 1 | github-code | 90 |
915546632 | #!/usr/bin/env python3
##################################################################################
## ##
## _____ _ _ _ _ ##
## | __| |_ ___| |_| |_ ___ ___ ___ _... | chapinb/shattered | libs/liblogcat.py | liblogcat.py | py | 4,282 | python | en | code | 1 | github-code | 90 |
26925213121 | # 3. Задайте последовательность цифр. Напишите программу, которая выведет список неповторяющихся элементов
# исходной последовательности.
# Семинарское решение
from random import randint as rInt
uniqueList = {}
finalStr = ''
listStr = "".join(list(map(str, [rInt(0,9) for i in range(40)])))
print(f'Задана последовате... | ninaro1966/HW-Python-Sem4 | task3.py | task3.py | py | 1,212 | python | ru | code | 0 | github-code | 90 |
18344234249 | #-*-coding:utf-8-*-
import sys
input=sys.stdin.readline
def main():
numbers=[]
n = int(input())
numbers= list(map(int,input().split()))
dp=[0]*n
dp[0]=numbers[0]
dp[-1]=numbers[-1]
for i in range(1,n-1):
dp[i]=min(numbers[i-1],numbers[i])
print(sum(dp))
if __name__=="__main__... | Aasthaengg/IBMdataset | Python_codes/p02917/s965053940.py | s965053940.py | py | 333 | python | en | code | 0 | github-code | 90 |
13218409580 | import timeit
import torch
import torch.utils.benchmark as benchmark
def empty_cache():
torch.cuda.empty_cache()
def zeros(size=1024, device="cuda:0", times=500):
x = []
for _ in range(times):
x.append(torch.zeros(size, size, size, dtype=torch.int8, device=device))
print(f"memory alloca... | flystarhe/hello | hello/utils/cuda.py | cuda.py | py | 1,815 | python | en | code | 2 | github-code | 90 |
5629559201 | def shift():
sentence = str(input("Enter a string: "))
lower = ""
upper = ""
for char in sentence:
if char.islower():
lower += char
elif char.isupper():
upper += char
new_sentence = lower + upper
print(new_sentence)
| davidobele/itsc-3155-modules-1-and-2 | exercise_12.py | exercise_12.py | py | 287 | python | en | code | 0 | github-code | 90 |
9183899235 | from django.shortcuts import redirect, render
from .models import Comptes,produit,client,fournisseur
from .forms import Creer_client, Creer_fournisseur, Creer_produit
# Create your views here.
def Verify_Login(request):
if request.method == "GET" :
accountquery=request.GET.get('usernameinput')
... | amineboucenna/Gestion-Stock | Gestion_Stock/views.py | views.py | py | 7,632 | python | fr | code | 0 | github-code | 90 |
8082010676 | """Extension to provide rule display management commands."""
import disnake
from disnake.ext import commands
from ..rulebot import Rulebot
from ..rule_displays import (
get_rule_display_channel,
set_rule_display_channel,
remove_rule_display_channel,
sync_rule_display,
)
class RuleDisplays(commands.C... | interrrp/rulebot | bot/exts/rule_displays.py | rule_displays.py | py | 2,357 | python | en | code | 0 | github-code | 90 |
3994528778 | import sys
input = sys.stdin.readline
def solution(N, w, p):
memo = [[0 for _ in range(100)] for _ in range(N + 1)]
for i in range(1, N + 1):
weigh = w[i - 1]
price = p[i - 1]
if i == 1:
for j in range(weigh, 100):
memo[i][j] = price
else:
... | WonyJeong/algorithm-study | WonyJeong/DP/1535.py | 1535.py | py | 732 | python | en | code | 2 | github-code | 90 |
39311996079 | """
Given an arbitrary ransom note string and another string containing letters from all the magazines, write a function that will return true if the ransom note can be constructed from the magazines ; otherwise, it will return false.
Each letter in the magazine string can only be used once in your ransom note.
Note:... | at3103/Leetcode | 383_Ransom Note.py | 383_Ransom Note.py | py | 818 | python | en | code | 0 | github-code | 90 |
39192686506 | import torch
import torch.nn as nn
class DoubleConv_2d(nn.Module):
def __init__(self, in_channels, out_channels, mid_channels=None):
super().__init__()
if not mid_channels:
mid_channels = out_channels
self.double_conv = nn.Sequential(
nn.Conv2d(in_channels, mid_chann... | kabbas570/nii-files-python-codes | training_files.py/multi_2D.py | multi_2D.py | py | 36,077 | python | en | code | 0 | github-code | 90 |
73530953898 | import numpy as np
import random
def main(data_folder, output_folder, num_sub_data):
cropped_top_bc = np.load(data_folder + "cropped_top_bc.npy")
cropped_bottom_bc = np.load(data_folder + "cropped_bottom_bc.npy")
cropped_left_bc = np.load(data_folder + "cropped_left_bc.npy")
cropped_right_bc = np.load(da... | ChenkaiMao97/MAML_EM_simulation | data_gen/crop_data_gen/gen_sub_dataset.py | gen_sub_dataset.py | py | 2,206 | python | en | code | 3 | github-code | 90 |
746835137 | import argparse
import logging
import hashlib
import sys
try:
from wirepas_mqtt_library import WirepasNetworkInterface, WirepasTLVAppConfigHelper
import wirepas_mesh_messaging as wmm
except ModuleNotFoundError:
print("Please install Wirepas mqtt library wheel (>= 1.1): pip install wirepas-mqtt-library==1.1... | wirepas/wm-sdk | libraries/local_provisioning/backend_script/local_provisioning_tool.py | local_provisioning_tool.py | py | 4,447 | python | en | code | 36 | github-code | 90 |
36048315759 | '''
Based on
https://github.com/Ariel5/omp-parallel-gpu-python
'''
import torch
def innerp(x, y=None, out=None):
if y is None:
y = x
if out is not None:
out = out[:, None, None] # Add space for two singleton dimensions.
return torch.matmul(x[..., None, :], y[..., :, None], out=out)[..., 0,... | rachana-sathish/FastSolver_DictL | omp.py | omp.py | py | 6,511 | python | en | code | 0 | github-code | 90 |
6947578341 | class Solution(object):
def firstMissingPositive(self, nums):
"""
:type nums: List[int]
:rtype: int
"""
nums.sort()
x=0
for i in range(len(nums)):
if nums[i]>0:
x=i
break
if nums[x]!=1:
return 1 ... | bittu876/leetcode_ | 0041-first-missing-positive/0041-first-missing-positive.py | 0041-first-missing-positive.py | py | 567 | python | en | code | 0 | github-code | 90 |
20803063561 | #En debugging.py hice un manejo de excepciones con try, except y raise
def palindrome(string):
try:
if len(string) == 0:
raise ValueError("No se puede ingresar una cadena vacía")
return string == string[::-1]
except ValueError as ve:
print(ve)
return False
def run()... | Itzel-men/Curso_python_intermedio | manejo_excepciones.py | manejo_excepciones.py | py | 515 | python | es | code | 0 | github-code | 90 |
17927125539 | # チャンネルの情報は不要ではない, その情報を適切に使う必要がある
from itertools import accumulate
from collections import defaultdict
N, V = map(int, input().split()) # N個の録画したい番組, V個のチャンネル
programs = defaultdict(list)
for _ in range(N):
s, t, c = map(int, input().split())
programs[c].append((s, t))
imos = [0] * (100002)
for c, p in progr... | Aasthaengg/IBMdataset | Python_codes/p03504/s208344899.py | s208344899.py | py | 1,341 | python | ja | code | 0 | github-code | 90 |
31734249858 | import numpy as np
import matplotlib.pyplot as plt
from matplotlib import colors
import pandas as pd
import plotly.graph_objects as go
from plotly.subplots import make_subplots
import plotly.express as px
# set up the spectrogram
def spectrogram(signal, period_len=16):
freqs = np.fft.rfftfreq(period_len, d=1 / per... | nickeisenberg/Python_min_working_ex | TimeSeriesProcessing/Spectrogram.py | Spectrogram.py | py | 2,888 | python | en | code | 0 | github-code | 90 |
36940650633 | #! /usr/bin/env python
#--------------------------------------------------------------
# webThumb - Python-fu script
#
#------------------ Modification History ----------------------
# Date Author Description
# 2009/01/06 SWheeler Script baselined
# 2009/01/23 SWheeler v0.9 - beta release
#-----------... | pixlsus/registry.gimp.org_static | registry.gimp.org/files/webThumb.py | webThumb.py | py | 4,789 | python | en | code | 178 | github-code | 90 |
24657653492 | import pandas as pd
import numpy as np
from sklearn.model_selection import StratifiedKFold
import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.optim as optim
from torch.utils.data import Dataset, DataLoader
class CodesDataset(Dataset):
'''
Dataset class to accommodate our nested b... | Pegayus/nested-bigrams | src/srfnn.py | srfnn.py | py | 8,101 | python | en | code | 5 | github-code | 90 |
25981674102 | import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
from tensorflow.keras import layers
from tensorflow import keras
import tensorflow as tf
import os
os.environ['TF_CPP_MIN_LOG_LEVEL'] = '2'
#################################################################################
# DATA
def train_data(n... | Abner0627/DSAI_HW3_GreenEnergyTrade | randy8642/tf_train.py | tf_train.py | py | 2,238 | python | en | code | 1 | github-code | 90 |
73090188775 | """
You're given strings jewels representing the types of stones that are jewels, and stones representing the stones you
have. Each character in stones is a type of stone you have. You want to know how many of the stones
you have are also jewels.
Letters are case sensitive, so "a" is considered a different type of ston... | devWorldDivey/mypythonprogrammingtutorials | Python Problems/771. Jewels and Stones.py | 771. Jewels and Stones.py | py | 833 | python | en | code | 0 | github-code | 90 |
9764656788 | from torch import nn
import torch
import torchvision.transforms.functional as TF
class ConvReLU(nn.Module):
def __init__(self, in_channels, out_channels, kernel_size = 3, pre_activation = None, padding = 0):
super().__init__()
self.conv = nn.Conv2d(in_channels = in_channels, out_channels =... | TrickyWhiteCat/IntroToDLSegmentation | model.py | model.py | py | 3,429 | python | en | code | 0 | github-code | 90 |
11839983634 | from mcpi.minecraft import Minecraft
from mcpi import block
import time
mc = Minecraft.create("mc2.tokyocodingclub.com")
player = mc.getPlayerEntityId("TCC_03")
attacker = mc.getPlayerEntityId('TCC_10')
pos = mc.entity.getTilePos(player)
attackerPos = mc.entity.getTilePos(attacker)
mc.postToChat('A player is immune ... | saywordsahn/mcpiMinecraftTools | voidDefense.py | voidDefense.py | py | 508 | python | en | code | 0 | github-code | 90 |
18174358059 | n, k = map(int, input().split())
A = list(map(int, input().split()))
bottom, top = 0, max(A)
def cut(x):
cnt = 0
for Length in A:
if Length % x == 0:
cnt += Length // x
else:
cnt += Length // x + 1
cnt -= 1
return cnt <= k
while top - bottom > 1:
middle... | Aasthaengg/IBMdataset | Python_codes/p02598/s439851452.py | s439851452.py | py | 433 | python | en | code | 0 | github-code | 90 |
18265255849 | def main():
n, k = map(int, input().split())
a = 1
b = 0
while True:
a *= k
if a > n:
break
b += 1
ans = b + 1
print(ans)
if __name__ == "__main__":
main()
| Aasthaengg/IBMdataset | Python_codes/p02766/s108708840.py | s108708840.py | py | 224 | python | en | code | 0 | github-code | 90 |
30328350877 | #!/usr/bin/env python
"""The setup script."""
from setuptools import setup, find_packages
with open('README.rst') as readme_file:
readme = readme_file.read()
with open('HISTORY.rst') as history_file:
history = history_file.read()
requirements = ['requests', 'dataclasses', 'fhir.resources==6.0.0']
setup_re... | walkIT-nl/hit-starter-on-fhir | setup.py | setup.py | py | 1,484 | python | en | code | 0 | github-code | 90 |
2632829105 | # Method 1: BFS
# time o(n)
# space o(n)
from collections import deque
def levelOrderBottom(root: TreeNode) -> List[List[int]]:
if root is None:
return []
result = deque()
queue = deque()
queue.append(root)
while queue:
levelSize = len(queue)
currentLevel = []
for ... | ramikhafagi96/Leetcode-Problems-Solutions | Easy-Questions/BTLevelOrderTraversalII/bottomUpLevelOrder.py | bottomUpLevelOrder.py | py | 1,156 | python | en | code | 0 | github-code | 90 |
37118895413 | # https://www.geeksforgeeks.org/search-an-element-in-a-sorted-and-pivoted-array/
def pivotedBinarySearch(arr, key):
n = len(arr)
pivot = findPivot(arr, 0, n-1)
if pivot == -1:
return binarySearch(arr, 0, n-1, key)
if arr[pivot] == key:
return pivot
if arr[0] <= key:
retur... | nanw01/python-algrothm | Python Algrothm Advanced/practice/050103roatedsord 02findNin copy.py | 050103roatedsord 02findNin copy.py | py | 1,300 | python | en | code | 1 | github-code | 90 |
36760383045 | # import sys
# input = sys.stdin.readline
# r = 1000000
# primes = [True for _ in range(1000000)]
# for i in range(2, int(r**0.6)):
# if primes[i] == True:
# for j in range(i*2, r, i):
# if primes[j] == True:
# primes[j] = False
# while(True):
# n = int(input())
# if n ... | gkatldus1/python-and-java-algorithm | python_solve/baek6588.py | baek6588.py | py | 1,110 | python | en | code | 0 | github-code | 90 |
24307138263 | alphabet = ["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"]
rearrangedAlphabet = []
firstInput = str(input("A is equal to: "))
firstInput = firstInput.upper()
thirdInput = str(input("Convert cipher into binary? "))
if thirdInput.lowe... | Papyrus2Yes/Caesar-Cipher-Machine | ciphermachine.py | ciphermachine.py | py | 2,342 | python | en | code | 0 | github-code | 90 |
18561134329 | N = int(input())
color = list(input().split())
# 1つの袋があり、ひなあられが N個 入っています。
# 桃色を P、白色を W、緑色を G、黄色を Y と表したとき、袋からひなあられを1粒ずつ取り出していったところ、i番目に取り出したひなあられの色は Si でした。
# この袋に 3種類 のひなあられが入っていた場合は Three、4種類 のひなあられが入っていた場合は Four と出力してください。
if "Y" in color:
print("Four")
else:
print("Three") | Aasthaengg/IBMdataset | Python_codes/p03424/s740847051.py | s740847051.py | py | 561 | python | ja | code | 0 | github-code | 90 |
38009309697 | from __future__ import annotations
import random
from user import User
from typing import Optional
from song import Song
DECISION_TREE_ROOT = (0, 0)
class DecisionTree:
"""A decision tree for organizing our songs.
Each node in the tree either stores a range of numbers or a set of songs.
Instance Attr... | Manal-jpg/csc111-group-project | decision_tree.py | decision_tree.py | py | 10,898 | python | en | code | 0 | github-code | 90 |
45861433150 | #!usr/bin/env python3
# -*- coding: utf-8 -*-
"""
app/api/routes.py:
This document includes routes concerning the Mealtime API.
The function of the API is to allow users to read (but not write) recipes, giving users easy access to our recipes.
"""
__authors__ = "Justin Wong"
__email__ = "justin.wong.17@ucl.ac.uk"
__cr... | justinattw/Group1_Mealtime | app/api/routes.py | routes.py | py | 1,776 | python | en | code | 0 | github-code | 90 |
20791927117 | import cv2
import numpy as np
import hand_tracking as htm
import time
import autopy
# 웹캠 설정
wCam, hCam = 640, 480
frameR = 100 # Frame Reduction
smoothening = 2
pTime = 0
plocX, plocY = 0, 0
clocX, clocY = 0, 0
# 0번 웹캠 캡쳐
cap = cv2.VideoCapture(0)
# 640 x 480 set
cap.set(3, wCam)
cap.set(4, hCam)
# 핸드 트래킹 호출
detect... | DoGooRi/python-finger-mouse | virtual_mouse.py | virtual_mouse.py | py | 2,861 | python | ko | code | 0 | github-code | 90 |
47656163490 | import os
import subprocess
import unittest
def get_repository_dir():
"""
Get the root directory of this repository.
"""
script_path = os.path.realpath(__file__)
root_dir = os.path.dirname(os.path.dirname(script_path))
return root_dir
def get_license_text():
"""
Return the license t... | imcs-compsim/pvutils | tests/testing_header.py | testing_header.py | py | 3,806 | python | en | code | 4 | github-code | 90 |
18455906909 | from heapq import heappop,heappush
n,k=map(int,input().split())
s=[]
h=set()#種類
l=[0]*n #個数について
for _ in range(n):
t,d=map(int,input().split())
s.append((d,t-1))
s=sorted(s,reverse=True)
a=[]#heapq
num=0#美味しさのわ
for i in range(k):
d,t=s[i]
l[t]+=1
h.add(t)
num+=d
if l[t]>1:
heappush(a... | Aasthaengg/IBMdataset | Python_codes/p03148/s363583710.py | s363583710.py | py | 698 | python | ja | code | 0 | github-code | 90 |
28884498831 | from selenium.webdriver import Chrome
from selenium.webdriver.common.action_chains import ActionChains
from selenium.webdriver.chrome.options import Options
from chaojiying import Chaojiying_Client
import time
# 初始化超级鹰
chaojiying = Chaojiying_Client('18614075987', '6035945', '914467')
# 如果你的程序被识别到了怎么办?
# 1.chrome的版... | WakingHours-GitHub/PythonCrawler | 代码/第五章/07_处理12306登录.py | 07_处理12306登录.py | py | 2,176 | python | en | code | 2 | github-code | 90 |
37136436906 | import requests
import re
'''
requests库的基本使用
requests :https://2.python-requests.org//zh_CN/latest/user/quickstart.html
正则表达式
re:https://docs.python.org/zh-cn/3/library/re.html
匹配网页所需信息
获取 https://book.douban.com/top250 页面 25本书的书名
'''
url = "https://book.douban.com/top250"
user_agent = "Mozilla/5.0 (Windows NT 6.1; ... | lichangke/Python3_Project | Python爬虫实战入门/webcrawler5.py | webcrawler5.py | py | 1,051 | python | zh | code | 3 | github-code | 90 |
18026155199 | N = int(input())
A = [int(a) for a in input().split()]
A.sort()
even = 0
odd = 0
num = A[0]
cnt = 0
for i in range(N+1):
if i < N and num == A[i]:
cnt += 1
else:
if cnt%2 == 0:
even += 1
else:
odd += 1
cnt = 1
num = A[min(i, N-1)]
if even%2 == 0:... | Aasthaengg/IBMdataset | Python_codes/p03816/s953724705.py | s953724705.py | py | 396 | python | en | code | 0 | github-code | 90 |
41779764268 | import random
import pandas as pd
import csv
import os
random.seed(19095)
#Script to be run
def main():
outpath='../../datastore/'
designpath='simulation/designs/'
sim_designs = []
with open('designs_to_run.csv', newline='') as inputfile:
for row in csv.reader(inputfile):
sim_des... | SimonFreyaldenhoven/example_template | analysis/source/simulation/simulate_data.py | simulate_data.py | py | 1,083 | python | en | code | 0 | github-code | 90 |
72809993577 | import tensorflow as tf
saved_model_dir = 'model_tf'
tflite_model_path = 'model.tflite'
# Convert the model
converter = tf.lite.TFLiteConverter.from_saved_model(saved_model_dir)
tflite_model = converter.convert()
# Save the model
with open(tflite_model_path, 'wb') as f:
f.write(tflite_model) | sithu31296/PyTorch-ONNX-TFLite | conversion/tf_to_tflite.py | tf_to_tflite.py | py | 299 | python | en | code | 288 | github-code | 90 |
27094018688 | from spack import *
class PyMako(PythonPackage):
"""A super-fast templating language that borrows the best
ideas from the existing templating languages."""
homepage = "https://pypi.python.org/pypi/mako"
url = "https://pypi.io/packages/source/M/Mako/Mako-1.0.1.tar.gz"
version('1.0.4', 'c5fc31a... | matzke1/spack | var/spack/repos/builtin/packages/py-mako/package.py | package.py | py | 596 | python | en | code | 2 | github-code | 90 |
27501139358 | import tkinter.messagebox as msgbox
from tkinter import *
root = Tk()
root.title('Nami Sushi')
root.geometry('640x480')
def info():
msgbox.showinfo('notice', 'You are good ')
btn = Button(root, command = info, text = 'warning')
btn.pack()
def warn():
msgbox.showwarning('Warning', 'There is no se... | djoo1028/Gui-Tutorial-example-Code- | 11_messageBox.py | 11_messageBox.py | py | 1,563 | python | en | code | 0 | github-code | 90 |
18325111039 | import sys
input = lambda : sys.stdin.readline().rstrip()
sys.setrecursionlimit(max(1000, 10**9))
write = lambda x: sys.stdout.write(x+"\n")
a,b = list(map(int, input().split()))
if 1<=a<=9 and 1<=b<=9:
ans = a*b
else:
ans = -1
print(ans) | Aasthaengg/IBMdataset | Python_codes/p02879/s262943431.py | s262943431.py | py | 248 | python | en | code | 0 | github-code | 90 |
18174019119 | def main():
n, k = map(int, input().split())
a = list(map(int, input().split()))
def value(v):
cnt = 0
for i in a:
cnt += (i-1)//v
if cnt > k:
return False
else:
return True
def b_search(ok, ng, value):
while abs(ok-ng) > 1:
... | Aasthaengg/IBMdataset | Python_codes/p02598/s055415157.py | s055415157.py | py | 509 | python | en | code | 0 | github-code | 90 |
4540176290 | import skimage.io as io
from skimage.util import pad, view_as_windows
import numpy as np
from scipy.ndimage.filters import generic_filter
from matplotlib import pyplot as plt
def normalize_matrix(matrix):
matrix = matrix - matrix.mean()
# Stand. deviation
matrix_std = np.sqrt((matrix**2).sum())
... | warmspringwinds/jhu_cv_homeworks | hw_3/second_task.py | second_task.py | py | 2,345 | python | en | code | 0 | github-code | 90 |
30275336426 | import time
import pygame
from pygame.locals import *
import sys
pygame.init()
fenetre = pygame.display.set_mode((648,604), RESIZABLE)
pygame.display.set_caption("***\__Jeu de Morpion__/***")
debut = pygame.image.load("home0.png").convert()
fenetre.blit(debut, (0,0))
pygame.display.flip()
def besoinAide():
help ... | houmenou-cheikh/AI-Runtrack-1 | pygame/Morpion.py | Morpion.py | py | 8,581 | python | fr | code | 0 | github-code | 90 |
38334525320 | import telebot
import os
from collections import defaultdict
from finglish import f2p
from translation import translate
from DB import DB
from utils import postprocess_msg
DBhandler = DB()
# Creating BOT
TOKEN = os.environ["FINBOT_TOKEN"]
bot = telebot.TeleBot(TOKEN)
UPDATE_COUNTER = 0
# ------------ /start and /h... | hejazizo/finTranslateBot | bot.py | bot.py | py | 2,397 | python | en | code | 3 | github-code | 90 |
12574835149 | from decimal import Decimal
from django.urls import reverse
from rest_framework.test import APIClient
from rest_framework import status
from django.test import TestCase
from django.contrib.auth import get_user_model
from core.models import Ingredient, Recipe
from recipe.serializers import IngredientSerializer
INGRE... | woohaen88/recipe-app-api | app/recipe/tests/test_ingredients_api.py | test_ingredients_api.py | py | 3,323 | python | en | code | 0 | github-code | 90 |
18319066609 | import sys, math
from pprint import pprint
input = sys.stdin.readline
rs = lambda: input().strip()
ri = lambda: int(input())
rl = lambda: list(map(int, input().split()))
mod = 10**9 + 7
r = ri()
print(r**2)
| Aasthaengg/IBMdataset | Python_codes/p02859/s774405189.py | s774405189.py | py | 209 | python | en | code | 0 | github-code | 90 |
17215590795 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
from setuptools import setup, find_packages
from os import path
import io
pwd = path.abspath(path.dirname(__file__))
with io.open(path.join(pwd, "README.md"), encoding="utf-8") as readme:
desc = readme.read()
setup(
name="swaggerhole",
version="1.1",
des... | Liodeus/swaggerHole | setup.py | setup.py | py | 1,059 | python | en | code | 30 | github-code | 90 |
22987459234 | def create_char_freq_map(a_string):
# create freq map of the string
freq_map = {}
for char in a_string:
if char in freq_map.keys():
freq_map[char] += 1
else:
freq_map[char] = 1
return freq_map
# kind of slow, if there is a way to avoid this, try
def is_anagram(st... | dp-mason/leetcodepractice | python/anagram_substring.py | anagram_substring.py | py | 2,972 | python | en | code | 0 | github-code | 90 |
73333552935 | import random
import time
# -------------------------------------------------------------------------------
def randomize(value, accRange): # to randomize the value of blood sugar within the accuracy range
return random.uniform(value - accRange, value + accRange)
# --------------------------------------------... | AsthaGarg16/Intuition-hack | FuncSet.py | FuncSet.py | py | 5,905 | python | en | code | 0 | github-code | 90 |
38503223367 | # -*- coding: utf-8 -*-
"""
2.1. Suponiendo que las preferencias de un consumidor vengan explicadas por la funci贸n de utilidad 饾憟(饾懃, 饾懄) = 饾懃. 饾懄 se pide que
a) derive en forma te贸rica las expresiones de la funci贸n de demanda de cada uno de los bienes, y que
b) encuentre la funci贸n de demanda hicksiana a partir de l... | LuciaFresno/facultad | Microeconomia/1er parcial/ej2.1.py | ej2.1.py | py | 612 | python | es | code | 0 | github-code | 90 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.