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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
41104474805 | import requests
from bs4 import BeautifulSoup
from flask import Flask, render_template, jsonify, request
app = Flask(__name__)
from pymongo import MongoClient # pymongo를 임포트 하기(패키지 인스톨 먼저 해야겠죠?)
client = MongoClient('localhost', 27017) # mongoDB는 27017 포트로 돌아갑니다.
db = client.dbsparta # 'dbsparta'라는 이름의 db를 만듭니다.... | Woogil90/MY_PROJECT | My_project_rev2.py | My_project_rev2.py | py | 5,588 | python | ko | code | 0 | github-code | 90 |
26685569164 | import base64
from django.core.files.base import ContentFile
from django.db import transaction
from django.shortcuts import get_object_or_404
from djoser.serializers import UserCreateSerializer, UserSerializer
from recipes.models import (Favorite, Ingredient, IngredientRecipe, Recipe,
Shopp... | LinaArtmv/foodgram-project-react | backend/foodgram/api/serializers.py | serializers.py | py | 13,491 | python | en | code | 0 | github-code | 90 |
72996257258 | # This program calculates the area of a region of interest in a spectra file.
# Spacing: TABS
import os
import time
import glob
def get_start_end():
start = input("Select the starting channel, from 0 to 2047: ")
end = input("Select the end channel, from 0 to 2047: ")
return int(start), int(end)
def calc_area(coun... | fangbo-yuan/RWS | calc_roi_area.py | calc_roi_area.py | py | 1,672 | python | en | code | 0 | github-code | 90 |
36295295577 | import sys
#import numpy
def del_last_digit(m): #primito
return m//10
def qdigit(m, counter): #Ejercicio 4.
if m//10==0:
return counter+1
else:
counter += 1
return qdigit(m//10, counter)
def del_last_digitv2(m,digitos): #Ejercicio 3.
if digitos==1:
... | RosanaR2017/PYTHON | del_last_digit.py | del_last_digit.py | py | 752 | python | es | code | 0 | github-code | 90 |
72669474217 | ogrenciler = {
"190509026": {
"ad":"Aytaç",
"soyad":"Kaşoğlu",
"telefon":"5442903647"
},
"190509010": {
"ad":"Mehmet Kadir",
"soyad":"Cırık",
"telefon":"5387984501"
},
"190543014": {
"ad":"Safa",
"soyad":"Çubuk",
"telefon":"5... | kasoglu/learn-python | demo_dictionaries_07_06_2020_tr.py | demo_dictionaries_07_06_2020_tr.py | py | 836 | python | en | code | 1 | github-code | 90 |
10876121667 |
import torch
import torch.nn as nn
import torch.nn.functional as F
from torch.nn.parameter import Parameter
class Attention(nn.Module):
def __init__(self, config):
super(Attention, self).__init__()
self.device = config['device']
self.attention_size = config['hidden_size']
self.at... | raja-1996/Pytorch_TextClassification | Attention_Classification/Attention.py | Attention.py | py | 1,231 | python | en | code | 0 | github-code | 90 |
4696863569 | from django.db.models.signals import post_save
from django.dispatch import receiver
from django.contrib.auth.models import User
from .models import Notification
from likes.models import Like
from comments.models import Comment
from follows.models import Follow
from sounds.models import Sound
from reports.models import ... | nacht-falter/sonic-explorers-api | notifications/signals.py | signals.py | py | 3,468 | python | en | code | 0 | github-code | 90 |
71956027817 | import torch.nn as nn
import torch
from torch import Tensor
from typing import *
import numpy as np
from scipy import stats
class CosineSimilarityMatrix(nn.Module):
name = 'cosine_matrix'
def __init__(self, dim: int = 1, eps: float = 1e-8) -> None:
super(CosineSimilarityMatrix, self).__init__()
... | EauDeData/IDF-Net | src/utils/metrics.py | metrics.py | py | 3,965 | python | en | code | 0 | github-code | 90 |
26370559324 | #
# File: MessageSubscriberBase.py
# Date: 21-Mar-2023 J. Smith
#
# Updates:
##
"""
Async message consumer -
This software was developed as part of the World Wide Protein Data Bank
Common Deposition and Annotation System Project
"""
from __future__ import division, absolute_import, print_function
__docformat__ =... | wwPDB/py-wwpdb_utils_message_queue | wwpdb/utils/message_queue/MessageSubscriberBase.py | MessageSubscriberBase.py | py | 5,840 | python | en | code | 0 | github-code | 90 |
36700172704 | #!/usr/bin/env python3
import rospy
from std_msgs.msg import ColorRGBA, Float64
rospy.init_node("battery_led")
pub = rospy.Publisher("/led2", ColorRGBA, queue_size=1)
led_full = ColorRGBA()
led_full.a = 1.0
led_full.r = 0
led_full.g = 0
led_full.b = 1
led_mid = ColorRGBA()
led_mid.a = 1.0
led_mid.r = 0
led_mid.g =... | MosHumanoid/bitbots_thmos_meta | bitbots_lowlevel/bitbots_ros_control/scripts/battery_led.py | battery_led.py | py | 821 | python | en | code | 3 | github-code | 90 |
18440737998 | #!/usr/bin/python3
'''
Demo of custom Vector Quantiser layer written in tf.keras:
$ ./vq_kmeans_demo.py
'''
import logging
import os
import numpy as np
from matplotlib import pyplot as plt
# Give TF "a bit of shoosh" - needs to be placed _before_ "import tensorflow as tf"
os.environ['TF_CPP_MIN_LOG_LEVEL'] = '3'... | drowe67/ampnn | vq_kmeans_demo.py | vq_kmeans_demo.py | py | 1,429 | python | en | code | 3 | github-code | 90 |
73983799976 | import os
import argparse
from PIL import Image
import numpy as np
import torch
import torch.nn as nn
import torch.optim as optim
import torchvision
from torch.optim import lr_scheduler
from torchvision import models
from FaceMaskClassificationUtils import imshow, DEVICE, CPU_DEVICE, split_prepare_dataset, CNN, train_... | amird1234/FaceMaskDetection | src/NaturalImages.py | NaturalImages.py | py | 3,470 | python | en | code | 0 | github-code | 90 |
20146445477 | import pytest
from some_project.utils import fib
def test_invalid_value():
value = -1
with pytest.raises(ValueError):
fib(value)
def test_invalid_type():
value = 'aaa'
with pytest.raises(TypeError):
fib(value)
@pytest.mark.parametrize(
'n,expected',
[(0, 0), (1, 1), (2, 1)... | inna-tuzhikova/some_project | tests/test_fib.py | test_fib.py | py | 411 | python | en | code | 0 | github-code | 90 |
40315965864 | '''
Input: a List of integers as well as an integer `k` representing the size of the sliding window
Returns: a List of integers
'''
def sliding_window_max(nums, k):
# iterate through list and work with a chunk of k elements at each iteration
# for each iteration sort the splice and append largest number to new ... | IanCarreras/first-pass-solution | sliding_window_max/sliding_window_max.py | sliding_window_max.py | py | 783 | python | en | code | 0 | github-code | 90 |
29517714071 | import os
import random
import numpy as np
import pandas as pd
import pickle as pickle
from load_data import *
random.seed(42)
PUNCTUATIONS = ['.', ',', '!', '?', ';', ':']
PUNC_RATIO = 0.3
# Insert punction words into a given sentence with the given ratio "punc_ratio"
def insert_punctuation_marks(sentence, punc_rat... | boostcampaitech3/level2-klue-level2-nlp-09 | data_augmentation.py | data_augmentation.py | py | 9,168 | python | en | code | 6 | github-code | 90 |
36121085796 | import io
from pathlib import Path
import click
from openpyxl import load_workbook
from rich.console import Console, Group
from rich.padding import Padding
from rich.panel import Panel
from core.models import AnonymousEtabRows
console = Console()
def load_xlsx(file):
wb = load_workbook(filename=file)
retu... | MTES-MCT/trackdechets-xslx2csv | src/anonymous.py | anonymous.py | py | 2,299 | python | en | code | 1 | github-code | 90 |
37564762909 | import fileinput
def parse():
tape = []
for line in fileinput.input():
words = line.strip().split(" ")
cmd = words[0]
reg = words[1].strip(",")
args = [reg]
if len(words) > 2:
args.append(int(words[2]))
tape.append((cmd, args))
return tape
def ... | rodrigorahal/advent-of-code-2015 | 23/turing_lock.py | turing_lock.py | py | 1,241 | python | en | code | 0 | github-code | 90 |
20341096567 | # Hash Table, String, Breath-First Search
from collections import deque
class Solution:
def minMutation(self, startGene: str, endGene: str, bank: List[str]) -> int:
que = deque([startGene])
info = deque(bank)
count = 0
gene = {0: 'A', 1: 'C', 2: 'G', 3: 'T'}
visited = set()
... | Stendhalsynd/algorithm-library | 0433-minimum-genetic-mutation/0433-minimum-genetic-mutation.py | 0433-minimum-genetic-mutation.py | py | 1,867 | python | ko | code | 0 | github-code | 90 |
38715945722 | import os
import sys
import math
from enum import Enum, unique
import shlex
import shutil
import signal
import time
from collections import namedtuple
import tempfile
import traceback
import configparser
import urllib.parse
import urllib.request
import gi
gi.require_version('Gtk', '3.0') # noqa: E402
gi.require_versio... | eduardoposadas/increasevol | increasevol.py | increasevol.py | py | 89,937 | python | en | code | 0 | github-code | 90 |
17422992642 | import os
from datasets import load_dataset
one_sentence_tasks = ['cola', 'sst2']
two_sentence_tasks = ['mrpc', 'stsb', 'qqp', 'mnli', 'mnli-mm', 'qnli', 'rte', 'wnli']
task_to_keys = {
"cola": ("sentence", None),
"mnli": ("premise", "hypothesis"),
"mrpc": ("sentence1", "sentence2"),
"qnli": ("questio... | AI-secure/adversarial-glue | training_script/ERNIE/download_glue_data.py | download_glue_data.py | py | 2,144 | python | en | code | 4 | github-code | 90 |
30722164184 | # imporrt packages
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
import seaborn as sns
import statsmodels.formula.api as smf
import statsmodels.api as sm
from statsmodels.formula.api import ols
from statsmodels.compat import lzip
import pylab
import scipy.stats as st
from sklearn.... | Pushpendra7767/Multilinear-regression | ToyotaCorolla final.py | ToyotaCorolla final.py | py | 3,433 | python | en | code | 0 | github-code | 90 |
3391129414 | import time
from src import utils
async def notice(ctx, userId, title='Example', content='Testing', penaltyType=0, adminOpNote=None, noticeType=0):
if not adminOpNote: adminOpNote = {}
data = {
"uid": userId,
"title": title,
"content": content,
"attachedObject": {
"... | leafylemontree/nati_amino-bot | src/admin/notices.py | notices.py | py | 1,065 | python | en | code | 5 | github-code | 90 |
6034619242 | from django.shortcuts import render, redirect
from django.http import JsonResponse
from django.contrib import messages
from management.Constant import *
import datetime
from .stockForm import AddStock
from .models import Stock
def addStock(request):
now = datetime.datetime.now()
today_date = now.strftime("%Y-... | multisanjeev/Django-management-system | default/stockView.py | stockView.py | py | 1,760 | python | en | code | 0 | github-code | 90 |
22834495144 | import queue
import itertools
import threading
import Process
class MainMemory:
mainMemory = 512 # MB
usedMemory = 0 # MB
frameSize = 32 / 1000 # MB aka 32 KB
tableSize = 35
q = queue.Queue()
def __init__(self):
self.frameTable = [None] * self.tableSize
self.processes = []
de... | untermanlm/CMSC312 | src/Memory.py | Memory.py | py | 4,335 | python | en | code | 0 | github-code | 90 |
36040391020 | # SM3
import math
from typing import ByteString
IV = [0x7380166F, 0x4914B2B9, 0x172442D7, 0xDA8A0600, 0xA96F30BC, 0x163138AA, 0xE38DEE4D, 0xB0FB0E4E]
T = [0x79cc4519, 0x7a879d8a]
def AsToByte(string):
BString = ''
for i in string:
BString += hex(ord(i))[2:]
return BString
def FF(... | sdu-lzq/Innovation-practice-homework | SM3/SM3.py | SM3.py | py | 3,131 | python | en | code | 1 | github-code | 90 |
1994026885 | from django.core.cache import cache
from gpsDatingApp.redis.RedisInterface import RedisInterface
from gpsDatingApp.dao.ReservationDaoSingleton import ReservationDaoSingleton
from gpsDatingApp.otherConfig.ListInitConfig import ListInitConfig
from gpsDatingApp.otherConfig.LifeCycleConfig import LifeCycleConfig
import t... | GitHub-WeiChiang/main | GpsDatingApp/Back-End/DjangoEnv/project/gpsDatingApp/redis/ReservationCounterRedisSingleton.py | ReservationCounterRedisSingleton.py | py | 2,054 | python | en | code | 7 | github-code | 90 |
42683200763 | class BikeRental:
"""
A class which packs all the functions including renting and issuing bills.
"""
def _init_(self, name, no_of_bikes) -> None:
self.name = name
self.no_of_bikes = no_of_bikes
self.users = {}
def rent_bike_hourly(self, name:str, bikes:int):
... | attardesujal/Bike-Rental-system-project | bike rental system.py | bike rental system.py | py | 5,988 | python | en | code | 0 | github-code | 90 |
1506811319 |
# coding: utf-8
# # Self-Driving Car Engineer Nanodegree
#
# ## Deep Learning
#
# ## Project: Build a Traffic Sign Recognition Classifier
#
# In this notebook, a template is provided for you to implement your functionality in stages, which is required to successfully complete this project. If additional code is re... | taoyang1/CarND-Term1-Project2-TrafficSignClassifier | Traffic_Sign_Classifier.py | Traffic_Sign_Classifier.py | py | 32,295 | python | en | code | 0 | github-code | 90 |
12989856415 | #Animal population game
#V0.7
#Credits: Atkin, Sir.burton, Leo
import time, random, sys
option = 0
#Item stuff
items = {'bunnyPopulation':10,
'foxPopulation':3,
'plants':20,
'thirst':40,
'hunger':40,
'sleep':0,
'day':0
}
#Creating a fu... | geedo7/AnimalgameV0.7 | AnimalgameV0.7.py | AnimalgameV0.7.py | py | 5,865 | python | en | code | 0 | github-code | 90 |
4769063010 | #!/user/bin/python
__author__ = 'hsenid'
from random import randint
#get number or rows
rows = int(input('Enter number of rows: '))
#get number of columns
columns = int(input('Enter number of columns: '))
output = open("output.csv", "w+")
for rw in range(0,rows):
yy=""
for cl in range(0,columns):
... | MashiW/pythonAssignment | assignment1/create_file.py | create_file.py | py | 468 | python | en | code | 0 | github-code | 90 |
18355548389 | s = list(input())
tmp1 = s[0]
tmp2 = ''
count = 0
for i in range(1, len(s)):
tmp2 += s[i]
if tmp2 != tmp1:
count += 1
tmp1 = tmp2
tmp2 = ''
print(count + 1)
| Aasthaengg/IBMdataset | Python_codes/p02939/s980841685.py | s980841685.py | py | 189 | python | en | code | 0 | github-code | 90 |
36225261428 | import cmath
def QuadraticFuncPlus(a, b, c):
try:
x1 = (-b + cmath.sqrt(b**2 - 4*a*c)) / 2*a
except:
print("Error")
return x1
def QuadraticFuncMinus(a, b, c):
try:
x2 = (-b - cmath.sqrt(b**2 - 4*a*c)) / 2*a
except:
print("Error")
return x2
print("Find the solution in the quadratic equation (a*x + b... | GL-Kageyama/QuadraticEquation | QuadraticEquationCheck3.py | QuadraticEquationCheck3.py | py | 740 | python | en | code | 0 | github-code | 90 |
74338810536 | #! /usr/bin/python
import os
import re
import sys
import subprocess
from datetime import datetime
TEGOLA_DB_HOST = os.environ.get("TEGOLA_DB_HOST")
TEGOLA_TEGOLA_PASSWORD = os.environ.get("TEGOLA_TEGOLA_PASSWORD")
OSM2PGSQL_STYLE = "/container/config/tegola/osm2pgsql.style"
EXTRACT_BUCKET = "gs://%s" % os.environ.ge... | kartta-labs/Project | k8s/cronjobs/tegola-update.py | tegola-update.py | py | 6,133 | python | en | code | 47 | github-code | 90 |
26254367549 | fname = input("enter the file name: ")
fhand = open(fname)
count = 0
for word in fhand:
#checking whether line has more than two elements space seperated
if word.startswith("From") and len(word.split()) > 2:
temp = word.split()
print(temp[1])
count = count + 1
print("There were", count... | utkarshtambe10/Python-for-Everybody-Course | Course2: Python Data Structures/week4/assignment8.5.py | assignment8.5.py | py | 371 | python | en | code | 1 | github-code | 90 |
2797739706 | import argparse, random
class Piece:
def __init__(self, color):
self.color = color
def __repr__(self):
return self.color[0].upper()
def __eq__(self, other):
if type(other) is Piece:
if self.color == other.color:
return True
class GameBoard:
DEPTH ... | PdxCodeGuild/class_salmon | 1 Python/solutions/lab27-connect_four.py | lab27-connect_four.py | py | 4,930 | python | en | code | 5 | github-code | 90 |
10586976188 | from microbit import pin16, sleep, button_b, display
from utime import ticks_ms, ticks_diff
from utime import sleep_us
_DEBOUNCE_DELAY = 50
_HIGH = 1
_LOW = 0
class Button:
def __init__(self, pin):
self._pin = pin
self._button_state = None
self._last_button_state = No... | dooley-ch/microbit-grove | src/button.py | button.py | py | 1,205 | python | en | code | 0 | github-code | 90 |
36848200709 | class EmptyError(Exception):
print(Exception)
#==========================================================================================
#
#
#==========================================================================================
def read_proxy_metadata_S1csv(datadir_proxy, datafile_proxy, proxy_region, pro... | modons/LMR | load_proxy_data.py | load_proxy_data.py | py | 45,538 | python | en | code | 23 | github-code | 90 |
8219068868 | from django.db import models
from wagtail.admin.edit_handlers import StreamFieldPanel
from wagtail.core import blocks
from wagtail.core.fields import RichTextField, StreamField
from wagtail.core.models import Page
from wagtail.documents.blocks import DocumentChooserBlock
from . import blocks as test_blocks
class Pa... | fourdigits/wagtail-xliff-translation | test_app/models.py | models.py | py | 1,770 | python | en | code | 11 | github-code | 90 |
34325876554 | import pygame as pg
pg.init()
windowSize = [800,600]
screen = pg.display.set_mode(windowSize)
bard = pg.image.load('Bard_Render.png')
dcap = pg.image.load('dcap.png')
x = 0
y = 0
screen.blit(bard,(x+10,y+50))
screen.blit(dcap,(x-120,y-170))
done = False
while not done:
for event in pg.event.g... | MatthewRandell/The-Devils-Trap | layeredImages.py | layeredImages.py | py | 428 | python | en | code | 0 | github-code | 90 |
37378216789 | from typing import Iterable
def flatten(xs):
"""https://stackoverflow.com/a/2158532
"""
for x in xs:
if isinstance(x, Iterable) and not isinstance(x, (str, bytes)):
yield from flatten(x)
else:
yield x
| janchaloupka/web-scraper-nabidek-pronajmu | src/utils.py | utils.py | py | 254 | python | en | code | 25 | github-code | 90 |
5908474459 | # Problem description:
# https://github.com/HackBulgaria/Programming0-1/tree/master/week2/3-Simple-Algorithms
n = int(input('Enter n: '))
divisors = []
for i in range(1, n):
if n % i == 0:
divisors += [i]
sum_divisors = sum(divisors)
if sum_divisors == n:
print(f'{n} is a perfect numb... | keremidarski/python_playground | Programming 0/week 2/12_is_perfect.py | 12_is_perfect.py | py | 385 | python | en | code | 0 | github-code | 90 |
36845583340 | import numpy as np
import pandas as pd
import glob
import re
import os
from scipy import stats
import statsmodels.formula.api as smf
import statsmodels.api as sm
from sklearn import preprocessing,pipeline,linear_model,model_selection,metrics,multiclass,inspection
import pylab as plt
import seaborn as sns
from statanno... | aschalkamp/UKBBprodromalPD | analyses/4_survival_model/rsf_POPmodels.py | rsf_POPmodels.py | py | 10,162 | python | en | code | 8 | github-code | 90 |
1919468004 | ## space:o(n)
## time:o(n)
class Solution:
def isPalindrome(self, s: str) -> bool:
# create two pointers left and right for the string
l,r = 0 , len(s)-1
## both pointers should be in bound
while(l<r):
## check if pointers ... | mohdabdulrahman297/Leetcode | 0125-valid-palindrome/0125-valid-palindrome.py | 0125-valid-palindrome.py | py | 1,599 | python | en | code | 0 | github-code | 90 |
18308718100 | from pyrogram import Client, filters
from plugins.menu import keyboards
import utils
import db
@Client.on_message(filters.regex(pattern='^.*меню.*$') & filters.private & utils.check_user)
async def menu(_, message):
"""
Функция которая срабатывает когда пользователь хочет перейти в режим работы с меню
:pa... | tardigrada-agency/telegram_bot | plugins/menu/menu.py | menu.py | py | 1,437 | python | ru | code | 0 | github-code | 90 |
18114013289 | from enum import Enum
from queue import Queue
import collections
import sys
import math
BIG_NUM = 2000000000
MOD = 1000000007
EPS = 0.000000001
global n,k
global ws
def iSok(Pmax):
truck = 0
now = 0
for i in range(n):
if ws[i]>Pmax:
return False
if now+ws[i]>Pmax:
... | Aasthaengg/IBMdataset | Python_codes/p02270/s686057966.py | s686057966.py | py | 733 | python | en | code | 0 | github-code | 90 |
18445848999 | import sys
input = sys.stdin.readline
# A - Anti-Adjacency
N, K = map(int, input().split())
count = 0
for i in range(1, N + 1, 2):
count += 1
if count >= K:
print('YES')
else:
print('NO') | Aasthaengg/IBMdataset | Python_codes/p03129/s857292987.py | s857292987.py | py | 193 | python | en | code | 0 | github-code | 90 |
33121232686 | #this file stores standard roots for our website
from flask import Blueprint,render_template, request, flash, redirect, url_for
from flask_login import login_required, current_user
from website.models import Contract_employees, Non_contract_employees, User
from website import db
#define the file as blueprint of the... | leannesal/flask-app | src/website/views.py | views.py | py | 5,120 | python | en | code | 0 | github-code | 90 |
14607662691 | import pickle
from pandas import DataFrame
import numpy as np
import pandas as pd
import streamlit as st
import xgboost as xgb
from xgboost import XGBClassifier,XGBRegressor
from streamlit import beta_columns
from PIL import Image
import streamlit as st
#from sklearn.externals import joblib
import sqlite3
import pyodb... | Mohammadseif/st | stcopy5.py | stcopy5.py | py | 47,797 | python | fa | code | 0 | github-code | 90 |
36423552004 | """
ПРИМЕЧАНИЕ: Мне пришлось удалить строчки database, т.к при подключении
к локальному серверу MySQL, программа не могла найти базу данных под именем.
Необходимо было в UI MySQL Workbench создавать вручную базу данных (SCHEMAS).
Поэтому, код ниже подключается к серверу, создавая базу данных на нем,
и после коннектится... | BeTeLGeUse101/AppsSQL | Lesson_2/main.py | main.py | py | 6,752 | python | ru | code | 0 | github-code | 90 |
2818864125 | #Version1 - Basic program with one attempt
correct_num = 6
while True:
user_guess = int(input("What is your guess? "))
if user_guess == correct_num:
print("Your Answer is correct")
break
else:
print("Sorry your guess is incorrect")
break
# Version 2
#import ... | manasi561/number-guessing-game | number_guess.py | number_guess.py | py | 1,717 | python | en | code | 0 | github-code | 90 |
39328851620 | #####################################################
# Property by Your Engineering Solutions (Y.E.S.) #
# Engineers: Lorans Hirmez, Brandon Fong #
#####################################################
# How to test if a file/directory exists https://www.guru99.com/python-check-if-file-exists.html & http... | Dual-Power-Generation/DualPowerGeneration | MaxPowerTracker/MaxPower/Files.py | Files.py | py | 6,391 | python | en | code | 0 | github-code | 90 |
18026238589 | a = int(input())
ar = []
for i in range(a):
l = list(map(int,input().split(" ")))
ar.append(l)
ar.reverse()
count = 0
for r in ar:
x = r[0] + count
y = r[1]
m = x % y
if m != 0:
count += y - m
print(count) | Aasthaengg/IBMdataset | Python_codes/p03821/s094717840.py | s094717840.py | py | 237 | python | en | code | 0 | github-code | 90 |
10237087886 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from argparse import ArgumentParser
import codecs
import os
import random
import tempfile
import numpy as np
from prepare_dict import load_lexicon
from compare_lexicons import compare_lexicons
def create_tmp_file_name():
basedir = os.path.join(os.path.dirname(__fil... | nsu-ai-team/russian_g2p_neuro | apply.py | apply.py | py | 5,569 | python | en | code | 19 | github-code | 90 |
30759856537 | """
Implements all functionality of spline initialization using non-uniform rational basis splines (NURBS),
including Particle Swarm Optimization, interpolation functions and calculation of RMS-VIF from a given IC.
Pseudo-code is given in the Paper.
"""
from geomdl import NURBS
from geomdl import utilities
import numpy... | tumaer/SITE | SITE/Initialization_Creator.py | Initialization_Creator.py | py | 12,643 | python | en | code | 7 | github-code | 90 |
6319745867 | # Ultralytics YOLO ЁЯЪА, AGPL-3.0 license
import ast
import contextlib
import json
import platform
import zipfile
from collections import OrderedDict, namedtuple
from pathlib import Path
import cv2
import numpy as np
import torch
import torch.nn as nn
from PIL import Image
from ultralytics.utils import ARM64, LINUX,... | ultralytics/ultralytics | ultralytics/nn/autobackend.py | autobackend.py | py | 26,984 | python | en | code | 15,778 | github-code | 90 |
18109892209 | a = raw_input()
n, q = a.split(" ")
n = int(n)
q = int(q)
total = 0
queue = []
for i in range(n):
queue.append(raw_input())
while (len(queue) > 0):
b = queue.pop(0)
p, t = b.split(" ")
sa = int(t) - q
if sa > 0:
queue.append(p + " " + str(sa))
total += q
else:
total += int(t)
print (p + " " + str(total)) | Aasthaengg/IBMdataset | Python_codes/p02264/s605633819.py | s605633819.py | py | 320 | python | en | code | 0 | github-code | 90 |
27041776278 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Time : 2021/5/17 13:36
# @Author : yh
# @File : doulaoban.py
# @Software: PyCharm
# @Desc :
"""
"""
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Time : 2021/4/21 13:52
# @Author : yh
# @File : demo1.py
# @Software: PyCharm
# @Desc :
"""
https://a... | zhangxin302/pythonProject | yuanhang/qianduan.py | qianduan.py | py | 8,419 | python | en | code | 3 | github-code | 90 |
18531552399 | import sys
sr = lambda: sys.stdin.readline().rstrip()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))
A, B, C, K = lr()
if K%2 == 0:
answer = A - B
else:
answer = B - A
if answer > 10 ** 18:
answer = 'Unfair'
print(answer)
| Aasthaengg/IBMdataset | Python_codes/p03345/s060612963.py | s060612963.py | py | 256 | python | en | code | 0 | github-code | 90 |
1929606771 | #!/usr/bin/env python
# coding: utf-8
import requests
from lxml import etree
import pandas as pd
import time
from multiprocessing import Pool
import glob
NUM_PROCS = 20
years_range = range(10, 20)
start = ["20" + str(y).zfill(2) for y in years_range]
end = [str(y + 1).zfill(2) for y in years_range]
start_end_list =... | clementlefevre/berlin_grundschulen_2019_2021 | python/schools_data.py | schools_data.py | py | 4,109 | python | en | code | 0 | github-code | 90 |
18292946709 | import math
n = int(input())
p = list(map(int, input().split()))
q = list(map(int, input().split()))
import itertools
t=[i for i in range(1,n+1)]
a = list(itertools.permutations(t))
def num(b,t,n):
c = 0
for i in range(len(t)):
if list(t[i]) != b:
c += 1
else:
break
return(c)
x = num(... | Aasthaengg/IBMdataset | Python_codes/p02813/s373008145.py | s373008145.py | py | 357 | python | en | code | 0 | github-code | 90 |
1188882987 | #!/user/bin/env python
# -*- coding:utf-8 -*-
# Code created by gongfuture
# Create Time: 2023/3/10
# Create User: gongf
# This file is a part of Homework_test_environment
count = 0
five = 0
for i in range(1000, 10000):
a = str(i)
if a[0] == a[-1] and a[1] == a[-2]:
count += 1
print(i, end=' ')... | gongfuture/Homework_test_environment | Python/作业4/成品/1.以每行5个输出四位整数中所有的回文数。回文数是指正看反看都相等的数.py | 1.以每行5个输出四位整数中所有的回文数。回文数是指正看反看都相等的数.py | py | 427 | python | en | code | 5 | github-code | 90 |
40631355000 | """
6. Dados dois números inteiros positivos i e j, imprimir em ordem crescente os
N (lido) primeiros múltiplos de i ou de j ou de ambos.
"""
i = int(input("Digite o valor de i: "))
j = int(input("Digite o valor de j: "))
n = int(input("Digite o valor de n: "))
cont = 0
fator_1 = fator_2 = 0
if i < j:
primeiro = ... | fatecspmanha182/IAL-002-algoritmos_e_logica_de_programacao | Resolução-Exercícios-Parte1/ALP_Lista2-06.py | ALP_Lista2-06.py | py | 855 | python | pt | code | 0 | github-code | 90 |
25294933318 | # https://dodona.ugent.be/nl/courses/807/series/9108/activities/360836693
getallen = input('')
lijst = getallen.split()
lijst = list(map(int,lijst))
no_result = 0
i = 0
result=[]
x = True
for i in range(len(lijst)-1):
if x == True:
if (lijst[i] > 0 and lijst[i+1] > 0) or (lijst[i] < 0 and lijst[i+... | ronnyremork/dodona | goede_buren.py | goede_buren.py | py | 546 | python | nl | code | 0 | github-code | 90 |
22707381969 | import numpy as np
import matplotlib
import matplotlib.pyplot as plt
import astropy
from astropy.io import ascii
from scipy.interpolate import interp1d
data0=ascii.read('transmission_0.dat')
lam=10.*data0['col1']
klam=-2.5*np.log10(data0['col2'])
lam=lam[data0['col2'] != 0]
klam=klam[data0['col2'] != 0]
ascii.wri... | sdss/lvmetc_lco_script | database/sky/trans2klam.py | trans2klam.py | py | 854 | python | en | code | 2 | github-code | 90 |
30622230760 | def main():
# Simple try catch to prevent type mismatch
quit = True
while quit:
try:
n = int(input("Please enter a number: "))
n += 1
n -= 1
except ValueError:
print("You did not enter a number. Please try again")
else:
fiz... | sleddog/methods | projects/fizzbuzz/python/LoganShy/fizzbuzz.py | fizzbuzz.py | py | 1,153 | python | en | code | 7 | github-code | 90 |
10259595116 | import os, shutil
import numpy as np
import pandas as pd
from matplotlib import pyplot as plt
import matplotlib as mpl
import flopy
import pyemu
# completed PEST run dir - calibrated parameter set
cal_dir = 'master_glm'
cal_pst_name ='cal_reg1.pst'
par_file = cal_pst_name.replace('pst','14.par')
# flag to copy cali... | tracktools/case_study | pproc_pst.py | pproc_pst.py | py | 7,336 | python | en | code | 0 | github-code | 90 |
21146721978 | """initial
Revision ID: 45079e4d0040
Revises:
Create Date: 2014-12-07 22:53:45.581098
"""
# revision identifiers, used by Alembic.
revision = '45079e4d0040'
down_revision = None
branch_labels = None
depends_on = None
from alembic import op
import sqlalchemy as sa
from sqlalchemy.dialects import postgresql
def upg... | krishnatejak/renaissance_men | alembic/versions/45079e4d0040_initial.py | 45079e4d0040_initial.py | py | 1,784 | python | en | code | 0 | github-code | 90 |
23195337211 | import cat
import toys
class CatPerson(cat.Cat, toys.Toy):
"""Класс персоны КОТ"""
def __init__(self, name, sex, color, breed, nationality_voice):
super().__init__()
self.sex = cat.Cat.set_sex(self, sex)
self.color = cat.Cat.set_color(self, color)
self.breed = cat.Cat.set_breed... | Evgeny-iAD/oop2 | main.py | main.py | py | 2,364 | python | ru | code | 0 | github-code | 90 |
971210723 | import logging
import uuid
from app.utility.base_service import BaseService
from app.objects.c_operation import Operation
from app.objects.c_ability import AbilitySchema
from app.objects.c_adversary import Adversary, AdversarySchema
from app.objects.secondclass.c_executor import Executor, ExecutorSchema
from app.api.v2... | ingbuono99/attack-on-agent | app/attack_svc.py | attack_svc.py | py | 5,990 | python | en | code | 0 | github-code | 90 |
39891082987 | # -*- coding: utf-8 -*-
"""
Created on Tue Nov 20 22:49:03 2018
@author: Ricardo Nunes
"""
def pascal(n):
result=""
for linha in range(n):
for coluna in range(linha+1):
result=result+str(int(factorial(linha)/(factorial(coluna)*factorial(linha-coluna))))
... | TitanicThompson1/FPRO | Play/pascal.py | pascal.py | py | 659 | python | en | code | 0 | github-code | 90 |
29341589005 | import sys
from dataclasses import dataclass, field
from math import fabs, isnan, log
from typing import Callable, Dict, List, Union
import numpy as np
from scipy.integrate import simpson
@dataclass
class SignalingMetric(object):
"""
Signaling metric used for sensitivity analysis.
Attributes
-------... | okadalabipr/periodontitis | biomass/analysis/util.py | util.py | py | 2,942 | python | en | code | 0 | github-code | 90 |
27102613316 | import tkinter as tk
# Create the master object
master = tk.Tk()
#Width, height
master.minsize(400,150)
# Create the entry objects using master
e1 = tk.Entry(master)
e2 = tk.Entry(master)
# Pack them using grid
e1.grid(row=0, column=1, columnspan=1, ipadx=55)
e2.grid(row=1, column=1, column... | meloniemorrell/Python | python_225.py | python_225.py | py | 1,017 | python | en | code | 0 | github-code | 90 |
14274915076 | # -*- coding: utf-8 -*-
"""
Created on Wed Dec 15 09:28:55 2021
@author: workstation
"""
import pandas as pd
dataset=pd.read_csv("iris.csv")
dataset.describe()
x=dataset['sepal.length'].value_counts()
import matplotlib.pyplot as plt
plt.pie(x)
plt.show()
import matplotlib.pyplot... | elhossiny/AI-search-techniques-and-first-order-logic | untitled1.py | untitled1.py | py | 1,806 | python | en | code | 0 | github-code | 90 |
32147646370 | import json as js
from Elevator import Elevator
class Building:
def __init__(self, file):
with open(file, 'r') as f:
data = js.load(f)
self._minFloor = data['_minFloor']
self._maxFloor = data['_maxFloor']
self.elev = []
for line in data['_elevators']:
... | ShauliTaragin/Smart-Elevator | Building.py | Building.py | py | 1,132 | python | en | code | 0 | github-code | 90 |
9196332340 | import re
import sys
import numpy as np
import matplotlib.pyplot as plt
def parse_loss(fpath, epoch_num=None):
losses = []
loss_regex = r"Loss:\s+\d+\.\d+\s*\(\s*\d+\.\d+\)"
if epoch_num is None:
epoch_count = 0
iter_count = 0
with open(fpath, "r") as fin:
for line in fin:
... | SaltedFishLZ/torchstream | tools/plot_logs.py | plot_logs.py | py | 1,418 | python | en | code | 2 | github-code | 90 |
70306868136 | from flask import Flask,render_template,request
from keras.models import load_model
import joblib
app = Flask(__name__)
# 플라스크 앱 생성
@app.route('/',methods=['GET'])
def main():
return render_template('ozone/input.html')
@app.route('/result',methods=['POST'])
def result():
model = load_model('c:/workspac... | wonyounging/3rd_Part | kerasweb/ozone.py | ozone.py | py | 1,185 | python | ko | code | 0 | github-code | 90 |
18487425639 | import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
in_n = lambda: int(readline())
in_nn = lambda: map(int, readline().split())
in_nl = lambda: list(map(int, readline().split()))
in_na = lambda: map(int, read().split())
in_s = lambda: readline().rstrip().decode('utf-8')
def main():
N =... | Aasthaengg/IBMdataset | Python_codes/p03240/s372691529.py | s372691529.py | py | 1,021 | python | en | code | 0 | github-code | 90 |
41415567926 | from infill_modified_triangle_wave import infill_modified_triangle_wave
import fullcontrol as fc
# Airfoil Parameters
naca_nums = ['2412', '2412'] # NACA airfoil numbers (for NACA airfoil method)
num_points = 256 # Resolution of airfoil - higher values give better quality but slower performance and larger file size fo... | aapolipponen/fullcontrol-airfoil | src/parameters.py | parameters.py | py | 4,690 | python | en | code | 2 | github-code | 90 |
25369954730 | import gym
import random
import itertools
import matplotlib
import matplotlib.pyplot as plt
import matplotlib.style
import numpy as np
import pandas as pd
import sys
from collections import defaultdict
import plottings
matplotlib.style.use('ggplot')
import gym_Recsys1
import time
import sys
#sys.path.append(... | Nabzozifo/Recsys1 | gym_Recsys1/slateq2.py | slateq2.py | py | 9,065 | python | en | code | 1 | github-code | 90 |
12631578012 | import os
from bisect import bisect
import numpy as np
import pandas as pd
import scipy.stats
import random
import datetime
import pickle
import os
import pathlib
import rpy2.robjects as robjects
from rpy2.robjects.packages import importr
from rpy2.robjects.vectors import IntVector, FloatVector
from sklearn.model_sel... | milos-simic/statistical_classification | util.py | util.py | py | 21,392 | python | en | code | 0 | github-code | 90 |
18430427229 | n=int(input())
print(n*(n-1)//2-n//2)
if n%2:
wa=n
else:
wa=n+1
for i in range(1,n+1):
for ii in range(1,i):
if i+ii!=wa:
print(ii,i) | Aasthaengg/IBMdataset | Python_codes/p03090/s780762127.py | s780762127.py | py | 166 | python | en | code | 0 | github-code | 90 |
16252627437 | from django.shortcuts import render, redirect
from .models import Schools, SchoolData
from .forms import SchoolDataForm,SchoolForm
# Create your views here.
def home(request):
return render(request,'index.html')
def schooldata_list(request):
schooldatas = SchoolData.objects.all()
return render(request,'scho... | sdev3millions/schoolPPP | schoolppp/school/views.py | views.py | py | 2,616 | python | en | code | 1 | github-code | 90 |
3387462946 | #!/usr/bin/env python
from hippocampus_common.node import Node
import rospy
from std_msgs.msg import Float64
import threading
from mavros_msgs.msg import State
from depth_control.msg import DepthEKFStamped
from dynamic_reconfigure.server import Server
from gripper.cfg import DepthStabilizerConfig
class StabilizerNod... | DavidHahn97/gripper | nodes/depth_stabilizer.py | depth_stabilizer.py | py | 3,782 | python | en | code | 0 | github-code | 90 |
73552257898 | import functools
import itertools
import struct
from . import command
from . import zwave
class DeserializeError(Exception):
pass
#----------------------------------------------------------------------
@functools.singledispatch
def serialize(cmd):
return list(cmd.sig())
@serialize.register(command.Associat... | ahsparrow/zwave | zwave/serialize.py | serialize.py | py | 3,302 | python | en | code | 0 | github-code | 90 |
16268156658 | """Tests for the is_subset function in the sets module of the lists package"""
import pytest
from hypothesis import given
from hypothesis import settings
from hypothesis import Verbosity
from hypothesis.strategies import integers
from hypothesis.strategies import lists
from speedsurprises.lists import sets
@pytest... | Tada-Project/speed-surprises | tests/test_issubset.py | test_issubset.py | py | 2,673 | python | en | code | 3 | github-code | 90 |
20456448994 | __author__ = 'di_shen_sh@163.com'
from DataCenter import *
from norlib.graphics import *
def Test():
print("abcdefg")
exec("Test()")
datacenter = DataCenter("mongodb://localhost:27017/")
klinecol = datacenter.IF当月[300]
klines = klinecol.getdatas(20130101, 20140701)
pairs = [(i,k) for i, k in enumerate(klines... | norsd/PythonProjects | Quant/Test.py | Test.py | py | 814 | python | en | code | 0 | github-code | 90 |
17984793759 | from collections import Counter
s=input()
ch=set([c for c in s])
ans=101
for c in ch:
cur=s
cnt=0
while len(set([x for x in cur]))>1:
cnt+=1
tmp=''
for i in range(len(cur)-1):
if cur[i]==c or cur[i+1]==c:
tmp+=c
else:
tmp+=cur[... | Aasthaengg/IBMdataset | Python_codes/p03687/s741561677.py | s741561677.py | py | 371 | python | en | code | 0 | github-code | 90 |
26337741410 | # -*- coding: utf-8 -*-
""" Granite FW's XML -> WBXML encoder.
Notes
The latest WAP Binary XML Content Format (WBXML) specification can be
found from here: http://www.w3.org/TR/wbxml/
"""
# ============================================================================
# Module Setup
# Python l... | slimsymphony/astt | framework/interfaces/wbxml_encoder.py | wbxml_encoder.py | py | 11,510 | python | en | code | 3 | github-code | 90 |
12844833140 | import config
import os
from sqlalchemy.orm import sessionmaker
from sqlalchemy import create_engine
from api import elasticsearch
from api.models import NotificationConfig, NotificationConfigDetail
from api.schema import NotificationModel, NotificationConfigModel, NotificationConfigDetailModel
from api.email import se... | akash-cis/PROJECTS | socialai/WebApp-API-develop/notifications/data_service.py | data_service.py | py | 3,214 | python | en | code | 0 | github-code | 90 |
73138888298 | def estPrem(x):
if (x <= 1):
return False
pasDeFacteur = True
tested = x
candidateForFactor = 2
while(candidateForFactor <= tested/candidateForFactor and pasDeFacteur):
if(tested % candidateForFactor == 0):
pasDeFacteur = False
candidateForFactor += 1
... | AmdaUwU/Projet_Euler | python/#46.py | #46.py | py | 625 | python | en | code | 0 | github-code | 90 |
24998871765 | def longestWord(words: [str]) -> str:
words.sort(key=lambda x: (-len(x), x))
set_words = set(words)
def dfs(s: str, idx: int, wordCnt: int) -> bool:
n = len(s)
if idx >= n:
return wordCnt > 1
for i in range(idx, n):
substr = s[idx:i + 1]
if substr... | Lycorisophy/LeetCode_python | 中等难度/面试题 17.15. 最长单词.py | 面试题 17.15. 最长单词.py | py | 622 | python | en | code | 1 | github-code | 90 |
18473208989 | N, K = map(int, input().split())
H = []
for _ in range(N):
H.append(int(input()))
H = list(sorted(H))
r_min = 10 ** 10
for i in range(N-K+1):
n_min = H[i]
n_max = H[i+K-1]
r_min = min(r_min, n_max-n_min)
print(r_min)
| Aasthaengg/IBMdataset | Python_codes/p03208/s797595887.py | s797595887.py | py | 233 | python | en | code | 0 | github-code | 90 |
11564430728 | from __future__ import absolute_import, division, unicode_literals
import socket
from typing import Union
from .base import StatsClientBase, PipelineBase
class StatsClient(StatsClientBase):
"""A client for statsd."""
_maxudpsize: int
def __init__(
self,
host: str = "localhost",
... | Arun-chaitanya/posthog-vite | env/lib/python3.10/site-packages/statshog/client/udp.py | udp.py | py | 1,957 | python | en | code | 0 | github-code | 90 |
42198896008 | #+++++++++++++++++++++++++ STUDENT RECORD ++++++++++++++++++++++++++++++++++++++++++++++++
class StudentRecord:
def __init__(self,i,name):
self.studentId=i
self.studentName = name
def Get_Student_Id(self):
return self.studentId
def Set_Student_Id(self,i):
... | MehadBinNaveed/HashTable_Implementation | implementation_HashTable.py | implementation_HashTable.py | py | 7,555 | python | en | code | 0 | github-code | 90 |
5100845078 | from collections import deque
n=int(input())
a=[]
for i in range(n):
a.append(int(input()))
a.sort()
a=deque(a)
ans=0
big=a.pop()
small=a.popleft()
ans+=big-small
#print(ans,a,big,small)
pre_big=big
pre_small=small
checked_a=deque([small,big])
while(len(a)>1):
big=a.pop()
small=a.popleft()
ans+=pre_big... | WAT36/procon_work | procon_python/src/atcoder/corporate/C_Tenka1Beginner.py | C_Tenka1Beginner.py | py | 526 | python | en | code | 1 | github-code | 90 |
21827466829 | '''
A calculator
@author: Appu13
'''
a = float(input("Enter the first number "))
b = float(input("Enter the second number "))
ops = input("Enter the operation ")
if ops == '+':
print("Sum = ", (a+b))
elif ops == '-' :
print("Difference = ", (a-b))
elif ops == '*':
print("product = ", (a*b)... | Appu13/Python | Calculator.py | Calculator.py | py | 421 | python | en | code | 0 | github-code | 90 |
71507917737 | from tdw.controller import Controller
from tdw.tdw_utils import TDWUtils
# from tdw.collisions import Collisions
from tdw.output_data import OutputData, Bounds, Images
from tdw.librarian import ModelLibrarian
import tdw.output_data as output_data
# from tdw.collisions import Collisions
import random
import math
impo... | Maitreyapatel/CRIPP-VQA | dataset/recreate.py | recreate.py | py | 6,872 | python | en | code | 7 | github-code | 90 |
17653089777 | from odoo import fields, models, api, _
from collections import defaultdict
from odoo.exceptions import UserError
class SaleContractedOrder(models.Model):
_inherit = 'sale.contracted.order'
project_id = fields.Many2one('project.project',string='Project',)
job_order_number = fields.Char(string='Job Order ... | myat90thu/test4 | joborder_project_bpc/models/contract_sale.py | contract_sale.py | py | 6,283 | python | en | code | 0 | github-code | 90 |
18315265639 | n,m=map(int,input().split())
l=list(input())
l=l[::-1]
now=0
ans=[]
while now<n:
num=min(n-now,m)#進める最大
b=True
for i in range(num):
num1=num-i
if l[now+num1]!="1":
ans.append(str(num1))
now+=num1
b=False
break
if b:
now=n+1
if b:
print(-1)
else:
ans=ans[::-1]
print(" ".... | Aasthaengg/IBMdataset | Python_codes/p02852/s061919226.py | s061919226.py | py | 340 | python | en | code | 0 | github-code | 90 |
28932437319 | from mxnet import nd
from mxnet.gluon import nn
class MLP(nn.Block):
def __init__(self, prefix=None, params=None):
super().__init__(prefix, params)
with self.name_scope():
self.hidden = nn.Dense(256, activation="relu")
self.output = nn.Dense(10)
def forward(self, x):
... | whenSunSet/gluon_leanning | 模型构造.py | 模型构造.py | py | 2,425 | python | en | 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.