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
18475202709
from flask import Blueprint, render_template, request, session, redirect, Response, make_response from twilio.twiml.voice_response import Dial, VoiceResponse, Say from twilio_client import sid, auth voice = Blueprint("voice", __name__, template_folder="templates", static_folder="static") @voice.route("/voice/", metho...
R-Ligier/AiHackathon
voice.py
voice.py
py
517
python
en
code
0
github-code
1
28135008759
from datetime import datetime from mitmproxy.flow import Flow class Intercept(object): def __init__(self, flow: Flow, connection) -> None: self.flow = flow self.connection = connection self.updated_at = datetime.now() self.session_id = None self.user_id = None self.m...
tarnacious/debugproxy
proxyserver/intercept.py
intercept.py
py
511
python
en
code
2
github-code
1
20910717859
# -*- coding: utf-8 -*- # DISCLAIMER # This code file is forked and adapted from https://github.com/hwwang55/DKN/blob/master/src/main.py #import libraries import argparse import numpy as np # import custom code from src.dkn_data_loader import load_data from src.dkn import train, evaluate from src.util.logger import...
andreeaiana/geneg_benchmarking
src/run_dkn.py
run_dkn.py
py
1,767
python
en
code
2
github-code
1
24812248218
''' This is trying to fix simple1.py issues ''' def myfunc(): ''' A Simple function ''' first = 1 second = 2 print(first) print(second) myfunc() ''' Again; this was run in Pylint and I got: (base) Desktop>python simple2.py 1 2 (base) Desktop>pylint simple2.py ************* Module simpl...
lucas-schranck/Python-Coding-Lessons
2022-11-10 Using Pylint in CMD/simple2.py
simple2.py
py
1,273
python
en
code
0
github-code
1
41283693798
from typing import Iterable import pytest from zepben.evolve import assign_equipment_to_feeders, Equipment, TestNetworkBuilder, Feeder, BaseVoltage def validate_equipment(equipment: Iterable[Equipment], *expected_mrids: str): equip_mrids = [e.mrid for e in equipment] for mrid in expected_mrids: asser...
zepben/evolve-sdk-python
test/services/network/tracing/test_assign_to_feeders.py
test_assign_to_feeders.py
py
3,820
python
en
code
3
github-code
1
33032277585
import numpy as np import math class Config: ######################################################################### # Game configuration # Time step size TIME_STEP = 0.2 # The world boundary, as a square WORLD_X_BOUND = 10 WORLD_Y_BOUND = 10 # Target area, a circle for now (TODO:...
FloraHF/2DSI
2DSI/Config.py
Config.py
py
3,988
python
en
code
0
github-code
1
2325252310
import os import shutil from flask import request, jsonify from flask_restful import Resource from flask_uploads import UploadNotAllowed from db import db from libs import image_helper from models.category import CategoryModel from models.subcategory import SubCategoryModel, SubCategoryImageModel from schemas.catego...
Emir99/city-service
resources/subcategory.py
subcategory.py
py
7,847
python
en
code
0
github-code
1
75184000353
# -*- coding: utf-8 -*- """ Created on Mon Oct 2 00:04:48 2023 @author: allen 請查詢附錄X的表格,將以下句子全部輸出成小寫, "PLEASE CONVERT THIS SENTENCE TO LOWER CASE." """ x = input() for i in range(len(x)): if(ord(x[i]) > 64 and ord(x[i]) <91): print(chr(ord(x[i]) + 32), end = "") else: print(x[i], end = "") ...
zhanallen/zero-judge
講義練習題/2.8.4.1. Ex. 1.py
2.8.4.1. Ex. 1.py
py
427
python
en
code
0
github-code
1
37442174729
# Import from other files https://stackoverflow.com/a/49480246 if __package__ is None or __package__ == '': from subscript import sum else: from .subscript import sum #########Function implementation############# def main(json_input): input1 = json_input["input1"] # Processing sum_result = sum(inp...
Apollo-Tools/resource-manager
backend/faas-templates/python38/apollorm/main.py
main.py
py
539
python
en
code
1
github-code
1
35298556855
from fastapi import FastAPI, Request, Response, BackgroundTasks from fastapi.responses import JSONResponse, StreamingResponse, RedirectResponse from fastapi.staticfiles import StaticFiles from fastapi.templating import Jinja2Templates from pathlib import Path import os import cv2 import time import subprocess app = Fa...
prabal01pathak/directory_video_player
app.py
app.py
py
2,900
python
en
code
0
github-code
1
31532664375
from flask import Flask, request from flask.templating import render_template from model import summariser app = Flask(__name__) @app.route('/') def index(): return render_template('index.html') @app.route('/results', methods=["POST"]) def summary(): if request.method == "POST": data = request.form.t...
UnpredictablePrashant/MachineLearninginFlask
summariserAI/app.py
app.py
py
574
python
en
code
4
github-code
1
23737668358
import dask.dataframe as dd from lightgbm import LGBMClassifier import joblib import json import pandas as pd from sklearn.metrics import accuracy_score def lightgbm_model(X_train_file, y_train_file, X_validation_file, y_validation_file, params_file, col_names, model_output_file): # Read from parquet file X_tr...
Asad1287/AutoML-for-Predictive-Maintenance
src/Data_Modeling/model_creation_lightgbm.py
model_creation_lightgbm.py
py
1,823
python
en
code
1
github-code
1
4149696396
import cv2 import numpy as np import matplotlib.pyplot as plt def conv2d(ori,kernal): dimension = ori.shape # ori = np.pad(ori,1,'constant',constant_values = 0) result = np.zeros((dimension[0],dimension[1])) for i in range(0,dimension[0]-2): for j in range(0,dimension[1]-2): ori_1 =...
ch3coch3/opencv_dl_hw
P3/P3.py
P3.py
py
2,279
python
en
code
0
github-code
1
36360318683
""" Unit tests for optimization routines from minpack.py. """ from numpy.testing import * import numpy as np from numpy import array, float64 from scipy import optimize from scipy.optimize.minpack import fsolve, leastsq, curve_fit class TestFSolve(TestCase): def pressure_network(self, flow_rates, Qtot, k): ...
decarlin/stuartlab-scripts
python/scipy-0.8.0/scipy/optimize/tests/test_minpack.py
test_minpack.py
py
5,138
python
en
code
6
github-code
1
24376449211
#!/usr/bin/env python # coding: utf-8 import torch import torch.nn as nn import torch.optim as optim import torchvision.transforms as transforms import torchvision.datasets as datasets from torch.utils.data import DataLoader from torch.nn import Sequential, Conv2d,MaxPool2d,Flatten,Linear import torchvision import cv2...
faiimea/WDAD
PRP_demo/net/ty3.py
ty3.py
py
8,545
python
en
code
6
github-code
1
21196188643
from flask import Flask,redirect,render_template,url_for,request app = Flask(__name__) @app.route('/') def Home(): return render_template('index.html') @app.route('/report/<float:marks>') def report(marks): if marks >= 35 : return render_template('pass.html',result = marks) else: ...
BHARATH970438/RasultChecker_API
Result_API/main.py
main.py
py
904
python
en
code
0
github-code
1
70556971235
from glob import glob from itertools import repeat from matplotlib import gridspec as gs from matplotlib import pyplot as plt from matplotlib.patches import Rectangle from matplotlib.ticker import MultipleLocator import json import numpy as np import seaborn as sns from copy import copy from os import path from six imp...
BrainsOnBoard/procedural_paper
scripts/plot_multi_area.py
plot_multi_area.py
py
10,715
python
en
code
22
github-code
1
44385920232
import logging import re from JsonReplace import JsonReplace def Position_strController(json_data): list_length = len(json_data) count = 0 for i in range(0, list_length): if re.search(JsonReplace().init_date, str(json_data[i].get('position_str'))): count = count + 1 if count == 0:...
SmallSky7/JsonReplace
Function/Position_strController.py
Position_strController.py
py
1,018
python
en
code
0
github-code
1
11514147052
# Released under the MIT License. See LICENSE for details. # """Functionality for importing, exporting, and validating dataclasses. This allows complex nested dataclasses to be flattened to json-compatible data and restored from said data. It also gracefully handles and preserves unrecognized attribute data, allowing ...
efroemling/ballistica
tools/efro/dataclassio/__init__.py
__init__.py
py
1,385
python
en
code
468
github-code
1
14122440992
import random # Hero Class class Hero: def __init__(self, name, starting_health=100): self.name = name self.abilities = list() self.starting_health = starting_health self.current_health = starting_health self.armors = list() self.deaths = 0 self.kills ...
AnniePawl/Superheroes
superhero.py
superhero.py
py
8,893
python
en
code
0
github-code
1
33594433609
#This file is designed to have all the functions for preprocess data in both the product df and the review data frames #It will act as the library to import from functions needed in the preprocess_data.py import pandas as pd import numpy as np from collections import Counter ##########################################...
stuartong/amazon-product-prediction
preprocess_data_module.py
preprocess_data_module.py
py
11,042
python
en
code
0
github-code
1
44494706441
#!/usr/bin/env python # -*- coding:utf-8 -*- # @Time : 2018/5/23 14:15 # @Author : zhouyuyao # @File : demon1.py import multiprocessing import os import time from datetime import datetime def subprocess(number): # 子进程 print('这是第{0}个子进程'.format(number)) pid = os.getpid() # 得到当前进程号 pr...
zyyxydwl/Python-Learning
LIVE_PYTHON/2018-05-22/demon1.py
demon1.py
py
1,049
python
en
code
0
github-code
1
39434606704
from django.shortcuts import render, get_object_or_404 from .models import Download, Item # Create your views here. def list_page(request): queryset = Download.objects.all() context = { 'object_list': queryset } return render(request, 'downloads/list.html', context) def detail_page(request, ...
pramod0021a/proutj
src/downloads/views.py
views.py
py
483
python
en
code
0
github-code
1
4978143849
print("========== LOJAS AMERICANAS ==========") valor = float(input("Valor das compras? R$")) print("[1] á vista dinheiro/cheque") print("[2] á vista no cartão") print("[3] em até 2x no cartão") print("[4] 3x ou mais no cartão") opcao = int(input("Qual a sua opção? ")) if opcao == 1: novo = valor * 10/100 p...
nicolasdonada/Exerc-ciosEmPython
DESAFIOS/desafio44.py
desafio44.py
py
1,333
python
pt
code
2
github-code
1
31097782837
""" Hold the functionality of Image Recognition and Verification """ import face_recognition import numpy as np from PIL import Image, ImageDraw class Image_recog: """ Holds the functionality of testing similarity between two images """ def __init__(self, im1, im_smiling, im_not_smiling): self.im_kn...
yohanguez/Hackathon_2018
image_recognition/image_recog.py
image_recog.py
py
8,201
python
en
code
1
github-code
1
11367251439
# Menu drive banking app # PAN number is considered as Primary key for all banking operations # Customer Name,Account Number,Balance, Date of Birth, Phone Number, Address are stored as customer details import datetime import os,sys import re import random import csv import pandas as pd def create_acc(): ...
aravind51097/Menu_Driven_Bank_management_system
BankingApp.py
BankingApp.py
py
6,395
python
en
code
0
github-code
1
32486212791
############## 주의 ############## # 입력을 받기위한 input 함수는 절대 사용하지 않습니다. # 내장 함수 sum, min, max, len 함수를 사용하지 않습니다. # 사용시 감점처리 되니 반드시 확인 바랍니다. def get_row_col_maxsum(matrix): length_r = 0 # 행의 크기 length_c = 0 # 열의 크기 flag = 0 # 최대값이 나온 줄이 행인지 열인지 판단 ans = -int(...
CrimsonTheLegoBuilder/MyBaekjoonSolve
hw/test230731/problem11.py
problem11.py
py
2,358
python
ko
code
0
github-code
1
36656597894
#!/usr/bin/env python3 def main(): with open('input.txt') as f: lines = [x.strip() for x in f.readlines()] output_sum = 0 for l in lines: print(l) (pattern, output) = l.split(' | ') pattern = pattern.split() output = output.split() known_pat = {} k...
gerrowadat/adventofcode
2021/8/2.py
2.py
py
2,857
python
en
code
1
github-code
1
30328203424
class Solution: def maxScore(self, cardPoints: List[int], k: int) -> int: cumaltativeSum = [0] count = 0 for i in cardPoints: count+=i cumaltativeSum.append(count) count = 0 backsum = [0] for i in cardPoints[::-1]: count+=i ...
simratsingh14/algorithmns
1423-maximum-points-you-can-obtain-from-cards/1423-maximum-points-you-can-obtain-from-cards.py
1423-maximum-points-you-can-obtain-from-cards.py
py
559
python
en
code
0
github-code
1
22725518291
from scipy.ndimage import label as bwlabel from computeNsSystem import computeNsSystem from computeLinesDC import computeLinesDC, compute_lines_data_cost from computeLinesLabelCost import computeLineLabelCost import numpy as np from LineExtraction_GC_MRFminimization import LineExtraction_GC_MRFminimization, line_extrac...
mishanius/handwriten-multi-skew-line-extraction
PostProcessByMRF.py
PostProcessByMRF.py
py
2,758
python
en
code
3
github-code
1
36262588213
# -*- coding: utf-8 -*- """ Created on Mon Nov 7 21:37:25 2022 @author: Han """ import torch import numpy as np import pandas as pd import warnings import time from utils import mapping, normalization from ATCNN_model import ATCNN, switch, to_binary, ATCNN_9LiFi warnings.filterwarnings("ignore") # t...
HanJi-UCD/ATCNN
ATCNN_acc_test.py
ATCNN_acc_test.py
py
6,470
python
en
code
0
github-code
1
38941150416
import abc from typing import ( Callable, TypeVar, Any, NamedTuple, Optional, Union, Set, List, Dict, Type, Tuple, ) from livestatus import SiteId from marshmallow import Schema # type: ignore[import] from marshmallow.fields import ( # type: ignore[import] List as MLis...
superbjorn09/checkmk
cmk/utils/bi/bi_lib.py
bi_lib.py
py
15,623
python
en
code
null
github-code
1
13482944607
def drill(canvas): canvas = canvas.lstrip("´`:") canvas = canvas.rstrip(".") power = 0 speed = 0 surface = [] cycle = 0 for item in canvas: if item == '-': power += 1 elif item == '=': power += 2 elif item == ">": speed += 1 ...
SabigBenmumin/PythonPractice
normal_day/before_pee1/lunar_drilling.py
lunar_drilling.py
py
1,152
python
en
code
0
github-code
1
36544529710
# 力扣面试题10.10. 数字流的秩 """ 假设你正在读取一串整数。每隔一段时间,你希望能找出数字 x 的秩(小于或等于 x 的值的个数)。 请实现数据结构和算法来支持这些操作,也就是说: 实现 track(int x) 方法,每读入一个数字都会调用该方法; 实现 getRankOfNumber(int x) 方法,返回小于或等于 x 的值的个数。 """ class TreeNode: def __init__(self, x, rank=0) -> None: self.val = x self.rank = rank self.right = None ...
buxucixingztx/cpp_learning
leetcode/leetcode_interview_10-10/interview_10_10.py
interview_10_10.py
py
1,602
python
zh
code
0
github-code
1
41303685951
from pickle import GET from flask import Flask, render_template, request, redirect, url_for, session import requests from bs4 import BeautifulSoup import datetime app = Flask(__name__) @app.route('/' , methods=['GET', 'POST']) def index(): return render_template('index.html') # Create route that displays t...
davidbardales17/music_traveler
music_traveler/webapp.py
webapp.py
py
1,478
python
en
code
0
github-code
1
7015619706
import re from mock import Mock, patch from nose.tools import assert_equal from nose.tools import assert_is_instance from unittest import TestCase from flask import request from twilio import twiml from strowger import switch TEST_TWILIO_REQUEST_DATA = { 'From': '+14155551234', 'To': '+14158675309', 'Num...
skimbrel/strowger
tests/test_switch.py
test_switch.py
py
4,458
python
en
code
9
github-code
1
74045510113
import random from not_last import last_but_one PUPILS_LIST = [ ("Вася Пупкин", 3.2), ("Петя Дудкин", 3.9), ('Юра Баранкин', 4.100_01), ("Костя Малинин", 3.141_592), ("Зина Фокина", 4.8), ("Артур Пирожков", 3.2), ("Гадя Петрович", 3.141_592) ] def test_vasya_wins(): pupils = list(PUP...
intyamo/dz
not_last/test_not_last.py
test_not_last.py
py
931
python
ru
code
1
github-code
1
2011552662
import datetime import requests from io import BytesIO from PIL import Image, ImageEnhance import discord from discord.ext import commands from lynxie.config import IMAGE_EXTENSIONS, IMAGE_OVERLAYS from lynxie.utils import error_message class Img(commands.Cog): def __init__(self, bot): self.bot = bot ...
Fluffy-Bean/Lynxie
Bot/lynxie/commands/image.py
image.py
py
9,728
python
en
code
0
github-code
1
35316999320
#!/usr/bin/env python import sys for line in sys.stdin: line = line.strip() key_value = line.split(",") key_in = key_value[0].split(" ") value_in = key_value[1] if value_in[0:3]=='ABC': print( '%s\t%s' % (key_in[0], value_in) ) elif value_in.isdigit(): print( '%s\t%s' %...
mandichen/data-ramblings
Hadoop/join2_mapper.py
join2_mapper.py
py
345
python
en
code
0
github-code
1
70270029795
from __future__ import absolute_import from __future__ import division from __future__ import print_function import numpy as np import tensorflow as tf def _float_feature(values): """Helper for creating a Float Feature.""" return tf.train.Feature(float_list=tf.train.FloatList(value=values)) def _int64_feature(...
brain-research/hyperbolictext
nli/tfrecord_creator.py
tfrecord_creator.py
py
2,155
python
en
code
8
github-code
1
29317981995
import matplotlib.pyplot as plt xlabels = ['64', '128', '256', '512', '1024', '2048', '4096'] x = range(len(xlabels)) y = [0.0679, 0.0766, 0.0786, 0.0793, 0.0788, 0.076, 0.0688] y1 = [0.0220, 0.02654, 0.02707, 0.02747, 0.02729, 0.02709, 0.0229] coefficients = np.polyfit(x, y, 2) # 2表示2次项拟合 p = np.poly1d(coefficients...
Lisennlp/paxml_praxis
paxml/my_scripts/plot_example.py
plot_example.py
py
1,344
python
en
code
0
github-code
1
37369014887
# sumar pares mayores a cero print("Suma de números mayores a cero y pares") n1 = int(input("ingrese 1er número:")) n2 = int(input("ingrese 2do número:")) n3 = int(input("ingrese 3er número:")) contador = 0 suma = 0 if n1 > 0 and n1 % 2 == 0: suma += n1 # suma = suma + n1 else: contador+=1 if n2 > 0 and n2 % 2...
patricioyanez/Algoritmos2023_04
EA2/Ejercicio6SumarPares.py
Ejercicio6SumarPares.py
py
530
python
es
code
0
github-code
1
7602666475
class Solution: def isHappy(self, n: int, visited= None) -> bool: if visited is None: visited = set() if n == 1: return True if n in visited: return False visited.add(n) new_num = sum(int(digit)**2 for digit in str(n)) return se...
nelson123-lab/Leetcode_solved_problems_solutions
Top 150 interview questions/HashMap/202. Happy Number.py
202. Happy Number.py
py
745
python
en
code
0
github-code
1
34763790059
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import models, migrations class Migration(migrations.Migration): dependencies = [ ('algo', '0002_auto_20170629_1511'), ] operations = [ migrations.AddField( model_name='results', name=...
HSISeg/HSISeg
algo/migrations/0003_results_status_text.py
0003_results_status_text.py
py
426
python
en
code
4
github-code
1
8513263835
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Given a User ID, returns the list of user templates and associated strengths """ import sys import traceback import barbante.config as config from barbante.context import init_session import barbante.maintenance.user_templates as user_templates import barbante.utils...
hypermindr/barbante
barbante/api/get_user_templates.py
get_user_templates.py
py
1,140
python
en
code
10
github-code
1
28234953103
import time import urllib import pandas as pd url = 'http://localhost:5001/download' raw_data_path = 'data/raw/' raw_data_file_name = 'creditcard.csv' if __name__ == '__main__': start = time.time() print('PROCESS STARTED') print(f'\nGET data from {url}...') try: df = pd.read_csv(url) ...
gprzy/real-time-fraud-detection
etl/airflow/scripts/extract.py
extract.py
py
719
python
en
code
1
github-code
1
42585287863
"""Converter.""" def dec_to_binary(dec: int) -> str: """ Convert decimal number into binary. :param dec: decimal number to convert :return: number in binary """ if dec == 0: return str(0) elif dec < 0: return False else: binary = "" while dec > 0: ...
IPSPoDD/iti0102-2019
ex02_binary/binary.py
binary.py
py
740
python
en
code
0
github-code
1
6187045808
import os import math import pandas as pd # load our data twitter_data_filename = "clean_tweets_pred.csv" twitter_data = pd.read_csv(twitter_data_filename) black_white_characters = pd.read_csv("black_white_characters.csv") black_chars = list(black_white_characters["black"]) white_chars = list(black_white_characters["...
kingsman142/cs6474-reddit-collection
twitter_analysis.py
twitter_analysis.py
py
2,640
python
en
code
0
github-code
1
25695942727
import os import cv2 import numpy as np import imutils import seaborn as sns import matplotlib.pyplot as plt import pandas as pd from tqdm import tqdm DATA = 'task-2' BASE_FRAME = 'frame_0.jpg' HSVLOW = tuple([17, 34, 146]) HSVHIGH = tuple([51, 217, 226]) area = [] table_centers = [] table_rectangles = [] counter_dict...
prasadsawant5/person-counter
main.py
main.py
py
4,480
python
en
code
0
github-code
1
71823933475
import re from functools import reduce from enum import Enum class Error_ID(Enum): OK = 0 ERR_EMPTY_INPUT = 1 ERR_INVALID_COMMAND = 2 ERR_INVALID_DOC_INDEX = 3 ERR_NO_DOC_ID = 4 ERR_NO_TOKENS = 5 ERR_KEY_NOT_FOUND_IN_DB = 6 ERR_DB_ENTRY = 7 ERR_TOKENS_NON_ALPHA = 8 ERR_EMPTY_DB = 9 ERR_NO_EXP = 1...
NAVEENMN/PersonalArchives
simple_sengine/utils.py
utils.py
py
4,799
python
en
code
0
github-code
1
3177425387
#Part 1 with open('day1input.txt') as in_file: count = 0 prev = None for line in in_file: cur = int(line.strip()) if prev != None and cur > prev: count+=1 prev = cur print(count) #PART 2 import sys with open('day1input.txt') as in_file: count = 0 prev = None ...
qzcx/AoC2021
day1.py
day1.py
py
656
python
en
code
0
github-code
1
6053089190
import os from qutebrowser.config.configfiles import ConfigAPI from qutebrowser.config.config import ConfigContainer config: ConfigAPI = config c: ConfigContainer = c config.unbind("d", mode="normal") config.unbind("r", mode="normal") config.unbind("<Ctrl-w>", mode="normal") config.set("content.javascript.enabled", ...
ewok/dotfiles
roles/browser/templates/config/qutebrowser.py
qutebrowser.py
py
24,084
python
en
code
1
github-code
1
24085619860
# -*- encoding: utf8 -*- import db from db.util import * from libs.cache import mem_cache default_group_permission = { "add_task": True, "add_anonymous_task": True, "add_task_limit_size": 20, "add_task_limit": True, "mod_task": True, "view_tasklist": True, "view...
binux/lixian.xunlei
libs/user_manager.py
user_manager.py
py
4,492
python
en
code
361
github-code
1
10546935939
from PyQt5.QtWidgets import QWidget, QApplication from PyQt5.QtCore import Qt, QPoint, QRect, pyqtSignal from PyQt5.QtGui import QMouseEvent, QPixmap, QPainter, QBrush, QColor class RectangleSelectionBackground(QWidget): left_clicked = pyqtSignal() right_clicked = pyqtSignal(QMouseEvent) rectangle_select ...
Snaiel/dbx-interface
package/ui/widgets/explorers/base/selection_background.py
selection_background.py
py
2,055
python
en
code
2
github-code
1
5306291392
import urllib.parse import requests main_api = "https://www.mapquestapi.com/directions/v2/route?" orig = "Rome, Italy" dest = "Frascati, Italy" key = "8qyd7dX1sai7AoMT2RmrXALq5a2T5u2a" #your own key url = main_api + urllib.parse.urlencode({"key":key, "from":orig, "to":dest}) json_data = requests.get(url).json() prin...
BenjamssOdisee/Devnet-Skills-2022-2023
labs/devnet-src/mapquest/mapquest_parse-json_1.py
mapquest_parse-json_1.py
py
334
python
en
code
0
github-code
1
70711738913
import base64 import json import pickle from django_redis import get_redis_connection from utils.cookiesecret import CookieSecret # def merge_cart_cookie_to_redis(request, user, response): # """ # 登录后合并cookie购物车数据到Redis # :param request: 本次请求对象,获取cookie中的数据 # :param response: 本次响应对象,清除cookie中的数据 # ...
libin-c/Meiduo
meiduo/apps/carts/utils.py
utils.py
py
2,909
python
en
code
0
github-code
1
42631149842
import time from threading import Thread from tkinter import * from PIL import Image,ImageTk import cv2 class LiveCameraWindow(Frame): def __init__(self, camera, parent): self.lmain = None self.window = None self.parent = parent self.camera = camera self.test_frame = None ...
TIS2022-FMFI/spektroskop-mikroskop
gui_widgets/LiveCameraWindow.py
LiveCameraWindow.py
py
1,654
python
en
code
0
github-code
1
19877897744
import numpy as np from random import random,randint,choice,uniform,shuffle,randrange from operator import itemgetter from collections import deque def gnp(n,p): a=[[0 for i in range(n)] for j in range(n)] for i in range(1,n): for j in range(i): if(random()<=p): a[...
plaskod/ok
Evocol/tabu.py
tabu.py
py
6,584
python
en
code
0
github-code
1
10603092475
from _collections import deque import sys sys.stdin = open('노드.txt') def prin(a): for i in range(len(a)): print(*a[i]) def bfs(x, end): que = deque() que.append(x) visited[x] = 1 while que: x = que.popleft() for y in range(1, V+1): if G[x][y] == 1 and visited[y]...
nopasanadamindy/Algorithms
10. Queue/노드3.py
노드3.py
py
1,089
python
en
code
0
github-code
1
10651399398
class Solution(object): def calculate(self, s): numbers,opts,i= [],[],0 #分别存数字列表,运算符列表和索引 while i < len(s): if s[i] == " ": #忽略空格 i += 1 elif s[i] == "+" or s[i] == "-" or s[i] == "*" or s[i] == "/": #加减乘除加入运算符列表 opts.append(s[i]) ...
radarcly/leetcode-cn-python
227.基本计算器2/answer.py
answer.py
py
1,377
python
en
code
0
github-code
1
4892480619
import numpy as np from scipy.io.wavfile import write import matplotlib.pyplot as plt # Set the parameters for the sine wave frequency = 440 # Hz duration = 2.0 # seconds amplitude = 0.5 # amplitude of the sine wave # Generate the time points for the sine wave t = np.linspace(0, duration, int(duration * 44100))...
axeldav/synth
sine.py
sine.py
py
635
python
en
code
0
github-code
1
27488738949
import os import json import random SPLIT_FILES = { # 'train': ['train_data_1_train.json', 'train_data_2_train.json', 'train_data_3_train.json', # 'train_data_4_train.json', 'train_data_5_train.json', 'train_data_6_train.json'], # 'val': ['val_data_val.json'], 'test5': ['test_data_5_test.js...
FJsRepo/InfML-HDD
lib/datasets/HorizonSet.py
HorizonSet.py
py
2,793
python
en
code
2
github-code
1
17407307596
# -*- coding: utf-8 -*- # Adam Thompson 2018 import yaml import os class ConfigReader: def __init__(self, job_path): """Initialize configReader class with a path to the root of the job""" self.job_path = job_path self.ymlFileName = "config.yml" self.configPath = os.path.join(self.job_path, self.ymlFileName)...
akoeste3dpu/projectLauncher
ConfigReader.py
ConfigReader.py
py
3,199
python
en
code
1
github-code
1
2990352123
import numpy as np , pandas as pd import csv from math import sqrt import sklearn.linear_model as lm from sklearn.model_selection import KFold from sklearn.metrics import mean_squared_error #init lamda_ = [.01, .1 , 1 , 10, 100] RMSE = np.zeros(5) data = pd.read_csv("train.csv").set_index("Id") X = np.arra...
rafisondi/CourseProjects
Introduction to Machine Learning/Task 1/Task_1a/Task_1a.py
Task_1a.py
py
994
python
en
code
0
github-code
1
10110351631
from time import sleep from adafruit_servokit import ServoKit kit = ServoKit(channels=16) def calibration_cycle(): for i in range(5): kit.servo[i].angle = 0 def movement(finger, motion): servono = int(finger) - 1 if motion == "close" or motion == "Close": angle = 180 elif motion == "open" or motion == "Open"...
abhiramra/3d-prosthetic-hand
servo.py
servo.py
py
651
python
en
code
0
github-code
1
26663471242
# pyright: reportMissingImports=false import time from threading import Thread import numpy as np import logging import traceback import ms5837 import os import shlex # TODO pip3 install this if not default import re from datetime import datetime, timezone logging.basicConfig(level=logging.DEBUG, filename="/home/pi/dat...
noahaosman/MeltStake
Operations.py
Operations.py
py
12,508
python
en
code
0
github-code
1
32485949171
def cover(r, c): t = town[r][c] for x in range(1, towers[t]+1): # 기지국의 종류에 따라 범위가 달라짐 for o in range(4): nr = r + drc[o][0] * x nc = c + drc[o][1] * x if 0 <= nr < N and 0 <= nc < N and town[nr][nc] == 'H': town[nr][nc] = 'X' # 커버되는 곳은 전부 X로 바꿔버리기 ...
CrimsonTheLegoBuilder/MyBaekjoonSolve
hw/sw11671.py
sw11671.py
py
1,102
python
ko
code
0
github-code
1
11185509756
from .basemodel import BaseModel class Associado(BaseModel): def __init__(self, content): super().__init__(content) [self.codigo, self.nome, self.codigoFoto, self.codigoEquipe, self.username, self.numeroDigito, self.dataNascimento, self.dataValidade, self.nomeAbreviado, self.sexo, self.codigoRamo...
escoteirando/escoteirando.org
src/backend/infra/mappa_hack/mappa/associado.py
associado.py
py
1,301
python
pt
code
0
github-code
1
40888234114
import re import sys import string from collections import Counter punctuation_regex = re.compile("[" + re.escape(string.punctuation) + "]") def extract_words(line): no_punctuation = re.sub(punctuation_regex, "\n", line) lowered = no_punctuation.lower() return lowered.split() def main(): counter = Counter()...
Mequrel/pjn
lab1/python.py
python.py
py
577
python
en
code
0
github-code
1
5593091123
n,m = map(int, input().split()) arr = [] d = {'.':0,'-':1,'B':2,'W':3} rd = {0:'.',1:'-',2:'B',3:'W'} for i in range(n): temp = input() t = [] for j in temp: t.append(d[j]) arr.append(t) for i in range(n): for j in range(m): if arr[i][j]==1: arr[i][j]=rd[1] elif...
mayank-kumar-giri/Competitive-Coding
A2OJ/(lt) 1300/dzy_loves_chessboard.py
dzy_loves_chessboard.py
py
658
python
en
code
0
github-code
1
71715189153
#my first python project #it is a calculator a = input ("give the first number: ") b = input ("give the sceond number: ") c = input ("give the operator ") if c == "+" : x=a+b print ("it is summation") elif c == "-" : x= a-b print ("it is minus") elif c == "/" : x= a/b print ("it is division") ...
ayon121/My-Python-Projects
python_project_1.py
python_project_1.py
py
473
python
en
code
0
github-code
1
41283279538
from hypothesis import given from hypothesis.strategies import lists, builds from cim.collection_validator import validate_collection_unordered from cim.iec61970.base.core.test_identified_object import identified_object_kwargs, verify_identified_object_constructor_default, \ verify_identified_object_constructor_kw...
zepben/evolve-sdk-python
test/cim/iec61970/base/core/test_sub_geographical_region.py
test_sub_geographical_region.py
py
2,324
python
en
code
3
github-code
1
42943055341
class Item: # This creates a class with name Item def __init__(self, name: str, price: int, quantity=0): """ 1. __init__(self) Is auto called whenever an instance of the class is called (self) argument is any and all instances created. eg. item1, item2 2. Al...
okiromosh/OOP-In-Python-Lessons
L2-Using__init__Method.py
L2-Using__init__Method.py
py
2,071
python
en
code
0
github-code
1
34837455714
import argparse import logging import hashlib import nltk from nltk.corpus import stopwords logging.basicConfig(level=logging.INFO) from urllib.parse import urlparse import pandas as pd logger = logging.getLogger(__name__) def main(filename): logger.info('Starting cleanig process') df = _read_data(filename) ...
crizleo/proceso_de_ETL
transform/news_paper_recipe.py
news_paper_recipe.py
py
3,674
python
en
code
0
github-code
1
12234701121
class Solution: def coinChange(self, coins: List[int], amount: int) -> int: cache = [inf] * (amount + 1) cache[0] = 0 for i in range(1,amount + 1): for coin in coins: if i - coin >=0: cache[i] = min(cache[i],1+cache[i-...
amanyih/Competitive-Programming
0322-coin-change/0322-coin-change.py
0322-coin-change.py
py
446
python
en
code
2
github-code
1
21838208246
__author__ = 'Ricardo Del Río' from loggers import MyLogger # -------------------------------------------------------------------------------------------------------------- LOGGERS log_i = MyLogger(__name__, name='SERVIDOR', formatter='%(name)s[{0}]: %(message)s'.format(__name__)) log_w = MyLogge...
RickyCode/ProgramacionAvanzada
Tareas/T06/Servidor/chat.py
chat.py
py
1,344
python
es
code
0
github-code
1
1816097182
# See readme.md for instructions on running this code. import random from typing import Any, Dict, List from zulip_bots.lib import BotHandler, use_storage class CodeExquisHandler: def initialize(self, bot_handler: BotHandler) -> None: storage = bot_handler.storage if not storage.contains("line...
eviau/code-exquis
code_exquis.py
code_exquis.py
py
7,354
python
en
code
0
github-code
1
36368439793
import json import datetime import matplotlib.pyplot as plt import pytz with open('/Users/decarlo/conda/steelyards/camera_garage.jsonl', 'r') as json_file: json_list = list(json_file) car_list = [] person_list = [] bike_list = [] t_list = [] tp_list = [] tb_list = [] for json_str in json_list: result = js...
decarlof/steelyards
garage/garage.py
garage.py
py
1,473
python
en
code
0
github-code
1
33516111574
import json from django.http import JsonResponse from django.views import View from django.db.models import Avg from homes.models import Home from users.models import User from bookmarks.models import BookMark from users.utils import ConfirmLogin class BookmarkView(View): @Co...
wecode-bootcamp-korea/15-2nd-CodeBnB-backend
bookmarks/views.py
views.py
py
3,575
python
en
code
0
github-code
1
12092507814
# 导入若干工具包 import torch import torch.nn as nn import torch.nn.functional as F # 定义一个简单的网络类 class Net(nn.Module): def __init__(self): super(Net, self).__init__() # 定义第一层卷积神经网络, 输入通道维度=1, 输出通道维度=6, 卷积核大小3*3 self.conv1 = nn.Conv2d(1, 6, 3) # 定义第二层卷积神经网络, 输入通道维度=6, 输出通道维度=16, 卷积核大小3*3 ...
Eye-Wuppertal/NLP_Learning
test/t_01pytorch_base/torchnn.py
torchnn.py
py
1,761
python
en
code
1
github-code
1
71082068835
import string import random import re import datetime from tornado_json.requesthandlers import APIHandler from python_mysql_dbconfig import getconnection class LinksAPIHandler(APIHandler):# pylint: disable=too-few-public-methods __url_names__ = ["links"] class GetLinks(LinksAPIHandler):# pylint:...
Evgen174/api
slink/api.py
api.py
py
3,503
python
en
code
0
github-code
1
4533876898
#references : https://youtu.be/pp61TbhJOTg #ieee paper link : https://scholar.google.com/scholar?hl=en&as_sdt=0%2C5&q=brain+tumor+detection&oq=brain+#d=gs_qabs&u=%23p%3DVe4XM0A9CzEJ import os import cv2 import tensorflow as tf from tensorflow import keras from PIL import Image import numpy as np import pandas a...
oskorp/_detANNFL_Brain_tumor
main.py
main.py
py
4,050
python
en
code
0
github-code
1
7572142954
import logging logging.basicConfig(level=logging.INFO, format='%(message)s') def addition(x, y): logging.info(f"Dodaję {x} i {y}") return x + y def subtraction(x, y): logging.info(f"Odejmuję {y} od {x}") return x - y def multiplication(x, y): logging.info(f"Mnożę {x} razy {y}") return x *...
qrnik/Kodilla
4.4zad_improved.py
4.4zad_improved.py
py
1,240
python
pl
code
0
github-code
1
29626850568
from cpu import CPU if __name__ == "__main__": cpu = CPU() cpu.parse_instruction_definitions(["instructions/core.instr"]) interrupts = [ ] while not cpu.halt: cpu.run(1) if len(interrupts) > 0: cpu.devices[interrupts[0][0]].interrupt(cpu, interrupts[0][1]) i...
tommasopeduzzi/TDP-11
emulator/main.py
main.py
py
352
python
en
code
0
github-code
1
32005544758
import logging import requests import pandas as pd from datetime import date from datetime import datetime def main(): logging.basicConfig(filename='app.log', filemode='a', format='%(asctime)s - %(message)s', level=logging.INFO) df = pd.DataFrame( columns=['district', 'city', 'county', 'instructional...
trackman1111/School-Opening-Scraper
illinois.py
illinois.py
py
2,116
python
en
code
2
github-code
1
1039238635
from torch import cuda USE_CUDA = cuda.is_available() LOAD_IMAGES_TO_MEMORY = False # Files CAPTIONS_DIR = '../data/coco/annotations/captions_{}2014.json' KARPATHY_SPLIT_DIR = '../data/karpathy_splits/karpathy_{}_images.txt' FEATURES_DIR = '../data/features/extracts/{}.npy' CAPTION_VECTORS_DIR = '../data/caption_vecto...
chipbautista/295-deeprl-captioning
settings.py
settings.py
py
1,419
python
en
code
2
github-code
1
24525843835
''' add data to dataset ''' import os import re import sys import time import fcntl import datetime import commands import brokerage.broker from dataservice import DynDataDistributer from dataservice.MailUtils import MailUtils from dataservice.Notifier import Notifier from taskbuffer.JobSpec import JobSpec from datas...
edquist/panda-server
pandaserver/dataservice/EventPicker.py
EventPicker.py
py
12,282
python
en
code
null
github-code
1
12802998686
# -*- coding: utf-8 -*- """ Created on Fri May 18 10:25:58 2018 @author: 刘闯 欧几里得算法 求解公约数 """ #A=Q*B+R if A>B def GCD(A,B): if A==0: gcd=B elif B==0: gcd=A else: return GCD(B,A%B) return gcd print(GCD(27,123))
LiuChuang0059/python_practise
graph algorithm/GCD.py
GCD.py
py
302
python
en
code
43
github-code
1
45645092924
from celery import states from celery.task import Task from celery.exceptions import Ignore from vigil.celery import app class LambdaBotInsufficientFundsTask(Task): """ Pre-process data from Lambda Bot when reporting insufficient funds to place total walls """ expected_data = { 'exchange'...
inuitwallet/vigil
vigil/tasks/preprocessors/lambdabot_insufficient_funds.py
lambdabot_insufficient_funds.py
py
1,859
python
en
code
0
github-code
1
11868818076
import pandas as pd import numpy as np import sys sys.path.append(".") import unittest import doctest from func_analises import reindexacao_e_filtragem, df class TestReindexacaoEFiltragem(unittest.TestCase): # teste com parâmetro válido def test_reindexacao_e_filtragem_com_dataframe(self): # ...
AnaJAPR/Trabalho-A1-LP-2023.2
tests/test_reindexacao_e_filtragem.py
test_reindexacao_e_filtragem.py
py
1,278
python
pt
code
1
github-code
1
11631638088
import flask import json import os import alsaaudio import mpv import threading import requests import signal import subprocess app = flask.Flask(__name__, static_folder = '../gui/build/', static_url_path="/") if os.environ.get('PIRADIO_DEV') is not None: from flask_cors import CORS CORS(app) conf = json.loa...
titulebolide/Juicebox
api/app.py
app.py
py
4,193
python
en
code
1
github-code
1
17566582575
from rest_framework.test import APIClient # import status_code from rest_framework import status import pytest from model_bakery import baker as Baker from store.models import Collection ,Product ,Cart # THIS FIXTURE IS SPECIFIC TO THIS TEST FILE # RETURN THE API CALL FUNCTION @pytest.fixture # we cant not take param...
md-armaan13/storefront
store/tests/test_products.py
test_products.py
py
2,806
python
en
code
0
github-code
1
37848324292
import os import re from difflib import SequenceMatcher, get_close_matches from typing import Tuple, Union import pandas as pd _src_path = os.path.dirname(__file__) _data = pd.read_feather(os.path.join(_src_path, "data/state.ft")) _states = list(_data["State"]) _data = pd.read_feather(os.path.join(_src_path, "data/...
sonesuke/nayose
nayose/address.py
address.py
py
2,875
python
en
code
0
github-code
1
12121070236
import matplotlib.pyplot as plt import numpy as np # Datenfile erzeugen data_x = np.linspace(0, 10, 50) data_y = 10 * np.exp(-data_x) np.savetxt("3.txt", np.column_stack([data_x, data_y]), header="x y") x, y = np.genfromtxt("3.txt", unpack=True) fig, (ax1, ax2) = plt.subplots(1, 2, layout="constrained") ax1.plot(x,...
pep-dortmund/toolbox-workshop
exercises-toolbox/3-matplotlib/3/loesung.py
loesung.py
py
492
python
en
code
25
github-code
1
71721971875
import torch import torch.nn as nn import numpy as np import sys import os sys.path.append(os.path.join(os.getcwd(), "lib")) # HACK add the lib folder # from models.backbone_module import Pointnet2Backbone from lib.pointnet2.pointnet2_modules import PointnetSAModuleVotes, PointnetFPModule from models.voting_module imp...
daveredrum/Scan2Cap
models/mask_votenet.py
mask_votenet.py
py
10,906
python
en
code
89
github-code
1
40664832390
import sys sys.stdin = open("A1_input.txt") def BubbleSort_sort(n): # O(n^2) # for k in range(n-1): for i in range(2): for j in range(i+1, n): if a[i] > a[j]: a[i], a[j] = a[j], a[i] n = int(input()) a = list(map(int, input().split())) res = 0 a.sort() while len(a) != 1: ...
manuck/Algorithm
codexpert(AD)/A1-최소비용으로 포장 다시하기.py
A1-최소비용으로 포장 다시하기.py
py
451
python
en
code
0
github-code
1
20798577228
""" File: logger.py Modified by: Senthil Purushwalkam Code referenced from https://gist.github.com/gyglim/1f8dfb1b5c82627ae3efcfbbadb9f514 Email: spurushw<at>andrew<dot>cmu<dot>edu Github: https://github.com/senthilps8 Description: """ #import tensorflow as tf from torch.autograd import Variable import numpy as np imp...
WeLoveKiraboshi/DeepTiltedDepthEstimation
utils/tb_logger.py
tb_logger.py
py
5,043
python
en
code
0
github-code
1
4351575598
from dataclasses import dataclass from typing import List, Optional, Tuple, Union import numpy as np import torch from diffusers import DDIMScheduler from diffusers.utils import BaseOutput @dataclass class NestedSchedulerOutput(BaseOutput): """ Output class for the scheduler's step function output. Ar...
noamelata/NestedDiffusion
NestedScheduler.py
NestedScheduler.py
py
8,833
python
en
code
13
github-code
1
41057279091
import sys import os import shutil import zipfile from cx_Freeze import setup, Executable APP_NAME = "MergeLogs" # ビルドに含めるパッケージとモジュールを指定 packages = ['module'] includes = [] excludes = [] # 実行ファイルの設定 exe = Executable( script='main.py', # 実行ファイルとなるスクリプト targetName=(APP_NAME + '.exe'), # 出力ファイル名 base=Non...
pinfu-jp/MergeFilesByPython
setup.py
setup.py
py
1,732
python
ja
code
2
github-code
1
1084288061
#!/usr/bin/env python3 # Requires python3 >= 3.4, and stress-ng to be installed. import subprocess import sys from statistics import stdev, mean def measure(): time_seconds = float(str(subprocess.check_output("stress-ng -c2 --cpu-method ackermann --cpu-ops 10 | grep -o '[0-9][0-9\.]*s'", shell=True), encoding="utf...
nh2/linux-bad-core-scheduling-investigation
test.py
test.py
py
645
python
en
code
2
github-code
1