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
5721387647
import sys import math for inputValue in sys.stdin: startNumber, endNumber = inputValue.split() result = [] for i in range(int(startNumber), int(endNumber)+1): sqrtValue = int(math.sqrt(i)) isPrime = True for j in range(2, sqrtValue+1): if i % j == 0: ...
lalalalaluk/python-zerojudge-practice
a121質數又來囉 copy.py
a121質數又來囉 copy.py
py
437
python
en
code
0
github-code
90
72604541737
from django.core.management import call_command from django.db import models from django.template.defaultfilters import slugify from django.urls import reverse class HouseTeam(models.Model): name = models.CharField(max_length=50) logo = models.ForeignKey('pages.BannerWidget', null=True, blank=True) image_...
zachcalvert/the_ape_theater
the_ape/people/models.py
models.py
py
5,004
python
en
code
3
github-code
90
28839860970
import json import sys import os from random import randrange import argparse import traceback from datetime import datetime parentPath = os.path.abspath("../../Metaheuristics") print(parentPath) if parentPath not in sys.path: sys.path.insert(0, parentPath) from Common.NurseSchedulingProblem import * try: base...
presmerats/Nurse-Scheduling-LP-and-Heuristics
Tools/Reporting/check_results.py
check_results.py
py
3,443
python
en
code
1
github-code
90
16173170134
# SPDX-License-Identifier: Apache-2.0 # Licensed to the Ed-Fi Alliance under one or more agreements. # The Ed-Fi Alliance licenses this file to you under the Apache License, Version 2.0. # See the LICENSE and NOTICES files in the project root for more information. from edfi_performance_test.factories.resources.api_fac...
Ed-Fi-Exchange-OSS/Suite-3-Performance-Testing
src/edfi-performance-test/edfi_performance_test/factories/resources/v4/dimensions.py
dimensions.py
py
646
python
en
code
1
github-code
90
1000792810
from machine import Pin from time import sleep led = Pin(2, Pin.OUT) led.value(0) while True: led.value(not led.value()) sleep(1) # pyboard —device /dev/cu.SLAB_USBtoUART hello.py
perbu/micropython-talk-2020
simple-blink.py
simple-blink.py
py
195
python
en
code
0
github-code
90
10017212820
import json def getSongsJson(songs): songs_json = [] for song in songs: minutes = str(song.duration // 60) seconds = song.duration % 60 if seconds < 10: seconds *= 10 seconds = str(seconds) ent = { 'name': song.title, 'artis...
kappa243/flask_music_player
src/player.py
player.py
py
772
python
en
code
0
github-code
90
14650995902
import logging import torch import torch.nn as nn import copy from .backbones.vit_pytorch_transreid import vit_base_patch16_224_TransReID, vit_small_patch16_224_TransReID, deit_small_patch16_224_TransReID, trunc_normal_ from loss.triplet_loss import WeightedRegularizedTriplet, TripletLoss, CrossEntropyLabelSmooth impor...
oliverck/TCiP
model/net/transreid.py
transreid.py
py
19,093
python
en
code
7
github-code
90
37396533160
# -*- coding: utf-8 -*- """ File name : MyCircularQueue Date : 13/08/2018 Description : 设计循环队列,其操作表现基于 FIFO(先进先出)原则并且队尾被连接在队首之后以形成一个循环。亦称为“环形缓冲器”。 Author : VickeeX """ class MyCircularQueue: def __init__(self, k): """ Initialize your data structure he...
VickeeX/LeetCodePy
desighClass/MyCircularQueue.py
MyCircularQueue.py
py
2,337
python
en
code
0
github-code
90
30781459853
import controller import model import random_student.person_generator as rp from time import sleep import pretty_table # Пункт меню: 1 def view_students(filename): print('\nВывод всего списка студентов:\n') data = model.read_csv(filename) pretty_table.table_print(data) # if len(data) == 0: # p...
pashtetrus33/pythonStart
dz_8/view.py
view.py
py
4,406
python
ru
code
0
github-code
90
33600932247
# -*- coding: utf-8 -*- # © 2015 Guewen Baconnier (Camptocamp SA) # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). import mock from openerp.tests import common from openerp.addons.delivery_carrier_label_postlogistics\ .postlogistics.web_service import PostlogisticsWebService class FakeWS(Postl...
sc4you/UduuX
odoo/custom/delivery_carrier_label_postlogistics/tests/test_postlogistics.py
test_postlogistics.py
py
3,544
python
en
code
0
github-code
90
38661268781
from django.shortcuts import render, redirect from django.contrib.messages.views import SuccessMessageMixin from django.views.generic import FormView from django.contrib.auth import authenticate,login from django.contrib import messages from django.http import HttpResponse from django.db.transaction import atomic from ...
Alica032/registration
registration/accounts/views.py
views.py
py
5,612
python
en
code
0
github-code
90
71177259497
import gi gi.require_version('Gtk', '4.0') from gi.repository import Gtk, Gdk, Pango import setzer.document.autocomplete.autocomplete_widget_viewgtk as autocomplete_view from setzer.app.service_locator import ServiceLocator from setzer.app.font_manager import FontManager class AutocompleteWidget(object): def __...
cvfosammmm/Setzer
setzer/document/autocomplete/autocomplete_widget.py
autocomplete_widget.py
py
4,255
python
en
code
362
github-code
90
18487301899
#from statistics import median #import collections #aa = collections.Counter(a) # list to list || .most_common(2)で最大の2個とりだせるお a[0][0] from fractions import gcd from itertools import combinations,permutations,accumulate # (string,3) 3回 #from collections import deque from collections import deque,defaultdict,Counter impo...
Aasthaengg/IBMdataset
Python_codes/p03240/s226437936.py
s226437936.py
py
1,372
python
en
code
0
github-code
90
4889728343
import psycopg2.extensions import psycopg2 conn = psycopg2.connect("host=localhost dbname=rbdm user=m") cur = conn.cursor() cur.execute(""" CREATE TABLE users( id integer PRIMARY KEY, email text, name text, address text ) """) # DATABASES = { # # ... # 'OPTIONS': { # 'isolation_leve...
MarshallSeid/rbdm
db.py
db.py
py
433
python
en
code
0
github-code
90
6409683412
from docx import Document from googletrans import Translator from google_trans_new import google_translator from time import sleep translator2 = Translator() translator3 = Translator() translator = google_translator() paras=[] check = False checksen="Anchor script (Voice Over)" endsen="Visual Reference" '''Enter fi...
ArpitBodana/Translator-Script
TranslationScript.py
TranslationScript.py
py
2,704
python
en
code
0
github-code
90
73552202216
# -*- coding: utf-8 -*- from openerp.osv import fields, osv from quant_trader import * class StockBalance(osv.osv): """ 资金状况 """ _name = "stock.balance" _rec_name = 'money_type' _columns = { 'asset_balance': fields.float(u"资产总值", size=32, required=True), 'current_balance': fi...
haogefeifei/OdooQuant
source/addons/stock_robot/stock_balance.py
stock_balance.py
py
2,915
python
en
code
31
github-code
90
21964269472
import setuptools with open("README.md", "r") as fh: long_description = fh.read() setuptools.setup( name="CompDesc", # Replace with your own username version="1.0.4", author="Alexandre Borrel", author_email="a.borrel@gmail.com", description="Compute molecular descriptors 1D, 2D and 3D from a S...
ABorrel/CompDESC
setup.py
setup.py
py
780
python
en
code
3
github-code
90
27222320858
import services from objects.object_enums import ResetReason from scripts_core.sc_message_box import message_box from scripts_core.sc_util import error_trap from scripts_core.sc_script_vars import sc_Vars try: from Tmex_TOOL_InputInteraction import TMToolData sc_Vars.TMEX = True except: sc_Vars...
AlinaNikitina1703/Sims4ScriptCore
Scripts/scripts_core/sc_editor.py
sc_editor.py
py
2,477
python
en
code
2
github-code
90
11002594633
# 输出到csv表格文件 from .output import Output import csv class OutputCsv(Output): def __init__(self, argd): self.dir = argd["outputDir"] # 输出路径(文件夹) self.fileName = argd["outputFileName"] # 文件名 self.fileName = self.fileName.replace( "%name", argd["outputDirName"] ) # 文件名...
hiroi-sora/Umi-OCR_v2
UmiOCR-data/py_src/ocr/output/output_csv.py
output_csv.py
py
1,821
python
en
code
917
github-code
90
30916530134
import gym from gym import spaces import numpy as np import math class ChaserInvaderDiscreteEnv(gym.Env): """ invader tries to reach the centre goal, while chaser wants to block it as far as possible Actions [0 : Left, 1 : Up, 2 : Right, 3 : Down, 4 : Stand] """ metadata = {'render.mode...
YuanhengZhu/Online-Minimax-Q-Network-Learning-for-Two-Player-Zero-Sum-Markov-Games
myenv/env_chaser_invader_discrete.py
env_chaser_invader_discrete.py
py
6,537
python
en
code
0
github-code
90
18152224739
n = int(input()) total = 0 for i in range(n): a,b = map(int, input().split()) if a == b: total += 1 if total == 3: break else: total = 0 if total == 3: print('Yes') else: print('No')
Aasthaengg/IBMdataset
Python_codes/p02547/s031790242.py
s031790242.py
py
211
python
en
code
0
github-code
90
42534892989
from collections import Counter def solution(participant, completion): counter = Counter(participant) counter2 = Counter(completion) key = participant answer = '' for i in range(len(counter)): if counter[key[i]] != counter2[key[i]]: answer = key[i] break return a...
macho-yoo/programmers
CODING_TEST/hash/완주하지 못한 선수/solution.py
solution.py
py
326
python
en
code
0
github-code
90
10309096565
import requests import json import os import re import sys from quizlet_secret import QUIZLET_CLIENT_ID ########################################################################### # Constants ########################################################################### SET_DIR = os.path.join(os.path.dirname(os.path.real...
joequery/quizlet
quizlet.py
quizlet.py
py
3,138
python
en
code
34
github-code
90
37876329630
class Solution(object): def getRow(self, rowIndex): """ :type rowIndex: int :rtype: List[int] """ dp=[1]*(rowIndex+1) fact=[1]*(rowIndex+1) for i in range(1,rowIndex+1): fact[i]=i*fact[i-1] print(fact) for i in range(0, rowIndex+1):...
haneehareshpatel/Leetcode-problems
my-folder/problems/pascal's_triangle_ii/solution.py
solution.py
py
402
python
en
code
0
github-code
90
26770777607
import warnings import pandas as pd from auxiliary_functions import BinBadRate, MergeBad0, BadRateMonotone, ChiMerge, AssignBin, Monotone_Merge, \ BadRateEncoding import matplotlib.pyplot as plt import numpy as np import pickle import numbers warnings.filterwarnings('ignore') total_df = pd.read_csv('D:\study\CDA_...
PeiQI1225/credit_rating
credit_rating.py
credit_rating.py
py
18,215
python
en
code
0
github-code
90
833208344
import requests import plotly.graph_objs as go import pandas as pd from flask import Flask, render_template, jsonify import dash from dash import dcc, html import time app = Flask(__name__) dash_app = dash.Dash(__name__, server=app, url_base_pathname='/trend/') dash_app.layout = html.Div([]) api_url_base ...
RhysM95/SIT723-RESEARCH-PROJECT
community-household-data-analysis/backups/Project.py
Project.py
py
3,847
python
en
code
0
github-code
90
28769541680
# Modified by Microsoft Corporation. # Licensed under the MIT license. # -*- coding: utf-8 -*- import logging import os import time from user import UserNeural def init_logging_handler(log_dir, extra=''): if not os.path.exists(log_dir): os.makedirs(log_dir) current_time = time.strftime("%Y-%m-%d-%H...
ConvLab/ConvLab
convlab/modules/usr/multiwoz/vhus_usr/main.py
main.py
py
858
python
en
code
398
github-code
90
2929447331
import torch import cv2 import argparse from torchvision.io import read_image from torch.nn import CosineSimilarity import torchvision.transforms as T from train_siamese import SiameseNetwork if __name__ == '__main__': parser = argparse.ArgumentParser("Inference code for siamese tracker network") parser.a...
FauxShow/tracker_net
inference.py
inference.py
py
1,499
python
en
code
0
github-code
90
35940247704
import collections import heapq '''import sys if len(sys.argv) != 2: print("Usage:-\npython dfs.py <OUT-FILE>\n") sys.exit(1) OUT_FILE = sys.argv[1]''' INP_FILE = "graph.dat" class Vertex: count = 0 def __init__(self): self.name = chr(ord('A') + Vertex.count) Vertex.count += 1 ...
PramodJose/Graph-Algorithms
dfs.py
dfs.py
py
4,738
python
en
code
0
github-code
90
71880596458
import os import lgsvl import math import time import sys import numpy as np from collections import namedtuple from configparser import ConfigParser config = ConfigParser() config.read('config.ini') speed = config.getint('main', 'speed') rain_level = config.getint('main', 'rain_level') fog_level = config.getint('mai...
kuoyaoming/LGSVL-collision-video-generator
script/SCP.py
SCP.py
py
4,197
python
en
code
2
github-code
90
25053952202
import cv2 import keras from keras.utils import to_categorical import tensorflow as tf from scipy import misc from keras.layers import * from keras.models import Sequential NUMBER_OF_CLASSES = 4 MODEL_IMG_SIZE = (64, 64) TRAIN_DIR = 'training/real/processed/' LABEL_TEXT_FILE = TRAIN_DIR + '/labels.txt' MODEL_FILE_NAM...
rocky3355/UdacityFinalProject
ros/src/tl_detector/light_classification/model_training.py
model_training.py
py
2,135
python
en
code
0
github-code
90
42425458484
""" https://codingbat.com/prob/p145834 """ def last2(str): sub=str[-2:] count=0 for i in range(0, len(str) - 2, len(sub)): if str[i:i + 2] == sub: count += 1 return count print(last2("hixxhi"))
vijay2930/HackerrankAndLeetcode
com/CodingBat/warmup-2/Last2.py
Last2.py
py
230
python
en
code
0
github-code
90
23303475126
from random import randint print('''Hey guys here lets play rock paper Scissors. You(Player) Vs Me(Computer/Navneet) Let the battle Begin ^_^!! ''') x = input('What is your name :- ') def rock_paper_scissors(): t = ["Rock", "Paper", "Scissors"] computer = t[randint(0,2)] player = input("Rock, Paper...
iNavneetKumar/My-game
Rockpaperscissors.py
Rockpaperscissors.py
py
1,182
python
en
code
0
github-code
90
72142223338
from typing import List, Tuple from dao_analyzer.web.logs import LOGS from dao_analyzer.web.apps.common.business.transfers.serie import Serie class StackedSerie(): """ * serie = see Serie * y_stack = each element of y_stack is a list of values on the serie. """ def __init__(self, serie: Serie = N...
Grasia/dao-analyzer
dao_analyzer/web/apps/common/business/transfers/stacked_serie.py
stacked_serie.py
py
3,533
python
en
code
33
github-code
90
23488017197
#财联社看盘实时监控 import requests,hashlib,time #请求库requests需要使用pip安装,命令行:pip3 install requests class monitoring(): def __init__(self): self.headers = { 'Referer': 'https://www.cls.cn/telegraph', 'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/5...
hl1227/cls_spider
cls_watch_monitoring.py
cls_watch_monitoring.py
py
2,821
python
en
code
2
github-code
90
44345523996
from instagramy import Instagram # Connecting the profile user = Instagram("geeks_for_geeks") # printing the basic details like # followers, following, bio print(user.is_verified()) print(user.popularity()) print(user.get_biography()) # return list of dicts posts = user.get_posts_details() print('\n\nLik...
pythonprogramming-development/scraping
Scraping.py
Scraping.py
py
1,245
python
en
code
0
github-code
90
353342088
from selenium.webdriver.common.by import By from selenium import webdriver def pracuj(): driver = webdriver.Chrome() driver.get('https://www.pracuj.pl/praca/software%20tester;kw?et=1') try: driver.find_element(by=By.XPATH, value='//*[@id="gp-cookie-agreements"]/div/div/div[1]/div[3]/button').c...
BtNowakowski/Job-Seeker
pracujpl.py
pracujpl.py
py
634
python
en
code
0
github-code
90
9070088032
import json import re import time from os import path, makedirs config = {} def load_config(): "Load config json-file to config variable." global config try: with open("config.json") as f: config = json.loads(f.read()) if not "node" in config: config["node"] = "" ...
spline1986/idec-client
api/__init__.py
__init__.py
py
5,753
python
en
code
0
github-code
90
15748725722
from pyplasma import * domain = Domain(grid=[1300], size=[20*um], pml_width=400*nm) laser = Laser(wavelength=800*nm, pulse_duration=10*fs, t0=20*fs, E0=5e9, phase=True) domain.add_laser(laser) material = Material(index=1.33, chi3=1e-19, resonance=120e-9) domain.add_material(material, boundaries={'xmin':10*um}) w =...
jldez/pyplasma
examples/capsules/1.4_third_order_susceptibility.py
1.4_third_order_susceptibility.py
py
483
python
en
code
13
github-code
90
41926242910
import tensorflow as tf RESIZE_FACTOR = 1 # 4 DIM_X = int(1920 / RESIZE_FACTOR) DIM_Y = int(1080 / RESIZE_FACTOR) def _decode(img_str): img = tf.image.decode_jpeg(img_str) img = tf.image.convert_image_dtype(img, tf.float32) img = tf.image.resize(img, [DIM_X, DIM_Y]) img = tf.reshape(img, [DIM_X, DI...
bigtimetapin/floras
ml/src/main/python/preprocess.py
preprocess.py
py
419
python
en
code
0
github-code
90
35311971308
#!/usr/bin/env python import logging import numpy as np import librosa import scipy from random import randint from src.utils.math_utils import nextpow2 logger = logging.getLogger(__name__) class Spectrum(object): def __init__(self, hparams): self.sample_freq = hparams.sample_freq self.duration ...
vikigenius/neural_speaker_identification
src/features/spectrum.py
spectrum.py
py
3,653
python
en
code
1
github-code
90
37930594844
from typing import List from unittest import TestCase class Solution: """ 2, 1, 5, 0, 3, 4 [1, 5], count=2 [0, 3, 4], count=3 New increasing subsequence can start. How do I give space to it in O(1) memory? The number at position i can extend the sequence whose last number < nums[i]. I need...
saubhik/leetcode
problems/increasing_triplet_subsequence.py
increasing_triplet_subsequence.py
py
2,749
python
en
code
3
github-code
90
5366934501
import torch import torch.nn as nn class SEModule(nn.Module): def __init__(self, planes, reduction): super(SEModule, self).__init__() self.avg_pool = nn.AdaptiveAvgPool2d((1, 1)) self.fc1 = nn.Conv2d(planes, planes // reduction, kernel_size=1, padding=0) self.fc2 = nn.Conv2d(planes ...
limingcv/Classification-template-with-PyTorch
models/se_resnet.py
se_resnet.py
py
6,272
python
en
code
1
github-code
90
18014819539
import sys readline = sys.stdin.readline MOD = 10 ** 9 + 7 INF = float('INF') sys.setrecursionlimit(10 ** 5) def main(): n = int(readline()) for i in range(1, n + 1): min_lim = (i - 1) * i // 2 + 1 max_lim = i * (i + 1) // 2 if min_lim <= n <= max_lim: print(i) ...
Aasthaengg/IBMdataset
Python_codes/p03779/s890057907.py
s890057907.py
py
373
python
en
code
0
github-code
90
29737680745
import pytest from bach.types_bq import bq_db_dtype_to_dtype pytestmark = [pytest.mark.db_independent] # mark all tests here as database independent. Obviously this code relates to BigQuery. But it does not # require an Engine or Dialect. The tested code only converts strings to strings, dicts, lists, or tuples. de...
massimo1220/objectiv-analytics-main
bach/tests/unit/bach/test_types_bq.py
test_types_bq.py
py
2,988
python
en
code
5
github-code
90
18384584249
W, H, x, y = map(int, input().split()) # 大きくない方とかって書いてあるけど、別にイコールの場合でもいいんかい! # 中心の座標を求める centerX = (W / 2) centerY = (H / 2) if ((x, y) == (centerX, centerY)): print((W * H) / 2, 1) else: print(W * H / 2, 0)
Aasthaengg/IBMdataset
Python_codes/p03001/s954891730.py
s954891730.py
py
307
python
ja
code
0
github-code
90
73244711017
import asyncio import logging import random import ssl from urllib.parse import urlparse from typing import ( List, Tuple, ) from .. import ( Connection, TcpAdaptor, SslTransformer, ReadUntilTransformer, CommException, TransformerEofError, AdaptorEofError, getaddrinfo, ) from ...
kedixa/pykedixa
pykedixa/comm/websocket/websocket_processor.py
websocket_processor.py
py
6,166
python
en
code
1
github-code
90
11090431275
import sys from requests_html import HTMLSession from tkinter import * from tkinter import messagebox from PIL import ImageTk, Image # pip install Pillow root = Tk() def begin(): global e1 root.geometry("550x400") text=Label(root, text = "Please enter a city name. ", font = ('Times', 20, "bold"), fg="b...
kevinarocha/weather-forecast
weather.py
weather.py
py
1,623
python
en
code
0
github-code
90
10744204145
#!/usr/bin/python import numpy as np import cupy as cp class CCM: 'Color Correction Matrix' def __init__(self, img, ccm): self.img = img self.ccm = ccm def execute(self): img_h = self.img.shape[0] img_w = self.img.shape[1] img_c = self.img.shape[2] ccm_img =...
eric612/CuPyISP
model/ccm.py
ccm.py
py
813
python
en
code
1
github-code
90
72350963817
from src.aluno.base.funcionario import Funcionario from src.cliente.irh_service import IRHService from src.cliente.tipo import Tipo class RHService(IRHService): def __init__(self): self.funcionarios = [] self.diarias = {} self.divisaolucros = 0 def cadastrar(self, funcionario: Funcio...
ariellyg/miniprojetos3
gestao-universitaria/src/aluno/manager/rh_service.py
rh_service.py
py
3,523
python
es
code
0
github-code
90
43835599530
from django.core.cache import cache import sys import json from PyWebSystem.PyUtil.DickUpdate import process_request_dick, update_context from PyWebSystem.PyUtil.pw_logger import logmessage def get_session(sessionid=None): if sessionid is None: return False else: try: if sessionid...
anji-a/PyWebSystem
PyWebSystem/PyUtil/GetSessionObject.py
GetSessionObject.py
py
2,439
python
en
code
0
github-code
90
15853716423
__author__ = "Emanuel Juliano Morais Silva" __email__ = "emanueljulianoms@gmail.com" import matplotlib.pyplot as plt import seaborn as sns import pandas as pd import numpy as np import string from textblob import TextBlob import argparse from empath import Empath lexicon = Empath() parser = argparse.ArgumentParser(de...
emanueljuliano/reddit_studies
_PushshiftReddit/data_analysis.py
data_analysis.py
py
6,175
python
en
code
0
github-code
90
18476364359
import itertools from collections import Counter import bisect N = int(input()) lst = ['3','5','7'] anslst = [] for i in range(1,10): for v in itertools.product(lst,repeat=i): x = Counter(str(v)) if x['7'] >= 1 and x['5'] >= 1 and x['3'] >= 1: anslst.append(int(''.join(v))) anslst.sort(...
Aasthaengg/IBMdataset
Python_codes/p03212/s663845360.py
s663845360.py
py
380
python
en
code
0
github-code
90
73534730857
def Minimumdistances(a): a = a.split(" ") length = len(a)//2 left = length - 1 right = 0 if len(a) % 2 != 0: right = length + 1 else: right = length for i in range(length): print(a[int(left)],a[int(right)],"difference {}".format(int(right)-int(left))) if a[in...
faiz687/CodingProblems
minimumdistances.py
minimumdistances.py
py
459
python
en
code
0
github-code
90
22377262475
# [69 2D 행렬 검색2] # 내가 푼 것 # 재귀: arr[0][0]에서 시작하여 오른쪽, 아래쪽으로 재귀 호출. def S(arr, target): def F(m, n): if m >= len(arr) or n >= len(arr[0]) or arr[m][n] is None: return if arr[m][n] == target: return True elif arr[m][n] < target: arr[m][n] = None if F(m+1, n) or F(m, n+1): re...
hannayangg/penwing
# ridi/69.py
69.py
py
892
python
ko
code
0
github-code
90
72057667817
from uuid import uuid4 from sqlalchemy.dialects.postgresql import UUID from app.main import db class Cart(db.Model): __tablename__ = "cart" id = db.Column( UUID(as_uuid=True), primary_key=True, default=uuid4 ) user_id = db.Column(UUID(as_uuid=True), db.ForeignKey('users.id')...
wards-a/fashion-campus
app/main/model/cart.py
cart.py
py
818
python
en
code
0
github-code
90
18242000799
def divisor(n): res = [] i = 1 while i*i <= n: if not n % i: res.append(i) if (i*i != n): res.append(n//i) i += 1 return res N = int(input()) ans = 0 for d in divisor(N): if d == 1: continue n = N while not n % d: ...
Aasthaengg/IBMdataset
Python_codes/p02722/s271999351.py
s271999351.py
py
405
python
en
code
0
github-code
90
38107252523
import math from aufmassZeile import AufmassZeile from component import Component class PolyLine: def __init__(self, poly_id=None, uid=None, symbol=None, points=None, wallIndex=None): """ Constructor :param poly_id: ID for Polyline :param uid: Unique Id from ...
jkleinau/aufmassConverterPy
polyLine.py
polyLine.py
py
2,170
python
en
code
0
github-code
90
18032987799
N,M=list(map(int,input().split())) import numpy as np from scipy.sparse.csgraph import floyd_warshall from scipy.sparse import csr_matrix l=[np.array([0]*N) for i in range(N)] for i in range(M): tmp=(list(map(int,input().split()))) l[tmp[0]-1][tmp[1]-1]=tmp[2] l[tmp[1]-1][tmp[0]-1]=tmp[2] l2=csr_matrix(l) l2=f...
Aasthaengg/IBMdataset
Python_codes/p03837/s399201625.py
s399201625.py
py
458
python
en
code
0
github-code
90
40576901251
import enum import uuid from datetime import datetime from typing import List from sqlalchemy import Boolean, Column, DateTime, Enum, ForeignKey, String, Table from sqlalchemy.dialects.postgresql import UUID from sqlalchemy.orm import Mapped, mapped_column, relationship from src.database import BaseModel, Re...
notarious2/fastapi-chat
src/models.py
models.py
py
3,740
python
en
code
0
github-code
90
18494306659
n,m=map(int,input().split()) p = 10**9+7 def pfact(m): pf = {} for i in range(2,int(m**0.5)+1): while m%i==0: pf[i]=pf.get(i,0)+1 m//=i if m>1:pf[m]=1 return pf def cmb(n, r, p): if (r < 0) or (n < r): return 0 r = min(r, n - r) return fact[n] * factinv[r] * factinv[n - r] % p N = 3 * 10 ** 5 # N ...
Aasthaengg/IBMdataset
Python_codes/p03253/s937412182.py
s937412182.py
py
781
python
en
code
0
github-code
90
74408486057
""" Build a CPF (brazilian document) validator A CPF has 12 numbers, it is validated by the last 2 digits The first digit is equal to a sum of a regressive multiplication, starting at 10, with all the previous numbers so, 746.828.890-80 is a CPF 10 9 8 7 6 5 4 3 2 times: 7 4 6 8 2 4 8 9 0 70 36 ...
ThiDurante/PythonStudies
Basic/Exercise5.py
Exercise5.py
py
3,493
python
en
code
0
github-code
90
40648533257
#coding:utf-8 # @Info: 从人事档案表中提取数据 # @Author:Netfj@sina.com @File:word2db.py @Time:2019/3/30 6:50 import docx,logging,os,re from flask_sqlalchemy import SQLAlchemy from datetime import datetime from setup_database import app, Person, Record_info, Home, Dwdm from win32com import client from tempfile import gettempdir f...
netfj/emp
word2db.py
word2db.py
py
25,050
python
zh
code
0
github-code
90
23221903498
import cv2 import os import sys pro_dir = os.path.dirname(os.path.dirname(__file__)) sys.path.append(pro_dir) from lib.utils.video import VideoWriter def main(): video_path = r"/videos/test_part.mp4" save_path = r"/videos/resized_test_part.mp4" cap = cv2.VideoCapture(video_path) w, h = ( in...
Daming-TF/Mediapipe-hands
tools/resize_video.py
resize_video.py
py
1,006
python
en
code
3
github-code
90
5802649937
import unittest import numpy as np from numpy.testing import assert_array_equal from biggus._init import MaskValueArray class Test___init__(unittest.TestCase): def test_nd_array(self): orig = np.arange(24) array = MaskValueArray(orig, 3) self.assertIs(array.array, orig) class Test___ge...
SciTools/biggus
biggus/tests/unit/init/test_MaskValueArray.py
test_MaskValueArray.py
py
1,610
python
en
code
54
github-code
90
71488124457
import os from pocketsphinx import LiveSpeech, get_model_path from easytello import tello model_path = get_model_path() my_drone = tello.Tello() speed = 30 #put your wake up code here #this code will go once when you say wake up at the beggining def funWakeUp(): print("Hey Adham :) ") my_drone.takeoff() ...
AbedIdres/DroneMusic
Older Project/main.py
main.py
py
2,645
python
en
code
1
github-code
90
19127363032
t = int(input()) def bound(m, x): if m >= 1: n = 5**(m-1) loc = x//n # 1, 3 or 2 or 0, 4 if loc == 0 or loc == 4: return 0 elif loc == 1 or loc == 3: return n + bound(m-1, x % n) elif loc == 3: return 2*n + bound(m-1, x & n) re...
adityakeerthi/competitive-programming
ccc/2011/S3.py
S3.py
py
585
python
en
code
0
github-code
90
18337283289
import sys def input(): return sys.stdin.readline()[:-1] sys.setrecursionlimit(1000000) n,m=map(int,input().split()) lis = [] for i in range(m): tmp = list(map(int,input().split())) tmp.extend(list(map(int,input().split()))) lis.append(tmp) dp = [[1000000000 for i in range(2**n)]for i in range(m+1)] dp...
Aasthaengg/IBMdataset
Python_codes/p02901/s338047167.py
s338047167.py
py
739
python
en
code
0
github-code
90
23535143305
import matplotlib.pyplot as plt # Given points (x, y, t) points = [ (15, -1, 0), (7, 11, -7), (20, -8, 9), (-16, -4, 13), (0, -11, 18), (19, -13, -8), (16, 1, -14), (-14, -3, 10), (-7, 13, 1), (6, -10, 17) ] # Extract x, y, and t values x_values, y_v...
vitorpbarbosa7/mit_6.006
psets/ps4-template/plotpoints.py
plotpoints.py
py
820
python
en
code
0
github-code
90
17977213339
N = int(input()) A = list(map(int, input().split())) snk = A[0] arg = sum(A)-snk ans = abs(arg-snk) for i in range(1, N-1): snk += A[i] arg -= A[i] dif = abs(arg-snk) ans = min(ans, dif) print(ans)
Aasthaengg/IBMdataset
Python_codes/p03659/s304472049.py
s304472049.py
py
206
python
en
code
0
github-code
90
16170999310
""" @time: 18-9-13 @author: zol @contact: 13012215283@sina.cn @file: create_train_data @desc: Project of LinkingMed, Python3.6(64 bit), keras 2.1.6 """ import os import re import math import random import numpy as np import nibabel as nib from nilearn import image from glob import glob from utils import split_filena...
SBZol/MRI-Segmentation
u_net_3d/create_train_data.py
create_train_data.py
py
7,032
python
en
code
4
github-code
90
72879020458
#suma de 1+2+3+4+...+n import os os.system('cls') n=int(input('Dime hasta que numero necesitas la sumatoria: ')) i=0 suma=0 while i<=n: suma=suma+i i+=1 print('La suma es: ',suma) os.system('cls') suma=0 for i in range(1,n+1): suma=suma+i print('La suma es: ',suma)
EduardoCGarcia/Curso-Python
Sumatoria.py
Sumatoria.py
py
282
python
es
code
0
github-code
90
314614158
from django.contrib import admin from .models.profile import Profile from django.utils.translation import ugettext_lazy as _ # Register your models here. class ProfileAdmin(admin.ModelAdmin): list_display = [ 'admin_photo', 'user', 'created', 'updated', ] list_display_link...
ShahadatShuvo/datascience
profiles/admin.py
admin.py
py
531
python
en
code
1
github-code
90
35771638654
import argparse from pathlib import Path import torch from torch import nn from torch import optim import torch.nn.functional as F from torchvision import datasets, transforms, models import numpy as np import matplotlib.pyplot as plt from workspace_utils import active_session def parse_arguments(): '''This funct...
Revak007/Udacity-AI-in-Python-Part-2
train_helper.py
train_helper.py
py
7,226
python
en
code
0
github-code
90
31812856960
#!/usr/bin/env python3 import rospy from giskardpy.configs.behavior_tree_config import OpenLoopBTConfig from giskardpy.configs.collision_avoidance_config import CollisionAvoidanceConfig from giskardpy.configs.giskard import Giskard from giskardpy.configs.world_config import WorldConfig, Derivatives, np from giskardpy....
Universal-Simulation-Framework/UniverSim-Robots
pal_robotics/tiago_dual_control/scripts/giskard.py
giskard.py
py
8,002
python
en
code
1
github-code
90
13467640697
import datetime from lib.servidor.conversor import SpeedConversor, VolumeConversor, VolumeUnit, SpeedUnit, AllowedGrandezas mapa_grandeza = { 1: AllowedGrandezas.speed, 2: AllowedGrandezas.volume } mapa_unidade = { 3: SpeedUnit.mps, 4: SpeedUnit.kmph, 5: SpeedUnit.mph, 6: VolumeUnit.m3, 7:...
Caarvalho/naoabra
trabalho01/logger.py
logger.py
py
1,355
python
pt
code
1
github-code
90
18381356249
#!/usr/bin/env python3 # from numba import njit # from collections import Counter # from itertools import accumulate # import numpy as np # from heapq import heappop,heappush # from bisect import bisect_left # @njit def solve(n,l): l = sorted(l,key=lambda x: x[1]) consumedTime = 0 flag = True for i in range(...
Aasthaengg/IBMdataset
Python_codes/p02996/s965983592.py
s965983592.py
py
657
python
en
code
0
github-code
90
73402416298
from django.shortcuts import render, redirect from receipts.models import Receipt, ExpenseCategory, Account from django.contrib.auth.decorators import login_required from receipts.forms import CreateReceiptForm, CreateExpenseForm, CreateAccountForm # Create your views here. @login_required() def receipt_list(request):...
Norma1dj/twoshot
receipts/views.py
views.py
py
2,293
python
en
code
0
github-code
90
20079881276
# ----------- Global Variables ----------- # Retro Color CREAM = (247, 246, 196) WHITE = (255, 255, 255) RED = (202, 79, 91) ORANGE = (241, 157, 93) GREEN = (43, 89, 80) LIME = (116, 164, 65) BLUE = (111, 186, 170) PURPLE = (45, 22, 45) # logic variables MAX_ATTEMPTS = 8 remaining_attempts = MAX_ATTEMPTS correct_num =...
sparshg/py-games
src/NumberGame/constants.py
constants.py
py
545
python
en
code
9
github-code
90
29290207316
""" 700. Search in a Binary Search Tree Given the root node of a binary search tree (BST) and a value. You need to find the node in the BST that the node's value equals the given value. Return the subtree rooted with that node. If such node doesn't exist, you should return NULL. For example, Given the tree: ...
mike-chesnokov/leetcode
tree/easy/0700_search_in_a_binary_search_tree.py
0700_search_in_a_binary_search_tree.py
py
1,903
python
en
code
0
github-code
90
30533054651
import datetime import pandas as pd import psycopg2 as pg from core import get_registered_emission_from_db """ Този модул чете данни за текущите котировки при наблюдаваните компании и изчислява спреда между тях. Модула се изпълнява веднъж дневно в периода 10:30:00 до 17:00:00 часа. Модула тегли данни от сайт...
olgayordanova/Artificial-Intelligence
DataScience/sofix_project/read_spread.py
read_spread.py
py
4,361
python
en
code
1
github-code
90
24998877145
def shortestSeq(big: [int], small: [int]) -> [int]: small_set = {s for s in small} m = len(small) d = {s: 0 for s in small} left = 0 cnt = 0 res = [0, 100000] for right, b in enumerate(big): if b not in small_set: continue d[b] += 1 if d[b] == 1: ...
Lycorisophy/LeetCode_python
中等难度/面试题 17.18. 最短超串.py
面试题 17.18. 最短超串.py
py
873
python
en
code
1
github-code
90
19660133827
""" - Retrieves quotes from an online site, using web scraping. - Outputs the quotes retrieved randomly. """ import requests from bs4 import BeautifulSoup import random def random_quote(): # Send a GET request to the website response = requests.get("https://example.com/quotes") # Create a BeautifulSoup ...
houdinipapi/Huncho
20-Beginner_Python_projects/Random Quote Generator/random_quote_scraper.py
random_quote_scraper.py
py
740
python
en
code
0
github-code
90
14531334021
import os import json def extract_route(request): # request é uma string lista_split = request.split() i = len(request)-1 route = lista_split[1][1:i] return route def read_file(path): # path é um caminho filename, file_extension = os.path.splitext('/path/to/somefile.ext') extensions_li...
andresabcb/Q1_PI_TecWeb
Projeto1A_404/utils.py
utils.py
py
2,610
python
en
code
0
github-code
90
70289098218
#!/bin/python3 #https://www.hackerrank.com/challenges/mini-max-sum/problem import math import os import random import re import sys # Complete the miniMaxSum function below. def miniMaxSum(arr): sm = sum(arr,0) mn = sm mx = 0 for i in arr: if((sm-i) <mn): mn = sm -i if ((sm...
build3r/Competitive-Coding-Daily
MknMax_24_09.py
MknMax_24_09.py
py
479
python
en
code
1
github-code
90
28790956765
#creare una funzione che prenda come input due liste di stessa lunghezza e restituisca un dizionario con chiave e valori dati dagli elementi appaiati delle due liste def zip_lists(ls1, ls2): dict_zip = {} for key, value in zip(ls1, ls2): dict_zip[key] = value return dict_zip print(zip_lists([...
sciucca8/Python_PracticeAndMore
Others/Test1_PythonCheckpoint.py
Test1_PythonCheckpoint.py
py
362
python
it
code
0
github-code
90
22595698398
import numpy as np from sklearn.linear_model import LogisticRegression from .models import User from .twitter import vectorize_tweet def predict_user(user0_name, user1_name, tweet_text): """takes two users that will be compared""" user0 = User.query.filter(User.name == user0_name).one() user1 = User.qu...
KilovoIt/twitoff-updated
twitoff/predict.py
predict.py
py
901
python
en
code
0
github-code
90
13219695328
import re import urllib2 import time import json from datetime import datetime from dateutil import parser from dateutil import rrule import pandas as pd signs = ["general", "aries", "taurus", "gemini", "cancer", "leo", "virgo", "libra", "scorpio", "saggitarius", "capricorn", "aquarius", "picies"] horoscope...
billpmurphy/horoscopes
horoscraper.py
horoscraper.py
py
2,777
python
en
code
0
github-code
90
14864549626
from django.shortcuts import render from .models import Library # Create your views here. def insert_library_details(schema): print("In insert libaray details") text = "Library " + schema lib = Library(name = text, rating=5) lib.save() return lib
sreyasvm/python
django/pollsapp/tenant_independent/views.py
views.py
py
270
python
en
code
0
github-code
90
18584564229
N,a,b = map(int, input().split()) sum=0 for i in range(1,N+1): c=0 d=i while d>0: c+=d%10 d//=10 if a<=c<=b: sum+=i print(sum)
Aasthaengg/IBMdataset
Python_codes/p03478/s763526185.py
s763526185.py
py
171
python
en
code
0
github-code
90
18448625079
N = int(input()) L = list(map(int, input().split())) max_L = max(L) max_i = L.index(max(L)) sum_without_max = sum([*L[:max_i], *L[max_i+1:]]) if sum_without_max > max_L: print("Yes") else: print("No")
Aasthaengg/IBMdataset
Python_codes/p03136/s321092058.py
s321092058.py
py
211
python
en
code
0
github-code
90
32409025596
""" 重新构建v2_6的数据集,一张图片对应一个images的一个unit,每个手对应annotations的一个unit images['id']标识图片id annotations['id']标识手对象id annotation['image_id']标识图片id 同时把所有关键点坐标保留两位保存 对于不同数据集的convert_coco_format仅需要对load_data做修改 对于load_data: 参照coco的读取数据方式,以原始图片名做索引号,对每张图片存储关键信息单元如下 unit_dict = dict({ 'hand_type': hand_type, ...
Daming-TF/HandData
scripts/Data_Interface/halpe_full_body/convert_coco_format_from_whole_body-v2_6.py
convert_coco_format_from_whole_body-v2_6.py
py
6,825
python
en
code
1
github-code
90
33674942367
import tracemalloc import time t_start = time.perf_counter() tracemalloc.start() class Node: def __init__(self, val): self.val = val self.left = None self.right = None self.parent = None self.size = None class Tree: def __init__(self): sel...
Algos-ICT/lab-2_2-KorolevaEkaterina334740
16.py
16.py
py
4,415
python
en
code
0
github-code
90
18511299389
d, g = map(int, input().split()) pc_ls = [] for i in range(d): p, c = map(int, input().split()) pc_ls.append([p, c]) ptns = [] for i in range(2 ** d): ptn = [] for j in range(d): if ((i >> j) & 1): ptn.append(j) ptns.append(ptn) ret = 10 ** 10 for item in ptns: cnt = 0 ...
Aasthaengg/IBMdataset
Python_codes/p03290/s986410860.py
s986410860.py
py
997
python
en
code
0
github-code
90
18636890027
# -*- coding: utf-8 -*- """ Created on Sat Dec 22 20:35:08 2018 @author: omi """ from sklearn import tree import pandas as pd from sklearn.metrics import classification_report,confusion_matrix eeg_data=pd.read_csv("F:\\Python scikit learner\\3FC6_train.csv") eeg_test_data=pd.read_csv("F:\\Python scikit lea...
MdOchiuddinMiah/Machine_Learning_Python_scikit_learn
Python scikit learner/differentsensor_performance.py
differentsensor_performance.py
py
945
python
en
code
0
github-code
90
21513990371
from argparse import ArgumentParser from logging import getLogger from pathlib import Path from pipeline.config import Config from pipeline.data_module import build_data_module from pipeline.runner import build_runner from src.utils import set_seed, setup_logger def main(): parser = ArgumentParser() parser....
sakami0000/kaggle_pipeline
main.py
main.py
py
937
python
en
code
7
github-code
90
73530503658
import torch, os from torch import optim import numpy as np import pandas as pd import argparse from torch.utils.data import random_split, DataLoader import sys sys.path.append("../util") # from FNO2d import FNO_multimodal_2d # from SM_FNO2d_remove_physics_injection import FNO_multimodal_2d from simulation_datas...
ChenkaiMao97/MAML_EM_simulation
DDM/ICLR_evaluation/test_evaluation_FNO.py
test_evaluation_FNO.py
py
16,410
python
en
code
3
github-code
90
18200929877
from CalefactorElectrico import CalefactorElectrico from CalefactorAGas import CalefactorAGas from Coleccion import Coleccion import csv def test(): calElectrico1 = CalefactorElectrico("Magiclick", "C1009", 2000, None, None) calAGas1 = CalefactorAGas("Eskabe", "S21 MX 3",None ,"GN01-00001-06-057", 3000)...
mrtrz257/2022-poo-unidad3
Ejercicio 4/main.py
main.py
py
3,498
python
es
code
0
github-code
90
21667462860
from collections import defaultdict from typing import Dict class Octopus: def __init__(self, energy_level: int) -> None: self.flashed = False self.energy_level = energy_level def energise(self) -> None: self.energy_level += 1 def flash(self) -> None: self.flashed = True ...
kwyckmans/advent-of-code-2021
day11/day11.py
day11.py
py
3,804
python
en
code
0
github-code
90
22770222973
class Solution(object): def maxSubArray(self, nums): """ :type nums: List[int] :rtype: int """ right = 0 right_reg = 0 left = len(nums) - 1 left_reg = left right_sum = left_sum = 0 while right<left: right_sum += nums[right]...
amisyy/leetcode
maxSubArray.py
maxSubArray.py
py
872
python
en
code
0
github-code
90