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
1789218275
# https://www.geeksforgeeks.org/fractional-knapsack-problem/ # Item Value DataClass class ItemValue: def __init__(self,weight,value): self.weight=weight self.value=value self.cost=self.value/self.weight class FractionalKnapSack: @staticmethod def getMaxValue(weights,values,capaci...
danish-faisal/Striver-s-SDE-Sheet
Greedy - Day 8/fractional-knapsack-problem.py
fractional-knapsack-problem.py
py
1,629
python
en
code
0
github-code
90
33633346819
from typing import Tuple, List import cv2 import dask import numpy as np from src.detection_helpers.detection_box import DetectionBox class IndexLoader: def __init__(self, confidence_threshold: float): self.classIDs = None self.confidences = None self.boxes = None self.confidence...
Reennon/Dask-Yolo
src/index_helpers/index_loader.py
index_loader.py
py
3,420
python
en
code
0
github-code
90
18012177959
N, A, B = map(int, input().split()) v = list(map(int, input().split())) v = sorted(v,reverse=True) # (合計, 個数) max_avg = (sum(v[:A]), A) t = v[A-1] num1 = v[:A].count(t) num2 = v[A:].count(t) fact = [0]*(N+1) ifact = [0]*(N+1) inv = [0]*(N+1) p=170141183460469231731687303715884105727 def combination(n,fact,ifact): ...
Aasthaengg/IBMdataset
Python_codes/p03776/s609599369.py
s609599369.py
py
1,041
python
en
code
0
github-code
90
42750222117
#!/usr/bin/env python import os import sys import coverage TOP_DIR = os.path.dirname(os.path.dirname(__file__)) BASE_DIR = os.path.join(TOP_DIR, 'tenant_extras') sys.path.insert(0, BASE_DIR) def runtests(args=None): test_dir = os.path.join(BASE_DIR, 'tests') import django from django.test.utils import ...
onepercentclub/django-tenant-extras
runtests.py
runtests.py
py
1,604
python
en
code
9
github-code
90
17948753139
n,m,k=map(int,input().split()) cnt=0 flag =0 for i in range(n+1): for j in range(m+1): cnt = (m*i) - (i*j) + (j*(n-i)) if cnt == k: flag=1 if flag: print("Yes") else: print("No")
Aasthaengg/IBMdataset
Python_codes/p03592/s037939015.py
s037939015.py
py
219
python
en
code
0
github-code
90
18113545229
n, k = map(int, input().split()) w = [int(input()) for _ in range(n)] left = 0 right = 100000*10000 while (right - left > 1): mid = (left + right)//2 s = 0 j = 1 for i in range(n): if mid < w[i]: j = 100000 break s += w[i] if s > mid: j += 1 ...
Aasthaengg/IBMdataset
Python_codes/p02270/s120531603.py
s120531603.py
py
426
python
en
code
0
github-code
90
19874440749
from django.contrib import admin from .models import Trainer # Register your models here. class TrainerAdmin(admin.ModelAdmin): list_display = ( 'name', 'types', 'description', 'price_per_hour', ) ordering = ('name',) admin.site.register(Trainer, TrainerAdmin)
aoshenye/Circuit-x-Fitness
trainers/admin.py
admin.py
py
318
python
en
code
0
github-code
90
11944947515
import heapq import sys input = sys.stdin.readline INF = int(1e9) node, edge = map(int, input().split()) graph = [[] for _ in range(node + 1)] distance = [INF] * (node + 1) start = 1 for _ in range(edge): a, b = map(int, input().split()) graph[a].append((b, 1)) graph[b].append((a, 1)) def dijkstra(star...
EcoFriendlyAppleSu/algo
algoStudy/최단거리/숨바꼭질.py
숨바꼭질.py
py
1,071
python
en
code
0
github-code
90
9141397236
#coding: utf-8 try: from urllib2 import urlopen except ImportError: from urllib.request import urlopen from bs4 import BeautifulSoup def treenit(bot, msg): print("/treenit was calld") chat_id = msg['chat']['id'] counter = 0 text = "" html = urlopen('http://hwarang.net/').rea...
Joukkue/JoukkueBot
code/treenit.py
treenit.py
py
1,848
python
en
code
1
github-code
90
18677342328
import json from .base import BaseTemplate from .common import Inputs, Outputs, DockerSpec, ExecutorSpec, GraphStorageVolumeSpec from argo.parser.parser import ObjectParser, ObjectDefinition as OD from ax.platform.annotations import Annotations class EnvVar(ObjectParser): def __init__(self): self.name ...
zhan849/argo
common/python/argo/template/v1/container.py
container.py
py
6,014
python
en
code
null
github-code
90
6100198756
from django.contrib.auth.decorators import login_required from django.shortcuts import render from .models import MultipleChoiceQuestion, Answer, QuizTaker # Global variables are used to pass generated questions and received answers from start_the_game # to game_result function. QUESTIONS, ANSWERS = [], [] # Create...
samveljanvelyan/Millionaire
Millionaire/QA/views.py
views.py
py
3,477
python
en
code
0
github-code
90
14035895124
from tkinter import * from tkinter import messagebox import tkinter; master = tkinter.Tk(); master.title("Wish Form"); master.geometry("300x200"); Label (master , text = "Enter Name:").grid(row=0); e1=Entry(master); e1.grid(row=0, column=1); def wish_click(): messagebox.showinfo("Message Title", "We...
yeloblu/Python
GUI/WishForm.py
WishForm.py
py
663
python
en
code
0
github-code
90
73358452778
""" Tests for management command """ from unittest import mock import django from django.core.management import call_command from django.test import override_settings from django.test.testcases import SimpleTestCase django.setup() @override_settings( INSTALLED_APPS=[ "dr_scaffold", ], ) class Comman...
Abdenasser/dr_scaffold
tests/test_command.py
test_command.py
py
1,011
python
en
code
149
github-code
90
33958019140
import math import time from selenium import webdriver from selenium.webdriver.common.alert import Alert link = "http://suninjuly.github.io/redirect_accept.html" def calc(x): return str(math.log(abs(12*math.sin(int(x))))) try: browser = webdriver.Chrome() browser.get(link) browser.find_element_by_...
TitovRoman/stepik_selenium
week_2/lesson3_step6.py
lesson3_step6.py
py
738
python
en
code
0
github-code
90
4669029982
#Name: Huan-Yun Chen #Course: CSCI 4140 #Date: 2/27/2018 #Description: midterm exam question1 import nltk #Question 1: universalTag=nltk.corpus.brown.tagged_words(tagset="universal") unsimplifiedTag=nltk.corpus.brown.tagged_words() ADVSet=[] resultSet=[] noDuplicate =[] totalNum=0 #Store ADV Set ADVSet =[word for wo...
oliver0616/my_work2
Natural Language Processing/NLTK/Midterm/question1/mt1.py
mt1.py
py
978
python
en
code
1
github-code
90
40990257331
''' Created on Feb 22, 2020 @author: boogie ''' from addon import Base from tinyxbmc import container from tinyxbmc import gui from tinyxbmc import net from tinyxbmc import const from tinyxbmc import mediaurl from liblivechannels import epg class Navi(Base): dropboxtoken = const.DB_TOKEN def cats(self): ...
boogieeeee/repository.boogie
plugin.video.livestreams/navi.py
navi.py
py
6,067
python
en
code
1
github-code
90
14081240451
from keras.layers import Dropout, Dense from keras.models import Model from sktime_dl.classifiers.deeplearning import CNNClassifier class CustomCNN(CNNClassifier): """Custom CNN Classifier inheriting from CNNClassifier. This class adds a dropout layer after the CNN layers to reduce overfitting and uses a...
nikolaiwest/2023-anomaly-detection-hicss
models/supervised/cnn.py
cnn.py
py
2,215
python
en
code
1
github-code
90
18174729194
import json class Person: def __init__(self, id,name, age): self.id = id self.name = name self.age = age def upload_data(self): new_person ={ "id": self.id, "name": self.name, "age": self.age } with open("practice.json",'a+') as...
Shwetha21031/python_learning
PYTHON/Practice/practiceJson.py
practiceJson.py
py
568
python
en
code
0
github-code
90
18514091609
import sys import numpy as np import math from functools import reduce sys.setrecursionlimit(10**6) n=int(input()) a=list(map(int,input().split())) b=1 for i in range(n): b*=a[i] #def lcm_base(x,y): # return (x*y)//math.gcd(x,y) #def lcm_list(numbers): # return reduce(lcm_base, numbers, 1) #c=lcm_list(a) ...
Aasthaengg/IBMdataset
Python_codes/p03294/s411352022.py
s411352022.py
py
545
python
en
code
0
github-code
90
18544593437
from collections import defaultdict from itertools import combinations def solution(orders, courses): answer = [] for course in courses: menu_cnt = defaultdict(int) for order in orders: for course_menu in list(combinations(order,course)): menu_cnt[''.join(sorted...
goldapple-ce/Algorithm
python/programmers/level2/메뉴리뉴얼.py
메뉴리뉴얼.py
py
716
python
en
code
0
github-code
90
71061845736
import os import pygame.image from pygame.sprite import Sprite, Group from src.settings import ASSETS class Bullet(Sprite): images = { "bullet": [], 'laser': [], } @classmethod def load_images(cls, b_type): if not cls.images[b_type]: cls.images[b_type] = [] ...
Joel-Edem/space_ranger
src/componnets/bullet.py
bullet.py
py
1,874
python
en
code
0
github-code
90
34131502615
import numpy as np import torch import torch.utils.model_zoo as model_zoo from torch import nn from torchvision.models.resnet import BasicBlock from Clinicadl.utils.network.cnn.resnet import ResNetDesigner, model_urls from Clinicadl.utils.network.network_utils import PadMaxPool2d, PadMaxPool3d from Clinicadl.utils.net...
nedleeds/OCTADeeplearning
Clinicadl/utils/network/cnn/models.py
models.py
py
4,665
python
en
code
1
github-code
90
35020162790
import pytest from mock import AsyncMock from evento import AsyncEvent class TestAsyncEvent: pytestmark = [pytest.mark.asyncio, pytest.mark.focus] async def test_fire(self): e = AsyncEvent[list[str]]() mock = AsyncMock() e += mock await e.fire(["p1", "p2"]) mock.asser...
markkorput/pyevento
tests/async_event_test.py
async_event_test.py
py
4,813
python
en
code
4
github-code
90
4014819371
import time import argparse import numpy as np from datetime import datetime from pathlib import Path from mosgim2.data.loader import LoaderTxt, LoaderHDF from mosgim2.data.tec_prepare import(process_data, combine_data, calculate_seed_mag_coord...
mfkiwl/mosgim2
prepare2.py
prepare2.py
py
2,503
python
en
code
0
github-code
90
18953309273
import torch import torchvision from torch import nn from torch.utils.tensorboard import SummaryWriter from srgan import Generator, Discriminator, GeneratorLoss, DiscriminatorLoss from utils import load_datasets, psnr, ssim from tqdm import tqdm import statistics import os import argparse def get_psnr(fake, real)...
oosky9/MachineLearning
SuperResolution/main.py
main.py
py
10,452
python
en
code
0
github-code
90
25754807572
#!/bin/python # compare a knows good troubleshooting script to the recorded script # output a quantified score of the ts steps import getopt # options for cli arguments import sys # # function: parse all the user inputs from the tslog => user_target_log[list] # ignore automated inputs, non related lines # open pat...
charlie-romeo/tseval
tseval.py
tseval.py
py
7,106
python
en
code
0
github-code
90
72965551978
""" Coursera exercise 3 | Part 1: One vs All""" import numpy as np import pandas as pd from matplotlib import pyplot as plt #from matplotlib import image as mpimg import scipy.io as sp def display_data(x_mat): """ Displays 100 random images""" n_max = 100 row_rand = np.random.randint(0,x_mat.shape[0]-1,n_...
anahid-a/ML-repo
ex3/ex3.py
ex3.py
py
3,735
python
en
code
0
github-code
90
18205817531
import streamlit as st import tensorflow as tf import numpy as np from PIL import Image import cv2 model_path=r'C:\Users\user\Desktop\Graduation\chest_model_balanced.h5' st.title("Chest Disease Identification Using CT Scan") upload = st.file_uploader('Upload a CT scan image') if upload is not None: file_bytes = n...
ME3ZA/graduate
streamlit.py
streamlit.py
py
945
python
en
code
0
github-code
90
9778768378
#!/usr/bin/env python import glob import PyAudio import wave from flask import Flask, redirect, url_for app = Flask(__name__) loud_devices = [u'Display Audio', u'Built-in Output' ] class WaveReader(object): def __init__(self, filename, size=1024): self.wav = wave.open(f...
Nubsiknut/PnP_Soundboard
new.py
new.py
py
3,180
python
en
code
0
github-code
90
6417567648
def charOffsetToTuples(charOffset): """ Splits a comma separated list of character offsets into tuples of integers. Keyword arguments: charOffset -- a string in the format "0-2,5-20" Returns: A list of tuples of two integers each """ tuples = [] ranges = charOffset.split(",") f...
arne-cl/ppi_graphkernel
src/ppi_graphkernel/utils/Range.py
Range.py
py
1,220
python
en
code
12
github-code
90
21066237023
""" Runs analysis according to specific demands """ from DataHandler import * from Graph import * from CurveFit import * from Equations import * from PIL import Image from ImageHandler import * import numpy as np from scipy.stats import linregress import os import matplotlib.pyplot as plt def calculate_lumen(csv_pat...
orengerc/polarization
Main.py
Main.py
py
2,394
python
en
code
0
github-code
90
34658304063
import PyPDF4 import re import io from googletrans import Translator from fpdf import FPDF import numpy as np def translateAndWriteToPDF(fileName,transToLang): # reading pdf file filePath = "filesToBeTranslated/"+fileName pdfFileObj = open(r''+filePath, 'rb') pdfReader = PyPDF4.PdfFileReader(pdfFileObj...
SushmitaShastri/pdfLanguageTranslator
translateAndWritePDF.py
translateAndWritePDF.py
py
1,248
python
en
code
2
github-code
90
18357891379
import sys input = lambda : sys.stdin.readline().rstrip() sys.setrecursionlimit(max(1000, 10**9)) write = lambda x: sys.stdout.write(x+"\n") n,m = list(map(int, input().split())) ab = [tuple(map(int, input().split())) for _ in range(n)] ans = 0 c = 0 ab.sort(key = lambda x: (x[0], -x[1])) from heapq import heappop as...
Aasthaengg/IBMdataset
Python_codes/p02948/s878136121.py
s878136121.py
py
1,207
python
en
code
0
github-code
90
73375358057
from bluetooth import * import numpy as np import matplotlib.pyplot as plt, mpld3 import threading mutex = threading.Lock() thread_list = [] data_dict = {} it = 0 def find_devs(): print("performing inquiry...") nearby_devices = discover_devices(lookup_names=True) print("found %d devices" % len(nearby_...
ihpar/BtoothEpuck
src/btc.py
btc.py
py
6,193
python
en
code
0
github-code
90
29307146244
import os import sys import gc import random import time import matplotlib.pyplot as plt import seaborn as sns import pandas as pd import numpy as np pd.options.display.max_rows = None pd.set_option('display.max_columns', 500) np.set_printoptions(threshold=sys.maxsize) np.set_printoptions(threshold=np.inf) os.environ[...
majidam20/MTP_AD_PaperMachine
augmentation/TestAuged_NN_RollingLbl2_CV.py
TestAuged_NN_RollingLbl2_CV.py
py
12,572
python
en
code
0
github-code
90
3753254458
# Make sure to have the server side running in V-REP: # in a child script of a V-REP scene, add following command # to be executed just once, at simulation start: # # simRemoteApi.start(19999) # # then start simulation, and run this program. # # IMPORTANT: for each successful call to simxStart, there # should be a cor...
somewhatdistracted/bipedal-AML
python/evolution.py
evolution.py
py
2,705
python
en
code
1
github-code
90
14231993591
#!/usr/bin/env python3 # -*- encoding: utf-8 -*- ''' @File : Lab1-Josephu.py @Time : 2022年4月10日10:14:49 @Author : Tianyi Wang @Version : 1.0 @Contact : tianyiwang58@gmail.com @Desc : Josephu's Problem for Lab1 solving by python @Problem : 设编号为1,2,… m的m个人围坐一圈,从1开始报数,数到n 的那个人出列,它的下一位又从1开始报数,数到n的那...
wtyqqq/Data_Structure_Lab
lab1/lab1.py
lab1.py
py
3,436
python
en
code
1
github-code
90
2312705812
import time from selenium import webdriver from selenium.webdriver.chrome.service import Service from selenium.webdriver.common.by import By driver = webdriver.Chrome(service=Service()) driver.get("http://the-internet.herokuapp.com/windows") driver.find_element(By.LINK_TEXT,"Click Here").click() tabs = driver.window...
MartianFlow/learning-python-selenium-basics
Notas/SELENIUM/TabsNavegador.py
TabsNavegador.py
py
816
python
es
code
1
github-code
90
18025393929
N = int(input()) A = list(map(int,(input().split()))) S = A #調べたいリスト result={} for i in range (0,len(S)): item = S[i] if item in result: result[item] = result[item]+1 else: result[item] = 1 a = [k for k, v in result.items()] h = [] for i in a: h.append(result[i]-1) h.sort(reverse=Tru...
Aasthaengg/IBMdataset
Python_codes/p03816/s006664397.py
s006664397.py
py
520
python
en
code
0
github-code
90
32682819256
import subprocess import os import sys import time import math import random from collections import Counter import numpy as np import json Max_iterations = 5 Wanted_ref_accuracy = 0.99 intToDNA = {'A': "A", 0: "A", 'C': "C", 1: "C", 'G': "G", 2: "G", 'T': "T", 3: "T"} def Get_possible_refs(ref, cluster): n = l...
duna-m/FogsaaBasedMSA
main.py
main.py
py
11,758
python
en
code
0
github-code
90
25320821880
#!/usr/bin/env python """ File name: my_bg_subtraction.py Author: skconan Date created: 2010/01/10 Python Version: 3.5 """ import constans as CONST import numpy as np import cv2 as cv from lib import * def neg_bg_subtraction(): # cap = cv.VideoCapture(CONST.PATH_VDO + r'\pool_gate_05.mp4') # c...
skconan/underwater_object_detection_old
source/sg.py
sg.py
py
3,350
python
en
code
0
github-code
90
14478142036
import torch from models import vgg19 import gdown from PIL import Image from torchvision import transforms import gradio as gr import cv2 import numpy as np import scipy import numpy import time pathOut = '/home/alpha/master_works/crowd/final_demo_data/angle_5/model_op_test_pre_train.mp4' video_path = '/home/alpha/m...
ziaatmasterworks/ai-hajj-crowd
roi_demo.py
roi_demo.py
py
4,798
python
en
code
0
github-code
90
37104364107
# -*- coding: utf-8 -*- import torch import torch.nn as nn import torch.optim as optim import numpy as np from scipy.stats import norm from abacus.simulator.model import Model class NNAR(Model): # TODO: MLE estimation of sigma. # TODO: MLE estimation of mu. def __init__(self, data, p): super().__i...
Sinbad-The-Sailor/Abacus
src/abacus/simulator/nnar.py
nnar.py
py
6,015
python
en
code
15
github-code
90
44575906435
""" Simple graph implementation compatible with BokehGraph class. """ import random class Graph: """Represent a graph as a dictionary of vertices mapping labels to edges.""" def __init__(self): self.vertices = {} def add_vertex(self, vertex_id): self.vertices[vertex_id] = Vertex(vertex_i...
munsu99/Graphs
projects/graph/src/graph.py
graph.py
py
1,165
python
en
code
null
github-code
90
39496161397
from django.template import Context, Template, TemplateSyntaxError from django.test import TestCase def render(template: str, data: dict[str, object] = None) -> str: """Convenience function for rendering templates""" data = data or {} return Template("{% load components slot_tags %} " + template).render( ...
nwjlyons/django_slots
tests/test_django_slots.py
test_django_slots.py
py
1,895
python
en
code
11
github-code
90
29703558182
""" 客户端:1.连接服务器(ip,port) 2.下载文件的名字 服务器接收到客户端需要下载的文件名字,搜索文件,传给客户端 客户端写入到自己的文件中. """ # 1. 输入服务器ip,端口 # 2. 建立socket 连接服务器 # 3. 输入文件名 # 4. 发送文件名给服务器 # 5. 使用socket接收来自服务器的数据(保存在文件中) # 6.如果收到b'',说明服务器断开连接-已经下载好 # 7.关闭socket import socket server_ip = input('输入server的ip:') server_port = int(input('输入server的port:')) cli...
Bngzifei/PythonNotes
学习路线/2.python进阶/day04/05-文件下载器-客户端.py
05-文件下载器-客户端.py
py
1,362
python
zh
code
1
github-code
90
11634747396
from airflow.utils.edgemodifier import Label from datetime import datetime, timedelta from textwrap import dedent from airflow.operators.bash import BashOperator from airflow.operators.python import PythonOperator from airflow import DAG from airflow.models import Variable import pandas as pd import sqlite3 # These ar...
DamodaraBarbosa/lh_desafio_engenharia_de_dados
tasks_desafio.py
tasks_desafio.py
py
3,535
python
en
code
0
github-code
90
41870342096
import math from arithmetic import * def swap(a,b): return b,a def ojld(a,b): #最终结果:gcd = m1 * aa + m2 *b flag=0 if a<b: flag=1 a,b=swap(a,b) aa=a bb=b #保存原来的数 #处理特殊情况,a = k*b。 if mod(a,b) == 0: print("gcd("+str(hex(aa))+","+str(hex(bb))+")="+str(hex(b)...
0xdaidai/crypto-homework
2/ojld.py
ojld.py
py
1,627
python
en
code
0
github-code
90
33951068176
#!/usr/bin/env python3 # -*- coding: utf-8 -*- ''' Author: Hao-Kai Zhang <zhk20@tsinghua.mails.edu.cn> Creation Date: 2020-12-20 14:00 Description: EasyMPS project. <data_process.py> contains functions as primary tools to process data. ''' import numpy as np def SvdTrunc(mat, D_trunc=None, if_normalize=False): '...
Haokai-Zhang/EasyMPS
DataToolBox/data_process.py
data_process.py
py
12,336
python
en
code
65
github-code
90
33625752943
#!/usr/bin/env python import pyglet from pyglet import * class Entity(object): def __init__(self, id, size, x, y, rot): self.id = id self.size = size self.x = x self.y = y self.rot = rot def draw(self): glLoadIdentity() glTranslatef(self.x, self.y, 0.0...
jaredly/babytux
entity.py
entity.py
py
655
python
en
code
12
github-code
90
23221900808
import cv2 import sys import os import time import numpy as np from argparse import ArgumentParser pro_dir = os.path.abspath(os.path.dirname(os.path.dirname(__file__))) sys.path.append(pro_dir) from lib.pose import PoseLandmarkTRT from lib.utils.video import VideoWriter parser = ArgumentParser() parser.add_argument...
Daming-TF/Mediapipe-hands
tools/pose_demo_trt.py
pose_demo_trt.py
py
5,919
python
en
code
3
github-code
90
28138263167
import discord from discord.ext import commands from asyncio import TimeoutError from configparser import ConfigParser from functools import wraps import asyncio def int_to_emoji(value: int): if value == 0: return "0️⃣" elif value == 1: return "1️⃣" elif value == 2: return "2️⃣" elif value == 3: return...
timraay/Seasonal
utils.py
utils.py
py
6,282
python
en
code
1
github-code
90
8381100868
#!/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 = ["ijson", "numpy", "pandas", "tqdm", "scikit-learn", "matplotl...
robachkaya/LrnXPAnaToolbox
setup.py
setup.py
py
1,775
python
en
code
0
github-code
90
38486908364
import os import time import signal import sys import struct import serial import serial.tools.list_ports from datetime import datetime import board import socket from digitalio import DigitalInOut, Direction, Pull from subprocess import Popen, DEVNULL, PIPE, run import threading import red_cap import which_or #MLFRA ...
patnatha/MLFRA_RASPI
client_32.py
client_32.py
py
10,720
python
en
code
0
github-code
90
39871249617
# -*- coding: utf-8 -*- """ Created on Mon Apr 2 14:57:32 2018 @author: Navneet """ #camelcaseing | https://www.hackerrank.com/challenges/camelcase/problem stringValue ='singleword' count = 0 for i in stringValue: if(i.isupper()): count = count + 1 if count == 0: print(0) else: print(count + 1) ...
NavneetPrakashSingh/Getting-Started-With-Python
HackerRankPython-CamelCase.py
HackerRankPython-CamelCase.py
py
327
python
en
code
0
github-code
90
2646462027
import argparse import math import os import random import sys import time import chainer import chainer.functions as cf import cupy as cp import matplotlib.pyplot as plt import numpy as np from chainer.backends import cuda from chainer.training import extensions from multi_process_updater import * import chainerx imp...
K6L6/viewpoint-optimization
GQNDocker/chainer-gqn/train_mGPU.py
train_mGPU.py
py
12,941
python
en
code
0
github-code
90
41281538677
from config import * import stg @bot.message_handler(commands=['start']) def start_msg(message): chat_id = message.chat.id if message.chat.type == "private": if Lang(chat_id).get() != "None": stg.start_msg(chat_id) else: stg.lang_set(chat_id) @bot.message_handler(cont...
ispining/publicDBseller
main.py
main.py
py
3,335
python
en
code
1
github-code
90
18259004289
from collections import deque import sys input=sys.stdin.readline S=input().rstrip() string = deque([S[i] for i in range(len(S))]) reverse = False for _ in range(int(input())): q = input().rstrip().split() if q[0] == "1": reverse = not reverse else: if q[1] == "1": if reve...
Aasthaengg/IBMdataset
Python_codes/p02756/s339649885.py
s339649885.py
py
638
python
en
code
0
github-code
90
35364359207
# Utils file for HUGEPAGES import sys import logging import math import subprocess import time import pytest sys.path.insert(0, "OSP_test_automation/osp_api_and_common_utils") from volume import Cinder from nova import Nova import common_utils def get_possible_hugepage_instances(compute_ip, flavor_ram): output = c...
tayseer619/openstack
TestCases/Hugepage/hpg_utils.py
hpg_utils.py
py
3,745
python
en
code
1
github-code
90
43033263987
__author__ = "Kaustav Bhattacharya" __credits__ = "Kaustav Bhattacharya" __maintainer__ = "Kaustav Bhattacharya" __email__ = "kaustavofficial1808@gmail.com" # Problem statement #Sol - write down the solution in formal language from typing import List class Solution: def findMaxConsecutiveOnes(self, nums: List...
kaustav1808/competitive-programming
StriverCPSheet/Arrays/Easy/MaxConsucativeOne.py
MaxConsucativeOne.py
py
1,147
python
en
code
0
github-code
90
34562497104
from __future__ import absolute_import from __future__ import division from __future__ import print_function from __future__ import unicode_literals from caffe2.python import core class Regularizer(object): def __init__(self): pass ''' Adds regularization to train_net for given parameter. Its f...
facebookarchive/AICamera-Style-Transfer
app/src/main/cpp/caffe2/python/regularizer.py
regularizer.py
py
1,691
python
en
code
81
github-code
90
71126541096
""" Given a list of track data, return the IDs of active tracks. The list may contain duplicate tracks. [ { 'id': 1, 'name': 'In Arms', 'active': True, }, { 'id': 2, 'name': 'Deep Dip', 'active': False, }, ...
karinamzalez/beatport_coding_challenge
python/challenges/active_tracks.py
active_tracks.py
py
771
python
en
code
0
github-code
90
39561797548
def longestCommonPrefix( strs) -> str: smallest=0 for i in range(len(strs)): if len(strs[smallest])>len(strs[i]): smallest=i length=len(strs[smallest]) m=None if length==0: return '' else: for j in range(le...
bre01/studypython
leetcode/testmost.py
testmost.py
py
550
python
en
code
0
github-code
90
12754384577
from flask import Flask from flask_restful import Api,Resource app = Flask(__name__) api = Api(app) users = {"Tim" : {"age":20, "gender": "male"}, "Bill" : {"age":30, "gender": "male"}, "Jam" : {"age":24, "gender": "male"}, "Lisa" : {"age":56, "gender": "female"} } class User(Re...
Locchuong96/backend
Flask/flask_restapi10/main.py
main.py
py
488
python
en
code
3
github-code
90
17251483618
import logging import requests from netmonitor.notifiers.terminal import Terminal class Pushover(Terminal): def __init__(self, user: str, token: str, title: str) -> None: super().__init__(title=title) self._user = user self._token = token self._logger = logging.getLogger(self.__c...
pseudorandomuser/netmonitor
netmonitor/notifiers/pushover.py
pushover.py
py
902
python
en
code
0
github-code
90
5969370604
import pygame import random import math import csv,os class Enemy(pygame.sprite.Sprite): def __init__(self,color, height, width): super().__init__() self.height = height self.width = width self.image = pygame.Surface([35, 35]) self.image.fill(color) self.rect = self....
DenizzG/A-level-BTD
Problem - X wont get incremented because if wont run/enemy_main.py
enemy_main.py
py
3,024
python
en
code
0
github-code
90
18487807463
# 给你一个数组 points 和一个整数 k 。数组中每个元素都表示二维平面上的点的坐标,并按照横坐标 x 的值从小到大排序。也就是说 points[i] = # [xi, yi] ,并且在 1 <= i < j <= points.length 的前提下, xi < xj 总成立。 # # 请你找出 yi + yj + |xi - xj| 的 最大值,其中 |xi - xj| <= k 且 1 <= i < j <= points. # length。 # # 题目测试数据保证至少存在一对能够满足 |xi - xj| <= k 的点。 # # # # 示例 1: # # 输入:points = [...
comeonboi/algorithm-practise
loong's code/leetcode/editor/cn/[1499]满足不等式的最大值.py
[1499]满足不等式的最大值.py
py
1,965
python
zh
code
5
github-code
90
21794554600
if step == 'UPSAMPLE': filename = '' #@param{type:'string'} choice = 1 #@param{type:'number'} choice -= 1 cut_from_seconds = 0 #@param{type:'number'} if filename: zs = t.load(f'{hps.name}/{filename}.zs') else: assert zs is not None, 'No filename given and no zs loaded' print(f'Loaded zs of ...
vzakharov/jukebox-webui
legacy/7_upsample.py
7_upsample.py
py
2,597
python
en
code
80
github-code
90
18809843582
from uuid import uuid1 import requests class BlahajWrapper: def __init__(self, url): self.base_url = url self.headers = { "content-type": "application/json" } def create_unit(self, name, code, level, semesters, academic_unit, cp, desc): location = "/units" ...
chriswuaus/2022SYNCSHACK
backend/scraper/blahaj_wrapper.py
blahaj_wrapper.py
py
3,013
python
en
code
0
github-code
90
18015828289
sel=4 #ICC-D3-J if sel==1: print('Judgement') #ARC030-A if sel==2: N=int(input()) K=int(input()) if 2*K-1<N: print('YES') else: print('NO') #AGC004-A if sel==3: A,B,C=map(int,input().split()) ans=10**19 whole=A*B*C for a in range(A//2,A//2+2): ans=min(ans,abs(wh...
Aasthaengg/IBMdataset
Python_codes/p03786/s145584846.py
s145584846.py
py
1,442
python
ja
code
0
github-code
90
42093907841
# https://www.acmicpc.net/problem/2252 import sys from collections import deque input = sys.stdin.readline N, M = map(int, input().split()) q = [[] for _ in range(N+1)] degree = {i:0 for i in range(1, N+1)} for _ in range(M): a, b = map(int, input().split()) q[a].append(b) degree[b] += 1 dq = deque([]) r...
GreenClothes/BAEKJOON
coding_test/PART2/2252.py
2252.py
py
561
python
en
code
0
github-code
90
25929079301
from __future__ import absolute_import, unicode_literals from anyjson import loads from django import forms from django.conf import settings from django.contrib import admin from django.contrib.admin import helpers from django.contrib.admin.views import main as main_views from django.forms.widgets import Select from ...
celery/django-celery
djcelery/admin.py
admin.py
py
12,297
python
en
code
1,508
github-code
90
72201280618
# Easy # Given the root of a binary tree, return the postorder traversal of its nodes' values. # # # # Example 1: # Input: root = [1,null,2,3] # Output: [3,2,1] # Constraints: # # The number of the nodes in the tree is in the range [0, 100]. # -100 <= Node.val <= 100 # Definition for a binary tree node. # class Tree...
ArmanTursun/coding_questions
LeetCode/Easy/145. Binary Tree Postorder Traversal/145. Binary Tree Postorder Traversal.py
145. Binary Tree Postorder Traversal.py
py
1,737
python
en
code
0
github-code
90
25109395792
import sys numlist = list() while (True): inp = input('Enter a number: ') if inp == 'done': break try: value = float(inp) except: print('Please enter a number') sys.exit() numlist.append(value) average = sum(numlist) / len(numlist) print('Average:', average) print('Maxim...
randompythonstudent/learning-python
chapters/chapter 8/chapter8_exercise3.py
chapter8_exercise3.py
py
370
python
en
code
1
github-code
90
32452853689
from sys import stdin import sys stdin = open("input.txt", "r") num = int(stdin.readline()) cost_ary = [list(map(int, stdin.readline().split(' '))) for _ in range(num)] """ 의사 코드 비트마스킹으로 방문기록을 찍어놓은걸 잠시 비트맵이라고 편하게 부르자. check[넘버][비트맵] = 남은 방문을 하는 것의 최소 비용 dfs(현재 넘버, 비트맵) -> 남은 방문장소를 들리는데의 최소비용을 출력...
choekko/algorithm
Python/inJungle/4주차/2098(외판원 순회).py
2098(외판원 순회).py
py
1,879
python
ko
code
0
github-code
90
18472786659
N, K = map(int,input().split()) H = [] min_dif = 1000000000000000000000000 for n in range(N): h = int(input()) H.append(h) H.sort() for i in range(N-K+1): dif = H[i+K-1] - H[i] if dif < min_dif: min_dif = dif print(min_dif)
Aasthaengg/IBMdataset
Python_codes/p03208/s305847332.py
s305847332.py
py
243
python
en
code
0
github-code
90
18120781329
import enum class Direction(enum.Enum): N = "N" E = "E" W = "W" S = "S" @classmethod def value_of(cls, value): return [v for v in cls if v.value == value][0] class Dice: def __init__(self, *value_list): self.__value_list = list(value_list) def rotate(self, direction):...
Aasthaengg/IBMdataset
Python_codes/p02383/s103358586.py
s103358586.py
py
908
python
en
code
0
github-code
90
18216365099
mod = 998244353 MAX = 2*10**5 + 100 inv=[0]*(MAX+1) inv[1]=1 for i in range(2,MAX+1): inv[i]=-(mod//i)*inv[mod%i]%mod g1=[1,1] g2=[1,1] for i in range(2,MAX+1): num_1=g1[-1]*i%mod g1.append(num_1) g2.append(g2[-1]*inv[i]%mod) def cmb(n,r): return g1[n]*g2[r]*g2[n-r]%mod N, M, K = map(int,i...
Aasthaengg/IBMdataset
Python_codes/p02685/s540668154.py
s540668154.py
py
493
python
en
code
0
github-code
90
2877872034
# -*- coding: utf-8 -*- import numpy as np import matplotlib.pyplot as plt def sigmoid(inX): return 1.0 / (1 + np.exp(-inX)) # return np.exp(inX) / (1 + np.exp(inX)) np.random.seed(666) def gradAscent(X_train, y_train, lr = 1e-3, loops = 500): y_train = y_train.reshape([-1,1]) W = np.random.random([X_...
windmissing/MachineLearningInAction
逻辑回归/logRegres.py
logRegres.py
py
1,916
python
en
code
15
github-code
90
70451985257
import glob import os import pandas as pd import psycopg2 from sql_queries import * def process_song_file(cur, filepath): """ Populate song and artist tables using given song data/JSON files. """ # open song file df = pd.read_json(filepath, lines=True) # insert song record song_data = l...
v-dev/udacity-data-engineering-projects
projects/1_data-modeling-postgres/etl.py
etl.py
py
4,049
python
en
code
0
github-code
90
1962126025
import tensorflow as tf class GaussianBiLSTM(object): """ Approximate the posterior distribution of a latent variable given an entity pair and context, i.e. q(u|x,y,c). Parameters ---------- max_len : int The maximum length of the contexts. emb_dim : int The dimensionality of ...
BenevolentAI/RELVM
models/unsup/recognition/__init__.py
__init__.py
py
4,429
python
en
code
14
github-code
90
39129288509
import cv2 import numpy as np img = cv2.imread('../img/shapes_donut.png') img2 = img.copy() imgray = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY) ret, imthres = cv2.threshold(imgray, 127, 255, cv2.THRESH_BINARY_INV) im2, contour, hierarchy = cv2.findContours(imthres, cv2.RETR_EXTERNAL, \ ...
YeonwooSung/ai_book
CV/OpenCV/segmentation/cntr_hierarchy.py
cntr_hierarchy.py
py
1,004
python
en
code
17
github-code
90
33377005887
#!/usr/bin/env python3 """Sample: Use only the renderer with the default map. Press the arrow keys to move agent 1. Press the "S" key to take the "STAND" action of agent 1. """ # Third-party modules import gym # User-defined modules import pygame_rl.scenario.gridworld.renderer as renderer def main(): # Create...
sc420/pygame-rl
sample/gridworld/renderer.py
renderer.py
py
749
python
en
code
9
github-code
90
17945465959
from sys import stdin def input(): return stdin.readline().strip() n, k = map(int, input().split()) xy = [] for _ in range(n): i, j = map(int, input().split()) xy.append((i, j)) xy.sort() # decide left, right, down ans = 10 ** 19 for left in range(n-k+1): for right in range(left+k-1, n): hor...
Aasthaengg/IBMdataset
Python_codes/p03576/s943522147.py
s943522147.py
py
682
python
en
code
0
github-code
90
33455336147
from PIL import Image, ImageDraw, ImageEnhance, ImageFont WIDTH = 2800 HEIGHT = int(WIDTH * 0.7) def total_width(arr): """ Oblicza szerokosc przyszłego obrazu :param arr: :return: """ # total = [] # for w in arr: # if w is not None: # total.append(w.width) # return...
anir001/SignalSeeker
util/img_procces.py
img_procces.py
py
2,463
python
en
code
0
github-code
90
71388858858
from selenium import webdriver import time dr = webdriver.Firefox() dr.get("http://www.facebook.com") el1 = dr.find_elements_by_css_selector("input[name='sex'][type='radio']") for i in el1: st = i.get_attribute("value") print(st) if st=="2": print("its equal") i.click() ...
Zafarhussain87/Selenium-with-Python
Basic Scripts/radioBtn_checkBox.py
radioBtn_checkBox.py
py
344
python
en
code
0
github-code
90
18015510869
N,C,K = map(int,input().split()) T = sorted([int(input()) for _ in range(N)]) ans = 1 count = 0 time = 0 start = -1 for i in range(N): if start == -1: start = i if i != N-1: if T[i+1] > T[start] + K or i+1 -start == C: ans += 1 start = -1 print(ans)
Aasthaengg/IBMdataset
Python_codes/p03785/s759662182.py
s759662182.py
py
277
python
en
code
0
github-code
90
74004099816
# # Task 1 school = {"9а": 23, "9б": 28, "9в": 27, "9м": 22, "9ф": 26, "9у": 31, "9л": 32} school["9в"] = 35 school["9я"] = 41 del school["9м"] print({sum(school.values())}) print(school) # # Task 2 synonyms={"чистый":"опрятный", "грязный":"запачканный", "магия":"волшебство"} search=input("Введите ...
AlenaKunshtel91/Group_155
Task #11.py
Task #11.py
py
936
python
en
code
0
github-code
90
2861767085
class FindFirstAndLastPosition: def search_range(self, nums: [int], target: int) -> [int]: # 这道题类似于自己实现 C++ 里的 upperBound 和 lowerBound 函数 left, right = 0, len(nums) - 1 if right == -1: return [-1, -1] elif right == 0: if nums[0] is not target: ...
Teayyyy/LeetCodeStudy_Python_Algorithm
LeetCode101_Google/Half_Interval_Search/Find_First_Last_Position.py
Find_First_Last_Position.py
py
1,520
python
en
code
0
github-code
90
18171797023
import numpy as np import random def get_ewkm(data, cluster_num, lamda): """ Cluster all abstractions by EWKM :param data: abstract set :param cluster_num: integer :param lamda: real number :return: cluster_labels: cluster labels that abstracts belong to, cluster_center...
qlcai/AdaPDTW-KMLMNN
code/ewkm.py
ewkm.py
py
3,929
python
en
code
0
github-code
90
15731098309
import os from glob import glob class Config(object): # Overwrite env vars with a secret if available for var in glob('/run/secrets/*'): k = var.split('/')[-1].upper() v = open(var).read().rstrip('\n') os.environ[k] = v # print(f'export {k}={v}') SECRET_KEY = os.getenv('FL...
Howest-AI-Engineer-Essentials/2022-2023-ai-engineer-essentials-git-labo
web/webapp/config.py
config.py
py
513
python
en
code
0
github-code
90
18407137209
N, M, *X = map(int, open(0).read().split()) class UnionFind: def __init__(self, n=0): self.d = [-1]*n self.u = n def root(self, x): if self.d[x] < 0: return x self.d[x] = self.root(self.d[x]) return self.d[x] def unite(self, x, y): x, y = self....
Aasthaengg/IBMdataset
Python_codes/p03045/s928097080.py
s928097080.py
py
797
python
en
code
0
github-code
90
7458635459
from flask import Flask, render_template from flask_login import LoginManager from flaskext.markdown import Markdown from pony.orm import db_session, desc from blueprints.authorization import authorization_blueprint from blueprints.character import character_blueprint from blueprints.custom_page import custom_pages_bl...
nekonungstvo/mainsite
app.py
app.py
py
2,003
python
en
code
0
github-code
90
1896312557
import os import sys import re import importlib import glob import typing dirname = os.path.dirname(os.path.abspath(__file__)) project = os.path.dirname(dirname) if project not in sys.path: sys.path.insert(0, project) from engine import Engine, PipeEngine # noqa from engine import UCCIEngine # noqa IGNORED = [...
StevenBaby/chess
src/engines/__init__.py
__init__.py
py
1,140
python
en
code
27
github-code
90
41133760918
import numpy from curvefit.core.utils import sizes_to_indices def unzip_x(x, num_groups, num_fe): """ {begin_markdown unzip_x} {spell_markdown params} # `curvefit.core.effects2params.unzip_x` ## Extract Fixed and Random Effects from Single Vector Form ## Syntax ```python fe, re = cu...
ihmeuw-msca/CurveFit
src/curvefit/core/effects2params.py
effects2params.py
py
6,496
python
en
code
192
github-code
90
24552955917
from helper import * @EUDFunc def f1(a): ret = EUDVariable(0) if EUDIf()(a == 0): ret << 1234 if EUDElse()(): ret << 5678 EUDEndIf() return ret @EUDFunc def f2(a): if EUDIf()(a == 0): EUDReturn(1234) if EUDElseIf()(a == 1): EUDReturn(5678) EUDEndIf() ...
phu54321/eudplib
tests/unittests/testmultiret.py
testmultiret.py
py
544
python
en
code
13
github-code
90
17204594151
import tkinter as tk from turtle import back, bgcolor import numpy as np import pandas as pd import matplotlib.pyplot as plt from matplotlib.backends.backend_tkagg import (FigureCanvasTkAgg, NavigationToolbar2Tk) import ts_config as cf import tkinter.ttk as ttk from tkinter.filedialog import askopenfile class UpperR...
wregann/table-summarizer
table_summarizer_main.py
table_summarizer_main.py
py
7,018
python
en
code
0
github-code
90
18289038139
from collections import deque import copy H,W=map(int,input().split()) S=[[x for x in input()] for _ in range(H)] start_list=[] length=[[-1]*W for _ in range(H)] ans=0 for i in range(H): for j in range(W): if S[i][j]=='.': start_list.append((i,j)) for start in start_list: h,w=start d=deque([(h,w)]) ...
Aasthaengg/IBMdataset
Python_codes/p02803/s548025758.py
s548025758.py
py
996
python
en
code
0
github-code
90
73559661415
class Computer: def __init__(self, instructions, accValue, instructionIndex): self.instructions = instructions self.accValue = accValue self.instructionIndex = instructionIndex def acc(self, value): self.accValue += value self.instructionIndex += 1 def jmp(self, va...
mikeconroy/advent-of-code-20
day8/day8.py
day8.py
py
2,615
python
en
code
0
github-code
90
69859493736
from django.shortcuts import render from django.http import HttpResponseRedirect from .forms import LaboratorioForm from laboratorio.models import Laboratorio # Create your views here. def v_list(request): consulta = Laboratorio.objects.all() # if 'num_visits' in request.session: # num = request.sessi...
diazalejandra/M7-Final-Datos-Django
laboratorio/views.py
views.py
py
2,112
python
en
code
0
github-code
90