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
70949272298
"""This script will implement the leitner algorithm for sorting flashcards. It includes 3 pre-build instances of CardBox (levels 1-3) """ from models import session, User, Deck, Flashcard, CardBox, MAXLEVEL from models import loglevel import logging import re from datetime import datetime logger = logging.getLogger...
luisnaranjo733/flashcards
flashcards/flashcards.py
flashcards.py
py
2,776
python
en
code
2
github-code
90
12304971582
import ctypes class DynamicArray(object): def __init__(self): self.n = 0 # count of elements in array self.capacity = 1 # max elements self.A_arr = self.make_array(self.capacity) # creates an array with a cap of 1 def __len__(self): '''Returns n number of elements stored in arr...
andrewbrase/completed_projects
11_Dynamic_array_project/dynamic_arr.py
dynamic_arr.py
py
2,334
python
en
code
0
github-code
90
27159124836
import cv2 as cv #Khai báo thư viện OpenCV import numpy as np #Thư viện tính toán chuyên dụng dùng cho ma trận from PIL import Image #Thư viện xử lý ảnh PILLOW hỗ trợ nhiều định dạng ảnh import math #Khai báo đường dẫn filehinh filehinh = r'lena.jpg' #Đọc ảnh màu dùng thư viện OpenCV được mã hóa thành ma trậ...
NguyenHoang127/Image_Processing
Project XLA Python/XLA14_Gray_Image_Edge_Detection.py
XLA14_Gray_Image_Edge_Detection.py
py
3,203
python
vi
code
0
github-code
90
18267114639
def calc_comb(n,r): numerator=1 for i in range(n-r+1,n+1): numerator=(numerator*i)%mod denominator=1 for i in range(1,r+1): denominator=(denominator*i)%mod return (numerator*pow(denominator,mod-2,mod))%mod n,a,b=map(int,input().split()) mod=1000000007 print((pow(2,n,mod)-1-calc_comb(...
Aasthaengg/IBMdataset
Python_codes/p02768/s418726511.py
s418726511.py
py
351
python
en
code
0
github-code
90
39773244843
import loadfile as lf import numpy as np import pymysql import os def get_table(attribute) : if attribute.startswith('p_') : return 'part' elif attribute.startswith('ps_') : return 'partsupp' elif attribute.startswith('s_') : return 'supplier' elif attribute.startswith('c_') : ...
dsolh/BEA-Project
calculate_cost.py
calculate_cost.py
py
7,061
python
en
code
0
github-code
90
43395273423
#Implement k-means in own way #define it as a class #repeat n number of times. #n_clusters already known. pick a random point - the second the most distant from it. #and so on. #implement the algorithm. 'k-means' or 'k-medians' import numpy as np from scipy.spatial.distance import cdist import pandas as pd import tim...
nbodapati/C-Python-Coding-
Caltech_10kWebFaces/Kmeans.py
Kmeans.py
py
3,549
python
en
code
0
github-code
90
21362274213
from qcloudsms_py import TtsVoiceSender from qcloudsms_py.httpclient import HTTPError import config def callPhone(params, phoneList): global result tvsender = TtsVoiceSender(config.appid, config.appkey) try: for phone in phoneList: print(phone) print(params) res...
SummerQiuye/devops-api
alert/module/sendTelAlert.py
sendTelAlert.py
py
556
python
en
code
3
github-code
90
32756788726
from typing import List class Solution: def findJudge(self, n: int, trust: List[List[int]]) -> int: others = list(map(lambda x : x[0], trust)) trusted = list(map(lambda x : x[1], trust)) a = [0 for _ in range(0,n+1)] for i in trusted: a[i] += 1 for i in range(1, ...
Ansore/LeetcodeSolutions
997.find-the-town-judge/main.py
main.py
py
641
python
en
code
0
github-code
90
16363799758
import logging import threading import time from absl import flags as gflags FLAGS = gflags.FLAGS gflags.DEFINE_integer("probe_frequency_secs", 10*60, "How often to probe the logs for updates") from ct.client import async_log_client from ct.client import monitor from ct.client import state fro...
google/certificate-transparency
python/ct/client/prober.py
prober.py
py
5,305
python
en
code
862
github-code
90
28136493300
#will be creating countdown where input will be provided by the user. # and when the countdown finish message will appear # import the time module import time # define the countdown func. def countdown(t): while t: mins, secs = divmod(t, 60) timer = '{:02d}:{:02d}'.format(mins, secs) ...
rassh15/Python_practice
InterMediateProj.py/timer.py
timer.py
py
521
python
en
code
0
github-code
90
3536244159
"""Module containing classes that pertain to forming an HTTP response.""" import eupheme.cookies STATUS_OK = '200 OK' class HttpException(Exception): """Base class for exceptions that may occur while processing a request.""" status = None def __init__(self, headers=None): self.headers = header...
Parnassos/Eupheme
eupheme/response.py
response.py
py
4,430
python
en
code
0
github-code
90
19341990133
from django.urls import path from second_app.views import index,user,form_detail_view urlpatterns = [ path('index/',index,name='index'), path('users/',user,name='user'), path('form-details/',form_detail_view,name='form-details') ]
SIVAGOPIREDDY/First_project
PycharmProjects/first_project/second_app/urls.py
urls.py
py
245
python
en
code
0
github-code
90
23817009500
import models from flask import Blueprint, request, jsonify from playhouse.shortcuts import model_to_dict dogs = Blueprint('dogs', 'dogs') @dogs.route('', methods=['GET']) def dogs_index(): result = models.Dog.select() print("") print('result of dog select query') print(result) #hmm looks like SQL ...
am852410/dog-app-back-end
resources/dogs.py
dogs.py
py
1,140
python
en
code
0
github-code
90
33198153159
# https://www.w3resource.com/python-exercises/python-basic-exercise-36.php # Python: Add two objects if both objects are an integer type def sum_numbers(a,b): if not (isinstance(a,int) and isinstance(b, int)): return "Error: Inputs must be integers!" return a + b n1 = input("Enter First No.:\n") prin...
Vishvendra-panwar/Python-Practice
002.W3resource.Python.Excersies/036.Python.Basic.36.integer.sum.py
036.Python.Basic.36.integer.sum.py
py
410
python
en
code
0
github-code
90
73206516778
#!/usr/bin/env python import rospy import sys from std_msgs.msg import Int32 from std_msgs.msg import Bool # takes in the data def callback(data): rospy.loginfo(data.data) # parameters specify the data that is returned # Sensor = distance, Trigger = True / Flase def listener(argv): rospy.init_node('listener', ...
lasseaeggen/SiNRI
sensor/sensor.py
sensor.py
py
698
python
en
code
1
github-code
90
8688484548
from spider_runner_base import SpiderRunnerBase # ! Do not delete these ! import sys from utils.helpers.arg_helper import ArgHelper """ This file is main entry point and is responsible of running spider(s). This is actually CrawlerKing runner that decides which spider(s) must be run with what parameters based on user-p...
codeworm47/CrawlerKing
run.py
run.py
py
1,781
python
en
code
0
github-code
90
44011149008
from tree import Node def lowest_common_ancestor_helper(node1, node2, currentNode): if node1==node2: return 2, node1 numFound = 0 if currentNode.left: lNumFound,lNode = lowest_common_ancestor_helper(node1,node2,currentNode.left) if lNumFound == 2: return 2, lNode ...
mffoley/LowestCommonAncestor
Python/LCA.py
LCA.py
py
1,166
python
en
code
0
github-code
90
38945429776
from celery import shared_task from django.core.mail import send_mail from django.conf import settings from useraccount.models import User @shared_task(bind=True) def fun(self): # operations print("You are in Fun function") return "done" @shared_task(bind=True) def send_mail_func(self): users=User.ob...
shammas01/E-learning
live/tasks.py
tasks.py
py
719
python
en
code
0
github-code
90
71605024936
from djongo import models from django import forms # Create your models here. class Booth(models.Model): _id = models.ObjectIdField() name = models.TextField() club = models.TextField() message = models.TextField() code = models.TextField() busy = models.IntegerField() objects = models.Djo...
dshslife/club_festival
main/models.py
models.py
py
750
python
en
code
0
github-code
90
11164473453
from ast import Delete from multiprocessing import parent_process from textwrap import fill from tkinter import* from PIL import Image,ImageTk #pip install pillow from tkinter import ttk ,messagebox import sqlite3 class supplierClass: def __init__(self,root): self.root=root self.root.geometry("1100x50...
hakim4545/SmartMart-
supplier.py
supplier.py
py
8,928
python
en
code
0
github-code
90
33376099357
import numpy as np import torch import torch.nn as nn import torch.nn.functional as F class Decoder(nn.Module): def __init__(self, cfg): super(Decoder, self).__init__() in_ch = cfg.color_in_ch feat_ch = cfg.hidden_ch self.color_net = nn.Sequential( nn.utils.weight_norm(...
snap-research/edit3d
models/colorsdf_mlp9.py
colorsdf_mlp9.py
py
808
python
en
code
23
github-code
90
18371943939
L,R=map(int,input().split()) min_val = 2019 flag = 1 for i in range(L, min(R,L+2019-1), 1): for j in range(i+1, min(R+1,L+2019), 1): tmp = (i*(j)) % 2019 if tmp == 0: flag = 0 break elif tmp < min_val: min_val = tmp if flag == 0: break if flag == 0: print(0) else: print(min_va...
Aasthaengg/IBMdataset
Python_codes/p02983/s298639104.py
s298639104.py
py
322
python
en
code
0
github-code
90
6489148542
# -*- coding: utf-8 -*- """ Utils for creating bodies neral netowrks """ from utils.network_utils import * class FCBody(nn.Module): def __init__(self, state_dim, hidden_units = (128, 128, 64), function_unit = F.relu): # initializes the parent class object into the child class ...
onginas/SDPG-Agent
utils/network_body.py
network_body.py
py
2,924
python
en
code
0
github-code
90
6556215776
from .pages.product_page import ProductPage import pytest link = "http://selenium1py.pythonanywhere.com/catalogue/coders-at-work_207/" @pytest.mark.xfail(reason="Всё окей, сообщение должно быть") def test_guest_cant_see_success_message_after_adding_product_to_basket(browser): page = ProductPage(browser, link) ...
NateSparkheart/SeleniumCourseFinalProject
test_product_page_negative.py
test_product_page_negative.py
py
907
python
en
code
0
github-code
90
8220322255
import os import copy from datetime import datetime import numpy as np import pandas as pd import utils from gift import Gift from bag import Bag class SolutionCandidate: def __init__(self, gift_weight_init_method, gift_type_amounts, n_observations_to_evaluate_solution, warm_start_path=None): ...
tuomastik/kaggle_christmas_2016
solution_candidate.py
solution_candidate.py
py
8,905
python
en
code
0
github-code
90
18428199909
import sys from bisect import * from heapq import * from collections import * from itertools import * from functools import * from math import * from fractions import * sys.setrecursionlimit(100000000) input = lambda: sys.stdin.readline().rstrip() def main(): N = int(input()) states = [s + t + u for s in 'ACG...
Aasthaengg/IBMdataset
Python_codes/p03088/s016685790.py
s016685790.py
py
1,242
python
en
code
0
github-code
90
15684130828
#!/usr/bin/env python3 import rospy from geometry_msgs.msg import PoseStamped from helpers.ros_globals import * import tf ################################################################################ ## Frames transforms global broadcaster. ## This centralizes transforms publishment to avoid extrapolation issues ...
Lukerrr/eaglex
eagle/scripts/framework/tf_manager.py
tf_manager.py
py
1,900
python
en
code
0
github-code
90
24659283549
# -*- coding:utf8 -*- import pickle as pkl import numpy as np from sklearn.decomposition import PCA from sklearn.feature_extraction.text import TfidfVectorizer import text_helpers from nltk.corpus import stopwords import os import tensorflow as tf freq_table_path = 'movie_vocab_freq.pkl' word_dict_path = ...
shillyshallysxy/Learning_NLP
Sentence2Vec/sentence2vec.py
sentence2vec.py
py
8,447
python
en
code
37
github-code
90
12563214352
# Author: Dominik Bauer # Vision for Robotics Group, Automation and Control Institute (ACIN) # TU Wien, Vienna import numpy as np import numpy.ma as ma from scipy.spatial.transform.rotation import Rotation import torch import torch.nn.parallel import torch.utils.data from torch.autograd import Variable import torchvis...
v4r-tuwien/verefine_pipeline
src/verefine/densefusion/densefusion.py
densefusion.py
py
6,872
python
en
code
0
github-code
90
17065480876
import argparse import csv import datetime import logging from openpyxl import Workbook from openpyxl.utils.exceptions import IllegalCharacterError import os import requests import shutil import subprocess import time import win32api import zipfile def get_current_time_as_string(): return datetime.datetime.now()....
michaeltneuman/neuforensics_imageparser
PARSER_20230413/main.py
main.py
py
28,317
python
en
code
0
github-code
90
13461386515
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import models import re US_STATES = [ "AL", "AK", "AZ", "AR", "CA", "CO", "CT", "DE", "FL", "GA", "HI", "ID", "IL", "IN", "IA", "KS", "KY", "LA", "ME", "MD", ...
jdaniel0x50/coding-dojo-teaching-Python
03_Django/demo_proj/dojos/apps/dojo_app/models.py
models.py
py
2,953
python
en
code
0
github-code
90
18065714339
n = int(input()) ai = [int(input()) for i in range(n)] ans = 0 nokori = 0 for i in range(n): if ai[i] % 2 == 1: if nokori == 1: nokori = 0 ans += ai[i] // 2 + 1 else: nokori = 1 ans += ai[i] // 2 elif ai[i] > 0: if nokori == 1: ...
Aasthaengg/IBMdataset
Python_codes/p04020/s982721619.py
s982721619.py
py
481
python
en
code
0
github-code
90
18417187049
n = int(input()) s = input() migi = s.count(".") hidari = 0 ans = migi for i in range(n): if s[i] == "#": hidari += 1 elif s[i] == ".": migi -= 1 ans = min(ans,hidari+migi) print(ans)
Aasthaengg/IBMdataset
Python_codes/p03069/s338272600.py
s338272600.py
py
211
python
en
code
0
github-code
90
41152146990
import os import random from isort import file from matplotlib.image import imread from PIL import Image import numpy as np from base64 import b64encode from io import BytesIO # pour langestion de l'API custum vision from azure.cognitiveservices.vision.customvision.training import CustomVisionTrainingClient from az...
adjanorpro18/Projet-P8---Triof
triof/src/utils.py
utils.py
py
4,894
python
en
code
0
github-code
90
16888758558
# import cv2 # cap=cv2.VideoCapture(0) # #infinite loop # while True: # ret, frame = cap.read() # cv2.imshow("Devansh's camera", frame) # if cv2.waitKey(1)== 13: #13 is ASCII code of ENTER # break # cap.release() # cv2.destroyAllWindows() #open webcamera-par pta nhi kyu ulta aara saala import ...
Devansh2005/OpenCv-practice
prac15.py
prac15.py
py
744
python
en
code
0
github-code
90
18003997669
n = int(input()) a = list(map(int,input().split())) acc = [a[0]] for i in range(1, n): acc.append(acc[-1] + a[i]) res = 10 ** 100 def f(fir): prv_pos = fir > 0 margin = fir - a[0] ret = abs(margin) for i in range(1, n): cur = margin + acc[i] if prv_pos and cur < 0: prv_...
Aasthaengg/IBMdataset
Python_codes/p03739/s466351156.py
s466351156.py
py
830
python
sh
code
0
github-code
90
18033205689
import heapq class Graph(): def __init__(self,vertex_num,node_num,naive_input,start_zero=True,direction=False): self.vertex_num=vertex_num self.node_num=node_num #nodeには入力時のインデックスも含む #[接続ノード , インッデクス]のarray node=[{} for _ in range(vertex_num)] for i in range(node_num)...
Aasthaengg/IBMdataset
Python_codes/p03837/s636767328.py
s636767328.py
py
2,974
python
en
code
0
github-code
90
33932585036
#!/usr/bin/env python import argparse import requests parser = argparse.ArgumentParser() parser.add_argument('url' ,type = str, help = 'web address') args = parser.parse_args() url = args.url def download(url): response = requests.get(url) print(response.text) return response.text if __name__ == '__main__...
Drahow/Web-Scrap-With-Python
chapter1/download3.py
download3.py
py
341
python
en
code
0
github-code
90
73576163497
dictionary = {} words = input("Please enter word with translations separated by : and ,\n->") result = words.split(",") for words in result: split_result = words.split(":") key = split_result[0].lower() value = split_result[1].lower() dictionary[key] = value phrase = input("Please enter a phrase in spa...
Algoritmos-y-Programacion-2122-3-S3/Ejercicios-en-clase
Semana 4/Martes/translate.py
translate.py
py
448
python
en
code
0
github-code
90
28134486560
''' 19a) Write the Python program To compute sin(x) using the below given Formula sin x = x - x3/3! + x5/5! - x7/7! + x9/9! ........ ''' def factorial(number): if number==1: return 1 else: return number * factorial(number-1) def exponent(x,p): return x**p x = int(input('Enter x value:'...
rajasekaran36/pspp2023
set5/19a/main.py
main.py
py
617
python
en
code
0
github-code
90
15169507011
from play.tests.base import BaseTestCase class PlayTestCase(BaseTestCase): """ 플레이어 게임 턴 변경 테스트 """ async def test_unittest_turn(self): # GIVEN: 사용자가 사용할 커맨드 turn = 0 command = { "command": "action", "player": turn, "card_number": "BASE_01" ...
MinJunsu/agricola
play/tests/play.py
play.py
py
1,446
python
ko
code
0
github-code
90
31661754353
#mutable but unlike lists and tuples it doesnt allow duplicate elements. eg if we print myset4 it will remove the second 2 myset = {"banana", "apple", "maembe", "avoc"} myset2=tuple(["Max", 30, "Boston"]) #this creates a set from a list myset3={5, True, "apple", "apple"} myset4={101, 22, 2, 0, 34, -10, 2, 330...
Timothy254/Playing-with-Python
Basics/4 Sets.py
4 Sets.py
py
1,924
python
en
code
0
github-code
90
1462474816
from django.db import models from django.utils.translation import pgettext_lazy as _ from google.cloud import vision from rest_framework import serializers class Image(models.Model): image_uri = models.URLField(max_length=1000, verbose_name=_('itt|Image url', 'Image url')) @property def get_obj_list(self...
lev-slinsen/Gimage
itt/models.py
models.py
py
900
python
en
code
0
github-code
90
7464583049
""" Automate line-length pipeline to a data dictionary. Author: Ankit N. Khambhati Last Updated: 2018/11/08 """ import numpy as np from . import signal_dict import pyfftw import pyeisen import functools print = functools.partial(print, flush=True) DUR = 0.04 N_KERN = 1 MEM_FFT = True def _reserve_fftw_mem(kernel_l...
subnets/EpiNetReorgChronicRNS
notebooks/utils/apply_linelength.py
apply_linelength.py
py
3,792
python
en
code
2
github-code
90
27121376072
import unittest from junit_xml import TestSuite, TestCase from pageobjects.home_screen import HomeScreen from webdriver import Driver import Logger class TestCases(unittest.TestCase): def setUp(self): print('Setting up driver') self.driver = Driver() Logger.set_logger() def test_sta...
DandresPer/appium_poc_booking
pythonProject/testcases/booking_services/stay_booking.py
stay_booking.py
py
965
python
en
code
0
github-code
90
18530896039
N = int(input()) num = list(map(int, input().split())) ans = 0 r = 0 sumz = 0 for l in range(N): if r < l: r = l while (r < N) and (num[r] + sumz) == (sumz ^ num[r]): sumz += num[r] r += 1 ans += r-l sumz -= num[l] print(ans)
Aasthaengg/IBMdataset
Python_codes/p03340/s282212883.py
s282212883.py
py
262
python
en
code
0
github-code
90
27413267815
import tkinter as tk from tkinter import messagebox as tkm from ex05.fight_kokaton import perfect_body, turth,ans def button_click(event): btn=event.widget txt=btn["text"] if turth==ans: perfect_body+=1#無敵回数を追加 success_point+=1 else: return
c0b21113/ProjExD
ex05/option.py
option.py
py
298
python
en
code
2
github-code
90
18443532909
def main(): N = int(input()) A = [int(a) for a in input().split()] mon1 = [a for a in A] mon2 = [a for a in A] for i in range(10**9): mon1 = sorted(mon2) mon2 = list() for j in range(1, len(mon1)): m_ = mon1[j] % mon1[0] if m_ != 0: m...
Aasthaengg/IBMdataset
Python_codes/p03127/s010738641.py
s010738641.py
py
473
python
en
code
0
github-code
90
18583918629
import math # s=int(input()) # b=input() # c=[] # for i in range(b): # c.append(a[i]) a = list(map(int,input().split())) #b = list(map(int,input().split())) if a[0]+a[1]<a[2]+a[3]: print("Right") elif a[0]+a[1]==a[2]+a[3]: print("Balanced") elif a[0]+a[1]>a[2]+a[3]: print("Left")
Aasthaengg/IBMdataset
Python_codes/p03477/s974572614.py
s974572614.py
py
297
python
en
code
0
github-code
90
24930290292
from lxml import objectify from src.utils.colors import get_random_color, color_to_string def parse_points(points_str) -> list: points = [] for point_str in points_str.split(';'): coords_str = point_str.split(',') coords = [float(coords_str[0]), float(coords_str[1])] points.append(coo...
prime-slam/PlaneDetector
src/annotations/cvat/CVATAnnotation.py
CVATAnnotation.py
py
3,016
python
en
code
2
github-code
90
71401972137
#!/usr/bin/python3 # -*- coding: utf-8 -*- # @Time : 2020.02.05 # @Author : Lhaihai # @File : AppCertDlls # @Software: PyCharm # @Blog : http://www.Lhaihai.top """ Description : 修改注册表的 AppCertDlls,需要管理员权限 """ import pyregedit.pyregedit as pyregedit from logger import factory_logger logger = ...
Lhaihai/PythonPersistence
AppCertDlls.py
AppCertDlls.py
py
1,370
python
en
code
32
github-code
90
19443486525
import threading from allmodels_ui.UITestTask import UITestTask from core.decorator.normal_functions import * class UITaskThread(threading.Thread): def __init__(self,task = UITestTask()): super(UITaskThread, self).__init__() self.task = task @catch_exception @take_time def run(self):...
LianjiaTech/sosotest
AutotestFramework/threads/UITaskThread.py
UITaskThread.py
py
445
python
en
code
489
github-code
90
18464307779
from sys import setrecursionlimit, stdin setrecursionlimit(10**6) input = stdin.buffer.readline def main(): n, m = map(int, input().split()) edges = [[] for _ in range(n)] for _ in range(m): x, y = map(int, input().split()) edges[x-1].append(y-1) dp = [-1] * n def dfs(node): ...
Aasthaengg/IBMdataset
Python_codes/p03166/s745408884.py
s745408884.py
py
750
python
en
code
0
github-code
90
35185864180
import unittest import grr.ThresholdModel_testutil as tmt from grr.AugmentedGIF import AugmentedGIF class TestAugmentedGIFSimulateDoesNotCrash_VectorInput( tmt.TestSimulateDoesNotCrash_VectorInput, unittest.TestCase ): def setUp(self): super(TestAugmentedGIFSimulateDoesNotCrash_VectorInput, self).set...
nauralcodinglab/raphegif
grr/AugmentedGIF_test.py
AugmentedGIF_test.py
py
1,185
python
en
code
0
github-code
90
37559635845
class Stack(object): u"""An object representing a stack data structure.""" def __init__(self): u"""Instantiate a Stack without Data.""" self.head_data = None def push(self, data): u"""Push a new data element to the top of the Stack.""" if self.head_data: new_da...
jefrailey/data-structures
data_structures/stack.py
stack.py
py
1,596
python
en
code
0
github-code
90
1959376995
def to_rna(dna_strand): a = [] for i in dna_strand: a.append(Check(i)) return ''.join(a) def Check(i): if i in 'GCTA': if i == 'G': return 'C' elif i == 'C': return 'G' elif i == 'T': return 'A' else: return 'U' ...
thirayut-m/exercism
python/rna-transcription/rna_transcription.py
rna_transcription.py
py
353
python
en
code
0
github-code
90
31597678485
from skimage import feature from imutils import build_montages from imutils import paths import numpy as np import argparse import cv2 import os from sklearn.preprocessing import LabelEncoder from joblib import load def quantify_image(image): # compute the histogram of oriented gradients feature vector for # the i...
Parkinsons-Diagnosis-uOttaHack2020/UOttaHack-Parkinsons-Diagnosis
python_script/execute.py
execute.py
py
3,976
python
en
code
1
github-code
90
43064188229
"""système => systeme Revision ID: e2fc2015019f Revises: c25cd8d68042 Create Date: 2023-08-18 00:50:18.355922 """ from alembic import op import sqlalchemy as sa # revision identifiers, used by Alembic. revision = 'e2fc2015019f' down_revision = 'c25cd8d68042' branch_labels = None depends_on = None def upgrade(): ...
MomoAy/G-PARC
migrations/versions/e2fc2015019f_système_systeme.py
e2fc2015019f_système_systeme.py
py
961
python
en
code
0
github-code
90
25925485378
#!/usr/bin/env python3 import json import sys import uuid import pika class MovieInfoRpcClient: def __init__(self): self.connection = pika.BlockingConnection() self.channel = self.connection.channel() result = self.channel.queue_declare( queue="", exclusive=True...
it490-wizards/api-proxy
rpc_client.py
rpc_client.py
py
1,434
python
en
code
0
github-code
90
12847786685
import datetime from typing import Any, Optional from fastapi import APIRouter, Depends, Request from fastapi.encoders import jsonable_encoder from fastapi.responses import JSONResponse from fastapi_pagination import Params, paginate from loguru import logger from core import deps from core.utils.constants import Defau...
wutong-paas/wutong-console
apis/manage/team/wutong_team_plugins_controller.py
wutong_team_plugins_controller.py
py
37,516
python
en
code
6
github-code
90
14252079737
# Andrew Moss # Assignment 2 : Cash Register # CS 002 from decimal import * purAmt = float(input("Enter purchase amount: ")) recAmt = float(input("Enter received amount: ")) totalChange = recAmt*100 - purAmt*100 print("Total Change: $", totalChange/100) dollars = int(totalChange/100) print("dollars:", dollars) total...
drewmoss86/exploringPython
assign2_cs002.py
assign2_cs002.py
py
842
python
en
code
0
github-code
90
5599826474
# Time limit exceeded solution class Solution: def groupAnagrams(self, strs: list[str]) -> list[list[str]]: from collections import Counter answer = [] for word in strs: # if go through all thw "answer" : new answer! count = 0 for i in answer: ...
jinhyung-noh/algorithm-ps
LeetCode/49_group_anagrams_20200610.py
49_group_anagrams_20200610.py
py
1,709
python
en
code
0
github-code
90
20039956295
import torch import numpy as np import onnx import onnxruntime as ort import simpleModel as trackModel modelName='trackKeyPointModel_0618_unet_320crop' device=torch.device("cuda:3" if torch.cuda.is_available() else "cpu") # device=torch.device("cpu") modelPath='./model/'+modelName+'.pt' model=trackModel.load_networ...
Wenlab/Larval-Zebrafish-Tracking
U-net/ExportOnnxModel.py
ExportOnnxModel.py
py
1,919
python
en
code
0
github-code
90
71899471338
import os def bianLi(rootDir): for root,dirs,files in os.walk(rootDir): for file in files: print(file.replace('.a','')) for dir in dirs: bianLi(dir) rootDir = "F:\\WorkPlace\\NDKTest\\OpenCVDemo2\\app\\src\\main\\cpp\\opencv\\3rdparty\\libs\\arm64-v8a" bianLi(rootDir)
zyongLiu/NDKTest
OpenCVDemo2/app/src/main/cpp/test.py
test.py
py
282
python
en
code
0
github-code
90
6697368066
from django.urls import path from . import views app_name = "prox" urlpatterns = [ path('', views.index, name='index'), path('requests/', views.AddressView.as_view(), name='requests'), path('send_request/', views.add_request, name='send_requests'), path('delete_data/', views.delete_data, name='delete'...
Fridi7/udp-hole-punching-with-django
posrednik/prox/urls.py
urls.py
py
323
python
en
code
0
github-code
90
30372598683
from collections.abc import Collection from contextlib import nullcontext import pytest from pydantic import BaseModel from hexkit.utils import ( FieldNotInModelError, NonAsciiStrError, calc_part_size, check_ascii, validate_fields_in_model, ) MiB = 1024**2 GiB = 1024**3 TiB = 1024**4 @pytest.ma...
ghga-de/hexkit
tests/unit/test_utils.py
test_utils.py
py
2,337
python
en
code
3
github-code
90
5844323339
from django.urls import path from core import views from rest_framework_simplejwt import views as jwt_views urlpatterns = [ path("log/", views.LogList.as_view(), name="log"), path("log/<int:pk>/", views.LogDetail.as_view(), name="log"), path("logs/", views.LogSearch.as_view(), name="search_logs"), path...
ffabiorj/codenation_logs
core/urls.py
urls.py
py
477
python
en
code
0
github-code
90
18232354459
n = int(input()) a = list(map(int, input().split())) a = list(enumerate(a)) a.sort(key = lambda x: x[1]) DP = [[0 for i in range(n+1)] for j in range(n+1)] DP[0][0] = 0 for i in range(1, n+1): pos, val = a.pop() pos = pos + 1 DP[0][i] = DP[0][i-1] + abs(val * (n - i + 1 - pos)) DP[i][0] = DP[i-1][0] ...
Aasthaengg/IBMdataset
Python_codes/p02709/s266599636.py
s266599636.py
py
576
python
en
code
0
github-code
90
33860213348
import cv2 import numpy as np import random def sp_noise(image, prob): output = np.zeros(image.shape,np.uint8) thres = 1 - prob for i in range(image.shape[0]): for j in range(image.shape[1]): rdn = random.random() if rdn < prob: output[i][j] = 0 e...
Zinnur01/Robotics
OpencvPython/Home works/Lesson 5/Task 1/task1.py
task1.py
py
1,061
python
en
code
0
github-code
90
9504348102
import sys def sumcalc(iput,n): coeff = [] multi = [] temp = pow(2,n,1000000007) - 1 coeff.append(temp) if (n%2) == 0 : k = n/2 k = int(k) else: k = (n + 1) / 2 k = int(k) for j in range(1,k+1): nxtval = (coeff[j-1] + pow(2,(n-...
Mdixit/Hackerrank
Dynamic Programming/sumpiece.py
sumpiece.py
py
988
python
en
code
0
github-code
90
18358276049
#入力高速化 + 再帰回数制限解除 import sys input=sys.stdin.readline sys.setrecursionlimit(10000000) #负の闭路検出 #n=顶点数 e=[[a,b,c],[]...](a~bの距离がc) def find_negative_loop(n,e): d=n*[10**20];d[0]=0 for h in range(n): for i,j,k in e: if d[j]>d[i]+k: d[j]=d[i]+k if h==n-1:return -1 return max(-d[n-1],0) #DA...
Aasthaengg/IBMdataset
Python_codes/p02949/s342268208.py
s342268208.py
py
1,629
python
zh
code
0
github-code
90
18350582649
#!/usr/bin/env python3 #import #import math #import numpy as np N, K = map(int, input().split()) A = list(map(int, input().split())) t1 = 0 for i in range(N - 1): for j in range(i + 1, N): if A[i] > A[j]: t1 += 1 A.sort() t2 = 0 lst = 0 for i in range(1, N): if A[i - 1] < A[i]: t2...
Aasthaengg/IBMdataset
Python_codes/p02928/s849550625.py
s849550625.py
py
457
python
en
code
0
github-code
90
23571095084
# %% import pandas as pd import spacy from collections import Counter import en_core_web_sm nlp = en_core_web_sm.load() from glob import glob import json # read in jsons jsons = [] for f_name in glob('./data/*.json'): # for all jsons in directory with open(f_name, "r") as fh: file = json.loads(fh.read...
charlottemcclintock/AnarchistCorpus
ner.py
ner.py
py
1,382
python
en
code
0
github-code
90
12338338499
import os import warnings from astropy.timeseries import LombScargle import numpy as np import pandas as pd from scipy.signal import find_peaks # Plotting stuff from matplotlib import rcParams rcParams["font.size"] = 16 import matplotlib.pyplot as plt from matplotlib.ticker import FormatStrFormatter class StackedP...
murphyjm/tessla
tessla/stackedperiodogram.py
stackedperiodogram.py
py
16,519
python
en
code
1
github-code
90
34997868150
# # Source: "Serializing Python Data To Json - Some Edge Cases" by Chris Wagner # http://robotfantastic.org/serializing-python-data-to-json-some-edge-cases.html # # Modified by Alexander Artemyev on 2018-02-09 # from collections import namedtuple, Iterable, OrderedDict import numpy as np import simplejson as js...
AlexanderArtemyev/Wilson-disease
data_to_json.py
data_to_json.py
py
4,191
python
en
code
0
github-code
90
41500294858
from __future__ import division from collections import OrderedDict from functools import partial import gzip import io import os import logging import os.path import h5py import numpy from picklable_itertools.extras import equizip from PIL import Image from scipy.io.matlab import loadmat from six.moves import zip, xr...
mila-iqia/fuel
fuel/converters/ilsvrc2010.py
ilsvrc2010.py
py
22,939
python
en
code
850
github-code
90
18578484829
# C - Otoshidama n,y = map(int,input().split()) import sys tmp = y - 1000*n a = y // 10000 for i in reversed(range(a+1)): for j in range((y - 10000*i) // 5000 + 1): if 9000*i + 4000*j == tmp: print(i,j,n-i-j) sys.exit() print(-1,-1,-1)
Aasthaengg/IBMdataset
Python_codes/p03471/s281685955.py
s281685955.py
py
277
python
en
code
0
github-code
90
21200029550
import numpy as np import pickle from response_surface import ResponseSurface def idfunc(*arg,**kwargs): if len(arg) == 1: return arg[0] return arg #print('loading') try: import tqdm tqfunc = tqdm.tqdm_notebook #print('tqdm found') except ImportError: #is not available tqfunc = id...
AdityaSavara/PEUQSE
PEUQSE/mumpce/measurement.py
measurement.py
py
22,194
python
en
code
12
github-code
90
41786349387
"""Transforms relate to hamming distance sampling.""" import random import numpy as np from onmt.utils.logging import logger from onmt.constants import DefaultTokens from onmt.transforms import register_transform from .transform import Transform class HammingDistanceSampling(object): """Functions related to (nega...
memray/OpenNMT-kpg-release
onmt/transforms/sampling.py
sampling.py
py
7,544
python
en
code
210
github-code
90
5490486043
from itertools import islice, count def is_even(number): return number % 2 == 0 evens = islice((number for number in count() if is_even(number)), 200) executed_evens = list(evens) print(executed_evens) print(any([True, False, False])) print(all([True, False, False])) print(any(is_even(number) for number in range(...
iainjmitchell/learning
python-fundamentals/iterables/iteration-tools.py
iteration-tools.py
py
545
python
en
code
0
github-code
90
72665247976
# coding=utf-8 import os.path import sys import json import copy import logging import tornado.httpserver import tornado.ioloop import tornado.options import tornado.web from datetime import datetime from dbmanager import DbManager from common import Common from error import Error import hashlib from modproject impor...
haojingus/pycms
editorhandler.py
editorhandler.py
py
10,995
python
en
code
1
github-code
90
17967376009
N = int(input()) from heapq import heapify, heappush, heappop inf = float("inf") def dijkstra(graph, start): # graphは隣接リスト(繋がっている先, コスト) vsize = len(graph) dist = [inf] * vsize seen = [False] * vsize prev = [None] * vsize pq = [] heapify(pq) dist[start] = 0 heappush(pq, (0, start)) #...
Aasthaengg/IBMdataset
Python_codes/p03634/s114722686.py
s114722686.py
py
1,116
python
en
code
0
github-code
90
32804264530
import torch from labml import logger, lab, monit from labml.logger import Text, Style from python_autocomplete.evaluate import Predictor from python_autocomplete.evaluate.beam_search import NextWordPredictionComplete from python_autocomplete.evaluate.factory import get_predictor def evaluate(predictor: Predictor, t...
labmlai/python_autocomplete
python_autocomplete/evaluate/eval_sample.py
eval_sample.py
py
2,262
python
en
code
176
github-code
90
18043459969
H,W=map(int,input().split()) A=[input() for _ in range(H)] Flag=True x,y=0,0 for _ in range(H+W-2): if x+1 < H and A[x+1][y] == '#': x += 1 continue if y+1 < W and A[x][y+1] == '#': y += 1 continue Flag=False Flag= Flag and (sum(x.count("#") for x in A)==H+W-1) if Flag:...
Aasthaengg/IBMdataset
Python_codes/p03937/s354424415.py
s354424415.py
py
388
python
en
code
0
github-code
90
10407625969
from inferno.io.volumetric import TIFVolumeLoader, HDF5VolumeLoader from inferno.io.transform import Compose from inferno.io.transform.generic import Cast, Normalize from inferno.io.transform.image import AdditiveGaussianNoise class RawVolume(TIFVolumeLoader): def __init__(self, path, dtype='float32', **slicing_c...
inferno-pytorch/neurofire
neurofire/datasets/isbi2012/loaders/raw.py
raw.py
py
1,481
python
en
code
7
github-code
90
23191404274
# -*- coding: utf-8 -*- """ Created on Fri Sep 27 11:59:02 2019 @author: Shaik Rameez """ import serial import time import json import cv2 import smtplib from ibm_watson import VisualRecognitionV3 port='COM4' ard = serial.Serial(port,9600,timeout=5) time.sleep(2) x="found" y="notfound" visual_recognition = VisualRec...
RameezAhamad/Animal_Detector
Codes/testfinal.py
testfinal.py
py
2,192
python
en
code
0
github-code
90
71334703018
import os from collections import namedtuple import numpy as np from sklearn.linear_model import RidgeCV from sklearn.svm import SVR from sklearn.model_selection import GridSearchCV from scipy.stats.stats import pearsonr import gpflow import GPy import config Data = namedtuple('Data', ['X_train', ...
beckdaniel/ijcnlp17_emo
bin/experiment.py
experiment.py
py
5,910
python
en
code
1
github-code
90
69837673576
from django.urls import path from . import views app_name = "store" urlpatterns = [ path('', views.index, name='index'), path('dept/', views.dept, name='department'), path('newstock/', views.newstock, name='newstock'), path('history/', views.history, name='dept_history'), path('department/', views...
olanipekun01/fmc_store
store/urls.py
urls.py
py
862
python
en
code
1
github-code
90
19731362260
from matplotlib import pyplot as plt from sklearn.model_selection import train_test_split from torch import nn, optim from torch.utils.data import DataLoader from torchvision import models from tqdm import tqdm import torch import preprocess as prep from preprocess import PhoneDataset import pandas as pd def fit_epoc...
Votun/phone-classifier-v2
classifier/train.py
train.py
py
7,864
python
en
code
0
github-code
90
25915876781
# Soma dos numeros impares soma = 0 cont = 0 for c in range(1, 7): num = int(input('Digite o {}° numero:'.format(c))) if num % 2 == 0: soma += num cont += 1 print('Voce informou {} numeros pares e a soma é a {}'.format(cont, soma))
celycodes/curso-python-exercicios
exercicios/ex050.py
ex050.py
py
259
python
pt
code
2
github-code
90
39893310303
import numpy as np from mayavi import mlab from bfieldtools.sphtools import ylm, Wlm, Vlm scaling_factor = 1 center = np.array([0, 0, 0]) * scaling_factor sidelength = 3 * scaling_factor n = 12 xx = np.linspace(-sidelength / 2, sidelength / 2, n) yy = np.linspace(-sidelength / 2, sidelength / 2, n) zz = np...
PhysicsTara/nEDM-gradient-coils
sph-field-test.py
sph-field-test.py
py
1,566
python
en
code
0
github-code
90
23187460891
#!/usr/bin/env python import os import sys import scipy import argparse from netCDF4 import Dataset from util import projections """ Create (lat,lon) grids from the (y0,x0) grids. """ def abs_existing_file(file): file = os.path.abspath(file) if not os.path.isfile(file): print("Error! File does not...
jhkennedy/cism-data
x0y0_grid.py
x0y0_grid.py
py
3,683
python
en
code
2
github-code
90
20900775200
x=2 lr=0.01 precision=0.000001 max_iter=9975 iter=0 prev_step_size=1 gf=lambda x:(x+3)**2 while precision<prev_step_size and iter<max_iter : prev=x x=x-lr*gf(x) prev_step_size=abs(x-prev) iter+=1 # print('Iteration',iter,'value',x) print('the minima of the given function is given as ',x...
macvirusnath/LP33
gda.py
gda.py
py
323
python
en
code
0
github-code
90
70952215658
import interactions from utils import * import os from tasks.ext import IntervalTrigger, create_task worker_interval = int(os.getenv('WORKER_INTERVAL_MINS', 30)) bot = interactions.Client(token=os.getenv('BOT_TOKEN')) @bot.command( name="create_role", description="Create a new role for a particular timezone",...
irshadshalu/discord-timezoneroles-bot
bot.py
bot.py
py
1,945
python
en
code
0
github-code
90
18485582910
import datetime import LRVectorBacktester as LR import ScikitVectorBacktester as SCI # Underlying Settings symbol = 'GLD' from_dt = datetime.datetime(2010, 1, 1) to_dt = datetime.datetime(2021, 5, 24) # Backtest Settings is_print = False is_plot = False initial_credit = 10000 transaction_costs = 0.001 # 0.1% related...
mattrudin/DLBIKI01_Agents
main.py
main.py
py
2,963
python
en
code
0
github-code
90
18313729649
n = int(input()) g = [[] for i in range(n+1)] d = {} l = [-1] * (n-1) max_idx = 0 for i in range(n-1): u,v = map(int, input().split()) d[(u,v)] = i d[(v,u)] = i g[u].append((u,v)) g[v].append((v,u)) if len(g[max_idx]) < len(g[u]): max_idx = u if len(g[max_idx]) < len(g[v]): max_idx = v m = len(g[m...
Aasthaengg/IBMdataset
Python_codes/p02850/s169341171.py
s169341171.py
py
809
python
en
code
0
github-code
90
17570237855
def sumAmicableNum(x): # Use set instead amicable_numbers = set() # No point assigning the range to a variable for num in range(1, x): x_val = 0 y_val = 0 # No point assigning the range to a variable for val in range(1, num): if (num % val) == 0: ...
joshuaz/ProjectEuler
21_amicable_numbers/amicable_numbers.py
amicable_numbers.py
py
606
python
en
code
0
github-code
90
31422936153
#! usr/bin/env/python3 # coding:utf-8 # Author: turpure import os from multiprocessing.pool import ThreadPool as Pool from src.services.base_service import CommonService import requests import datetime class Worker(CommonService): """ worker """ def __init__(self): super().__init__() ...
yourant/ur_cleaner
src/tasks/joom_inventory.py
joom_inventory.py
py
3,324
python
en
code
0
github-code
90
27454193630
from sympy import * x,y,z,t = symbols('x y z t') userInput = input("Nhap vao ham : ") var = input("Ban muon tinh dao ham theo bien :") level = input("Ban muon tinh dao ham cap : ") init_printing(use_unicode=True) # In ra duoi dang ki hieu toan hoc pprint() pprint(diff(userInput,var,level))
bangoc123/PythonCore
Derivative/Ex.py
Ex.py
py
298
python
en
code
0
github-code
90
25872145450
import youtube_dl import telebot import requests token = '1702123934:AAG4xQh_ZnXnauuHnpjd0Jwojj9_fM4VwDw' bot = telebot.TeleBot(token) def download(title, link): link = 'https://www.youtube.com/results?search_query=bruno+mars+leave+the+door+open' ydl_opts = { 'format': 'bestaudio/best', 'postp...
xic2401/telegram_bot_1
main_2.py
main_2.py
py
708
python
en
code
0
github-code
90