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
36388169565
from fastapi import APIRouter from api.docker.models import DockerStatsModel from api.docker.retrieval import get_container_stats, ping_docker router = APIRouter( prefix="/docker", tags=["Docker"], ) @router.get("/", tags=["Ping"]) def get_docker_health(): status = ping_docker() return {"status": "o...
noahtigner/homelab
api/docker/router.py
router.py
py
462
python
en
code
0
github-code
6
7418507725
# Title: IS 6713 Homework #1 # Author: Kalea Sebesta # Date: Oct. 20, 2017 # Due Date: Oct 31, 2017 ''' Program Discription: Purpose is to maintian company info for a small business. (first and last name, position, department, and salary of each employee) The program continuously read input from the user, output data,...
ksebesta/PythonCourseProjects
sebesta_HW1_script.py
sebesta_HW1_script.py
py
13,882
python
en
code
0
github-code
6
72779432828
import requests import optparse from progressbar import * CHUNK_SIZE = 1024 widgets = ['Downloading : ', Percentage(), ' ', Bar(marker='#',left='[',right=']'), ' ', ETA(), ' ', FileTransferSpeed()] def download_file(url, file_name=None): response = requests.head(url) total_size = int(...
bitst0rm/video-stream-downloader
vid_single.py
vid_single.py
py
1,158
python
en
code
0
github-code
6
2542885352
from os import path import warnings import copy import cv2 from PIL import Image from infy_field_extractor.internal.constants import Constants class ExtractorHelper(): """Helper class for data extraction""" @staticmethod def extract_with_text_coordinates( image, bboxes_text, get_text_provider,...
Infosys/Document-Extraction-Libraries
infy_field_extractor/src/infy_field_extractor/internal/extractor_helper.py
extractor_helper.py
py
26,643
python
en
code
6
github-code
6
23370877467
IDUN = True RANDOM_SEED = 2021 TEST_SIZE = 0.15 VAL_SIZE = 0.10 TUNING_SIZE = 0.3 # Dataset sizes LABELED_VALIDATION_ABSOLUTE_SIZE = 345 LABELED_TRAIN_SIZE = 1380 WEAK_NUMBER_OF_ARTICLES_PER_CLASS = 2760 # TF-IDF params TITLE_MAX_FEATURES = 1000 CONTENT_MAX_FEATURES = 5000 # LR params MAX_ITER = 4000 SOLVER = 'lib...
piiingz/fake-news-detection-classifiers
config.py
config.py
py
4,044
python
en
code
0
github-code
6
19649617548
from sys import stdin from heapq import heappop, heappush readline = stdin.readline heap = [] while True: line = readline() if line[1] == 'x': print(-heappop(heap)) elif line[0] == 'i': heappush(heap, -int(line.split()[1])) else: break ''' def insert(heap, key): heap.appen...
okuchap/cppAlgo
19C.py
19C.py
py
1,358
python
en
code
0
github-code
6
40026671586
import requests from lxml import etree BASE_DOMIN = 'https://ygdy8.net' URL = [] HEADERS = { 'Referer': 'https://c.02kdid.com/b/1/1754/22432/960X90/960X90.html', 'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.116 Safari/537.36' } def get_detai...
mirrorthink/python
douban/douban.py
douban.py
py
2,668
python
en
code
0
github-code
6
36649336174
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Sun Apr 11 10:56:48 2020 @author: alexanderfalk """ import itertools import time import sys class ThreeOPT: def __init__(self, computed_solution, time_limit=60): self.solution = computed_solution self.time_limit = time_limit def...
AlexanderFalk/2020_Project01_CS_HA
src/threeopt.py
threeopt.py
py
2,076
python
en
code
0
github-code
6
3439580711
class Solution(object): def splitArray(self, nums): """ :type nums: List[int] :rtype: bool """ n = len(nums) target = 0 total = sum(nums) for i in range(1, n-5): if i != 1 and nums[i-1]==0 and nums[i] == 0: continue ...
cuiy0006/Algorithms
leetcode/548. Split Array with Equal Sum.py
548. Split Array with Equal Sum.py
py
1,236
python
en
code
0
github-code
6
18769137511
from sys import stdin while(True): try: xa,ya,xb,yb,xc,yc,xd,yd = map(float, stdin.readline().split(",")) ab = [xb-xa,yb-ya] bc = [xc-xb,yc-yb] cd = [xd-xc,yd-yc] da = [xa-xd,ya-yd] cr1 = ab[0]*bc[1] - ab[1]*bc[0] cr2 = bc[0]*cd[1] - bc[1]*cd[0] cr3 =...
ehki/AOJ_challenge
python/0035.py
0035.py
py
567
python
en
code
0
github-code
6
31095201820
import struct import math import mathutils UINT32 = {"format": "<L", "size": 4} SINT32 = {"format": "<l", "size": 4} UINT16 = {"format": "<H", "size": 2} SINT16 = {"format": "<h", "size": 2} FLOAT = {"format": "<f", "size": 4} BYTE = {"format": "b", "size": 1} class Vertex_Data: def __init__(self): self...
ElectricVersion/Blender-FATE-plugin
util.py
util.py
py
7,045
python
en
code
4
github-code
6
15518608756
from gnuradio_core import * from exceptions import * #from hier_block2 import * #from top_block import * from gateway import basic_block, sync_block, decim_block, interp_block from tag_utils import tag_to_python, tag_to_pmt import gras RT_OK = 0 RT_NOT_IMPLEMENTED = 1 RT_NO_PRIVS = 2 RT_OTHER_ERROR = 3 def enable_r...
manojgudi/sandhi
modules/gr36/gnuradio-core/src/python/gnuradio/gr/__init__.py
__init__.py
py
2,197
python
en
code
1
github-code
6
18842905496
import logging try: from settings import DEBUG except ImportError: DEBUG = True from raven.handlers.logging import SentryHandler from clean.infra.log.utils.colors import color_style class RequireDebugFalse(logging.Filter): def filter(self, record): return not DEBUG class RequireDebugTrue(logging...
bahnlink/pyclean
clean/infra/log/utils/__init__.py
__init__.py
py
1,182
python
en
code
0
github-code
6
43293144011
""" 学员管理系统 系统简介 需求:进⼊系统显示系统功能界⾯,功能如下: 添加学员 删除学员 修改学员信息 完善修改学员信息: 可全部修改,也可单独修改 查询学员信息 完善查找学员信息: 根据姓名查找(如果有两个张三,则全部显示,如果只有一个,则显示一个) 显示所有学员信息 退出系统 """ """ 这是宠物信息管理系统的主程序 """ # 导入学员管理系统的功能模块 from student_tools import * def main(): # 1. 显示系统功能界面 while True: show_menu() ...
pisces-jeffen/Learning-Python
chapter1_basic/lesson14_学员管理系统/student_main.py
student_main.py
py
1,705
python
zh
code
0
github-code
6
40534220786
from dataclasses import dataclass, field from typing import List from frater.component import ComponentState, IOComponent, IOComponentConfig, ComponentBuilder from frater.stream import InputStream, OutputStream, StreamConfig, StreamState @dataclass class SummationComponentState(ComponentState): total: int = 0 ...
Frater-SDK/frater
docs/source/getting_started/examples/io_component_example.py
io_component_example.py
py
1,530
python
en
code
3
github-code
6
39746911520
import threading from flask import jsonify from dophon_cloud import enhance, micro_cell_list a = enhance(import_name=__name__, properties={'111': 'aaa', 'service_name': 'dxh-service', 'host': '0.0.0.0', 'port': 80, 'reg_url': 'http://127.0.0.1:8301/reg/service/'}) m_c_list = micr...
Ca11MeE/dophon_cloud
dophon_cloud/a_test.py
a_test.py
py
912
python
en
code
0
github-code
6
18672735980
import numpy as np import pickle import scipy.signal as sp import matplotlib.pyplot as plt with open('datasave', 'rb') as file: datasym =pickle.load(file) dataf = np.zeros((91, 1024, 1024)) ref = np.mean(datasym[:17, :, :],axis=0) for z1 in range(1024): for z2 in range(1024): value1 =datasym[30:121, z1,...
jialanxin/UED-Analysis
load.py
load.py
py
615
python
en
code
0
github-code
6
11916090818
# Loay Mohamed # Challeng 6: matrix = input("Input your binary n*m matrix:") #matrix = [[0, 1, 1, 0], [0, 1, 1, 0], [1, 0, 0, 1], [1, 0, 0, 1]] # matrix = [[1, 0], [0, 1]] n = len(matrix) m = len(matrix[0]) # check and validate matrix dimensions: if m == 0 or n == 0: print("Invalid Matrix with dimensions " + str(n...
LoayMoh99/EVA_Hackathon
Task1/python_codes/q6.py
q6.py
py
1,667
python
en
code
0
github-code
6
19303998344
# -*- coding: utf-8 -*- import pygame, os, sys import pygame_functions as pyf import constants as c import time import shuffle import bfs import dfs import it_dfs import a_star import utils class Game_Interface: def __init__(self, nmax, filename): # Variaveis de Controle self.nmax = nmax se...
pHgon/8Puzzle-FIA
Interface/main.py
main.py
py
13,432
python
en
code
0
github-code
6
3989954821
from typing import TYPE_CHECKING, Any, Dict, List, Self, Union, cast from attrs import define as _attrs_define from attrs import field as _attrs_field from ..types import UNSET, Unset if TYPE_CHECKING: from ..schemas.deposit import Deposit from ..schemas.recent_2_result_type_1 import Recent2ResultType1 @_a...
tlg7c5/kraken-connector
kraken_connector/schemas/recent_2.py
recent_2.py
py
3,654
python
en
code
0
github-code
6
43918816491
from cleverhans.attacks import CarliniWagnerL2 from tools.cleverhans.adversarial_attack import AdversarialAttack class CarliniWagnerAttack(AdversarialAttack): def __init__(self, model, targeted=False, confidence=0, batch_size=1, learning_rate=5e-3, binary_search_steps=5, max_iterations=1000, abo...
GianmarcoMidena/adversarial-ML-benchmarker
tools/cleverhans/carlini_wagner_attack.py
carlini_wagner_attack.py
py
1,845
python
en
code
0
github-code
6
73826485946
# # Lendo arquivos com funções do Python # def leitura_arquivo(): arquivo = open("novo_arquivo.txt", "r") if arquivo.mode == "r": conteudo = arquivo.read() print(conteudo) arquivo.close() leitura_arquivo() def leitura_arquivo_grande(): arquivo = open("novo_arquivo.txt", "r") if ...
Feltrim/CursoPython-LinkedInLearning
Exercicios/arquivos_de_exercicios_descubra_o_python/Cap. 04/leituraArquivo_start.py
leituraArquivo_start.py
py
505
python
pt
code
0
github-code
6
72493095869
import math import time def isPrimeOptimal(n): sa = int(math.sqrt(n)) count = 0 for i in range(2, sa+1): if n % i == 0: count += 1 if count == 0: return True else: return False def isPrimeJoke(n): count = 0 for i in range(2, n+1):...
Rahul109866/python-data-structures
prime optimization.py
prime optimization.py
py
707
python
en
code
0
github-code
6
23399964442
import nextcord from nextcord.ext import commands, application_checks from nextcord import Interaction, SlashOption from config.config_handler import ConfigHandler from middlewares.server_verification import ServerVerification from components.modals.nuke_model import NukeModel from middlewares.bot_permissions i...
Worcer/ASF
amanecer sin fronteras/src/commands/raid/nuke.py
nuke.py
py
1,639
python
en
code
0
github-code
6
14807523398
import multiprocessing import time import os ''' import os print("work进程编号",os.getpid()) ''' def dance(nums,names): print("dance进程id:"+str(os.getpid())) print("dance父进程id:"+str(os.getppid())) for i in range(nums): print(names+"跳舞") time.sleep(0.5) def sing(nums,names): print("sing进程i...
kids0cn/leetcode
Python语法/python多线程多进程/3.获取进程编号.py
3.获取进程编号.py
py
808
python
en
code
0
github-code
6
33564541075
import time #i had ChatGPT3 help me a bit, know i need to apply this to my original code, for all my story. as well as i need to remove the prints i used to start new lines. I need #to put /n at the start of all my input commands. Finally, I need to remove the time.sleeps becuase i can instead just use the typing_pr...
Titan-Slayer09/My-TBA-Thing
TBAai.py
TBAai.py
py
4,224
python
en
code
1
github-code
6
15751070560
#!/usr/bin/env python # -*- coding: utf-8 -*- # Created by Alex on 2016/10/18 class A(object): a = 'a' def __init__(self, b): self.b = b if __name__ == '__main__': a = A('test a') print (a.b) print (a.a) a.a = 'asdasdf' b = A('test b') print (b.b) print (b.a)
bufubaoni/antitools
learnpython/pytest.py
pytest.py
py
309
python
en
code
17
github-code
6
21092937121
def detectCycleInGraph(edges: list[list[int]], node: int) -> bool: if edges is None or node == 0: return False stack = [] visited = [0 for i in range(0, node)] graph = [[] for i in range(0, node)] for edge in edges: _from = edge[0] _to = edge[1] graph[_from].append(_t...
fahadfahim13/Problem_Solve
Python/Coding Simplified/Graph/DetectCycleInGraphDFS.py
DetectCycleInGraphDFS.py
py
1,048
python
en
code
0
github-code
6
9027119591
# encoding: utf-8 import pdb, time, sys, os, codecs, random, re, math import numpy as np emotion_idx = dict(zip(['neutral','anger', 'disgust', 'fear', 'joy', 'sadness', 'surprise'], range(7))) def print_time(): print('\n----------{}----------'.format(time.strftime("%Y-%m-%d %X", time.localtime()))) ...
NUSTM/MECPE
utils/pre_data_bert.py
pre_data_bert.py
py
20,065
python
en
code
24
github-code
6
70279501309
import os import six import logging from django.utils import timezone logger = logging.getLogger(__name__) def queryset_csv_export(qs, fields, cache_funcs=None, filepath=None, fileobj=None, delimiter='|'): import csv import inspect from django.db.models.query import QuerySet if not filepath: ...
mirusresearch/mirus_django_csv
mirus_django_csv.py
mirus_django_csv.py
py
4,477
python
en
code
0
github-code
6
73652285629
# 你有一个带有四个圆形拨轮的转盘锁。每个拨轮都有10个数字: '0', '1', '2', '3', '4', '5', '6', '7', '8', '9' 。每个拨轮可以自由旋转:例如把 '9' 变为 '0','0' 变为 '9' 。每次旋转都只能旋转一个拨轮的一位数字。 # 锁的初始数字为 '0000' ,一个代表四个拨轮的数字的字符串。 # 列表 deadends 包含了一组死亡数字,一旦拨轮的数字和列表里的任何一个元素相同,这个锁将会被永久锁定,无法再被旋转。 # 字符串 target 代表可以解锁的数字,你需要给出最小的旋转次数,如果无论如何不能解锁,返回 -1。 class Solution(object...
xxxxlc/leetcode
BFS/openLock.py
openLock.py
py
2,133
python
zh
code
0
github-code
6
40732764303
temp = 0 Average = 0 Ratings = {'A+':4.5, 'A0':4.0,'B+':3.5, 'B0':3.0,'C+':2.5, 'C0':2.0,'D+':1.5, 'D0':1.0,'F':0.0} for _ in range(20): Subject, Grade, Rating = map(str, input().split()) if Rating == 'P': continue Average += int(Grade[0]) * Ratings[Rating] temp += int(Grade[0]) print(Average/temp)
seriokim/Coding-Study
백준 단계별로 풀어보기/심화1/25206.py
25206.py
py
315
python
en
code
0
github-code
6
13919169732
# License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl.html). from odoo import _, api, fields, models class ProjectScrumRelease(models.Model): _inherit = "project.scrum.release" @api.depends( "total_planned_hours", "total_planned_hours_edit", "sprint_ids", "sprint_ids...
onesteinbv/ProjectManagement
project_scrum_agile_extended/models/project_scrum_release.py
project_scrum_release.py
py
5,492
python
en
code
1
github-code
6
22019348906
import os import sys FULL_PATH = os.path.abspath(os.path.dirname(sys.argv[0])) sys.path.insert(0, FULL_PATH+'/lib') from errors import error class reRefine(): # the aim of this class is to allow later datasets within a damage # series to be rigid body refined (using REFMAC), using the coordinate # model ...
GarmanGroup/RIDL
lib/rigidBodyRefine.py
rigidBodyRefine.py
py
10,059
python
en
code
3
github-code
6
4272453202
from django.shortcuts import render, get_object_or_404 from django.http import JsonResponse from .models import Pokemon def pokemon_list(request): pokemon = Pokemon.objects.all() data = {"results": list(pokemon.values( "name", "apiId", "chainId", "healtPoint", "attack"...
hitolv4/poketest
pokemon/views.py
views.py
py
1,667
python
en
code
0
github-code
6
15849581052
class Solution: def hammingDistance(self, x: int, y: int) -> int: distance = 0 while True: rx, ry = x % 2, y % 2 print(rx, ry) if rx != ry: distance += 1 x, y = x // 2, y // 2 if x == 0 and y == 0: break ...
xinkai-jiang/coding_tutorial
leetcode/HammingDistance.py
HammingDistance.py
py
422
python
en
code
0
github-code
6
25006136605
from typing import TYPE_CHECKING, List, NamedTuple, Optional import boto3 if TYPE_CHECKING: from mypy_boto3_ec2.type_defs import FilterTypeDef from typing_extensions import TypedDict from aec.util.config import Config class Image(TypedDict, total=False): Name: Optional[str] ImageId: str CreationDa...
DENE-dev/dene-dev
RQ1-data/exp2/552-seek-oss@aec-dc5825f8ca2f88df7f4eba38362ffbcf90bf17bb/src/aec/command/ami.py
ami.py
py
4,241
python
en
code
0
github-code
6
13923936476
import os import random from os import listdir from os.path import splitext from tqdm import tqdm import numpy as np import cv2 from utils.FileOperator import * # img_tf_flip(r'E:\Project\Unet-vanilla\data\img_backup',r'E:\Project\Unet-vanilla\data\mask_backup') # img_tf_flip(r'../data/backup/img', r'../data/backup...
ssocean/UNet-Binarization
utils/Augmentation.py
Augmentation.py
py
2,259
python
en
code
4
github-code
6
36766531397
import numpy as np import pandas as pd import matplotlib.pyplot as plt import seaborn as sns import os import time data = pd.read_csv('C:/Users/SwetaMankala/Desktop/Assignments/EAI6000/ma_statewide_2020_04_01.csv',low_memory= False) data.head(10) # Checking the shape of the data set data.shape data['location'].uni...
anirudh0809/fundamentals_of_ai
linear_models/eda.py
eda.py
py
9,689
python
en
code
1
github-code
6
38390581306
import logging from queue import Queue from logging.handlers import QueueListener, QueueHandler, RotatingFileHandler from contextlib import contextmanager from django.conf import settings @contextmanager def prepare_background_logging(log_path): logger = logging.getLogger() logger.handlers = [] log_queue ...
Shvidkiy-Dima/checker
background_service/utils.py
utils.py
py
1,090
python
en
code
1
github-code
6
74387135229
try: from setuptools import setup except ImportError: from distutils.core import setup #using unittest to test the file instead of nosetests config = { 'description': 'ex47 using unittest and using a package', 'author': 'Cynthia E Ma', 'url': 'URL to get it at.', 'download_url': 'Where to download it', 'au...
xnanodax/lpthw
ex47_unittest/setup.py
setup.py
py
523
python
en
code
0
github-code
6
75066299708
import argparse def parse_args(): # description parser = argparse.ArgumentParser( description='Compares two configuration files and shows a difference.') # positional arguments: parser.add_argument('first_file') parser.add_argument('second_file') # optional arguments: parser.add_...
slovohot/python-project-50
gendiff/logic/argparser.py
argparser.py
py
620
python
en
code
0
github-code
6
20044482765
# https://www.codechef.com/problems/LAPTOPREC def solve(l): d = {} for i in l: if i not in d: d[i] = 1 else: d[i]+=1 mx = 0 key = 0 print(d) for i in d: if d[i]>mx: mx = d[i] key = i ct = 0 for i in d...
Elevenv/Placement-Stuff
LaptopRecomm.py
LaptopRecomm.py
py
530
python
en
code
1
github-code
6
20605708222
import Tkinter root=Tkinter.Tk() root.title("GUI Application") album={} album["Artist 1"]="Song1" album["Artist 2"]="Song2" album["Artist 3"]="Song3" #Function def show_all(): #Clear list box lb_music.delete(0,"end") #iterate through keys for artist in album: lb_music.insert("end",artist) def show_one(): arti...
rishabh-1004/Python-codes
guiprog.py
guiprog.py
py
1,037
python
en
code
0
github-code
6
31110943594
#https://leetcode.com/problems/diameter-of-binary-tree/ def diameter(root): if not root: return 0 self.ans = 0 def depth(root): if not root: return 0 L = depth(root.left) R = depth(root.right) #adds both arms of a node to give the diameter self.ans...
sparsh-m/30days
d18_3.py
d18_3.py
py
521
python
en
code
0
github-code
6
34134686621
from objects import Girl, Boy, Location # چون ایرانیا پر غصه ان گفتیم یک دو سه بیخیال غصه iran = Location(1, 2, 3) # چون ترکیه ای ها شیطان پرستن 666 turkey = Location(6, 6, 6) # صاحب توییت tweet_owner = Girl( dna={ 'fibula_bone': 'AAGGCCT', 'tibia_bone': 'AAGGCCT', 'femur_bone': 'AAGGCCT'...
mmdthurr/saghie_tataloo_project
main.py
main.py
py
2,459
python
fa
code
4
github-code
6
9224597934
from prediction.M2I.predictor import M2IPredictor import numpy as np import math import logging import copy import random import time from plan.env_planner import EnvPlanner, Agent, SudoInterpolator import interactive_sim.envs.util as utils import plan.helper as plan_helper S0 = 3 T = 0.25 #1.5 # reaction time when...
Tsinghua-MARS-Lab/InterSim
simulator/plan/ltp/ego_ltp.py
ego_ltp.py
py
1,199
python
en
code
119
github-code
6
4330202050
import types import numpy as np from acados_template import MX, Function, cos, fmax, interpolant, mod, sin, vertcat from casadi import * def bicycle_model(s0: list, kapparef: list, d_left: list, d_right: list, cfg_dict: dict): # define structs constraint = types.SimpleNamespace() model = types.SimpleName...
wueestry/f110_mpcc
src/mpc/bicycle_model.py
bicycle_model.py
py
7,313
python
en
code
2
github-code
6
72966516669
# encoding=utf8 from Source import * import logging,re,mylex logging.basicConfig(format=' %(filename)s[line:%(lineno)d] %(levelname)s %(message)s', datefmt='%a, %d %b %H:%M:%S',level=logging.DEBUG) index=0 # token_stream="""INT IDENTIFIER '(' ')' '{' IDENTIFIER ';' IDENTIFIER '=' CONSTANT ';' WHI...
zhaoguoquan94/compiler_syntax_analysor
systax_analysisor.py
systax_analysisor.py
py
4,919
python
en
code
2
github-code
6
40017294295
import mysql.connector import matplotlib.pyplot as plt import argparse import os import random import pandas as pd import datetime import numpy as np from sklearn.decomposition import PCA from sklearn.preprocessing import MinMaxScaler def createDatabase(dataBase="smartBottle"): """连接数据库,创建database""" mydb = mysql.c...
YuTheon/NUS_AIOT_web2
setMysqlData.py
setMysqlData.py
py
7,386
python
en
code
0
github-code
6
27264929540
#!/usr/bin/env python # PYTHON_ARGCOMPLETE_OK import argparse import configparser import json import logging import textwrap import argcomplete from las import Client, Credentials from las.credentials import MissingCredentials, read_from_file from .__version__ import __version__ from .util import NotProvided from .p...
LucidtechAI/las-cli
lascli/__main__.py
__main__.py
py
3,452
python
en
code
1
github-code
6
73652417469
# 给你两个字符串数组 creators 和 ids ,和一个整数数组 views ,所有数组的长度都是 n 。平台上第 i 个视频者是 creator[i] ,视频分配的 id 是 ids[i] ,且播放量为 views[i] 。 # 视频创作者的 流行度 是该创作者的 所有 视频的播放量的 总和 。请找出流行度 最高 创作者以及该创作者播放量 最大 的视频的 id 。 # 如果存在多个创作者流行度都最高,则需要找出所有符合条件的创作者。 # 如果某个创作者存在多个播放量最高的视频,则只需要找出字典序最小的 id 。 # 返回一个二维字符串数组 answer ,其中 answer[i] = [creatori, idi] 表示...
xxxxlc/leetcode
competition/单周赛/317/mostPopularCreator.py
mostPopularCreator.py
py
2,125
python
zh
code
0
github-code
6
73479090107
"""This module is a wrapper for libhydrogeo (WASP 8)""" import os import datetime import ctypes as ct import constants as co class Wasp(object): def __init__(self, libname=co.LIB_NAME, libpath=None): """Initialization for class Seach and load the library ... else exit. Args: ...
fpacheco/hydrolink
wasp.py
wasp.py
py
12,492
python
en
code
4
github-code
6
72255274108
from __future__ import annotations import asyncio import datetime import time from typing import TYPE_CHECKING, List, Optional, Tuple, Union import asyncpg import discord from discord.ext import commands from utils import ( AvatarsPageSource, AvatarView, FieldPageSource, Pager, format_bytes, ...
LeoCx1000/fish
src/cogs/discord_/user.py
user.py
py
12,878
python
en
code
0
github-code
6
43166848463
'''A simple blockchain implementation. Inspired by https://medium.com/crypto-currently/lets-build-the-tiniest-blockchain-e70965a248b''' from __future__ import print_function import hashlib import datetime class Block: '''Blocks of data that will create the Blockchain''' def __init__(self, index, timestamp, da...
William-Hill/UVI_Teaching_2018
blockchain/cruzan_coin.py
cruzan_coin.py
py
1,722
python
en
code
0
github-code
6
19682814836
#!/usr/bin/env python # coding: utf-8 # # ORCA utilities # # Utilities for input creation and output post-processing # ## Geometry Splitter for CREST conformers with open('crest_conformers.xyz') as ifile: name=input('Enter name of the fragments: ') func=input('Which functional? ') disp=in...
EduardoSchiavo/utilities
crest_splitter.py
crest_splitter.py
py
1,223
python
en
code
0
github-code
6
26889276534
import torch def iou_score(output, target): smooth = 1e-5 if torch.is_tensor(output): output = torch.sigmoid(output).data.cpu().numpy() if torch.is_tensor(target): target = target.data.cpu().numpy() output_ = output > 0.5 target_ = target > 0.5 intersection = (output_ & targe...
krishnakaushik25/Medical-Image-Segmentation-DL
modular_code/src/ML_Pipeline/iou.py
iou.py
py
423
python
en
code
7
github-code
6
44942108516
model = dict( type='BRNet', backbone=dict( type='PointNet2SASSG', in_channels=4, num_points=(2048, 1024, 512, 256), radius=(0.2, 0.4, 0.8, 1.2), num_samples=(64, 32, 16, 16), sa_channels=( (64, 64, 128), (128, 128, 256), (128, 1...
cheng052/BRNet
configs/_base_/models/brnet.py
brnet.py
py
3,261
python
en
code
90
github-code
6
23876853087
class SLLNode: def __init__(self, item, nextnode): self.element = item self.next = nextnode class SLinkedList: def __init__(self): self.first = None self.size = 0 def length(self): return self.size def add_first(self, item): newnode = SLLN...
maximised/College_work
Year_2/CS2516/ADTs/Singly_Linked_list.py
Singly_Linked_list.py
py
2,229
python
en
code
0
github-code
6
39509933349
import argparse from torch.nn import BatchNorm2d from cifar.norm_layers import MyBatchNorm, BatchInstance, MyLayerNorm, MyGroupNorm, MyInstanceNorm from cifar.dataset import get_data_loaders,get_default_device from cifar.train import train from cifar.model import MyResnet # python3 train_cifar.py --normaliz...
aps1310/COL_870
Assignment 1/2020MCS2448_2020MCS2468/train_cifar.py
train_cifar.py
py
1,757
python
en
code
0
github-code
6
1558159854
from enum import IntEnum SCALE_2X: bool = False WORLD_SCALE: int = 32 OBJECT_SCALE: int = WORLD_SCALE // 2 SPRITE_SCALE: int = WORLD_SCALE * 2 ANIMATION_NUM_FRAMES: int = 4 RESOLUTION_X: int = WORLD_SCALE * 20 RESOLUTION_Y: int = int(RESOLUTION_X * 0.625) # 640x400 aspect ratio SPRITE_CLOTHES_COLORS = ['#42200f',...
cgloeckner/prehistoric_guy
core/constants.py
constants.py
py
713
python
en
code
0
github-code
6
40693675853
import argparse import glob import os import shutil import subprocess # noqa: S404 import sys from collections import namedtuple from types import MappingProxyType from typing import Iterable, List, Optional HOST_BUILD_CTX = '/tmp/magma_orc8r_build' # noqa: S108 HOST_MAGMA_ROOT = '../../../.' IMAGE_MAGMA_ROOT = os.p...
magma/magma
orc8r/cloud/docker/build.py
build.py
py
10,627
python
en
code
1,605
github-code
6
11833093627
import qrcode from django.db import models from django.utils.text import slugify from django.utils.html import mark_safe from cms.models import Title from django.contrib.sites.models import Site import uuid class QrCodeUrlPost(models.Model): TITLE_URLS = [(o.path, o.title) for o in Title.objects.filter(publisher_...
vazvieirafrederic67/qrCodePlugin
models.py
models.py
py
1,878
python
en
code
0
github-code
6
40033915805
#import necessary modules import numpy as np from numpy import load from sklearn.model_selection import StratifiedKFold from sklearn.svm import SVC from sklearn.pipeline import make_pipeline from sklearn.preprocessing import Normalizer, LabelEncoder, MinMaxScaler, StandardScaler from sklearn.metrics import accur...
karth1ksr/Face-Recognition-with-Facenet
cross validation.py
cross validation.py
py
1,907
python
en
code
0
github-code
6
12178949620
import time import os from maeda.SystemFile import File class Csv: def __init__(self, labels = [], directory = "data.csv"): self.labels = labels self.file = File(directory) self._config() def _config(self): data_loc = [] if not self.file.CheckFileSiz...
equipe-maeda/MaedaLibsPi
maeda/Csv.py
Csv.py
py
1,137
python
en
code
0
github-code
6
35428261847
""" This script detects laughter within all audio files contained in the directory `root_dir/audio/raw`, and save one pickle file for each audio file with laughter timecodes in the directory `root_dir/audio/laughter`. """ import argparse import os import os.path as osp import pickle from laughter_detection.core.laug...
robincourant/FunnyNet
laughter_detection/scripts/detect_laughters.py
detect_laughters.py
py
1,990
python
en
code
1
github-code
6
1962665868
import tensorflow as tf import numpy as np class MultiArmedBandit(): def __init__(self, input_dimension=[], output_dimension=[], layer_sizes=[], learning_rate=1e-4, model_ckpt=None): if model_ckpt is None: self.input, self.output = _construct_network(input_dimension, output_dimension, ...
vumaasha/contextual-mab-link-adaptation
src/link_adaptation_agents/multi_armed_bandit.py
multi_armed_bandit.py
py
6,322
python
en
code
2
github-code
6
25377227491
import profile from django.urls import path from . import views from django.conf import settings from django.conf.urls.static import static from django.contrib.auth import views as auth_views from .views import PostListView,PostDetailView,PostCreateView,PostUpdateView, PostDeleteView, ProfileView, AddFollower,RemoveFol...
Njoro410/Insta-clone
insta/urls.py
urls.py
py
1,566
python
en
code
0
github-code
6
13006866992
import numpy as np import pandas as pd import cv2 from PIL import Image import joblib import cv2 import numpy as np import time import pandas as pd import imagehash import multiprocessing as mp import logging import os from dataclasses import dataclass, field from typing import List, Dict from slideext...
shex1627/slideextract
src/slideextract/slide_extractors/baseSlideExtractor.py
baseSlideExtractor.py
py
4,003
python
en
code
1
github-code
6
26869499538
from flask import Flask, redirect, request, session, Response, jsonify from flask_login import LoginManager from flask_mail import Mail from myapp.models.base import db # 初始化 Loginmanager login_manager = LoginManager() mail = Mail() def create_app(): app = Flask(__name__) app.config.from_object('myapp.secur...
102244653/WebByFlask
myapp/__init__.py
__init__.py
py
1,159
python
en
code
0
github-code
6
33107730586
import math seznam = [] for i in range(0, 1000): stevilka = int(input("Vnesi število: ")) seznam.append(stevilka) if stevilka == 0: # ali je število enako 0 break; print("Najmanjše število je: ", min(stevilka))
rutniklea/coding-with-python
Naloga35.py
Naloga35.py
py
240
python
sl
code
0
github-code
6
34105917071
import cv2 as cv import numpy as np def diferenca(): captura = cv.VideoCapture(0) while True: ret, frame = captura.read() frame = cv.cvtColor(frame, cv.COLOR_BGR2GRAY) cv.imshow("Video", np.subtract(frame, quarto)) k = cv.waitKey(30) & 0xff if k == 27: br...
gabrielga-dev/visao-computacional-2022
s6/main.py
main.py
py
419
python
en
code
0
github-code
6
23856904095
''' Created by Han Xu email:736946693@qq.com ''' import xml.etree.ElementTree as ET def read_configuration(xml_file): # 解析 XML 文件 tree = ET.parse(xml_file) root = tree.getroot() # 获取camvid数据集路径 camvid_path = root.find('camvid_path').text # 获取模型路径 HANet_oneHAM_path = root.find('HANet_oneH...
UnderTurrets/HeightDriven_DoubleAttentions_Net
conf/__init__.py
__init__.py
py
1,167
python
en
code
1
github-code
6
18991460697
import gzip import shutil import os, sys """ This script compresses text file into gzip """ fpath = '/home/varsha/fl-proj/lingspam_public/lemm_stop/part9' fl_list = os.listdir(fpath) for fl in fl_list: if ".txt.gz" not in fl: print(fl) fop = os.path.join(fpath, fl) print(type(fop)) ...
vaarsha/Spam-Filtering
compressfiles.py
compressfiles.py
py
475
python
en
code
0
github-code
6
22666826531
from torchmetrics import Accuracy, F1Score, Precision, Recall, AUROC class Configs: def __init__(self, dataset="EMG"): # preprocess configs if dataset == "EMG": self.dataset_config = EMGGestureConfig() elif dataset == "NINA": self.dataset_config = NinaproDB5Config()...
3rd-Musketeer/UAF-PyTorch
configs/TSTCC_configs.py
TSTCC_configs.py
py
4,479
python
en
code
0
github-code
6
31236792661
# you can write to stdout for debugging purposes, e.g. # print("this is a debug message") def solution(A): if (len(A)) < 2: return 0 else: MC = 0 MS = 0 for i,x in enumerate(A): DV = (x - A[i-1]) if i > 0 else 0 MC = max(MC+DV,0) MS = max(MS, ...
diegoami/DA_Codility_EX
sum/sum1.py
sum1.py
py
404
python
en
code
0
github-code
6
72532300669
# pylint: disable=redefined-outer-name # pylint: disable=unused-argument import json from pathlib import Path from typing import Any, Iterable from unittest.mock import AsyncMock, call from uuid import UUID, uuid4 import pytest from models_library.projects import NodesDict, ProjectID from models_library.projects_netw...
ITISFoundation/osparc-simcore
services/director-v2/tests/unit/test_modules_project_networks.py
test_modules_project_networks.py
py
7,545
python
en
code
35
github-code
6
73901138108
import pi_servo_hat import time # Function to rescale web interface controls def scale(x, in_min, in_max, out_min, out_max): return (x - in_min)*(out_max - out_min)/(in_max - in_min) + out_min ######################################################################## # Main Function: ##################################...
sparkfun/sparkfun_autonomous_kit
piservohat_web_interface_firmware.py
piservohat_web_interface_firmware.py
py
1,318
python
en
code
5
github-code
6
74535254588
import seaborn as sns from matplotlib import pyplot as plt import tools import numpy as np import pandas as pd def plot_missrate_comp(): processed_row = tools.load_pkl('outputs/feature_explore[ards@origin]/row_missrate.pkl').flatten() processed_col = tools.load_pkl('outputs/feature_explore[ards@origin]/col_mis...
on1262/sepsisdataprocessing
test.py
test.py
py
1,239
python
en
code
2
github-code
6
32661755491
""" A basic CNN model /** * @author Xinping Wang * @email [x.wang3@student.tue.nl] * @create date 2021-09-11 09:32:41 * @modify date 2021-09-11 09:32:41 * @desc [description] */ """ import torch import torch.nn as nn import torch.nn.functional as F import torch.optim as optim import torchvision from torchvision...
CillianWang/ENN
Library/Models/CNN.py
CNN.py
py
1,777
python
en
code
0
github-code
6
9782078918
class Node: def __init__(self, value = None): self.val = value self.next = None #mergesort na seriach naturalnych def Merge(L1,L2): inv=0 if L1 is None: return L2 if L2 is None: return L1 if L1.val>L2.val: L1,L2=L2,L1 inv+=1 head=L1 L1=L1.next ...
wiksat/AlghorithmsAndDataStructures
ASD/Exercises/round1/ddd.py
ddd.py
py
1,553
python
en
code
0
github-code
6
72531899069
# Citations according to https://scicrunch.org/resources """ NOTES: - scicrunch API ONLY recognizes RRIDs from SciCrunch registry of tools (i.e. with prefix "SCR") - scicrunch web search handles ALL RRIDs (see below example of citations from other) - scicrunch API does NOT uses 'RRID:' prefix in rrid r...
ITISFoundation/osparc-simcore
packages/pytest-simcore/src/pytest_simcore/helpers/utils_scrunch_citations.py
utils_scrunch_citations.py
py
2,212
python
en
code
35
github-code
6
5042024536
import tensorflow as tf import numpy as np import os,glob,cv2 import sys,argparse class Predictor(object): def __init__(self, graph_path, model_path): ## Let us restore the saved model sess = tf.Session() # Step-1: Recreate the network graph. At this step only graph is created. save...
roger-cores/hand_gestr_ros
scripts/predict.py
predict.py
py
1,843
python
en
code
1
github-code
6
72096598268
import pygame import random import rospy import math from geometry_msgs.msg import TwistStamped from geometry_msgs.msg import PoseStamped from armf import armtakeoff rospy.init_node('make_a_circle', anonymous=True) current_pos = PoseStamped() def main(): pygame.init() screen = pygame.display.set_mode((640, 4...
DarkcrusherX/indoor_nav
src/transmitter.py
transmitter.py
py
5,866
python
en
code
0
github-code
6
10623839028
import random from discord import Colour """ These are some presets configs, that are predefined and normally dont need any changes (Thats why they are not in the config file """ bottest = True # decides if the bot checks other bots messages ignorfiles = ['image/gif', 'image/jpeg'] # Content types to ignor. Check...
veni-vidi-code/VirusTotalDiscordBot
Cogs/settings.py
settings.py
py
599
python
en
code
3
github-code
6
39348285870
from nose.tools import * import wntr from os.path import abspath, dirname, join testdir = dirname(abspath(__file__)) datadir = join(testdir,'..','..','..','examples','networks') def test_isOpen(): enData = wntr.pyepanet.ENepanet() enData.inpfile = join(datadir,'Net1.inp') assert_equal(0, enData.isOpen())...
stephenfrechette/WNTR-test
wntr/pyepanet/tests/test_epanet2.py
test_epanet2.py
py
734
python
en
code
3
github-code
6
4452602501
import os import sys import mock import unittest import pkg_resources from pybkick.kick import kick, main as kick_main, MissingSourceCode from pybkick.pyboard import Pyboard class TestKick(unittest.TestCase): """Test that we can kick code over to the PyBoard """ def testBasicKick(self): test_d...
salimfadhley/pybkick
src/pybkick_tests/test_kick.py
test_kick.py
py
1,878
python
en
code
5
github-code
6
40333388008
import pytumblr class Tumblr: def __init__( self, consumer_key: str, consumer_secret: str, oauth_token: str, oauth_secret: str, blog_name: str, ): self.client = pytumblr.TumblrRestClient( consumer_key, consumer_secret, oauth_token, oauth_secr...
fabiolab/photobox
fabiotobox/tumblr.py
tumblr.py
py
569
python
en
code
0
github-code
6
36827766673
from layers.domain_layer.repositories import AccountRepository from layers.domain_layer.repositories import TokenRepository from libs.cutoms.singleton import Singleton class AuthSystem(object): __metaclass__ = Singleton def token_to_user_id(self, access_token): account_id = self.token_to_account_user...
siliu3/c-SewpPocket
layers/use_case_layer/systems/auth_system.py
auth_system.py
py
522
python
en
code
0
github-code
6
8214750417
from flask import request from flask_restx import Resource, Namespace, abort from marshmallow import ValidationError from implemented import user_service from tools.jwt_token import JwtSchema, JwtToken from views.users import LoginValidator auth_ns = Namespace('auth') @auth_ns.route('/') class AuthView(Resource): ...
Mariyatm/-lesson19_project_hard_source
views/auth.py
auth.py
py
1,256
python
en
code
0
github-code
6
6323653516
import asyncio from typing import * from urllib.parse import urlencode from datetime import datetime from pprint import pformat as pf import logging logging.basicConfig(format='%(asctime)s %(message)s') import jikanpy from enum import Enum from copy import copy, deepcopy from pprint import pprint import traceback impo...
zp33dy/inu
inu/utils/rest/my_anime_list.py
my_anime_list.py
py
6,129
python
en
code
1
github-code
6
16719892891
import MSGrid import time def printgrid(arr): print(" ",end="") index = len(arr[0]) for x in range(index): print(str(x)+" ", end="") print() index = 0 for i in arr: print(index,end="") index+=1 for j in i: print("|"+str(j), end="") print("|\n") while(1): try: n = int(input("How tall should the ...
lazarchitect/Minesweeper
MSDriver.py
MSDriver.py
py
2,392
python
en
code
0
github-code
6
13523037639
from flask import Flask import os.path app = Flask(__name__) @app.route("/") def hello(): if os.path.exists('/volume/test'): return "Hello from pvc!" return "Hello World!" if __name__ == "__main__": app.run()
prgcont/workshop-OKD
cz/lekce-2/demoapp/app.py
app.py
py
236
python
en
code
1
github-code
6
34382591529
from django.contrib import admin app_name = 'admin' # Register your models here. #当前目录下models from myapp.models import Grades, Students #创建班级的时候同时创建2个学生 class StudentInfo(admin.TabularInline): model = Students extra = 2 @admin.register(Grades) class GradesAdmin(admin.ModelAdmin): inlines = [StudentInfo,] ...
pyslin/project01
myapp/admin.py
admin.py
py
1,071
python
en
code
0
github-code
6
11152523627
from simple.PIL import Image image = Image.open('strawberries.png') for pixel in image: avg = (pixel.red + pixel.green + pixel.blue) / 3 if pixel.red < pixel.blue + 40: pixel.red = avg pixel.green = avg pixel.blue = avg if pixel.red < pixel.green + 40: pixel.red = avg ...
groklearning/simple-packages
examples/PIL/colour_splash.py
colour_splash.py
py
393
python
en
code
0
github-code
6
70263663549
import random import math num_teams = 32 country_list = {"england" : ["English", 4], "france" : ["French", 4], "spain" : ["Spanish", 4], "germany" : ["German", 4], "italy" : ["Italian", 4], "portugal" : ["Portuguese", 3], "russia" : ["Russian", 2], "dutch" : ["Dutch", 1]...
fabriziocominetti/practice
Python/ChampionsLeague_draw-simulator/drawSimulator-ChampionsLeague2.py
drawSimulator-ChampionsLeague2.py
py
2,172
python
en
code
1
github-code
6
25225882706
"""If a number is equal to the sum of its factors, the number is called the perfect number, for example, 6, because 6=1+2+3. Program and print all the perfect numbers within 1000.""" for i in range(1, 1001): s = 0 for j in range(1, i): if i % j == 0: s += j if s == i: print('\...
HawkingLaugh/Data-Processing-Using-Python
Week1/Exerciese/7. Perfect number.py
7. Perfect number.py
py
474
python
en
code
0
github-code
6
41563404071
import socket import threading bind_ip = '0.0.0.0' bind_port = 9999 server = socket.socket(socket.AF_INET, socket.SOCK_STREAM) server.bind((bind_ip,bind_port)) server.listen(5) print("[*] Listening on %s: %d" % (bind_ip,bind_port)) def handle_client(client_socket): #exibe o que o cliente enviar request = ...
jamalghatit/EstudoBlackHatPython
ServidorTCP.py
ServidorTCP.py
py
791
python
en
code
0
github-code
6
33689496961
from string import ascii_lowercase from behave import given, then from toolium.utils.dataset import map_param from common.utils import assert_arrays_equal, payload_to_table_format, replace_param @given("there is {chore_types:d} chore type") @given("there are {chore_types:d} chore types") def step_create_chore_types...
sralloza/chore-management-api
test/steps/aliases/chore_types.py
chore_types.py
py
1,503
python
en
code
0
github-code
6
9582892535
import os from pathlib import Path def get_last_n_files_in_dir(dir_path, n, recurse=False, *args, **kwargs): method_str = "rglob" if recurse else "glob" p = Path(dir_path) fluid_glob = getattr(p, method_str) l = [(i, i.stat().st_mtime) for i in fluid_glob("*.*")] l.sort(key=lambda x: x[0], **kwar...
royassis/djangoRestML
myapi/helpers.py
helpers.py
py
536
python
en
code
0
github-code
6