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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
71957180137 | """
Sensor for checking the status of Hue sensors.
For more details about this platform, please refer to the documentation at
https://home-assistant.io/components/sensor.hue/
"""
import asyncio
import logging
from datetime import timedelta
import requests
import voluptuous as vol
import homeassistant.helpers.config_... | eavanvalkenburg/home-config | custom_components/sensor/hue.py | hue.py | py | 11,946 | python | en | code | 5 | github-code | 90 |
12671699288 | import time
import datetime
import requests
import threading
import queue
import atexit
from pynput import keyboard
from apscheduler.schedulers.background import BackgroundScheduler
#globals
last_adjustment_time = 0
adjustment_lock = threading.Lock()
volume_adjustments = []
click_timestamps = []
task_queue = queu... | krazykyleman/Spotify-Auto-Volume-Adjust | spotify_auto_volume.py | spotify_auto_volume.py | py | 7,319 | python | en | code | 0 | github-code | 90 |
18678692708 | import copy
import json
import logging
import time
from retrying import retry
from requests.exceptions import HTTPError
from ax.devops.axdb.constants import AxdbConstants
from ax.devops.axrequests.axrequests import AxRequests
from ax.exceptions import AXException, AXIllegalArgumentException
from ax.devops.settings imp... | zhan849/argo | devops/src/ax/devops/axdb/axdb_client.py | axdb_client.py | py | 54,731 | python | en | code | null | github-code | 90 |
23738975367 | #!/bin/env python3
#-*- coding=utf-8 -*-
import numpy as np
from scipy.special import expit
from sklearn.metrics import log_loss
#ProbGenerative class for impletement of probpabilstic generative model
class ProbGenerative(object):
#initialize
def __init__(self, random_state=False, n_features=100):
np.... | kunxianhuang/ML_hand | ProbGenerative.py | ProbGenerative.py | py | 4,222 | python | en | code | 0 | github-code | 90 |
31563488653 | import pyrtl
from ift.gates import *
from ift.full_adder import *
from ift.multiplier import *
from ift.comparator import *
BITMAX = 32
def simulate_gates(op, a_inp, b_inp, a_t_inp, b_t_inp):
a, b = pyrtl.Input(BITMAX, 'a'), pyrtl.Input(BITMAX, 'b')
a_t, b_t = pyrtl.Input(BITMAX, 'a_t'), pyrtl.Input(BITMAX, ... | RhysGretsch81/mapacheIFT | mapachesim/ift/interface.py | interface.py | py | 4,087 | python | en | code | 0 | github-code | 90 |
25919053511 | #!/usr/bin/env python
import sys, os, re, logging, cPickle, bz2
import numpy, scipy
from optparse import OptionParser
from dmtk.model.kinetics import PulseStatsTable
from dmtk.io import cmph5
logging.basicConfig(level=logging.DEBUG)
class makePulseStatsTable:
""" Extract pulse metrics (IPD, PulseWidth, Transit... | kislyuk/dmtk | scripts/makePulseStatsTable.py | makePulseStatsTable.py | py | 2,884 | python | en | code | 2 | github-code | 90 |
10423472605 |
import os
import xml.etree.ElementTree as ET
from xml.dom import minidom
def findChild(parent, childLocalName):
for child in parent._get_childNodes():
if child._get_localName() == childLocalName:
return True, child
return False, child
def followXMLPath(parent, path):
if path != None:
... | jakobis95/WebScrapingForDummies | ibnExcelConverter/XMLread.py | XMLread.py | py | 4,346 | python | en | code | 0 | github-code | 90 |
20431031187 | from unittest.mock import Mock, sentinel
from layer_enforcer.config.interfaces import Config
from layer_enforcer.config.multiple import MultipleConfigLoader
from layer_enforcer.config.testing import StaticConfigLoader
class TestMultipleConfigLoader:
def test_load(self) -> None:
default_config = Config()
... | ZipFile/layer-enforcer | tests/config/test_multiple.py | test_multiple.py | py | 711 | python | en | code | 3 | github-code | 90 |
70904639977 | def dfs(queens, n, row):
count = 0
# n개의 행에 퀸들이 있다면 종료
if n == row:
return 1
# 모든 열 탐색
for col in range(n):
queens[row] = col
for x in range(row):
# 같은 열에 있다면
if queens[x] == queens[row]:
break
# 대각선에 있다면
if abs... | dohun31/algorithm | 2021/week_11/210915/9663.py | 9663.py | py | 605 | python | ko | code | 1 | github-code | 90 |
11325023414 | from expects import *
class Roman(object):
def translate(self, number):
if number <= 5:
roman_number = (5-number) * "I" + "V"
if number < 4:
roman_number = number * "I"
dictionary = {
6: "VI",
7: "VII",
9: "IX",
10: "X"... | alejandrodob/dojo | katas/roman-numerals/python-15-09/spec/roman_spec.py | roman_spec.py | py | 1,391 | python | en | code | 0 | github-code | 90 |
43675711389 | import sys
from PyQt5.QtWidgets import (QMainWindow, QStackedLayout, QWidget, QAction, QApplication, QMessageBox, QLabel, QLineEdit,QVBoxLayout,
QPushButton, QGridLayout, QPlainTextEdit, QTableWidgetItem, QTableWidget)
from PyQt5.QtCore import Qt
from PyQt5.QtGui import QPixmap
import ti... | darciu/21-oczko | main_window.py | main_window.py | py | 23,086 | python | en | code | 0 | github-code | 90 |
23474456908 | import alpaca_trade_api as tradeapi
import json
import sys
import pandas as pd
import requests
API_CFG_PATH = 'api.json'
def load_api_cfg(path):
with open(path, 'r') as f:
config = json.load(f)
return config
def score_change(ranges, value):
score = 5
for i, r in enumerate(ranges):
... | glostream/wg-assetAuditor | main.py | main.py | py | 4,537 | python | en | code | 0 | github-code | 90 |
27312826062 | """
Multiple widget-utils to simplify the make the usage of Jupyter-Notebooks more user friendly.
"""
# Author: LukasHuber
# Github: hubernikus
# Created: 2019-06-01
import time
import numpy as np
import matplotlib.pyplot as plt
import matplotlib
from ipywidgets import interact, interactive, fixed, interact_manual
... | hubernikus/dynamic_obstacle_avoidance | dynamic_obstacle_avoidance/visualization/widget_function_vectorfield.py | widget_function_vectorfield.py | py | 16,102 | python | en | code | 43 | github-code | 90 |
40259161217 | import json
import logging
LOGGER = logging.getLogger(__name__)
LOGGER.setLevel(logging.INFO)
def handler(event, context):
LOGGER.info(event)
# if "SubscribeURL" in post_data:
# requests.get(post_data["SubscribeURL"])
# messages = post_data["Message"]
# user_ids = []
# status = []
# j... | cork03/infra_pj | apiGatewayProxy/lambdaFunctions/execute.py | execute.py | py | 799 | python | en | code | 0 | github-code | 90 |
5280082384 | import sys
import pandas as pd
import numpy as np
import sqlalchemy
from sqlalchemy import create_engine
from nltk.tokenize import word_tokenize
from sklearn.multioutput import MultiOutputClassifier
from sklearn.feature_extraction.text import CountVectorizer, TfidfTransformer
from sklearn.pipeline import Pipeline
from... | sandeepnie/DS-Hub | Disaster Reponse Pipeline Project/workspace/models/train_classifier.py | train_classifier.py | py | 4,340 | python | en | code | 0 | github-code | 90 |
30506256713 | from django.contrib.auth import get_user_model
from django.contrib.auth import views as auth_views
from django.contrib.auth.decorators import login_required
from django.http import HttpResponse
from django.shortcuts import render, redirect, get_object_or_404
from accounts.forms import eduuserForm
def login(reques... | chipperdrew/talkEdu | accounts/views.py | views.py | py | 2,447 | python | en | code | 0 | github-code | 90 |
19595111066 | # beautifulSoup也可以实现信息的筛选和提取
from bs4 import BeautifulSoup as bs
import urllib.request
data = urllib.request.urlopen("http://edu.iqianyue.com/").read().decode("utf-8", "ignore")
bs1 = bs(data)
#格式化输出
#print(bs1.prettify())
#获取标签: bs对象.标签名.string
title = bs1.title
#获取标签里面的文字: bs对象.标签名.name
str = bs1.a.name
#获取属性列表: bs对象... | letwant/python_project | hello_bi_python/第02章 Urllib模块基础与糗事百科爬虫项目实战/015、 Beautifulsoup的使用/beautifulsoup的使用.py | beautifulsoup的使用.py | py | 604 | python | en | code | 1 | github-code | 90 |
26011578824 | # -*- coding: utf-8 -*-
# Time : 2021/12/7 16:01
# Author : kfu
import os
import warnings
warnings.filterwarnings("ignore")
import pandas as pd
from tqdm import tqdm
import tushare as ts
ts.set_token('8a13051b514249491b029cb46bcf1cd4e059b83bdeb516fc53c9f630')
pro = ts.pro_api()
class DataDownloader(object):
d... | Jimmerkuang/Multi-Factor-Investing | get_data.py | get_data.py | py | 1,868 | python | en | code | 6 | github-code | 90 |
10539231372 | from os import system
import time
def menu():
print("**************************************************")
print("* Vida y Salud *")
print("**************************************************")
print("* OPCIONES *")
pri... | catac19/prueba-3 | prueba3.py | prueba3.py | py | 4,696 | python | es | code | 0 | github-code | 90 |
40581245676 | # Solution to Letter Combination of Phone Number
# https://leetcode.com/problems/letter-combinations-of-a-phone-number/description/
class Solution(object):
def letterCombinations(self, digits):
"""
:type digits: str
:rtype: List[str]
"""
Ans =[]
char_list = [["a","b",... | venkatsvpr/Problems_Solved | LC_Letter_Combination_of_a_Phone_Number.py | LC_Letter_Combination_of_a_Phone_Number.py | py | 792 | python | en | code | 3 | github-code | 90 |
1551212540 | # В фермерском хозяйстве.....
# Напишите программу для нахождения максимального числа ягод,
# которое может собрать за один заход собирающий модуль,
# находясь перед некоторым кустом заданной во входном файле грядки.
bush_quantity = int(input('Введите кол - во кустов: '))
list = list()
print('Введите количество ягод ... | Gregorian1489/HT04PY | ht2.py | ht2.py | py | 904 | python | ru | code | 0 | github-code | 90 |
22382179647 | #Exercício 4
C = float(input('Digite o capital inicial: '))
i = float(input('Digite a taxa de juros em porcentagem: '))
i = i / 100
t = int(input('Digite o prazo em meses da aplicação: '))
Ci = C
# Fórmula pro montante total
MT = C * (1 + i) ** t
print('O montante após ',t,' meses é = R$ {}' .format(round(MT,2)))
# ... | allanholanda/CALCULO-JUROS | CALCULO_JUROS.py | CALCULO_JUROS.py | py | 641 | python | pt | code | 0 | github-code | 90 |
31976616091 | # Positives Database Support
# Functions for support of positives database
import utils
import numpy as np
import pandas as pd
# Delays in days from the symptom start date
days_delay = 3
# Columns for date.
# Whatever expresion you include, must return either null or a date in string
first_bogota_date_col = 'FORMA... | Data-Lama/covid_contact_graphs | functions/positive_db_functions.py | positive_db_functions.py | py | 5,360 | python | en | code | 0 | github-code | 90 |
162007691 | #What is the point of a break statement
#A break statement will break out of the most immediate loop that you are in
word = "ABCDEFG"
for i in range(0, len(word), 1):
if (word[i] == 'C'):
break;
print(word[i])
#Break jumps to here and keeps going. | PMiskew/contest_problems | Technique_Questions/Tech_break.py | Tech_break.py | py | 257 | python | en | code | 1 | github-code | 90 |
18462101977 | #!/usr/bin/python
import numpy as np
import torch
import torch.nn as nn
import torch.nn.functional as F
class ConvBlock(nn.Module):
def __init__(self, in_channels, out_channels,
kernel_size=(3, 3), stride=(1, 1), padding=(1, 1)):
super().__init__()
self.conv1 = nn.Conv2d(in_cha... | dberghi/Leveraging-Visual-Supervision-for-Array-based-ASDL | core/models.py | models.py | py | 3,076 | python | en | code | 0 | github-code | 90 |
71845719658 |
# coding: utf-8
# In[63]:
import random
import sys
# In[64]:
"""
create fname (default input.txt) of type int (default) or float of w*h*ch size
w = width
h = height --only square is tested
ch = channels
"""
def createIMG(w, h, ch, t='i', fname="input.txt"):
if t=='f':
with open(fname, "w") as f:... | istoony/winograd-convolutional-nn | createInput.py | createInput.py | py | 1,077 | python | en | code | 12 | github-code | 90 |
74500011177 |
# verificar se o X ou O ganhou returnando verdadeiro, matriz = eh jogo da velha
def verificar(char, matriz):
# char = caracter para X ou O ou outro que quiser pode verificar se ganhou
# 0 --- posicao
if matriz[0][0] == char and matriz[0][1] == char and matriz[0][2] == char:
return True
... | jonasht/python | 16-jogoDaVelha/interfaceGrafica_version/uteis.py | uteis.py | py | 2,624 | python | pt | code | 0 | github-code | 90 |
23641078201 | from urllib.parse import parse_qs
from django.http import HttpResponseRedirect
from django.urls import reverse
from django.views.generic import FormView
from barriers.forms.notes import AddPublicBarrierNoteForm, EditPublicBarrierNoteForm
from barriers.forms.public_barriers import (
PublicBarrierSearchForm,
Pu... | uktrade/market-access-python-frontend | barriers/views/public_barriers.py | public_barriers.py | py | 8,433 | python | en | code | 5 | github-code | 90 |
19444573285 | from django.shortcuts import render,HttpResponse
from all_models.models import *
from apps.common.func.WebFunc import *
import openpyxl,xlrd,json,platform
from django.http import StreamingHttpResponse
from apps.ui_test.services.ui_test import *
def uiTestPage(request):
context = {}
text = {}
text["pageTit... | LianjiaTech/sosotest | AutotestWebD/apps/ui_test/views/ui_test.py | ui_test.py | py | 6,694 | python | en | code | 489 | github-code | 90 |
16896763998 | from django.forms import ModelForm
from django import forms
from .models import CustomProduct, ContactUs
class MultipleFileInput(forms.ClearableFileInput):
allow_multiple_selected = True
class MultipleFileField(forms.FileField):
def __init__(self, *args, **kwargs):
kwargs.setdefault("widget", Multip... | yshekouhi/npmohit | pages/forms.py | forms.py | py | 2,481 | python | en | code | 0 | github-code | 90 |
22200451312 | import os
import sys
import json
import numpy as np
import scipy.misc as sm
import tensorflow as tf
import scipy.ndimage as ndimg
import matplotlib.pyplot as plt
import matplotlib.image as mpimg
from lsm.mvnet import MVNet
from lsm.utils import Bunch, get_session_config
from lsm.models import grid_nets, im_nets, model_... | ziyanw1/active_geometryaware | env_data/replay_memory.py | replay_memory.py | py | 23,101 | python | en | code | 12 | github-code | 90 |
5378270156 | #
# Created by Pedro Freitas on 13/01/2020.
#
sexo = ''
while sexo != 'M' and sexo != 'F':
sexo = str(input('\033[1;33mDigite o sexo da forma correta [M/F]: ')).upper()
if sexo != 'M' and sexo != 'F':
print('Você não digitou da maneira correta. Tente novamente.') | phdfreitas/python | Mundo 02 - Estruturas de Controle/Aula 14/057.py | 057.py | py | 273 | python | pt | code | 0 | github-code | 90 |
18188515529 | import numpy as np
N, M, K = list(map(int, input().split()))
A = list(map(int, input().split()))
B = list(map(int, input().split()))
# cumsum
i = 0
A_sum = [0]
while (i < len(A)) and (A_sum[i] + A[i] <= K):
A_sum.append(A_sum[i] + A[i])
i += 1
i = 0
B_sum = [0]
while (i < len(B)) and (B_sum[i] + B[i] <= ... | Aasthaengg/IBMdataset | Python_codes/p02623/s004836535.py | s004836535.py | py | 580 | python | en | code | 0 | github-code | 90 |
5377799406 | import random
import re
def play():
user = input("Enter your choice:\nfor rock: 'r'\nfor paper: 'p'\nfor scissors: 's'\n").lower()
computer = random.choice(['r','p','s'])
print(user)
try:
valid_input = r"['r','s','p']"
if re.search(valid_input,user):
if user == computer:
... | Pal-Sandeep/Rock-Paper-Scissors | rockpaperscissors.py | rockpaperscissors.py | py | 784 | python | en | code | 7 | github-code | 90 |
30282666676 | from __future__ import print_function
from mitsuba.core import *
class EmitterType:
SUN_SKY = 'sunsky'
SKY = 'sky'
SUN = 'sun'
DIRECTIONAL = 'directional'
CONSTANT = 'constant'
class Emitter:
def __init__(self, emitter_type, sample_weight=1.0, to_world=Transform()):
self.type = emitt... | AdrianJohnston/ShapeNetRender | Emitter.py | Emitter.py | py | 1,967 | python | en | code | 2 | github-code | 90 |
14810964827 | #!/usr/bin/env python
from Gnuplot import GnuplotProcess
class KalmanViz(object):
def __init__(self, world_size):
self.gp = GnuplotProcess(persist=False)
self.gp.write(self.gnuplot_header(-world_size / 2, world_size / 2))
def gnuplot_header(self, minimum, maximum):
'''Return a string... | thyer/CS470 | bzagents/KalmanViz.py | KalmanViz.py | py | 2,040 | python | en | code | 0 | github-code | 90 |
25694688682 | from django.db import models
from django.utils import timezone
from django.utils.translation import gettext_lazy as _
import datetime
from uuid import uuid1
from revibe._helpers import const
from revibe.utils import classes
from revibe.utils.language import text
from administration import managers
# ---------------... | Revibe-Music/core-services | administration/models.py | models.py | py | 21,662 | python | en | code | 2 | github-code | 90 |
2829444050 | # ===============================================================================
# Copyright 2020 Intel Corporation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.... | PetrovKP/svm_benchmarks | benchmarks/svm_workload_run.py | svm_workload_run.py | py | 11,230 | python | en | code | 0 | github-code | 90 |
17770177406 | import pandas as pd
# 04:数据预处理(去除列中共有的元素)(4:00)
import tkinter
import tkinter.ttk
root = tkinter.Tk()
root.geometry('150x120')
def show():
labelOther.config(text='Tkinter')
labelOther.config(bg='lightgreen')
notebook = tkinter.ttk.Notebook(root)
frameOne = tkinter.Frame()
frameTwo = tkinter.Frame()
# 添加内... | 871523104-zhang/Aspen.py | AspenProject/pandas学习笔记.py | pandas学习笔记.py | py | 811 | python | en | code | 0 | github-code | 90 |
1817885535 | # Transcribing a DNA sequence into an RNA sequence
# python 2_Transcribe_DNA.py 2_Rosalind_DNA.txt
import sys
input_file = open(sys.argv[1], 'r')
dna_seq = input_file.readline().strip() # A single-line text file
""" Given a DNA string t with at most 1000 nucleotdies, returns a
string, rna, corresponding to the tran... | natejangeles/Rosalind | 2_Transcribe_DNA.py | 2_Transcribe_DNA.py | py | 443 | python | en | code | 0 | github-code | 90 |
8028705559 | import cv2
import numpy as np
import matplotlib.pyplot as plt
import pandas as pd
cap = cv2.VideoCapture(2)
cap2 = cv2.VideoCapture(3)
fourcc = cv2.VideoWriter_fourcc(*'XVID')
out = cv2.VideoWriter('3a.avi', fourcc, 30.0, (640, 480))
out2 = cv2.VideoWriter('3b.avi', fourcc, 30.0, (640, 480))
while True:
ret,... | GlidingRaven/Juggler | other/save_video.py | save_video.py | py | 712 | python | en | code | 4 | github-code | 90 |
71716171496 | from __future__ import print_function
import json
import requests
import time
import signal
import os
import sys
sys.path.insert(1, os.getcwd() + '/clipper/clipper_admin')
from clipper_admin import ClipperConnection, DockerContainerManager
from clipper_admin.deployers.tensorflow import deploy_tensorflow_model
from cl... | hyperchris/ClipperApps | clipper_start.py | clipper_start.py | py | 2,169 | python | en | code | 0 | github-code | 90 |
38791438034 | # -*- coding:utf-8 -*-
import os
import sys
import flask
import gc
from flask import request
from src import app
from src import db
from docx import Document
from src.controller.common_function import check_directory, check_file
from src.entity.diagnose import Diagnose
from src.entity.difficulty_assessment import Dif... | hxproj/medical_case_backend_api | src/controller/doc_helper.py | doc_helper.py | py | 11,914 | python | en | code | 0 | github-code | 90 |
18036231939 | N = int(input())
A = list(map(int, input().split()))
B=[]
if N%2 ==0:
for a in range(1, N, 2):
B.append(a)
B+=B
if sorted(A) == sorted(B):
print(2**len(set(A))%(10**9+7))
else:
print(0)
else:
for a in range(2, N, 2):
B.append(a)
B=B+B+[0]
if sorted(A) == sorte... | Aasthaengg/IBMdataset | Python_codes/p03846/s523339741.py | s523339741.py | py | 396 | python | en | code | 0 | github-code | 90 |
18589546109 | n=int(input())
n_list=list(map(int,input().split()))
count=0
def check(list):
for i in range(n):
if(n_list[i]%2!=0):
return False
return True
while(check(n_list)):
n_list=[k/2 for k in n_list]
count+=1
print(count) | Aasthaengg/IBMdataset | Python_codes/p03494/s947759658.py | s947759658.py | py | 260 | python | en | code | 0 | github-code | 90 |
16247874132 | import datastream.csi_interface as csi_interface
import datastream.load as load
import plkg.greycode_quantization as quan
import plkg.ecc as ecc
import time
import plkg.sha256 as sha256
class end_device:
def __init__(self):
self.comPort = "COM5"
self.reconciliation_result = ''
#csi average... | Ricky610329/PLKG_on_ESP32 | plkg/eveplkg.py | eveplkg.py | py | 2,678 | python | en | code | 0 | github-code | 90 |
32153341020 | from redis_adapter import RedisKeys
class BackupDataManager:
def __init__(self, redis_instance, reactions_table):
self.redis_instance = redis_instance
self.reactions_table = reactions_table
def __write_data_to_db(self, data_list):
for data in data_list:
self.reactions_tabl... | cosmos-sajal/low_level_design | live_streaming_emoticons/backup_data.py | backup_data.py | py | 1,314 | python | en | code | 3 | github-code | 90 |
18047086089 | def main():
n,t = map(int,input().split())
a = [int(x) for x in input().split()]
a_min = []
ap = a_min.append
ap(a[0])
for i in range(1,n):
ap(min(a_min[-1],a[i]))
a_sub = []
ap = a_sub.append
for i in range(n):
ap(a[i]-a_min[i])
print(a_sub.count(max(a_sub)))
if ... | Aasthaengg/IBMdataset | Python_codes/p03946/s869252727.py | s869252727.py | py | 354 | python | en | code | 0 | github-code | 90 |
37659077002 | import csv
import operator
import warnings
import lsst.daf.persistence as dafPersist
def list_cc_images(date_filter, butler_path="/lsstdata/offline/teststand/NCSA_comcam/gen2repo",
is_ccs=False, from_seqnum=None, save_file=False):
"""Create catalog of ComCam images.
Functions to parse... | mareuter/notebooks | LSST/ComCam/list_images.py | list_images.py | py | 3,160 | python | en | code | 0 | github-code | 90 |
21832101699 | import cv2
import numpy as np
from numpy.core.umath_tests import inner1d
from scipy.spatial.distance import directed_hausdorff
from matplotlib import pyplot as plt
from alignImages import alignImages
from numpy import linalg as LA
from direct_distance import directDistance
# img = cv2.imread('input_images/box/bo... | arashabedin/ImageAnalysisExperiments | direct_distance_test.py | direct_distance_test.py | py | 2,148 | python | en | code | 0 | github-code | 90 |
11518423729 |
#
# Complete the 'reversePrint' function below.
#
# The function accepts INTEGER_SINGLY_LINKED_LIST llist as parameter.
#
#
# For your reference:
#
# SinglyLinkedListNode:
# int data
# SinglyLinkedListNode next
#
#
def reversePrint(llist):
# Write your code here
temp = llist
prev = None
wh... | Sagor31h2/LeetcodeGroup | Rimon/HackerRank/reverse_a_linked_list.py | reverse_a_linked_list.py | py | 510 | python | en | code | 0 | github-code | 90 |
43334447076 | #!/usr/bin/env python3
import sys
from collections import namedtuple
from operator import add, mul, floordiv, mod, eq
Expr = namedtuple('Expr', 'opcode, left, right')
OPS = {'add': add, 'mul': mul, 'div': floordiv, 'mod': mod, 'eql': eq}
def parse(line):
parts = line.split()
if len(parts) == 2:
operan... | taddeus/advent-of-code | 2021/24_alu.py | 24_alu.py | py | 2,696 | python | en | code | 2 | github-code | 90 |
33686797199 | # -*- coding: utf-8 -*-
"""
Created on Sat Jan 20 13:09:23 2018
@author: IssaMawad
"""
import os;
from FeatureExtraction.HOGFeatures import extractHOGFeatures
from FeatureExtraction.GaborDown import extractGabor
#from FeatureExtraction.GaborZernike import extractGaborZernike
from FeatureExtraction.GaborDCT import extr... | issamouawad/ML_DSIP_Proj | IterateDataSet.py | IterateDataSet.py | py | 3,492 | python | en | code | 1 | github-code | 90 |
10681836342 | from util import Record, sql
TABLE_NAME = "merges"
TABLE_FIELD_TYPES = ["utime integer",
"peerid varchar",
"action varchar",
"groupid varchar",
"path varchar",
"details varchar",
"author_peerid... | merlink01/psync | src/history/mergelog.py | mergelog.py | py | 1,234 | python | en | code | 0 | github-code | 90 |
72328682537 | import logging
from aiogram import types
from aiogram.dispatcher import FSMContext
from bot.handlers.text.base_command_handler import BaseCommandHandler
from config import INTERCOM_TOKEN
from database.conversation_repo import ConversationRepository
from database.user_repo import UserRepository
from third_party.intercom... | Forevka/Emcd | bot/handlers/text/reply_to_conversation.py | reply_to_conversation.py | py | 2,629 | python | en | code | 2 | github-code | 90 |
18198444319 | # でつoO(YOU PLAY WITH THE CARDS YOU'RE DEALT..)
import sys
def main(N, A):
C = [0] * (10**6 + 1)
for a in A:
if C[a] == 1:
C[a] = -1
continue
if C[a] == -1:
continue
C[a] = 1
for b in range(a + a, 10 ** 6 + 1, a):
C[b] = -1
ans =... | Aasthaengg/IBMdataset | Python_codes/p02642/s350616289.py | s350616289.py | py | 532 | python | en | code | 0 | github-code | 90 |
17134689122 | from abc import ABC, abstractmethod
from typing import Optional, List, Tuple, Union, Callable
import numpy as np
import pygame as pg
from pygame import Surface, Rect
from linear_algebra_testcase.elements import Vector, Transform2D, Transform3D, Element
from linear_algebra_testcase.utils import gray, format_float, noo... | Bluemi/linear-algebra-testcase | linear_algebra_testcase/user_interface/items.py | items.py | py | 23,778 | python | en | code | 0 | github-code | 90 |
32546107919 | from django.shortcuts import render
from django.http import HttpResponse
from django.core.paginator import Paginator
from django.db.models import Avg, Max, Min, Sum, Count
from django.contrib import messages
from django.http import JsonResponse
from .models import Category, Item, Comments, Project, ProjectSeed, Proje... | RootA/cheka-learn | ecsite/views.py | views.py | py | 7,232 | python | en | code | 0 | github-code | 90 |
14369858621 | from flask import Flask, render_template, request, redirect, url_for
from dao.orm.entities import *
from forms.discipline_form import DisciplineForm
from forms.student_form import StudentForm
from forms.teacher_form import TeacherForm
from dao.db import PostgresDb
app = Flask(__name__)
app.secret_key = 'deve... | nikmoz/Cassandra | Laboratory2/main.py | main.py | py | 9,746 | python | en | code | 0 | github-code | 90 |
23424710666 | ## SCRAPING VIA SELENIUM NOW SEEMS TO BE OFF THE TABLE,
## THEY HAVE SOPHISTICATED MECHANISMS IN PLACE TO PREVENT THIS, AND NOT WORTH THE EFFORT TO EVADE
"""
examples include [according to chat gpt])
User-Agent: The User-Agent string sent by WebDriver-driven browsers is often different than the ones sent by a regular,... | xflynx25/boring_uninteresting_repo | Scrape_human_seasons.py | Scrape_human_seasons.py | py | 23,896 | python | en | code | 1 | github-code | 90 |
72089895977 | #!/bin/python
# coding=utf-8
#
# Python script for Ophidia workflow check
# Copyright (C) 2016 CMCC Foundation
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation... | indigo-dc/indigokepler | workflows/ophidia/ensemble-visualization/oph_workflow_check.py | oph_workflow_check.py | py | 9,015 | python | en | code | 2 | github-code | 90 |
17956199059 | import sys
from scipy.sparse import csr_matrix
from scipy.sparse.csgraph import floyd_warshall
from itertools import permutations
input = sys.stdin.readline
ans = -1
n, m, r = map(int, input().split())
r = list(map(int, input().split()))
A, B, C = [], [], []
for i in range(m):
a, b, c = map(int, input().split())... | Aasthaengg/IBMdataset | Python_codes/p03608/s224912116.py | s224912116.py | py | 624 | python | en | code | 0 | github-code | 90 |
3139773058 | # -*- coding: utf-8 -*-
'''
Module for configuring Manila services
======================================
'''
import json
import logging
import requests
import os
from keystoneclient.auth.identity import v2
from keystoneauth1 import session
from functools import wraps
from collections import OrderedDict
from lxml i... | ohryhorov/salt-formula-manila | _modules/manila.py | manila.py | py | 2,317 | python | en | code | 0 | github-code | 90 |
34661577720 | class emp:
def hello_emp(self,e_name=None):
if e_name is not None:
print("Hello",e_name)
else:
print("Hello")
emp1=emp()
emp1.hello_emp()
emp1.hello_emp("Kiran")
class Overloading:#Overload@signature()
def getMethod(self,j):
print("First method",j... | lakshmihrgowda/lakshmi | helo/src/hi/py/methodoverloading.py | methodoverloading.py | py | 484 | python | en | code | 0 | github-code | 90 |
74750513575 | import time
import random
import termios, fcntl, sys, os
from adafruit_servokit import ServoKit
class Turret:
def __init__(self, max_angle=180):
self.servokit = ServoKit(channels=16)
self.vertical_servo_id = 0
self.horizontal_servo_id = 2
self.horizontal_angle = 90
self.... | home9464/battletank | turret.py | turret.py | py | 2,494 | python | en | code | 0 | github-code | 90 |
15383875719 | import cv2
from utils import subplot, save_subplot
from utils import timing
from utils import replace_filepath_components
import config
from detect_icon.detect_icon import IconDetector
def detect_icon_func(img_path):
img = cv2.imread(img_path) if isinstance(img_path, str) else img_path
icon_detector = IconD... | ttkien2035/StructureDetectWithYolov5 | extract_door/detect_icon_func.py | detect_icon_func.py | py | 1,930 | python | en | code | 0 | github-code | 90 |
21334497425 | from tokenizer import Tokenizer, WHITESPACE
import mien.nmpml
from mien.math.array import alltrue
import re
import os
HOC_TOKENS = {"(":{},
")":{},
"{":{},
"}":{},
"/*":{"readto":"*/"},
"//":{"readto":"\n"},
'"':{"readto":'"'},
'=':{"return":1},
"\n":{},
",":{}}
HOC_TOKE... | gic888/MIEN | parsers/hoc.py | hoc.py | py | 3,501 | python | en | code | 2 | github-code | 90 |
7940543502 | from flask import Flask, request, jsonify
import pickle
import numpy as np
import sklearn
app = Flask(__name__)
@app.route('/api/v1/coverage', methods=['POST'])
def predict():
# Load the trained model from a file
loaded_model = pickle.load(open("auto_insurance_model.pkl", 'rb'))
# Get the input data from... | DMEvanCT/CoverageML | api.py | api.py | py | 1,044 | python | en | code | 0 | github-code | 90 |
41091455206 | from flask import Flask, render_template, request, redirect, url_for
from pymongo import MongoClient
app = Flask(__name__)
client = MongoClient('localhost', 27017)
db = client['local']
collection = db['phone']
collection2 = db['comment']
# ~~~~~~~ HOME PAGE ~~~~~~~
@app.route('/')
def home_page():
brands_list =... | mihai10001/phone_picker_site | main.py | main.py | py | 4,095 | python | en | code | 0 | github-code | 90 |
24538787683 |
import re
valid = []
x = "[+][9][1]\d{10}"
f = open("validno", "r")
for num in f:
number = num.rstrip("\n")
matcher = re.fullmatch(x, number)
if matcher != None:
valid.append(number)
print(valid) | toncysara17/luminarpythonprograms | Advance_Python/Details/test_pgm7.py | test_pgm7.py | py | 220 | python | en | code | 0 | github-code | 90 |
18429628299 | n = int(input())
A = list(map(int, input().split()))
ans = []
for i in range(n):
ind = -1
for j in range(len(A)):
if A[j] == j + 1:
ind = j
if ind == -1:
break
else:
A.pop(ind)
ans.append(ind+1)
if ind == -1:
print(-1)
else:
ans.reverse()
for a in ans:
print(a) | Aasthaengg/IBMdataset | Python_codes/p03089/s794766761.py | s794766761.py | py | 303 | python | en | code | 0 | github-code | 90 |
27822691270 | import scrapy
from bs4 import BeautifulSoup
from itertools import chain
from cardiology.items import CardiologyItem
from scrapy.spiders import CrawlSpider, Rule
from scrapy.linkextractors import LinkExtractor
class cly_cl(CrawlSpider):
name = "cardiology"
start_urls = ['https://www.hindawi.com/journals/cric/contents... | satan007417/scrapy_case_of_cardilology | cardiology/spiders/cl.py | cl.py | py | 1,397 | python | en | code | 0 | github-code | 90 |
73578731177 |
from setuptools import setup, find_packages
import os
requirementPath = 'requirements.txt'
if os.path.isfile(requirementPath):
with open('requirements.txt') as f:
requires = f.readlines()
install_requires = [item.strip() for item in requires]
setup(name='Time_Matters_Query',
version='1.0',
d... | JMendes1995/Time-Matters-Query | setup.py | setup.py | py | 568 | python | en | code | 0 | github-code | 90 |
31112889376 | import torch
import torch.nn as nn
from transformers import BertModel, BertPreTrainedModel, RobertaModel
class Classifier(nn.Module):
def __init__(self, input_dim, output_dim, dropout_rate=0.0, use_activation=True):
super(Classifier, self).__init__()
self.use_activation = use_activation
sel... | gabrielebrunini/NLP-project | model.py | model.py | py | 5,393 | python | en | code | 0 | github-code | 90 |
71085992298 | """summerMRND URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/2.0/topics/http/urls/
Examples:
Function views
1. Add an import: from my_app import views
2. Add a URL to urlpatterns: path('', views.home, name='home')
Class-ba... | Arpit-X/mentor-app | mentorapp/urls.py | urls.py | py | 2,089 | python | en | code | 0 | github-code | 90 |
24317704658 | import random
import QuickSort as q
import RadixSort as c
import time
n = [n for n in range(10000)]
random.shuffle(n)
sort1 = q.QuickSort(n)
t = time.time()
sort1.sort()
print('Quicksort time taken: %s' % str(time.time()-t))
random.shuffle(n)
sort2 = c.RadixSort(n)
t = time.time()
sort2.sort()
print('Radix sort ti... | dp1706/Python-Data-Structure | Code/SortingComparison.py | SortingComparison.py | py | 356 | python | en | code | 1 | github-code | 90 |
18546393129 | def getval():
n = int(input())
x = list(map(int,input().split()))
return n,x
def main(n,x):
y = sorted(x)
a,b = y[(n-1)//2],y[(n-1)//2+1]
for i in x:
if i>a:
print(a)
else:
print(b)
if __name__=="__main__":
n,x = getval()
main(n,x) | Aasthaengg/IBMdataset | Python_codes/p03379/s448511832.py | s448511832.py | py | 306 | python | en | code | 0 | github-code | 90 |
34870087690 | from __future__ import annotations
from collections.abc import (
Collection,
Generator,
Hashable,
Iterable,
Sequence,
)
from functools import wraps
from sys import getsizeof
from typing import (
TYPE_CHECKING,
Any,
Callable,
Literal,
cast,
)
import warnings
import numpy as np
... | pandas-dev/pandas | pandas/core/indexes/multi.py | multi.py | py | 142,704 | python | en | code | 40,398 | github-code | 90 |
34529299664 | import socket
def main():
host = '127.0.0.1'
port = 5000
s = socket.socket()
s.bind((host, port))
s.listen(1)
c, addr = s.accept()
print ("connection from : " + str(addr))
while True:
data = c.recv(1024).decode()
if not data:
break
print ("from connected user :" + str(data))
data = ... | nemnous/Networks | Messenger/Single Client/tcpServer.py | tcpServer.py | py | 487 | python | en | code | 0 | github-code | 90 |
18285586869 | import sys
input = sys.stdin.readline
N = int(input())
imo = []
xlmin = 0
xlmax = 0
for _ in range(N):
x,l = map(int,input().split())
imo.append([x-l,x+l-1])
imo = sorted(imo,key = lambda x: x[1])
cnt = 1
ls = imo[0][1]
for i in range(1,N):
if imo[i][0]<=ls:
continue
else:
cnt += 1
... | Aasthaengg/IBMdataset | Python_codes/p02796/s313818893.py | s313818893.py | py | 350 | python | en | code | 0 | github-code | 90 |
18475928579 | n = int(input())
def Base_10_to_n(X, n):
if (int(X/n)):
return Base_10_to_n(int(X/n), n)+str(X%n)
return str(X%n)
if n < 357:
print(0)
else:
ans = 0
for i in range(3, 10):
for j in range(3**i):
a = ''
val = Base_10_to_n(j, 3).zfill(i)
for k in val... | Aasthaengg/IBMdataset | Python_codes/p03212/s131810484.py | s131810484.py | py | 580 | python | en | code | 0 | github-code | 90 |
21989676364 | from faker import Faker
import csv
import json
fake = Faker(locale='en_US')
def create_employee(num):
employee_list = []
for i in range(1,num):
employee = {}
employee['name'] = fake.name()
employee['address'] = fake.address()
employee['job'] = fake.job()
employee['phone... | CoffeeKeyboardYouTube/FakerData | dataset.py | dataset.py | py | 1,267 | python | en | code | 0 | github-code | 90 |
18464097959 | import sys
sys.setrecursionlimit(1000000)
n,m=map(int,input().split())
p=[[] for _ in range(n)]
for _ in range(m):
x,y=map(int,input().split())
p[x-1].append(y-1)
f=[-1 for _ in range(n)]
def calc(x):
if f[x]!=-1:
return f[x]
if len(p[x])==0:
f[x]=0
return 0
f[x]=max([c... | Aasthaengg/IBMdataset | Python_codes/p03166/s515737900.py | s515737900.py | py | 449 | python | en | code | 0 | github-code | 90 |
25915884851 | from datetime import date
atual = date.today().year
maior = 0
menor = 0
for c in range(1, 8):
ano = int(input('Em que ano a {}° pessoa nasceu:'.format(c)))
idade = atual - ano
if idade >= 18:
maior += 1
elif idade < 18:
menor += 1
print('Ao todo temos {} pessoas maiores de idade'.format(maior))
print('E t... | celycodes/curso-python-exercicios | exercicios/ex054.py | ex054.py | py | 421 | python | pt | code | 2 | github-code | 90 |
10876436325 | import enum
import json
import math
import random
from Block import block_type
from Collision import collides
from Entities import entity_type
from Utils import pixel_to_grid
class mapblock_data(object):
def __init__(self, sprite, pos, type, eType = entity_type.none):
self.sprite = sprite
self.pos... | stojanov/dungeon-crawler | Level.py | Level.py | py | 6,490 | python | en | code | 0 | github-code | 90 |
71791558377 | from flask import request, jsonify
from . import api
from app.helpers.common import force_int
import copy
from flask.views import MethodView
from app.lib.stylegan_tensorflow.demo import get_sample as te_sample
from flask import Flask, render_template, request
# pip install gevent-websocket导入IO多路复用模块
from geventwebsocke... | LIMr1209/ai_tools | app/views/api/stylegan.py | stylegan.py | py | 1,859 | python | en | code | 2 | github-code | 90 |
20469482199 | import sys
import pickle
import numpy as np
import matplotlib.pyplot as plt
from os import path
from tqdm import tqdm
from sklearn.decomposition import IncrementalPCA
sys.path.append('../code')
from data_loader import Archs4GeneExpressionDataset, GtexDataset
from torch.utils.data import DataLoader
dat_dir = "data/hdf5... | urokoz/DL_proj_29 | code/dataset_similarity.py | dataset_similarity.py | py | 2,371 | python | en | code | 1 | github-code | 90 |
28939813378 | # -*- coding: utf-8 -*-
import cv2
import numpy as np
img = np.zeros((120, 120), dtype=np.uint8) # 120x120 2차원 배열 생성, 검은색 흑백 이미지
img[25:35, :] = 45 # 25~35행 모든 열에 45 할당
img[55:65, :] = 115 # 55~65행 모든 열에 115 할당
img[85:95, :] = 160 # 85~95행 모든 열에 160 할당
img[:, 35:45] = 205 # 모든 행 35~45 열에 205 할당
img[:, 75:85] = 255 # 모... | syjung0130/opencv_python_sample | ch3_numpy_matplotlib/np_gray.py | np_gray.py | py | 1,064 | python | ko | code | 0 | github-code | 90 |
42240410697 | import os
import sys
class RofiDialog:
"""Simple class to build the input for rofi to create a simple
rofi-driven interface
"""
def __init__(self, prompt=None, message=None, data=None, settings=None):
"""Initialize the object and set retrieve the rofi environment
variables.
Ar... | defname/rofi-iwd-wifi-menu | iwdrofimenu/rofidialog.py | rofidialog.py | py | 4,843 | python | en | code | 48 | github-code | 90 |
70881939818 | import math
import random
import numpy as np
from scipy.stats import norm
import copy
import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import Axes3D
from matplotlib import cm
from matplotlib import colors
import seaborn as sns
sns.set(color_codes=True)
def black_scholes_c(S,N,T,sigma,r,K):
d = ((np.log(S... | DCCdelang/Comp_Finance | Assignment_3/Finite_EU_Call.py | Finite_EU_Call.py | py | 3,105 | python | en | code | 0 | github-code | 90 |
14569639613 | class Solution:
def BinarySearch(self, array, target, left, right):
mid = left + (right - left) // 2
# base condition
if left > right:
return -1
if array[mid] == target:
return mid
if array[mid] > target:
return self.BinarySearch(array, tar... | shaoye/algorithm | jianzhioffer/二维数组中的查找.py | 二维数组中的查找.py | py | 1,176 | python | en | code | 0 | github-code | 90 |
18462618459 | from functools import lru_cache
n = int(input())
action = []
for i in range(n):
action.append(list(map(int,input().split())))
@lru_cache(maxsize=None)
def dp(i, a):
if i == 0:
return action[0][a]
else:
return max(dp(i-1, (a+1)%3), dp(i-1, (a+2)%3)) + action[i][a]
import sys
sys.setrecursi... | Aasthaengg/IBMdataset | Python_codes/p03162/s665391739.py | s665391739.py | py | 379 | python | en | code | 0 | github-code | 90 |
1064962759 | import json
import pytest
import requests
from HW04.lib.helpers import assert_valid_schema
@pytest.mark.parametrize("post_id , code_response, res_not_empty", [
('0', 404, False),
('1', 200, True),
('100', 200, True),
('-4', 404, False),
])
def test_get_post(start_url, post_id, code_response, res_not... | SmileRexar/OtusPythonQAJune2020 | HW04/test_placeholder.py | test_placeholder.py | py | 4,351 | python | en | code | 0 | github-code | 90 |
19790679451 | def longest_substring_with_k_distinct(str, k):
letter_map = {}
start_ind, longest_len = 0, 0
for end_ind in range(len(str)):
curr_letter = str[end_ind]
if curr_letter not in letter_map:
letter_map[curr_letter] = 0
letter_map[curr_letter] += 1
while len(letter_map) > k:
remove = str[start_ind]
lette... | willgorick/grokking-coding | sliding_window/longest_substring_with_k_distinct.py | longest_substring_with_k_distinct.py | py | 845 | python | en | code | 0 | github-code | 90 |
5835451717 | """A set of tools for reading/writing/querying the in-built cache."""
import glob
import h5py
import logging
import os
import re
from os import path
from . import outputs, wrapper
from ._cfg import config
from .wrapper import global_params
logger = logging.getLogger("21cmFAST")
def readbox(
*,
direc=None,
... | 21cmfast/21cmFAST | src/py21cmfast/cache_tools.py | cache_tools.py | py | 6,528 | python | en | code | 50 | github-code | 90 |
2709004681 | #!/usr/bin/env python3
# -*- coding:utf-8 -*-
# import rospy
# import math
# import actionlib
# from move_base_msgs.msg import MoveBaseAction, MoveBaseGoal
# from actionlib_msgs.msg import GoalStatus
# from geometry_msgs.msg import Pose, Point, Quaternion
# from tf.transformations import quaternion_from_euler
# '''
#... | dstjr2434/ros_git | SLAM main algoritm/move_base_seq.py | move_base_seq.py | py | 6,721 | python | en | code | 1 | github-code | 90 |
70104523816 | from functools import wraps
def function_logger(logging):
def wrap(func):
@wraps(func)
def function_log(*args, **kwargs):
logging.debug(
"Inside Function {} with parameters: {},{}".format(
func.__name__,
args,
... | anandtripathi5/function_logger | function_logger/__init__.py | __init__.py | py | 665 | python | en | code | 2 | github-code | 90 |
6305351762 | list1 = [10,20,40,60,70,80]
list2 = [5,15,25,35,45,60]
len1 = len(list1)
len2 = len(list2)
list3 = []
i,j =0,0
while i<len1 and j<len2:
if list1[i]<list2[j]:
list3.append(list1[i])
i=i+1
else:
list3.append(list2[j])
j=j+1
list3 = list3 + list1[i:] + list2[j:]
print(list3) | HellB1azer/Python-Assignments | Day5/Assignment2.py | Assignment2.py | py | 309 | python | en | code | 0 | github-code | 90 |
64780251 | class Money:
def __init__(self, dollars, cent):
self.total_cents = dollars * 100 + cent
@property
def dollars(self):
return self.total_cents // 100 # делим нацело на 100
@dollars.setter
def dollars(self, new_dollars):
if isinstance(new_dollars, int) and new_dollars >= 0:
... | koskin17/MyEducation | OOP/Egorov/2_7_egorov_property_Homework1.py | 2_7_egorov_property_Homework1.py | py | 1,304 | python | en | code | 0 | github-code | 90 |
18452955979 | n = int(input())
ab = [list(map(int,input().split())) for _ in range(n)]
l = sorted([[a + b, a, b] for a, b in ab])[::-1]
res = 0
for idx, i in enumerate(l):
if idx % 2 == 0:
res += i[1]
else:
res -= i[2]
print(res)
| Aasthaengg/IBMdataset | Python_codes/p03141/s674509133.py | s674509133.py | py | 241 | 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.