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
43574733165
import os import unittest import re from unittest import mock import tempfile with mock.patch('cffi.FFI.dlopen', return_value=mock.MagicMock()): from geopmdpy.system_files import ActiveSessions, AccessLists, WriteLock # Patch dlopen to allow the tests to run when there is no build with mock.patch('cffi.FFI.dlopen'...
geopm/geopm
service/geopmdpy_test/TestPlatformService.py
TestPlatformService.py
py
21,394
python
en
code
79
github-code
6
72474001787
import random import numpy as np from math import sqrt, log import matplotlib.pyplot as plt from mpl_toolkits.mplot3d import Axes3D x1_list = [] x2_list = [] y_list = [] counter = 0 def drawFunc(minX, minY, maxX, maxY): fig, ax = plt.subplots(subplot_kw={"projection": "3d"}) ax.set_xlabel('x1') ax.set_yla...
AlexSmirno/Learning
6 Семестр/Оптимизация/Lab_6_test.py
Lab_6_test.py
py
7,638
python
en
code
0
github-code
6
20538374789
# https://leetcode.com/problems/counting-bits/ """ Time complexity:- O(N) Space Complexity:- O(N) """ from typing import List class Solution: def countBits(self, n: int) -> List[int]: # Initialize a list 'dp' to store the number of 1 bits for each integer from 0 to 'n'. dp = [0] * (n + 1) ...
Amit258012/100daysofcode
Day51/counting_bits.py
counting_bits.py
py
800
python
en
code
0
github-code
6
40889171603
# coding:utf-8 import os APP_NAME = "torweb" # Server PORT = 9000 DEBUG = True # log file log_path = '/var/tmp/' # cache sys_status = [0, 0, 0, 0] # Tornado COOKIE_SECRET = "6aOO5ZC55LiN5pWj6ZW/5oGo77yM6Iqx5p+T5LiN6YCP5Lmh5oSB44CC" TEMPLATE_PATH = 'frontend/templates' LOGIN_URL = '/login' avatar_upload_path = './f...
jmpews/torweb
settings/common.py
common.py
py
906
python
en
code
9
github-code
6
33146835188
from flask import Flask, jsonify, redirect, url_for, request import os import pymysql app = Flask(__name__) @app.route('/') def index(): response = jsonify({"Choo Choo": "Welcome to your Flask app 🚅"}) response.headers.add("Access-Control-Allow-Origin", "*") return response @app.route('/add', method...
zpdunlap/flask
main.py
main.py
py
2,425
python
en
code
0
github-code
6
73662491386
from multiprocessing import Pool import time from datetime import datetime from typing import Any from tqdm import tqdm from tqdm.contrib.concurrent import process_map import itertools from classifiers import project_algorithms from data_ingestion import ingestion_functions from sklearn.model_selection import KFold, G...
lukebrb/final_project
runners.py
runners.py
py
3,580
python
en
code
0
github-code
6
41766646913
import string s = input().split() n = int(s[0]) k = int(s[1]) s = input() min_occ = n found_all = True for i in range(k): cnt = s.count(string.ascii_uppercase[i]) if cnt == 0: found_all = False break if cnt < min_occ: min_occ = cnt if not found_all: print(0) e...
gautambp/codeforces
1038-A/1038-A-47886872.py
1038-A-47886872.py
py
348
python
en
code
0
github-code
6
19317356930
# This is a sample Python script. import random # Press Shift+F10 to execute it or replace it with your code. # Press Double Shift to search everywhere for classes, files, tool windows, actions, and settings. def load_data(file_path): data_list = [] labels_list = [] with open(file_path, 'r') as f: ...
DC060/Perceptron
main.py
main.py
py
3,122
python
en
code
0
github-code
6
39830820754
from src.exceptions import InvalidCommand class Load: """ **Load: Carrega o comando previamente salvo** - Line 1: !load - Line 2: <label> **Resultado: Comando !graph** """ def __init__(self, message_content): try: self.query, self.label = message_content.split("\n") ...
pedrohrf/geralda-bot
src/commands/load.py
load.py
py
477
python
en
code
0
github-code
6
71818859709
import sys import numpy as np import pickle Vectors = {} for line in sys.stdin: thisLine = line.split() thisVector = np.array(map(lambda x: float(x), thisLine[1:])) thisVector/=np.linalg.norm(thisVector) Vectors[thisLine[0]] = thisVector pickle.dump(Vectors, sys.stdout)
NehaNayak/shiny-octo-lana
scripts/numpyizeVectors.py
numpyizeVectors.py
py
278
python
en
code
0
github-code
6
72490450747
from polygon import * import math from functools import wraps,lru_cache from collections import namedtuple @validate_type(int) @validate_params class Polygon_sequence: def __init__(self,n,circumradius): """ This function initializes the number of polygons and circum radius. """ self.n = n ...
m-shilpa/EPAI
Session_10_Sequence_Types/polygon_sequence.py
polygon_sequence.py
py
2,781
python
en
code
0
github-code
6
71477051708
import sys input = sys.stdin.readline tc = int(input()) INF = int(1e9) def bellman_ford(start): distance = [INF] * (n+1) distance[start] = 0 for i in range(n): for edge in edges: current = edge[0] next = edge[1] cost = edge[2] if distance[next] >...
YOONJAHYUN/Python
BOJ/1865.py
1865.py
py
1,136
python
ko
code
2
github-code
6
27673839201
# -*- coding: utf-8 -*- # Define your item pipelines here # # Don't forget to add your pipeline to the ITEM_PIPELINES setting # See: http://doc.scrapy.org/en/latest/topics/item-pipeline.html import html2text class Html2TextPipeline(object): def process_item(self, item, spider): for f in ('description_md'...
redapple/pyvideo-contrib
pyconfr2015/pyconfr2015/pyconfr2015/pipelines.py
pipelines.py
py
459
python
en
code
0
github-code
6
24021214626
""" Allows for platform-specific configuration options. """ import os from enum import Enum from typing import Any, Dict class BaseOrigin(Enum): """ Enum for the origin of the base path """ ENV = 1 """The base path is specified in the environment""" CONF = 2 """The base path is specified ...
MattMoony/d4v1d
d4v1d/config/platforms.py
platforms.py
py
3,549
python
en
code
34
github-code
6
72013262909
import gym from memory import ReplayBuff from models import Network import numpy as np import torch import torch.nn as nn import torch.nn.functional as F from torch.nn.utils import clip_grad_norm_ class agent(): '''DQN Agent. Attribute: memory: replay buffer to store transition batch_si...
linnaeushuang/RL-pytorch
value-based/distributionalDQN/distributionalDQN_learner.py
distributionalDQN_learner.py
py
9,928
python
en
code
8
github-code
6
39131054965
import os import base64 from pathlib import Path from sys import stdout from Get_data import get_keys from encrypt_setting import * class colors: def __init__(self): self.blue = "\033[94m" self.red = "\033[91m" self.end = "\033[0m" self.green = "\033[92m" col = colors() def print_hacked(): prin...
realsung/Ransomeware
encrypt.py
encrypt.py
py
2,052
python
en
code
2
github-code
6
33644608975
from django.shortcuts import render, redirect, get_object_or_404 from .models import Product, Category, Cart, Address, Order from django.contrib.auth.decorators import login_required from django.http import HttpResponseRedirect import decimal from django.contrib.auth.models import User from django.contrib import messag...
digital-era-108/Ecommerce-django
storeApp/views.py
views.py
py
7,779
python
en
code
0
github-code
6
31280749903
import numpy as np, glob, face_recognition, ntpath, pickle, os from os.path import basename from shutil import copyfile def copy_face_image(): for i in glob.glob("data/avatars/*.jpg"): image = face_recognition.load_image_file(i) face_locations = face_recognition.face_locations(image) ...
chechiachang/scouter
face_recognition/encoding_file_generator.py
encoding_file_generator.py
py
1,509
python
en
code
13
github-code
6
35474166745
from collections import defaultdict from warhound import util class PlayerRoundStats: __slots__ = ('raw') def __init__(self): self.raw = None class RoundSummary: __slots__ = ('raw', 'list_dict_player_round_stats_by_player_id', 'dict_player_round_stats_by_player_id') def...
odeumgg/warhound
warhound/outcome.py
outcome.py
py
2,834
python
en
code
1
github-code
6
25272911980
T = int(input()) for _ in range(T): L = list(map(int, input().split())) a = L[0] b = L[1] % 4 if L[1] % 4 != 0 else 4 test = pow(a, b) if test % 10 == 0: print(10) else: print(test % 10)
powerticket/algorithm
Baekjoon/B3_1009_solved.py
B3_1009_solved.py
py
226
python
en
code
0
github-code
6
8316768665
from brownie import FundMe from scripts.helpful_scripts import get_account def fund(): # Set variable fund_me to the latest deployment of the FundMe contract fund_me = FundMe[-1] account = get_account() entrance_fee = fund_me.getEntranceFee() print(entrance_fee) print(f"The current entry fee i...
AgenP/brownie_fund_me
scripts/fund_and_withdraw.py
fund_and_withdraw.py
py
618
python
en
code
0
github-code
6
27535979388
import os import matplotlib.pyplot as plt def get_project_path(project_name): """ :param project_name: 项目名称,如pythonProject :return: ******/project_name """ # 获取当前所在文件的路径 cur_path = os.path.abspath(os.path.dirname(__file__)) # 获取根目录 return cur_path[:cur_path.find(project_name)] + proj...
fym1057726877/Defense
utils.py
utils.py
py
1,115
python
en
code
0
github-code
6
40243178863
import cv2 from snooker_table import find_snooker_table from balls import find_balls from holes import find_holes # Videó feldolgozás def process_video(input_path, output_path): # Open the video file video_capture = cv2.VideoCapture(input_path) # Get video properties frame_width = int(video_capture.g...
hirschabel/SZTE-snooker
snooker/process.py
process.py
py
8,137
python
en
code
0
github-code
6
25294948506
from django.shortcuts import render, redirect, get_object_or_404 from django.http import HttpResponse from .forms import * from .models import * import psycopg2 from mysite.settings import DATABASES from psycopg2.extras import RealDictCursor def db_answer(query): try: connection = psycopg2.connect( ...
Fastsnai1/Employee_log
mysite/employees/views.py
views.py
py
6,205
python
en
code
0
github-code
6
17034068791
import logging, os, json from rest_framework.response import Response from rest_framework.decorators import api_view from rest_framework import status from app.worker.tasks import recommend_options_exe logger = logging.getLogger(__name__) @api_view(['GET']) def get_recommend_options(request, format=None): key = o...
dearvn/tdameritrade-bot
app/api/views.py
views.py
py
816
python
en
code
1
github-code
6
8829781188
from Node import Node # Node pointers head = None second = None third = None # Assign data using constructor. head = Node(10) second = Node(20) third = Node(30) # Assign data using "." operator. # head.data = 10 # second.data = 20 # third.data = 30 head.next = second # Link first (head) node with second. ...
drigols/studies
modules/algorithms-and-ds/modules/data-structures/linear/lists/src/python/singly-linked-list/driver_insert_using_node_class.py
driver_insert_using_node_class.py
py
593
python
en
code
0
github-code
6
35935636198
from gpt4all import GPT4All import asyncio import websockets import datetime print(r''' $$$$$$\ $$\ $$\ $$$$$$\ $$$$$$\ $$ __$$\ $$ | \__| $$ __$$\ \_$$ _| $$ / $$ |$$ | $$\ $$$$$$\ $$$$$$\ $$\ $$ / $$ | $$ | $$$$$$$$ |$$ | $$ ...
76836/Akari
experimental/server.py
server.py
py
3,098
python
en
code
0
github-code
6
17640174097
""" Use blender to convert FBX (T-pose) to BVH file """ import os import bpy import numpy as np def get_bvh_name(filename): filename = filename.split(".")[-2] return filename + ".bvh" def main(): fbx_dir = "./mixamo/fbx/" bvh_dir = "./mixamo/bvh/" for filename in os.listdir(fbx_dir): fbx_...
awkrail/mixamo_preprocessor
fbx2bvh.py
fbx2bvh.py
py
935
python
en
code
0
github-code
6
1499727625
from bs4 import BeautifulSoup import json import logging import requests from Mongo import client as MongoClient from Redis import client as RedisClient WEB = 'https://www.gensh.in/events/promotion-codes' class RequestErrorException(Exception): def __init__(self, message, resp): super().__init__(message)...
BRAVO68WEB/genshin-notify
scrapperCodes/scrapper.py
scrapper.py
py
2,107
python
en
code
1
github-code
6
19499795421
# -*- coding: utf-8 -*- class Solution: def fromMiddles(self, mid_f: int, mid_s: int, s: str) -> (int, int): dis = start = end = 0 # condition ensures we don't point beyond the beginning of the word while dis <= mid_f: pstart = mid_f - dis pend = mid_s + dis ...
michaeldye/mdye-python-samples
src/mdye_leetcode/solution_5.py
solution_5.py
py
1,177
python
en
code
0
github-code
6
10230270575
import numpy as np from pyparsing import Any import evals import evals.elsuite.steganography.steganography as steganography import evals.metrics from evals.api import CompletionFn, DummyCompletionFn from evals.eval import Eval from evals.record import RecorderBase class Steganography(Eval): def __init__( ...
openai/evals
evals/elsuite/steganography/eval.py
eval.py
py
3,437
python
en
code
12,495
github-code
6
28985765692
import community as community_louvain import networkx as nx #read file graph_file = 'abide_au_2_4132_sparse.txt' #label_file='4132_regions.txt' with open(graph_file) as f: graph = f.readlines() graph = [x.strip() for x in graph] G = nx.parse_edgelist(graph, delimiter="\t", nodetype=int) partition = community_lo...
chandrashekar-cds/Graph-Coarsening
louvain_subgraphs_label.py
louvain_subgraphs_label.py
py
2,184
python
en
code
0
github-code
6
21053864803
# Import the necessary libraries import PySimpleGUI as sg import qrcode # Set the theme for the UI sg.theme('GreenMono') # Define the layout for the app layout = [ [sg.Text('Enter Text: ', font=('Helvetica', 12, 'bold')), sg.InputText(font=('Helvetica', 12), size=(30,1))], [sg.Button('Create', font=('...
haariswaqas/Project2
QR Code Generator.py
QR Code Generator.py
py
1,401
python
en
code
0
github-code
6
36572760050
import random import colorgram from turtle import Turtle, Screen colors = colorgram.extract("./example.jpg", 10) list_colors = [] for color in colors: current_color = color.rgb color_tuple = (current_color[0], current_color[1], current_color[2]) list_colors.append(color_tuple) porto = Turtle() porto.penup...
porto-o/Python_projects
18. hirst-painting/main.py
main.py
py
725
python
en
code
1
github-code
6
18537329449
# prob_link: https://www.codingninjas.com/codestudio/problems/trapping-rain-water_8230693?challengeSlug=striver-sde-challenge&leftPanelTab=0 from os import * from sys import * from collections import * from math import * def getTrappedWater(height, n) : # Write your code here. n = len(height) pre = [0]*n...
Red-Pillow/Strivers-SDE-Sheet-Challenge
P40_Trapping_Rain_Water.py
P40_Trapping_Rain_Water.py
py
729
python
en
code
0
github-code
6
9816344184
# Nearest stars to Earth # star1 = 'Sol' # star2 = 'Alpha Centauri' # star3 = 'Barnard' # star4 = 'Wolf 359' stars = [ "sol", "Alpaha", "Barnard", "Wolf 359" ] print(stars[3]) # # Highest peak on each tectonic plate # Antarctic = 'Vinson' # Australian = 'Puncak Jaya' # Eurasian = 'Everest' # North_Amer...
fouad963/linked-in
Exercise FilesProgramming Foundations Beyond the Fundamentals/Ch01/01_06/begin/collections.py
collections.py
py
602
python
en
code
0
github-code
6
35743712704
import sys import read_write as rw import numpy as np import scipy.sparse from MatrixFactorization import MatrixFactorization if (__name__ == '__main__'): finput_dataset = sys.argv[1] finput_K = (int)(sys.argv[2]) iu_matrix_train_path = "../../Data/" + finput_dataset + "/iu_sparse_matrix_train.npz...
clamli/Dissertation
Baselines/Content-based Active Learning/content_based_active_learning.py
content_based_active_learning.py
py
2,632
python
en
code
28
github-code
6
18997085490
import torch.nn as nn from efficientnet_pytorch import EfficientNet class EfficientNetCustom(nn.Module): def __init__(self, model_name, in_channels, num_classes, load_pretrained_weights=True, train_only_last_layer=False): super(EfficientNetCustom, self).__init__() self.model_name = model_name ...
sanjeebSubedi/cats-dogs-efficientnet
efficientNetCustom.py
efficientNetCustom.py
py
1,204
python
en
code
0
github-code
6
74743366586
from decimal import Decimal, setcontext, ExtendedContext setcontext(ExtendedContext) precision = Decimal('0.000001') class LocationStore(object): def __init__(self): self.locations = {} def add(self, latitude, longitude, name, url=None, primary=False): latitude = makedecimal(latitude).quanti...
kurtraschke/cadors-parse
src/cadorsfeed/cadorslib/locations.py
locations.py
py
1,387
python
en
code
1
github-code
6
5123241016
""" Requests モジュールによりリモートファイルを読み込むサンプル 事前にRequestsモジュールをインストールしましょう # pip install requests """ import requests url = 'https://it-engineer-lab.com/feed' try: r = requests.get(url, timeout=10.0) print(r.text) except requests.exceptions.RequestException as err: print(err) # ダウンロード(読み込み + ローカル保存) # ダウンロードして...
toksan/python3_study
network/get_by_requests.py
get_by_requests.py
py
690
python
ja
code
2
github-code
6
1948037648
from django.contrib import admin from django.db.models import QuerySet from django.db.models.expressions import RawSQL from django.forms import ModelForm from django.urls import reverse from django.utils.safestring import mark_safe from tree.models import Category from django.utils.html import format_html from django ...
Vulwsztyn/django_treebeard_admin
tree/admin.py
admin.py
py
1,783
python
en
code
0
github-code
6
72340847227
# Tower of Hanoi # code by Akshat Aryan def tower(n, src, aux, dest): if n == 1: print("Move Disk from", src, "to", dest) else: tower(n - 1, src, dest, aux) print("Move Disk from", src, "to", dest) tower(n - 1, aux, src, dest) if(__name__ == "__main__"): n = int(inp...
crazydj8/DesignAlgorithms
Misc. Algos/Recursive_algos/towerofhanoi.py
towerofhanoi.py
py
437
python
en
code
1
github-code
6
27259334450
"""We are the captains of our ships, and we stay 'till the end. We see our stories through. """ """1059. All Paths from Source Lead to Destination """ class Solution: def leadsToDestination(self, n, edges, s, d): visited = [0] * n graph = [[] for _ in range(n)] def dfs(i): if...
asperaa/back_to_grind
Graphs/1059. All Paths from Source Lead to Destination.py
1059. All Paths from Source Lead to Destination.py
py
756
python
en
code
1
github-code
6
6323414106
from contextlib import suppress import random import asyncio from typing import * import traceback import hikari from hikari import Embed import lightbulb from lightbulb import events, errors from lightbulb.context import Context from core import Inu from utils.language import Human from .help import OutsideHelp fro...
zp33dy/inu
inu/ext/commands/errors.py
errors.py
py
10,996
python
en
code
1
github-code
6
14952780826
from temporalio.client import Client from temporalio.worker import Worker from temporal_test.activity import say_hello_activity from temporal_test.config import Config from temporal_test.workflows import TestWorkflow import asyncio import os async def main(): temporal_host = os.getenv("TEMPORAL_ADDRESS", "127.0.0...
qadiludmer/temporal-test
temporal_test/worker.py
worker.py
py
824
python
en
code
0
github-code
6
4495970726
from CategoriasProdutos import CateProd from Compras import Compras #from MenuOpcoes import MenuOpcoes Co = Compras() CP = CateProd() #Mo = MenuOpcoes() class ContEstoque: def __init__(self): pass def LimiteEstoque(self,LisProd): limite = 0 if LisProd == 'vazio': retur...
Ander20n/Codigos-Faculdade
Projeto IP/ControleEstoque.py
ControleEstoque.py
py
1,224
python
pt
code
0
github-code
6
71971281789
from kubeflow import fairing import os import sys GCS_PROJECT_ID = fairing.cloud.gcp.guess_project_name() DOCKER_REGISTRY = 'gcr.io/{}'.format(GCS_PROJECT_ID) NOTEBOOK_PATH = os.path.join(os.path.dirname(__file__), 'test_notebook.ipynb') def run_full_notebook_submission(capsys, notebook_file, expected_result, ...
kubeflow/fairing
tests/integration/common/test_full_notebook.py
test_full_notebook.py
py
1,452
python
en
code
336
github-code
6
10640003312
import requests import json import urllib2 BASE_URL = "https://api.github.com" def confirm_github(): """Confirm Github is up and running""" url = BASE_URL r = requests.get(url) if r.status_code == 200: # print "status code:", r.status_code, "(github is working)" return True else: # print "github is down"...
smithers1221/replicatedcc_python
githubapi.py
githubapi.py
py
1,833
python
en
code
0
github-code
6
26038294916
import inspect import json import sys from pathlib import Path import pytest from _pytest import fixtures from _pytest.compat import get_real_func def get_func_path(func): real_func = get_real_func(func) return inspect.getfile(real_func) def get_fixturedef(fixture_request, name): fixturedef = fixture_r...
pantsbuild/pants
pants-plugins/internal_plugins/test_lockfile_fixtures/collect_fixtures.py
collect_fixtures.py
py
2,655
python
en
code
2,896
github-code
6
38777260786
import pandas as pd import os import numpy as np from math import floor from sqlalchemy import create_engine, MetaData, Table import tushare as ts from utils import get_all_tdx_symbols import click import struct """ 读取通达信数据 """ class TdxFileNotFoundException(Exception): pass class TdxReader: def __init__...
maxwell-lv/MyQuant
tdxreader.py
tdxreader.py
py
5,452
python
en
code
0
github-code
6
43272673113
import os import cv2 import numpy as np import torch from PIL import Image import torchvision class SegDataset(object): def __init__(self, root, transforms): self.root = root self.transforms = transforms # load all image files, sorting them to # ensure that they are aligned ...
v7labs/deeplabv3-edges
dataset.py
dataset.py
py
2,535
python
en
code
1
github-code
6
72355994109
#!/usr/bin/python3 """Module that lists all State objects from the database hbtn_0e_6_usa""" from sys import argv from model_state import Base, State from sqlalchemy import create_engine from sqlalchemy.orm import sessionmaker if __name__ == '__main__': engine = create_engine('mysql+mysqldb://{}:{}@localhost:330...
MrZooM001/alx-higher_level_programming
0x0F-python-object_relational_mapping/10-model_state_my_get.py
10-model_state_my_get.py
py
672
python
en
code
0
github-code
6
39964228620
import pymysql from tkinter import * from tkinter import messagebox import sys import datetime u=sys.argv[1] p=sys.argv[2] class dropdown: def __init__(self,appen,lis): self.m = StringVar() self.m.set("choose") self.opt=OptionMenu(appen,self.m,*lis) self.opt.grid(row=len(lis),colum...
2HgO/CLASS-SCHEDULER
Scheduler.py
Scheduler.py
py
13,116
python
en
code
1
github-code
6
39341038944
class Point2D: def __init__(self, x, y): self.x = x self.y = y class Point3D: def __init__(self, x, y, z): self.x = x self.y = y self.z = z class Line: def __init__(self, p1, p2): self.p1 = p1 self.p2 = p2 @property def distance(self): ...
SchulerHunter/CMPSC-132
Quiz 1/Coding_Q2.py
Coding_Q2.py
py
1,144
python
en
code
0
github-code
6
10865691548
from django.contrib import admin from django.db import models from django.db.models import Q from django.utils.translation import gettext_lazy as _ from ...settings import ADMIN_MEDIA_JS from .actions import save_all_theses_to_xls from .models import Thesis # Copied from https://gist.github.com/rafen/eff7adae38903ee...
tlrh314/UvA_API_Alumni
apiweb/apps/research/admin.py
admin.py
py
8,102
python
en
code
2
github-code
6
27466582699
""" 학생들에게 0~N번의 번호를 부여할 때, 총 N+1개의 팀이 존재한다. 이떄 선생님은 두가지 옵션을 선택할 수 있다. 1. "팀 합치기" : 두 팀을 합치는 것 2. "같은 팀 여부 확인": 특정한 두 학생이 같은 팀에 들어가 있는가 확인하는 것. 선생님이 M개의 연산을 하여 연산결과를 출력하는 프로그램을 작성하여라 첫째줄에 N,M 이 주어진다. (1<=N,M<=100,000) 다음 M개의 줄에는 0 a b 나 1 a b 형태로 값이 주어진다. 0 a b 는 a와 b 학생이 속한 팀을 합치는 것이고 1 a b 는 a와 b가 같은 팀에 속해있는지의...
20190511/GraphAlgorithm
문제풀이/Q2-팀결성.py
Q2-팀결성.py
py
1,442
python
ko
code
1
github-code
6
8413409544
import numpy as np from itertools import product from vgc_project.maze import Maze def test_basic_maze_properties(): pw=.94 ps=.6 m = Maze( tile_array=( ".j.", "x#3" ), absorbing_features=("j",), wall_features=("#","3"), default_features=("."...
markkho/value-guided-construal
vgc_project/vgc_project/tests/test_maze.py
test_maze.py
py
2,403
python
en
code
20
github-code
6
40275219447
# %% import pandas as pd import plotly.io as pio import plotly.express as px import plotly # %% adani_df = pd.read_csv('Data\Scatterplot\ADANIENT_day_data_processed.csv', parse_dates=['date'], index_col=['date']) appolo_df = pd.read_csv('Data\Scatterplot\APOLLOHOSP_day_data_processed.csv', parse_dates=['date'], index_...
mathewjames/covid-impact-on-indian-stock-market
scatterplot.py
scatterplot.py
py
7,537
python
en
code
0
github-code
6
30469295270
# Integer multiplication using recursion # Author: Prashanth Palaniappan """ Description: This is an algorithm that performs multiplication of 2 integers of size n using recursion. Solution: The algorithm recursively divides the input numbers by half, until we are left with single digits. This is the base case for re...
prashpal/algorithms-and-datastructures
python/numbers/integer_multiplication.py
integer_multiplication.py
py
1,606
python
en
code
0
github-code
6
69960819069
print("Advent of Code Day 1 Exercise 2") # Set local variables y = int(0) calories = int(0) count = int(0) calorielist = [] f = open("/Users/pauldobe/AOC_22/input_file_day_1", "r") for x in f: if x != "\n": y = y + int(x) else: calorielist.append(y) y = 0 calorielist.sort(reverse = Tr...
pdobek/AOC_22
AOC_1_2.py
AOC_1_2.py
py
415
python
en
code
0
github-code
6
9312776182
class Solution: def findDuplicate(self, nums): """ :type nums: List[int] :rtype: int """ """ Complexity: O(n) Space: O(1) Think of a linked list with a cycle in it somewhere. (142. Linked List Cycle II) Say fast pointer goes ...
acnokego/LeetCode
287_find_duplicate_num/two_ptr.py
two_ptr.py
py
1,775
python
en
code
0
github-code
6
23015453145
# Write a Pyhton Program to reverse a tule ? # x=('p','y','t','h','o','n') # y=print(reversed(x)) x = (2, 4, 6) result = reversed(x) result = tuple(result) print(result)
JACK07770777/Python-Assignments
Module 3/Q26.py
Q26.py
py
181
python
en
code
0
github-code
6
70722602427
import requests from bs4 import BeautifulSoup from .componentParser import ComponentParser from .utils import isRelativePostDate, getRelativePostDate class BlogPost: errorCount = 0 def __init__(self, url, isDevMode=False): # 개발 편의 self.isDevMode = isDevMode # init self.url = url self.postInframeUrl = '' ...
Jeongseup/naver-blog-backer
src/naverblogbacker/post.py
post.py
py
4,676
python
en
code
4
github-code
6
40315905815
############################################## # Q1 --- find sum of all inputs ############################################## # Read input - (f.read() for char-by-char read) & (loop file object for LINE-by-LINE reading) with open('./1201.in', 'r') as f: freqList = [line.strip() for line in f] # Compute sum from ...
hdd2k/adventOfCode
2018/01/1201.py
1201.py
py
924
python
en
code
2
github-code
6
38358981811
import logging from enum import Enum import openai from fastapi import Query from openai.error import AuthenticationError, InvalidRequestError, RateLimitError from tenacity import ( retry, stop_after_attempt, wait_random_exponential, retry_if_exception_type, ) # for exponential backoff from app.confi...
jybaek/Hello-ChatGPT
app/services/openai_completions.py
openai_completions.py
py
2,522
python
en
code
7
github-code
6
31819134582
""" The field should look like this: col0 col1 col2 col3 col4 col5 col6 col7 col8 ||======|======|======||======|======|======||======|======|======|| || A | A | A || B | B | B || C | C | C || row0||cell0 |cell1 |cell2 ||cell3 |cell4 |cell5 ||cell6 |cell7 |ce...
stanislavstarkov/sudoku
sudoku.py
sudoku.py
py
6,469
python
en
code
0
github-code
6
34849239284
import sqlite3 def execute_with_output(conn, query_txt, fetch_quant="one"): """ Takes the connection file variable and executes the query text within that connection :param fetch_quant: :param conn: :param query_txt: :return: """ try: c = conn.cursor() c.execute(query_t...
James-Rocker/data_engineering_portfolio
working_with_sqllite/query/__init__.py
__init__.py
py
705
python
en
code
0
github-code
6
31564356652
import svgwrite.extensions import faiss import numpy as np import matplotlib.pyplot as plt import svgwrite import networkx as nx import src.particle_utils as particle_utils if __name__ == "__main__": page_size = (11 * 96, 17 * 96) max_iterations = 1000 max_particles = 1000 index_training_node_count =...
neoques/dla-python
src/virnolli.py
virnolli.py
py
3,998
python
en
code
0
github-code
6
29013781998
import sys,usb,struct USB_TIMEOUT_DEFAULT = 1000 SMS_EP_IN = 0x81 SMS_EP_OUT = 0x02 HIF_TASK = 11 class SMS1180USB: def __init__(self, dev, timeout=USB_TIMEOUT_DEFAULT): self.dev = dev self.timeout = timeout def usb_read(self): try: return bytes(self.dev.read(SMS_...
fxsheep/helloworld-anyware
src/siano/sms1180/sms1180usb.py
sms1180usb.py
py
1,474
python
en
code
4
github-code
6
28564753746
import sys import urllib.request START_MARKERS = { 'title': '<h1 class="header"> <span class="itemprop" itemprop="name">', 'year': '<span class="nobr">(<a href="/year/', 'genres': '<h4 class="inline">Genres:</h4>', 'genre': '> ', 'languages': '<h4 class="inline">Language:</h4>', 'language': "i...
PythonAnkara/basicimdb
imdb08.py
imdb08.py
py
1,325
python
en
code
0
github-code
6
9135098878
# -*- coding: utf-8 -*- import lzma import os import shutil from datetime import datetime from datetime import timedelta import hglib from bugbug import bugzilla from bugbug import labels from bugbug import repository from bugbug_data.secrets import secrets from cli_common.log import get_logger from cli_common.taskc...
chutten/release-services
src/bugbug/data/bugbug_data/retriever.py
retriever.py
py
3,307
python
en
code
null
github-code
6
12733893864
commands = [ '!help', '!done', 'plain', 'bold', 'italic', 'header', 'link', 'inline-code', 'new-line', 'ordered-list', 'unordered-list' ] outputs = [] def get_formatter(): formatter = input("Choose a formatter: ") return formatter def format...
CRowland4/markdown_editor
Markdown_Editor.py
Markdown_Editor.py
py
3,661
python
en
code
0
github-code
6
72453543549
#!/usr/bin/python3 from tkinter import Image import rospy import sys import cv2 from cv_bridge import CvBridge, CvBridgeError class viewer: def __init__(self): self.bridge = CvBridge() # self.image_rgb_sub = rospy.Subscriber("/camera/color/image_raw",Image,self.callback) self.image...
Yandong-Luo/hybrid
src/Vision/detect_ball/nodes/image_pub.py
image_pub.py
py
997
python
en
code
1
github-code
6
7615725014
import math class Circle: def __init__(self, centre, radius): self.centre = centre self.radius = radius def isInside(self, rectangle): x = (rectangle.rightLower.x + rectangle.leftUpper.x) / 2 y = (rectangle.leftUpper.y + rectangle.rightLower.y) / 2 distance = math.sqrt...
Tariod/what-is-near
lib/Circle.py
Circle.py
py
410
python
en
code
0
github-code
6
18528705421
# Section12-1 # 파이썬 데이터베이스 연동(SQLite) # 테이블 생성 및 삽입 import datetime import sqlite3 # 삽입 날짜 생성 now = datetime.datetime.now() print('now', now) nowDatetime = now.strftime('%Y-%m-%d %H:%M:%S') print('now Datetime', nowDatetime) # sqlite3 버전 print('sqlite3.version : ', sqlite3.version) print('sqlite3.sqlite_version', s...
dailyco/python-study
src/section12_1.py
section12_1.py
py
2,122
python
ko
code
2
github-code
6
19981883727
import time import requests from bs4 import BeautifulSoup from fake_useragent import UserAgent import datetime import csv import json def get_data(): current_time = datetime.datetime.now().strftime('%m-%d-%Y') with open(f'data/{current_time}_labirint.csv', 'w', newline='', encoding='utf-8-sig') as file: ...
Baradys/scrappers
scrappers/labirint/labirint.py
labirint.py
py
4,771
python
en
code
0
github-code
6
37301787598
import random n=int(input("n=")) mas=random.sample(range(-100,100),n) print(mas) print("Мінімальний від'ємний елемент",min(mas)) S=0 for i in mas: if i<0: S=S+i print("Сума від'ємних елементів масиву=",S) k=0 for i in mas: if i>0: k=k+1 print("Кількість додатніх елементів масиву= ",k) for i...
oly17/-
лб 1 30 варыант/3.py
3.py
py
550
python
uk
code
0
github-code
6
27214244555
# 1:57 시작, 12:18 종료 def solution(N, stages): answer = [] user = [0] * (N + 2) # 스테이지에 도달한 사람 fail = [0] * (N + 2) # 스테이지에 머물러 있는 사람 fail_rate = [] # 실패율 for s in stages: for i in range(1, s + 1): user[i] += 1 if i == s: fail[i] += 1 for i in r...
hammii/Algorithm
python_practice/정렬/실패율.py
실패율.py
py
657
python
ko
code
2
github-code
6
31357541271
import argparse, sys import tornado.ioloop import tornado.gen import time from nats.io.client import Client as NATS def show_usage(): print("nats-sub SUBJECT [-s SERVER] [-q QUEUE]") def show_usage_and_die(): show_usage() sys.exit(1) @tornado.gen.coroutine def main(): # Parse the command line arg...
nats-io/nats.py2
examples/nats-sub/__main__.py
__main__.py
py
1,186
python
en
code
62
github-code
6
8366434140
#!/usr/bin/env python # -*- coding:utf-8 -*- import sys import os import file def get_input_file(filepath, filename): """ 从标准输入读取内容,存入文件中 :param filepath:文件存储路径 :param filename:文件名 :return: """ # 打开文件,进行读写,如果不存在,创建新文件 file01 = open(filepath + filename, 'w+') # 从标准输入循环读取内容,知道输入的是,结...
renxiaowei-1991/pythonLearn
a01PythonLearn/package/b02BaseModule/c02FileIOType.py
c02FileIOType.py
py
5,515
python
en
code
0
github-code
6
37176772654
# Реализуйте RLE алгоритм: реализуйте модуль сжатия и восстановления данных. # Входные и выходные данные хранятся в отдельных текстовых файлах. with open ('file_5.4.txt', 'r') as data: text = data.readline() # print(text) def rle_coding(text): rle_text = '' count =1 char = text[0] for i in range(...
Svetabtr/Homework_Python
hometask_5.4.py
hometask_5.4.py
py
1,192
python
en
code
0
github-code
6
9259336526
import numpy as np from calculateZ import WeightCrossData, AddBiasToProduct from output import Softmax_activation from activationFunctions import Tanh,Relu,Sigmoid class FeedForwardNeuralNetwork: def __init__(self,S): self.biases = [] self.Weights = [] for i in range(len(S)-1): ...
nancyagrwal/Machine-Learning
Feed FOrward NN/feedForwardNeuralNetwork.py
feedForwardNeuralNetwork.py
py
3,721
python
en
code
0
github-code
6
74182195707
class Queue : def __init__(self, list = None): self.time = 0 if list == None: self.items = [] else: self.items = list def dequeue(self): if not self.isEmpty(): return self.items.pop(0) else: return -1 ...
chollsak/KMITL-Object-Oriented-Data-Structures-2D
Queue/exercise2.py
exercise2.py
py
1,191
python
en
code
0
github-code
6
30433642050
import requests from jSona import jSona import pprint pp = pprint.pprint class proImagery : def __init__(self, CONF_PATH) : self.jso = jSona() self.headers = {'json':{'Content-Type':'application/json; charset=utf-8'}} self.config = self.jso.loadJson(CONF_PATH)['IMAGERY'] self.lower...
oimq/proCleaner
proCleaner/proImagery.py
proImagery.py
py
2,349
python
en
code
0
github-code
6
39669765080
import hashlib import os.path import sys import pickle from SuperStoreParser import Parser as ssParser from SheetsController import SheetsController def main(): # Ensure usage is correct if (len(sys.argv) != 2): print("usage: python3 FoodParser.py inputfile.txt") return if (not os.path.exists(sys.argv[1])): ...
haondt/531fitness
foodparser/FoodParser.py
FoodParser.py
py
2,981
python
en
code
0
github-code
6
13116301687
l=[] r=int(input('enter no.of rows: ')) c=int(input('enter no.of columns: ')) for i in range(r): row=[] for j in range(c): elem=int(input('Element'+str(i)+','+str(j)+':')) row.append(elem) l.append(row) print('list: ') print('l=[') for i in range(r): print('\t[',end='') ...
ParthivSen/Python_Programming
2D list.py
2D list.py
py
402
python
en
code
0
github-code
6
33340636168
from wsgiref.simple_server import make_server from pyramid.view import view_config from pyramid.config import Configurator @view_config(route_name='theroute', renderer='json',request_method='POST') def myview(request): import pdb; pdb.set_trace() return {'POST':''} if __name__ == '__main__': config = Conf...
Yatish04/MicrosoftBackend
testscripts/pyramidserver.py
pyramidserver.py
py
524
python
en
code
0
github-code
6
24991083298
from tkinter import * root = Tk() root.title('ERIC PY') root.geometry("500x400") def grab(): my_label.config(text=my_spin.get()) names = ("j","T","M","N") # my_spin = Spinbox(root, from_=0, to=10, increment=2, font=("helvetica",20)) # my_spin = Spinbox(root, values=("j","T","M","N") ,font=("helvetica",20)) my_s...
miraceti/tkinter
gui_98tk_Spinboxes.py
gui_98tk_Spinboxes.py
py
550
python
en
code
2
github-code
6
75187431228
from django.conf import settings import jwt from rest_framework import authentication, exceptions from django.contrib.auth.models import User class JWTAuthentication(authentication.BasicAuthentication): def authenticate(self, request): auth_data = authentication.get_authorization_header(request) ...
Limookiplimo/Contacts-API
authentication/backends.py
backends.py
py
835
python
en
code
1
github-code
6
24458342362
from sklearn.feature_selection import SelectKBest from sklearn.feature_selection import chi2 X = rs_train[['price_per_ticket', 'seat_row', 'paid_full_price', 'paid_online', 'Regular_Ticket', 'age', 'est_income', 'Male', 'married', 'fam_w_kids', 'kids_in_house', 'from_Boston', 'from_MA','game_hour', ...
befitz/ISOM837_RS
feature_selection.py
feature_selection.py
py
996
python
en
code
0
github-code
6
6183714269
# coding:utf-8 # @Time : 2023/10/27 19:37 # @Author : 郑攀 # @File : filter.py # @Software : PyCharm import csv filter_feature = [] with open("Output/filter feature.csv", "r", encoding='utf8') as f: # 打开文件 lines = csv.reader(f) for line in lines: filter_feature.append(line[0]) seed_feature = [] with op...
PanZheng-2021/2022.0333_11.8
src/Review Feature Extraction/filter.py
filter.py
py
791
python
en
code
0
github-code
6
72248624827
class TreeNode: def __init__(self,data): self.data = data self.left = None self.right = None class BST: def __init__(self): self.root = None #def def isEmpty(self): return self.root is None #def def clear(self): self.root = [] ...
phamduclong2103/CSD203
LAB/LAB4.py
LAB4.py
py
7,991
python
en
code
0
github-code
6
34215956791
#state rates statetaxrate = 0.1120 #anne arundel county rates #New Proposed for FY24 superceeds this - annearundeltaxrate = .93300 annearundeltaxrate = .98000 annearundelsolidwaste = 341 annearundelstormwater = 35.70 annapoliscountyrate = 0.559000 annapolisrate = 0.738000
dataguy2020/PropertyTax
rates.py
rates.py
py
275
python
en
code
1
github-code
6
41711840918
import numpy as np from sklearn.model_selection import KFold, TimeSeriesSplit from helpers.settings import * from model.preprocessing_helper import * from model.config import HISTORY_SIZE from datetime import datetime LSTM_STEP = 1 LSTM_FUTURE_TARGET = 1 LSTM_HISTORY = HISTORY_SIZE TRAIN_DATASET_FRAC = 0.8 def gene...
burnpiro/wod-usage-predictor
model/data_preprocessor.py
data_preprocessor.py
py
5,157
python
en
code
0
github-code
6
42647237351
from django.contrib.auth import get_user_model from django.forms import widgets from root import forms_override as forms from root.models import UserGroup, EmailTemplate, EmailGroup, Experiment INITIAL_EMAIL_TEMPLATE = """<html> <body> <h1>{{content}}</h1> </body> </html> """ class RegistrationForm(for...
ograycode/engage
root/forms.py
forms.py
py
4,691
python
en
code
0
github-code
6
39259219902
#!/usr/bin/env python3 import rclpy from rclpy.node import Node import speech_recognition as sr from custom_if.srv import SendSentence from functools import partial from nl_understanding.tcp_client import GenericClient ### Node class class NLUnderstanding(Node): def __init__(self): super().__init__("nlu_node") ...
Alessandro-Scarciglia/VoiceAssistant
nl_understanding/nl_understanding/nl_understanding.py
nl_understanding.py
py
854
python
en
code
0
github-code
6
34773865480
import time from functools import cache from math import radians from XivCombat.utils import a, s, cnt_enemy, res_lv, find_area_belongs_to_me from XivCombat.strategies import * from XivCombat import define, api from XivCombat.multi_enemy_selector import Rectangle, NearCircle, circle, FarCircle aoe = NearCircle(5.) fir...
ShoOtaku/f3combat
OT/nin.py
nin.py
py
6,428
python
en
code
1
github-code
6
15855579751
from appium import webdriver from appium.webdriver.common.mobileby import MobileBy from selenium.webdriver.common.by import By class TestWeworkTest: def setup(self): desired_cap = {} desired_cap["platformName"] = "Android" # desired_cap["platformVersion"] = "6.0" desired_cap["devic...
sunmings1310/HogwartsHomework
hogwarts-homework/AppWeworkHomework/test_clokc_in.py
test_clokc_in.py
py
3,015
python
en
code
0
github-code
6
74977703867
import re import logging import sys import os import yaml from rdflib import ConjunctiveGraph, Literal, URIRef, BNode, Namespace from dipper.graph.Graph import Graph as DipperGraph from dipper.utils.CurieUtil import CurieUtil from dipper import curie_map as curie_map_class from dipper.models.BiolinkVocabulary import ...
monarch-initiative/dipper
dipper/graph/RDFGraph.py
RDFGraph.py
py
7,720
python
en
code
53
github-code
6
2535030622
from pathlib import Path from shutil import move from threading import Thread import logging folders = [] extensions = [] def grabs_folder(path: Path): for el in path.iterdir(): if el.is_dir(): folders.append(el) grabs_folder(el) def sort_file(path: Path): ...
PetroChulkov/web_homework3
file_sorter.py
file_sorter.py
py
1,354
python
en
code
1
github-code
6