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
74290457704
import json import yaml def refs_to_dict(filename): data = yaml.load(open(filename), Loader=yaml.CLoader) return {elem['id']: elem['title'] for elem in data.get('references', [])} refs = {elem['id']: elem['title'] for elem in json.load(open('wg21/data/csl.json'))} refs.update(refs_to_dict('md/wg21_fmt.yaml'))...
brevzin/sd6
reduce_refs.py
reduce_refs.py
py
399
python
en
code
2
github-code
36
75088426664
from django.urls import path from . import views urlpatterns = [ path('', views.home, name='home'), # path('', views.TaskListView.as_view(), name='home'), # path('add/', views.TaskCreateView.as_view(), name='add'), path('detail/<int:pk>/', views.TaskDetailView.as_view(), name='detail'), path('del...
alen0577/todo
todo_app/urls.py
urls.py
py
461
python
en
code
0
github-code
36
32057438346
from aiogram.types import Message, ReplyKeyboardRemove from aiogram.dispatcher.filters.builtin import Text from aiogram.dispatcher import FSMContext from states.StateStart import StateStart from loader import dp @dp.message_handler(Text(equals="Mukammal Telegram Bot"),state=StateStart.Kurs) async def MTBKurs(msg: M...
ozodbekernazarov6642/mohirdev.uz_bot
handlers/users/KursBackendHendler.py
KursBackendHendler.py
py
5,008
python
en
code
0
github-code
36
23500397801
""" 题目内容: 请编写Python程序完成以下要求: 以每行5个的形式输出100以内的所有素数。 输入格式: 没有输入 输出格式: 在循环结构中,使用语句print("{:2}".format(num),end="")输出每一个素数,每输出5个素数后输出一个换行 输入样例: 无 输出样例: 2 3 5 7 11 13 17 19 23 29 … """ from math import sqrt, ceil def check(x): if x == 2: return True xx = ceil(sqrt(x)) for i in range(2, xx + 1): if ...
gtn1024/python-course
mooc/s5-2.py
s5-2.py
py
725
python
zh
code
0
github-code
36
313375115
import os BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) DEBUG = True ALLOWED_HOSTS = [] INSTALLED_APPS = [ 'django.contrib.admin', 'django.contrib.auth', 'django.contrib.contenttypes', 'django.contrib.sessions', 'django.contrib.messages', 'django.contrib.staticfiles'...
Yugank16/Demand-Driven-Marketplace-Api
demand_driven_marketplace_api/demand_driven_marketplace_api/settings.py
settings.py
py
3,730
python
en
code
0
github-code
36
26195476426
from typing import List from tensorflow import keras from sklearn.model_selection import train_test_split import librosa import numpy as np from tqdm.notebook import tqdm import os import data_augmentation import random RATE = 8000 def load_recordings(paths=["recordings"], label_type="number", sr=RATE): """ ...
GianCarloMilanese/dsim_project
Audio/data_preparation.py
data_preparation.py
py
18,819
python
en
code
1
github-code
36
21907341977
# funcion que levanta IndexError def oops(): list = [1, 2] print(list[10]) def llamada_a_oops(): try: oops() except IndexError: # si escribo solo except me ataja cualquier tipo de excepcion print("Excepcion salvada") def ejercicio5sub1(): try: oops() except IndexEr...
alvarezfmb/edd-untref
Guias/Practica3/excepciones.py
excepciones.py
py
675
python
es
code
0
github-code
36
29852609530
import collections f = open("movie.txt","r") print("Count number of movies in the file") list_1 = [] for i in f: list_1.append(i.split()) print(len(list_1)) f.close() print("Add a new movie detail (War Amit 180 2019) at the end of file.") f = open("movie.txt","a") f.write("\nWar Amit 180 2019") f.close() print("...
Hardik121020/Pyhton-Code
File Handling/File3.py
File3.py
py
882
python
en
code
0
github-code
36
74865037543
#-*- coding:utf-8 -*- import random import pymongo client = pymongo.MongoClient('112.74.106.159', 27017) db = client.develop #获取useragent池 get_info = db.userAgents.find() USER_AGENTS = [i['userAgent'] for i in get_info] class MyUserAgent(object): def process_request(self, request, spider): request.headers.setdefa...
dreamyteam/py_crawler
movie_spider/movie_spider/User_Agents.py
User_Agents.py
py
378
python
en
code
0
github-code
36
16032279764
#!/usr/bin/python3 import sys import os class Tool: x = 0 def ping(): os.system('ping -c 4 kernel.org') def uname(): os.system('uname -a') if __name__ == "__main__": print('p - ping, u - uname') x = input() if x=='p': Tool.ping() elif x=='u': Tool.uname()
repu1sion/meminfo
tool.py
tool.py
py
280
python
en
code
0
github-code
36
193648592
from asyncio.windows_events import NULL import pygame class Selector: def __init__(self,w,h,x,y): self.width = w self.height = h self.x = x self.y = y self.isSelected = False self.selectedColor = -1 self.selectedTube = NULL def draw(self,surface): coord = [(self.x,self.y), (self.x+s...
Houdeifa/Lquid-tube
Selector.py
Selector.py
py
946
python
en
code
0
github-code
36
15729326581
from pandas import DataFrame from utils.dataset.dataset_info import * class ModelUtils(object): def __init__(self): self._is_debug = False self._dataset_info = None def train(self, dataset_path, model_path, model_names=None): return None def _to_dataframe(self, feat_names, feat_vals): data = {...
SheepHuan/CoDL-Mace
codl-eval-tools/codl-lat-collect-and-eval/utils/model/model_utils.py
model_utils.py
py
1,562
python
en
code
0
github-code
36
11893023589
# -*- coding: utf-8 -*- import pymysql # by huxiajie class MySqlPipeline(object): def __init__(self): self.conn = pymysql.connect( host="localhost", db="jroom", user="root", passwd="123456", charset='utf8' ) self.cursor = self.co...
mohxjmo/jroomCrawl
JRoom/pipelines.py
pipelines.py
py
3,424
python
en
code
0
github-code
36
6642689496
##LC 1275. Find Winner on a Tic Tac Toe Game #Solution class Solution(object): def tictactoe(self, moves): """ :type moves: List[List[int]] :rtype: str """ plate = [[''] * 3 for i in range(3)] plate[1][1] = 'T' for i in range(len(moves)): ...
Caonisandaye/LeetCode
1275.py
1275.py
py
1,111
python
en
code
1
github-code
36
74845408103
import logging from datetime import date from flask.app import Flask def get_logger(name=__name__, level=logging.INFO): """Returns a logger object""" logger = logging.getLogger(name) if not len(logger.handlers): logger.setLevel(level) console = logging.StreamHandler() console.se...
carneirofc/utility-api
application/common/utils.py
utils.py
py
1,104
python
en
code
0
github-code
36
14570130326
from skimage.io import imread, imsave from numpy import clip img = imread('img.png') pixels = [] for row in img: for pixel in row: pixels.append(pixel) pixels.sort() k = round(len(pixels) * 0.05) mn, mx = pixels[k], pixels[-k] img = img.astype('float') img = (img - mn) / (mx - mn) * 255 img = clip(img, ...
vfolunin/stepic-image-processing-course
week2/3. Устойчивый автоконтраст черно-белого изображения.py
3. Устойчивый автоконтраст черно-белого изображения.py
py
382
python
en
code
1
github-code
36
72809322024
from typing import TYPE_CHECKING, Any, Dict, List, Type, TypeVar, Union import attr from ..models.submodel_kind import SubmodelKind from ..types import UNSET, Unset if TYPE_CHECKING: from ..models.administrative_information import AdministrativeInformation from ..models.embedded_data_specification import Emb...
sdm4fzi/aas2openapi
ba-syx-submodel-repository-client/ba_syx_submodel_repository_client/models/submodel.py
submodel.py
py
11,684
python
en
code
7
github-code
36
20003378974
import os import re import requests import logging from telegram.ext import Updater, CommandHandler, MessageHandler, Filters # Enable logging logging.basicConfig(format='%(asctime)s - %(name)s - %(levelname)s - %(message)s', level=logging.INFO) logger = logging.getLogger(__name__) # Declaramos a...
matiasnoriega/bot-telegram-analisis
bot.py
bot.py
py
5,873
python
es
code
0
github-code
36
71846051304
# -*- coding: utf-8 -*- ''' 这段代码将做出函数f(x)=e^2-2在[0,2]之间的图像,并描画出在该曲线下面的近似矩形 ''' import numpy as np import matplotlib.pyplot as plt import matplotlib.patches as patches import math num = 4 x = np.linspace(0,2,1000) y = np.power(np.e,x)-2 fig = plt.figure(figsize=(8,8)) x1 = np.linspace(0,2,num+1) width=2.0/num ax1 = fig...
coolban/somemath
plotf3.py
plotf3.py
py
584
python
en
code
0
github-code
36
30061835039
def solve(n, m, prices): prices.sort() prev = prices[0] count = 0 for i in range(1, n): if prev + prices[i] <= m: count += 1 prev = prices[i] else: break return count + 1 n, m = list(map(int, input().strip().split(' '))) prices = list(map(int, i...
KatarinaLouise/CSALGCM
Hierophant/prize.py
prize.py
py
376
python
en
code
0
github-code
36
2082273383
__all__ = ["familymemberhistory_mapping", "familymemberhistory_references"] familymemberhistory_mapping = { "code": "token", "date": "date", "identifier": "token", "patient": "reference", "instantiates-canonical": "reference", "instantiates-uri": "uri", "relationship": "token", "sex": "...
teffalump/fhir_parse_qs
fhir_parse_qs/mappings/familymemberhistory.py
familymemberhistory.py
py
589
python
en
code
2
github-code
36
41239382060
# coding:utf-8 import sys import os import numpy as np import cv2 import matplotlib.pyplot as plt import torch import torch.nn.functional as F sys.path.append('../synthesize_blur') import viz_flow as viz data_dir = "./" old_path = data_dir + "1.jpeg" new_path = data_dir + "2.jpeg" gap = [0, 100] feature_params = di...
MingmChen/burst-deghost-deblur
code/utils/cal_lk.py
cal_lk.py
py
4,325
python
en
code
0
github-code
36
8087367519
""" This file pretends to check the tables % available after the filter """ import pandas as pd import os def common_member(a, b): a_set = set(a) b_set = set(b) if (a_set & b_set): return a_set & b_set else: print("No common elements") # Read the queries.txt tables tables_q = pd....
aberenguerpas/inferia
extra/coverage.py
coverage.py
py
1,077
python
en
code
0
github-code
36
71899575783
import csv import random import numpy as np from sklearn import preprocessing import matplotlib.pyplot as plt from keras.models import Sequential, Model from keras.layers import Dense, LSTM, TimeDistributed, Conv2D, Flatten from keras.optimizers import Adam import utm max_latitude = 330414.05273900216 max_longitude = ...
haoranpb/datamining
hw3/code/e.py
e.py
py
12,319
python
en
code
0
github-code
36
31428987091
# 2021.10.17 # 2966 # 찍기 a = ['A', 'B', 'C'] b = ['B', 'A', 'B', 'C'] c = ['C', 'C', 'A', 'A', 'B', 'B'] names = ['Adrian', 'Bruno', 'Goran'] results = [0, 0, 0] n = int(input()) ans = input() for i in range(n): if a[i % 3] == ans[i]: results[0] += 1 if b[i % 4] == ans[i]: results[1] += 1 ...
Minkeyyyy/OJ
BaekJoon/All/2966.py
2966.py
py
474
python
en
code
0
github-code
36
15869088221
def convert(str1, str2): list1 = [] list2 = [] for i in range(0,len(str1)-1): list1.append(str1[i:i+2]) for i in range(0,len(str2)-1): list2.append(str2[i:i+2]) list1 = [i.lower() for i in list1 if i.isalpha()] list2 = [i.lower() for i in list2 if i.isalpha()] print(list1, ...
HYEONAH-SONG/Algorithms
프로그래머스/Level2/문제 해결 능력/뉴스 클러스터링.py
뉴스 클러스터링.py
py
1,941
python
en
code
0
github-code
36
23788529078
#Conversion function def convert_bits(value, from_unit): #Dictionary to hold the conversion factors conversion_factors = { "bit": { "kbit": 1/1000, "kibibit": 1/1024, "kByte": 1/8000, "Kibibyte": 1/8192, "Mebibyte": 1/8589934592, "M...
HabibUrRehmanBhattii/Casio-fx-CG50-python
Network/bit_convert_kibit.py
bit_convert_kibit.py
py
1,013
python
en
code
0
github-code
36
34848620005
import os import sys sys.path.append(os.path.dirname(os.path.realpath(__file__))) from definition import Node def create_linked_list(array): """Creates a linked list from a list of items""" head = Node(value=array[0]) current = head if len(array) > 1: for val in array[1:]: next_i...
stonecharioteer/blog
source/code/dsa/linked_lists/python/creation_iterative.py
creation_iterative.py
py
427
python
en
code
5
github-code
36
14345450698
import random def mod(a, m): """ Взятие числа по модулю с бинарным поиском Бинарным поиском находится наибольшее частное от деления a / m, при котором (a - q * m) < m Тогда a - q * m = r (остаток) :param a: Число :type a: int :param m: Модуль :type m: int :return: Число по моду...
artymmmm/RSA_secret_sharing
math_functions.py
math_functions.py
py
5,765
python
ru
code
0
github-code
36
20645490044
from my_socket import * # from myMath import * import inspect import myMath from myMath import * from my_inspect import * import logging def send_functions(): global func_list global server func_info = [] n = 0 for f in func_list: func_info.append(';'.join([f['name'], f['info'], str(n)])) ...
HarryFengYX/Py2GUI
free_op_interface.py
free_op_interface.py
py
7,358
python
en
code
0
github-code
36
5535184380
import sys import os import json import threading BASE_DIR = os.getcwd()+"/.." EOF = "" def setPlatformCfg(env): cfgPath = BASE_DIR+"/stays-platform/config.json" cfg = "" with open(cfgPath) as f: cfg = json.load(f) with open(cfgPath, "w") as f: cfg['env'] = env txt = json.dump...
nickrunner/stays
scripts/deploy.py
deploy.py
py
1,806
python
en
code
0
github-code
36
11226132142
from datetime import timedelta from django.utils import timezone from celery import shared_task from django.contrib.auth.models import User from .models import ReadingStatistics, ReadingSession @shared_task def update_reading_statistics(): # Завдання Celery для оновлення статистики читання користувачів prin...
RomanovDanii1/Books
api/tasks.py
tasks.py
py
2,075
python
uk
code
0
github-code
36
4759735391
import streamlit as st from PIL import Image from detection import process import numpy as np from torchdetect import process import os st.set_page_config( page_title="Image Detection", layout="wide", initial_sidebar_state="expanded" ) st.title('Tuberculosis Detection from sputum sample') st.markdown("## ...
irfanheru66/Tuberculosis-Detector
pages/page_2.py
page_2.py
py
1,882
python
en
code
0
github-code
36
16961930308
import matplotlib.pyplot as plt import matplotlib.animation as animation import numpy as np # input parameter den = 8880.0 cp = 386.0 cond = 398.0 temp_bc = 100.0 temp_init = 0.0 lx = 1.0 nx = 101 tend = 20000.0 dt = 0.1 tout = 100.0 alpha = cond / (den * cp) dx = lx / (nx - 1) nt = int(tend / dt) nout = int(tout / d...
cattech-lab/lecture3_fdm_thermal
thermal_1d_ftcs.py
thermal_1d_ftcs.py
py
1,474
python
en
code
0
github-code
36
22565700808
from abc import ABC, abstractmethod from dataclasses import dataclass from functools import partial from typing import Any, Dict, List, Optional, Tuple import torch from shap_e.models.nn.utils import sample_pmf from shap_e.models.volume import Volume, VolumeRange from shap_e.util.collections import AttrDict from .mo...
openai/shap-e
shap_e/models/nerf/ray.py
ray.py
py
19,663
python
en
code
10,619
github-code
36
6209532245
# -*- coding: utf-8 -*- """ Created on Tue Jan 31 12:39:09 2023 @author: Mouhamad Ali Elamine """ import argparse import json import re parser = argparse.ArgumentParser(description='A1T1') parser.add_argument('--input_file', type=str, default='./review.json', help='the input file ') parser.add_argument(...
elami018/CSCI_5523
HW1/task1.py
task1.py
py
2,746
python
en
code
0
github-code
36
19724867032
""" *************************** --------EveIDE_LIGHT-------- Author: Adancurusul Date: 2021-07-17 18:07:02 LastEditors: Adancurusul LastEditTime: 2021-07-31 14:10:21 Github: https://github.com/Adancurusul Email: adancurusul@gmail.com *************************** """ import re impo...
Adancurusul/EveIDE_LIGHT
source/eve_module/GetSimDumpFile.py
GetSimDumpFile.py
py
1,200
python
en
code
50
github-code
36
16523777795
from django.core import urlresolvers from django.core.mail import send_mail from django.conf import settings from django.contrib.comments.moderation import CommentModerator, moderator from django.contrib.sites.models import Site from akismet import Akismet AKISMET_KEY = getattr(settings, "AKISMET_KEY", None) class...
sunlightlabs/reportingsite
reporting/comments.py
comments.py
py
1,809
python
en
code
0
github-code
36
31058313098
from operator import itemgetter import networkx as nx import prefect from sklearn.metrics import roc_auc_score logger = prefect.context.get("logger") def compute_centrality_metrics(G): closeness_centrality = nx.centrality.closeness_centrality(G) degree_centrality = nx.centrality.degree_centrality(G) bet...
ryankarlos/networks_algos
networks/models/metrics.py
metrics.py
py
1,184
python
en
code
1
github-code
36
4248710550
# Given an m x n integer matrix matrix, if an element is 0, set its entire row and column to 0's, and return the matrix. # Input: matrix = [[1,1,1],[1,0,1],[1,1,1]] # Output: [[1,0,1],[0,0,0],[1,0,1]] def setZeroes(matrix): x, y = [], [] for i in range(len(matrix)): for j in range(len(matrix[i])): ...
keabraekman/leetcode
set-matrix-zeroes.py
set-matrix-zeroes.py
py
1,243
python
en
code
0
github-code
36
49873569
# demonstration of the YCbCr encoder/decoder functionality import numpy as np import cv2 #import matplotlib.pyplot as plt #import matplotlib.image as mpimg K_VALS = [.299, .587, .114] # ITU-R BT.601 #K_VALS = [.2627, .678, .0593] # ITU-R BT.2020 R = 0 G = 1 B = 2 def color_matrix(values): """ Generates a color m...
octinhuh/hdvid21
tests/ycbcr.py
ycbcr.py
py
3,034
python
en
code
0
github-code
36
35899003132
import discord import asyncio from dotenv import load_dotenv from collections import Counter from os import getenv intents = discord.Intents.default() intents.members = True intents.presences = True load_dotenv() TOKEN = getenv('DISCORD_TOKEN') class MyClient(discord.Client): def __init__(self, *args, **kwargs...
mcl650s/DynamicChannelNameBot
DynamicNameBot.py
DynamicNameBot.py
py
2,688
python
en
code
0
github-code
36
43298961794
from rpython.rlib import jit_hooks from rpython.rlib.jit import JitHookInterface, Counters from pypy.interpreter.error import OperationError from pypy.module.pypyjit.interp_resop import (Cache, wrap_greenkey, WrappedOp, W_JitLoopInfo, wrap_oplist) class PyPyJitIface(JitHookInterface): def are_hooks_enabled(s...
mozillazg/pypy
pypy/module/pypyjit/hooks.py
hooks.py
py
3,264
python
en
code
430
github-code
36
3163314445
#!/usr/bin/python import sys, glob from sys import platform if platform == "linux" or platform == "linux2": sys.path.insert(0, glob.glob('/home/yaoliu/src_code/local/lib/lib/python2.7/site-packages/')[0]) from thrift.transport import TSocket from thrift.transport import TTransport from thrift.protocol import TBin...
sonaliw-pointers/distributed-systems
DistributedStore/initReplica.py
initReplica.py
py
10,236
python
en
code
0
github-code
36
9134097621
#!/usr/bin/python import argparse def find_max_profit(prices): max_profit = float("-inf") # start with neg. infinity (account for least worse loss) for p in range(1,len(prices)): profit = prices[p] - min(prices[:p]) if profit > max_profit: max_profit = profit return max_profit ...
Tclack88/Lambda
CS/CS-2-Algorithms/2-algorithms/stock_prices/stock_prices.py
stock_prices.py
py
772
python
en
code
0
github-code
36
37429707287
import rrdtool def graficar(rrdpath,imgpath): print("\n *****************************************") print(" * = Generación de Gráficas = *") print(" *****************************************\n") ultima_lectura = int(rrdtool.last(rrdpath + "CpuLoad1.rrd")) tiempo_final = ultima_lectura ...
ScarlettRaln/Problema2
graficar.py
graficar.py
py
4,729
python
en
code
0
github-code
36
30112331556
import pandas as pd import numpy as np from sklearn.feature_extraction.text import CountVectorizer # constants TRAIN_DATA_FILE_PATH = "Lyrics-Genre-Train.csv" TEST_DATA_FILE_PATH = "Lyrics-Genre-Test-GroundTruth.csv" LYRICS_COLUMN = "Lyrics" GENRE_COLUMN = "Genre" # useful variables output_mappings = {} # Pentru ca...
daneel95/Master_Homework
FirstYear/Regasirea Informatiei/Homework2/main.py
main.py
py
1,806
python
en
code
0
github-code
36
9052754713
"""Support for the Mastertherm Sensors.""" from decimal import Decimal from datetime import date, datetime import logging from homeassistant.core import HomeAssistant from homeassistant.components.sensor import SensorEntity, SensorDeviceClass from homeassistant.config_entries import ConfigEntry from homeassistant.cons...
sHedC/homeassistant-mastertherm
custom_components/mastertherm/sensor.py
sensor.py
py
2,980
python
en
code
3
github-code
36
35095640017
from django.shortcuts import render from .models import cities, city from django.http import Http404 from datetime import datetime import pytz import folium now = datetime.now(pytz.timezone('Europe/Warsaw')).strftime("%H") def weather_view(request, *args, **kwargs): cities_ = cities.objects.all() city_ = city...
Kapiura/weather.is
src/cities/views.py
views.py
py
2,002
python
en
code
0
github-code
36
29111113556
# 프랙탈 [fractal] : 일부 작은 조각이 전체와 비슷한 형태 # 나무줄기 , 번개 , 나뭇잎 def drawCircle( x , y , r ) : global count count += 1 # 카운트 1증가 # 원형 그리기 [ create_oval : 원형 그리기 함수 ] canvas.create_oval( x - r, y - r, x + r, y + r, width=5, outline='black') # 원형 # 왼쪽끝x , 위쪽끝y 오른쪽x , 아래끝y # canvas.c...
itdanja/week_python_202206
5일차/예제4_재귀활용.py
예제4_재귀활용.py
py
1,210
python
ko
code
0
github-code
36
3458574227
#题解见notion class Solution: def minDistance(self, word1: str, word2: str) -> int: if not word1: return len(word2) if not word2: return len(word1) m,n = len(word1), len(word2) f = [[0]*(n+1) for i in range(m+1) ] for i in range(m+1): f[i][0] = i ...
pi408637535/Algorithm
com/study/algorithm/daily/72. Edit Distance.py
72. Edit Distance.py
py
777
python
en
code
1
github-code
36
71237520105
class BinarySearchTreeNode: left = None right = None def __init__(self, value): self.value = value def __repr__(self): return f"{self.__class__.__name__}({self.value})" def __str__(self): return str(self.value) class BinarySearchTree: def __init__(self, root): ...
garibaldiviolin/python-trees
src/trees/binary_search_trees.py
binary_search_trees.py
py
4,680
python
en
code
0
github-code
36
11936612348
from typing import Optional, TYPE_CHECKING from django.db import models from django.contrib.auth.models import Group, User from rest_framework import serializers from rest_framework.exceptions import NotFound from processes.exception import UnprocessableEntity from .uuid_model import UuidModel if TYPE_CHECKING: ...
CloudReactor/task_manager
server/processes/models/named_with_uuid_model.py
named_with_uuid_model.py
py
2,749
python
en
code
0
github-code
36
22292402033
# 동빈나 그리디 모험가 길드 # 공포도가 x 인 모험가는 x명 이상의 그룹에 들어가야한다. -> 최대 몇 그룹 # 1. 정렬 후 끊기 # 입력 예제 # 5 # 2 3 2 2 1 답 2 n=int(input()) arr=list(map(int,input().split())) arr.sort() team=0 count=0 for i in arr: count+=1 if count>=i: team+=1 count=0 print(team)
98hyun/algorithm
greedy/b_14.py
b_14.py
py
367
python
ko
code
0
github-code
36
19169680561
from setuptools import setup with open('requirements.txt') as fp: install_requires = fp.read() setup( name='mapped_config', packages=['mapped_config'], version='2.36', description='Mapped config loader for python for secure, easy and modular configuration management', author='Alvaro Garcia Gom...
maxpowel/mapped_config
setup.py
setup.py
py
738
python
en
code
3
github-code
36
20474535065
import torch import torch.nn as nn import numpy as np from dataset_windows import SatelliteSet, flatten_batch_data, standardize_data from torchvision.models.segmentation.deeplabv3 import DeepLabHead from torchvision import models import torch.nn.functional as F from tqdm import tqdm import h5py from PIL import Image i...
jingyan-li/Vege_Height_Regression
feature_extraction/DeepLabv3_ResNet101.py
DeepLabv3_ResNet101.py
py
8,660
python
en
code
0
github-code
36
74394357543
import numpy as np from DigitalFilter import Filter import cv2 from Utilities import show_image class Sharpening(Filter): __kernel = None def __init__(self): size = 3 self.set_height(size) self.set_width(size) self.make_kernel() def make_kernel(self): self.__kernel...
Izio91/DigitalFilters
SharpeningFilter.py
SharpeningFilter.py
py
2,905
python
en
code
0
github-code
36
5223935084
from env import * # import os import re import sys import argparse from os.path import join from tools import * import logging from core.api import set_api_logger from core.chat import ChatBot, Turn, set_chat_logger import gradio as gr from prompts.dialogue import * args: argparse.Namespace = None bot: ChatBot = None ...
wbbeyourself/SCM4LLMs
dialogue_test.py
dialogue_test.py
py
11,654
python
en
code
20
github-code
36
26729745489
""" with open("Day25_csv_pandas/weather_data.csv") as data_file: data = data_file.readlines() """ """ import csv with open('Day25_csv_pandas/weather_data.csv') as data_file: data = csv.reader(data_file) temperatures = [] for row in data: if row[1] != "temp": temperatures.append(int...
MarchisLost/100DaysOfPython
Day25_Csv_pandas/weather.py
weather.py
py
1,010
python
en
code
0
github-code
36
7775088104
from django.shortcuts import render from operator import attrgetter # Para a paginação from django.core.paginator import Paginator, PageNotAnInteger, EmptyPage, InvalidPage # Importamos a função criada anteriormente from post.views import get_post_queryset POSTS_PER_PAGE = 2 # Pode ser qualquer valor acima de 0, co...
imklesley/SimpleBlog_Site_API
personal/views.py
views.py
py
1,994
python
pt
code
0
github-code
36
14231636802
#!/usr/bin/env python3 import sys import mrcfile args = sys.argv from IsoNet.util.filter import maxmask,stdmask import numpy as np #import cupy as cp import os def make_mask_dir(tomo_dir,mask_dir,side = 8, density_percentage=30,std_percentage=1,surface=None): tomo_list = ["{}/{}".format(tomo_dir,f) for f in os.li...
IsoNet-cryoET/IsoNet
bin/make_mask.py
make_mask.py
py
3,191
python
en
code
49
github-code
36
13292259369
from statistics import mode from sklearn.feature_extraction import image import torch import torch.nn as nn import numpy as np import matplotlib.pyplot as plt import os import random import pandas as pd from utils.Metric import compute_meandice_multilabel from utils.Visualize import plot_whole_imgs from utils.Utils im...
SWKoreaBME/brats2020
UNet_transformer/remove_input.py
remove_input.py
py
6,135
python
en
code
1
github-code
36
33408291882
from selenium import webdriver import time from selenium.webdriver.common.by import By class clickSendkey(): def test(self): driver = webdriver.Firefox(executable_path='/Users/Jatin Singh/Downloads/geckodriver') driver.get('https://google.com/') driver.maximize_window() texttype =...
JatinSsingh/SeleniumPython
pythonProject/webelement.py
webelement.py
py
648
python
en
code
0
github-code
36
15593721054
import copy import math import numpy as np import random as rd from typing import List class Layer: def __init__(self, size: int, next_size: int): self.size = size self.neurons = np.zeros((size,)) self.biases = np.zeros((size,)) self.weights = np.zeros((size, next_size)) class Po...
vbalabin/mp_practical
pscripts/neural.py
neural.py
py
3,323
python
en
code
0
github-code
36
39445267791
# -*- coding: utf-8 -*- # """ Utility functions related to input/output. """ from __future__ import absolute_import from __future__ import print_function from __future__ import division from __future__ import unicode_literals from io import open # pylint: disable=redefined-builtin import os #import logging import imp...
VegB/Text_Infilling
texar/utils/utils_io.py
utils_io.py
py
6,380
python
en
code
26
github-code
36
15795610866
import tensorflow as tf def single_accuracy(y_true: dict, y_pred: list) -> dict: """Compute Team, Position and Mask metrics for a batch of single sequence: - binary accuracy for Team prediction - categorical accuracy for Position classification - topk accuracy 3 for Position classification ...
samchaineau/StratFormer
code/pretraining/models/metrics.py
metrics.py
py
3,081
python
en
code
7
github-code
36
16643813667
from Imports import * from Exercice2 import code_communs # 1. Fixer comme indice la variable de code commune dans les deux bases. Regarder le # changement que cela induit sur le display du DataFrame df_code_communs = df[df["INSEE commune"].isin(code_communs)] df_city_code_communs = df_city[df_city["CODGEO"].isin(code_...
Steve-t93/TP_Python_Pandas_SQL
TP_Pratique_Pandas/Exercice3.py
Exercice3.py
py
1,739
python
fr
code
0
github-code
36
14359223498
from datasets import load_conll2003_en from conll_dictorizer import CoNLLDictorizer from dictionizer import dictionize from sklearn.feature_extraction import DictVectorizer from keras.preprocessing.sequence import pad_sequences from keras import models, layers from keras.utils import to_categorical from keras.layers i...
niklashedstrom/EDAN95
lab4/index_builder.py
index_builder.py
py
5,607
python
en
code
0
github-code
36
32476914350
import sys import csv import sqlite3 # creates db if one does not exist # conn = sqlite3.connect('some.db') class CSVTool(object): def __init__(self, path=None): self.path = None self.csv_name = None self.db = None def dump_to_db(self, csv_path): # store connection...
cmhedrick/GalenDBTool
csvToDB.py
csvToDB.py
py
1,047
python
en
code
0
github-code
36
23877871959
import math # Write a program that calculates and prints the value according to the given formula: # Q = Square root of [(2 * C * D)/H] # Following are the fixed values of C and H: # C is 50. H is 30. # D is the variable whose values should be input to your program in a comma-separated sequence. q = [] C = 50 H = 30 D...
olayemii/python-beginner-solutions
Q6.py
Q6.py
py
488
python
en
code
0
github-code
36
75171241702
from setuptools import setup, find_packages import sys, os here = os.path.abspath(os.path.dirname(__file__)) README = open(os.path.join(here, 'README.rst')).read() NEWS = open(os.path.join(here, 'NEWS.txt')).read() version = '0.1' install_requires = [ # List your project dependencies here. # For more detail...
yufongpeng/starplot
setup.py
setup.py
py
1,336
python
en
code
0
github-code
36
23836096348
# 1. Реализовать скрипт, в котором должна быть предусмотрена функция расчёта заработной платы сотрудника. # Используйте в нём формулу: (выработка в часах*ставка в час) + премия. Во время выполнения расчёта для конкретных # значений необходимо запускать скрипт с параметрами. from sys import argv script_name, work_...
AndrewSus/Python_Study-I
lesson-04.py
lesson-04.py
py
7,609
python
ru
code
0
github-code
36
42774121207
from asyncio.locks import Lock from typing import Union import markovify import asyncio class InitializationError(Exception): """Error thrown when the model is not initialized""" pass class MarkovHandler: """ Manages the state of the internal markov model """ def __init__(self): se...
anmolw/markov-generator-service
markovhandler.py
markovhandler.py
py
1,669
python
en
code
0
github-code
36
8755767955
from odoo import models, api from odoo.osv.orm import browse_record class ReportDynamicLabel(models.AbstractModel): _name = 'report.of_label.report_label' @api.multi def get_data(self, row, columns, ids, model, number_of_copy): active_model_obj = self.env[model] label_print_obj = self.env...
odof/openfire
of_label/report/dynamic_label.py
dynamic_label.py
py
6,564
python
en
code
3
github-code
36
17793979591
a = list(map(int, input().split())) i5 = 0 i7 = 0 for i in a: if i == 5: i5 += 1 if i == 7: i7 += 1 if i5==2 and i7==1: print('YES') else: print('NO')
fastso/learning-python
atcoder/contest/solved/abc042_a.py
abc042_a.py
py
185
python
en
code
0
github-code
36
71575293223
#-*- encoding:utf-8 -*- #written by: Jiao Zhongxiao import os import shutil import xml.etree.ElementTree as ET import io import binascii import sys from threading import Thread from ftplib import FTP #import subprocess os.chdir( os.path.split( sys.argv[0] )[0] ) #config------------------------------------------------...
edwardandy/kylinProject
KylinGame/py/towerPublishTool.py
towerPublishTool.py
py
8,123
python
en
code
0
github-code
36
74612417065
import os def getAllDirDeep(path):#深度遍历 stack=[] #建立一个栈 stack.append(path) #将第一个目录进行压栈 #处理栈,当栈为空的时候结束循环 while len(stack) != 0: # 从栈里取出数据 dirpath = stack.pop() # 目录下所有文件 fileList=os.listdir(dirpath) # 处理一个文件,如果是普通文件则打印出来,如果是目录文件就将该目录的地址压栈 for fileN...
hanyb-sudo/hanyb
基本语法/目录遍历/栈模拟递归遍历目录(深度遍历).py
栈模拟递归遍历目录(深度遍历).py
py
957
python
zh
code
0
github-code
36
29317996143
from os.path import isfile, join, isdir import numpy as np import matplotlib.pyplot as plt ##input: heatmap ##output: ##heatmap+boundingbox->scored box->threshold&IOU/I->(ifframe,tp,#detected,#proposal,num_ca) gaze_dir_prefix = '/home/yixin/Dropbox/JointAttention/tested_face_direction/test/' prop_path = '/media/yixin...
LifengFan/Shared-Attention
src/roc_metric.py
roc_metric.py
py
5,550
python
en
code
4
github-code
36
23426672809
def power(base,exp): if(exp==1): return(base) if(exp==0): return(1) if(exp>1): return(base*power(base,exp-1)) fivePowerThree = power(5,3) print(fivePowerThree) #--------------------------------------------- myList = [-4, -6, -5, -1, 2, 3, 7, 9, 88] def positive(lst): ...
NaifAlqahtani/100_DaysOfCode
100 days of python/Day39-40.py
Day39-40.py
py
418
python
en
code
0
github-code
36
42298647568
class Computer: def __init__(self):#hm kisi b method ko object k sath call kre skrty han self.name="Ibrar" self.age=23 def update(self): self.age=993 def compare(self,c2): #yahan pe jo self ha wo c1 a rha ha if self.age==c2.age: return True else...
IbrarShakoor/Python-codes
Constructor and self.py
Constructor and self.py
py
721
python
en
code
1
github-code
36
21048917252
from app import mysql class PersonasDB(): def __init__(self): car = True def buscaPersona(self,cc): try: self.lisper =[] _conn = mysql.connect() _cur = _conn.cursor() _cur.execute('''SELECT ccPersona,nombres,apellidos,direccion,cel,barrio.no...
Havir01/flaskapi
app/modelos/dbpersonas.py
dbpersonas.py
py
2,966
python
es
code
0
github-code
36
1794733837
from flask import Flask, request from flask import jsonify app = Flask(__name__) @app.route('/', methods=['GET','POST']) def hello(): tipo_de_peticion = request.method json_de_entrada = request.get_json() print(tipo_de_peticion) print(json_de_entrada) json_de_respuesta = { "text": "Hola Mu...
JoseAngelChepo/curso-chatbot
app.py
app.py
py
932
python
es
code
0
github-code
36
31804320199
# /usr/bin/python3.6 # -*- coding:utf-8 -*- import collections class TreeNode(object): def __init__(self, x): self.val = x self.left = None self.right = None class Solution(object): def isCompleteTree(self, root): """ :type root: TreeNode :rtype: bool ...
bobcaoge/my-code
python/leetcode/958_Check_Completeness_of_a_Binary_Tree.py
958_Check_Completeness_of_a_Binary_Tree.py
py
852
python
en
code
0
github-code
36
70008668583
#!/bin/python3 import sys def jumpingOnClouds(c): c.insert(n,0) i = 0 count = 0 while i < n-1: i += (c[i+2] == 0) + 1 count += 1 return count if __name__ == "__main__": n = int(input().strip()) c = list(map(int, input().strip().split(' '))) result =...
jediofgever/HackerRank_Solutions_Python
Jumping_on_the_Clouds.py
Jumping_on_the_Clouds.py
py
358
python
en
code
1
github-code
36
8738194119
import random import numpy as np import pandas as pd from tqdm import tqdm from os import mkdir from os.path import join, exists from pytorch_transformers import RobertaTokenizer max_length = 100 tokenizer = RobertaTokenizer.from_pretrained('roberta-base') SOS_ID = tokenizer.encode('<s>')[0] EOS_ID = tokenizer.encode(...
yehchunhung/EPIMEED
datasets/encode_os_yubo.py
encode_os_yubo.py
py
6,874
python
en
code
3
github-code
36
33083409726
# Desafios 94 pessoa = {} lista = [] soma = 0 while True: pessoa.clear() pessoa['nome'] = input('Nome: ') sexo = ' ' while sexo not in 'FM': sexo = input('Sexo [F/M]: ').upper().strip()[0] pessoa['sexo'] = sexo pessoa['idade'] = int(input('Idade: ')) soma += pessoa['idade'] ...
sarandrade/Python-Courses
Curso Python - Gustavo Guanabara/Mundo 3 - Estruturas Compostas/Exercícios/Exercício #094.py
Exercício #094.py
py
1,006
python
pt
code
0
github-code
36
37656686792
import sqlite3 def create_table(): conn = sqlite3.connect('avinogradov.db') c = conn.cursor() c.execute('CREATE TABLE IF NOT EXISTS avinogradov(nimi TEXT, vanus INTEGER)') conn.commit() conn.close() def auto_lisamine(): name = input("Sisesta nimi: ") surname = input("Sisesta...
ArtjomVinogradov/sqlite3
sqlite3-main/sqlite3-main/sqlite-dll-win64-x64-3410200-20230508T093537Z-001/sqlite-dll-win64-x64-3410200/sqlite-tools-win32-x86-3410200/h3.py
h3.py
py
3,324
python
en
code
0
github-code
36
15255951210
from celery import Celery import mysql.connector import pandas as pd from celery import shared_task from snippets.models import SnippetHistory from testproject.settings import DB_CONFIG from datetime import datetime app = Celery('tasks', broker='redis://localhost') @app.task def add(x, y): return x + y @shared_t...
crazy-djactor/amazon_for_test
snippets/tasks.py
tasks.py
py
1,664
python
en
code
0
github-code
36
42493287966
class Node: def __init__(self,data): self.__data=data self.__next=None def get_data(self): return self.__data def set_data(self,data): self.__data=data def get_next(self): return self.__next def set_next(self,next_node): self.__next...
mugsss/Data-structures-with-Python
Delete_node.py
Delete_node.py
py
3,454
python
en
code
0
github-code
36
73580285223
class Employee: def __init__(self, emp_id, name, age, salary): self.emp_id = emp_id self.name = name self.age = age self.salary = salary def __str__(self): return f"{self.emp_id} {self.name} {self.age} {self.salary}" def sort_employees(employees, key): if key == 1:...
Maulikkkk/lab_04_Monday.pdf
emplyee.py
emplyee.py
py
1,377
python
en
code
0
github-code
36
28924145111
from typing import List class Solution: def maxProfit(self, prices: List[int]) -> int: profit = 0 maximum = -1e9 minimum = 1e9 for price in prices: #Change maximum or minimum. if price>=maximum : maximum = price if price<=minimum : minimu...
GuSangmo/BOJ_practice
Leetcode/121.bestTimetoBuyandSellStock.py
121.bestTimetoBuyandSellStock.py
py
544
python
en
code
0
github-code
36
25469063444
# -*- coding: utf-8 -*- """ Created on Thu Oct 4 18:04:51 2018 @author: 우람 """ # Example 1: Multi-class classification # # Classify stocks into deciles on their returns # Features: past 3, 6, 12 month returns # y: class label (0, ..., 9) based on the future 1 month return. import numpy as np import pandas as pd ...
KWOOR/Python-Algorithm
exercise1.py
exercise1.py
py
4,384
python
en
code
0
github-code
36
71088718504
from django.urls import path from . import views urlpatterns = [ path('user/', views.UserAPI.as_view()), path('login/', views.KakaoLogin.as_view()), path('kakaopay/', views.kakaopay), path('kakaopay/approval/', views.kakaopay_approval), path('kakaopay/info/', views.kakaopay_info), path('kakaopa...
epser93/Narang_Norang
backend/accounts/urls.py
urls.py
py
413
python
en
code
0
github-code
36
347715655
from scipy.sparse.linalg import eigs, eigsh import utils.utils as utils import sys import numpy as np import time import math from sklearn import mixture sys.path.append("..") from utils.laplacian import calLaplacianMatrix from sklearn.cluster import KMeans def run_ES_SCOREplus(W, k, c=0.1): star...
yz24/RBF-SCORE
rbf-score/ES_SCOREplus.py
ES_SCOREplus.py
py
1,894
python
en
code
0
github-code
36
40095793121
from django.urls import path from . import views urlpatterns = [ path('', views.TmListView.as_view(), name='home'), path('table/', views.TableListView.as_view(), name='table'), path('profile/', views.EmpCreateView.as_view(), name='profile'), path('table/employe/<int:pk>/update', views.EmpUpdView.as_vi...
kostik2295/Django_Web-site
employees/urls.py
urls.py
py
429
python
en
code
0
github-code
36
13988662708
# count-sort based soln, based on another's port seen in phorum (mine used # regular sorts) from math import inf class Solution: def relativeSortArray(self, arr1: List[int], arr2: List[int]) -> List[int]: n = 1001 cnt1 = [0] * n in_arr2 = [False] * n max_x = -inf ans = [] ...
dariomx/topcoder-srm
leetcode/trd-pass/easy/relative-sort-array/relative-sort-array-cntsort.py
relative-sort-array-cntsort.py
py
607
python
en
code
0
github-code
36
4827725138
#!/usr/bin/env python3 from pynput import keyboard from pynput.keyboard import Key, Controller import pyperclip import sys f='' usekey='' autoenter=False def on_press(key): global usekey if key == Key.esc: f.close() return False # stop listener if usekey=='': usekey=key p...
boba2fett/ShitCollection
python/insFiles/insFilesCLI.py
insFilesCLI.py
py
1,670
python
en
code
0
github-code
36
41227989911
import numpy as np from queue import PriorityQueue import time import os class Graph(): def __init__(self, tam): self.dist = np.zeros(shape=(tam)) for i in range(tam): self.dist[i] = int(1e18) self.graph = list() for _ in range(tam): self.graph.append(list()...
projeto-de-algoritmos/Grafos2_MyDij
MyDij.py
MyDij.py
py
2,188
python
pt
code
1
github-code
36
29101112137
import numpy from scipy import stats speed = [99, 86, 87, 88, 111, 86, 103, 87, 94, 78, 77, 85, 86] ages = [5, 31, 43, 48, 50, 41, 7, 11, 15, 39, 80, 82, 32, 2, 8, 6, 25, 36, 27, 61, 31] mean = numpy.mean(speed) median = numpy.median(speed) mode = stats.mode(speed) std = numpy.std(speed) var = numpy.var(spe...
maxyvisser/Python-projects
ML/ML intro.py
ML intro.py
py
452
python
en
code
0
github-code
36
24925094334
import sys import itertools import copy input = sys.stdin.readline n = int(input()) A = list(map(int, input().strip().split())) b = list(map(int, input().strip().split())) B = [] for i in range(4): for j in range(b[i]): B.append(i) B = list(itertools.permutations(B, n-1)) result = [] for i in range(len(B...
pla2n/python_practice
python/backjoon/14888_연산자 끼워넣기.py
14888_연산자 끼워넣기.py
py
685
python
en
code
0
github-code
36