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
10704679897
import pandas from tqdm import tqdm from geojson import Feature, FeatureCollection, Point import json df = pandas.read_csv('stops.csv') df = df[['stop_id', 'stop_name', 'stop_lat', 'stop_lon']] data = {} for index, row in tqdm(df.iterrows()): stop_id, stop_name, stop_lat, stop_lon = row data[stop_id] = { ...
AzurIce/SubwayFrontend
playground/data/google_transit/convert_stop_to_json.py
convert_stop_to_json.py
py
465
python
en
code
2
github-code
90
18681307388
import json import logging import os import subprocess import sys from threading import Thread import time import uuid from ax.devops.artifact.constants import RETENTION_TAG_DEFAULT, RETENTION_TAG_AX_LOG, RETENTION_TAG_AX_LOG_EXTERNAL, \ RETENTION_TAG_USER_LOG, RETENTION_TAG_LONG_RETENTION, ARTIFACT_TYPE_AX_LOG, A...
zhan849/argo
platform/source/lib/ax/platform/sidecar/log_collector.py
log_collector.py
py
20,957
python
en
code
null
github-code
90
22722650323
import pandas as pd import numpy as np def print_cv_results(a, len_gs, params, param_r, param_sep): d = len(params['param_grid'][param_sep]) ar=np.array(a).reshape(len_gs,d) df=pd.DataFrame(ar) pen_par=params['param_grid'][param_sep] c_par=params['param_grid'][param_r].tolist() columns_...
ml-dafe/ml_mipt_dafe_old
archieve/2019/week_03_Linear_model_part_2/utils.py
utils.py
py
660
python
en
code
9
github-code
90
18147831969
# -*- coding: utf-8 -*- import sys import os for s in sys.stdin: sentence = s.strip() if sentence == '-': break N = int(input()) for i in range(N): h = int(input()) sentence = sentence[h:] + sentence[:h] print(sentence)
Aasthaengg/IBMdataset
Python_codes/p02420/s553548069.py
s553548069.py
py
267
python
en
code
0
github-code
90
29823306218
import numpy as np import matplotlib.pyplot as plt fig = plt.figure() ax = fig.add_subplot(111) t = np.arange(0.0, 5.0, 0.01) s = np.cos(2*np.pi*t) line, = ax.plot(t, s, lw=2) # ax.annotate('local max', xy=(2, 1), xytext=(2, 1.5), # arrowprops=dict(facecolor='black', shrink=0.05), # ) for j ...
bluelocust/SynU3-project
Motifs/snippets/add_txt.py
add_txt.py
py
575
python
en
code
2
github-code
90
18572136429
class WeightedUnionFind: def __init__(self, n): self.n = n self.root = [-1]*(n+1) self.rnk = [-1]*(n+1) self.weight = [0]*(n+1) """ xの根を求める""" def Find_Root(self, x): if (self.root[x] < 0): return x else: y = self.Find_Root(self.ro...
Aasthaengg/IBMdataset
Python_codes/p03450/s393370974.py
s393370974.py
py
1,616
python
en
code
0
github-code
90
15056510791
import math #------------------------------------- def find_max_num_for(array_values): n = len(array_values) s = array_values[0] max_idx = 0 for i in range(1, n): if s <= array_values[i]: s = array_values[i] max_idx = i print("Max Id is " + max_idx.__str__()...
yooshinK/Python_Study
Algorithm_py_Input_Num_Find_Max_Num.py
Algorithm_py_Input_Num_Find_Max_Num.py
py
704
python
en
code
0
github-code
90
5194752977
""" gacca """ from character_creation import CharacterInfo, get_pronoun_list def pull_information(pulls: list): pull_info = "" counter = 1 for pull in pulls: pull_info += (f"<===PULL {counter}===>\n" f"YOU PULLED A {pull.stats.rarity['Rarity'].upper()} UNIT!!!\n" ...
nickluong-dev/Hack-the-Break-2021
gacha.py
gacha.py
py
794
python
en
code
0
github-code
90
43580444960
# Imports necesarios from src.public import pub from flask import render_template, redirect, url_for, request, flash import pandas as pd import requests import json import os from flask_login import login_required, current_user from src.forms.updateUser import UpdateUser from src.forms.scheduleParams import SchedulePar...
jesgararm/GestorQuirofanos
APP-WEB/src/public/routes.py
routes.py
py
6,879
python
es
code
0
github-code
90
6484470709
from fastapi.testclient import TestClient from source.queries import students_queries from fastapi import HTTPException import pytest from main import app client = TestClient(app) def id_cache(): cache_id = [] student = students_queries.select_query() for i in range(0,len(student)): cache_id.appe...
nayan-chordia/StudentDatabaseAPI
tests/tests_unit/test_unit_students.py
test_unit_students.py
py
2,501
python
en
code
0
github-code
90
12589452532
import re import torch import torch.nn as nn import torchvision import pandas as pd from torch.nn.init import constant_ from torch.nn.init import normal_ from torch.utils import model_zoo from copy import deepcopy import slowfast.utils.weight_init_helper as init_helper from . import head_helper, resnet_helper, stem_h...
iranroman/ego_actrecog_analysis
slowfast/models/video_model_builder.py
video_model_builder.py
py
27,336
python
en
code
6
github-code
90
73953706217
from os import environ import kea import json import requests # This hook was improved by ChatGPT and later some errors were resolved. powerdns_domain = environ["PDNS_DOMAIN"] powerdns_api_key = environ["PDNS_API_KEY"] powerdns_api_host = environ["PDNS_API_HOST"] powerdns_api_port = environ["PDNS_API_PORT"] powerdns_...
NIXKnight/Personal-Linux-Firewall-Gateway
docker/kea/keahook.py
keahook.py
py
10,667
python
en
code
0
github-code
90
7627136907
""" This file is responsible for implementing a server side `main` function. """ import numpy as np import tensorflow as tf import zmq from flysight.config import Config from flysight.message_pb2 import ( Request, RepTracking, ReqDetections, RepDetections, ) from flysight.server....
cjhanks/flysight
flysight/server/main.py
main.py
py
2,896
python
en
code
0
github-code
90
32113900314
from . import hio import numpy as np import bpy from mathutils import Matrix from bpy_extras.io_utils import axis_conversion def export_mesh(path:str, me): assert len(me.polygons) > 0, 'Only supports polygons. No lines or points.' me.flip_normals() me.calc_normals_split() geo = hio.Geometry() vertices = np....
satoruhiga/blender-houdini-geo-io
exporter.py
exporter.py
py
6,602
python
en
code
22
github-code
90
15738197219
from django.shortcuts import render from feeds.models import Feed from django.db.models import Count from django.utils import timezone from datetime import timedelta from archives.models import Suggestion def main(request): return render( request, "web/info.html", ) def feed_rank_list(reques...
Hooooni98/api.fooiy.com
repo/web/views/v2/info.py
info.py
py
1,084
python
en
code
0
github-code
90
13386432439
#!/bin/python # # Author : Ye Jinchang # Date : 2015-06-17 13:56:42 # Title : 49 anagrams # Given an array of strings, return all groups of strings that are anagrams. # # Note: All inputs will be in lower-case. class Solution: # @param {string[]} strs # @return {string[]} def anagrams(s...
Alwayswithme/LeetCode
Python/049-anagrams.py
049-anagrams.py
py
667
python
en
code
1
github-code
90
17952468029
import itertools A, B, C, D, E, F = map(int, input().split()) U = F water = [0]*(U+1) water[0] = 1 for i in range(U+1): if water[i]: if i+100*A <= U: water[i+100*A] = 1 if i+100*B <= U: water[i+100*B] = 1 water_val = [val for val in range(1, U+1) if water[val]] suger = [0]*(U...
Aasthaengg/IBMdataset
Python_codes/p03599/s623252510.py
s623252510.py
py
753
python
en
code
0
github-code
90
43015432057
#!/usr/bin/env python """Backend jl uses module joblib to parallelize the dataset processing functions""" import logging import tempfile import numpy as np from joblib import Parallel, delayed, dump, load from dosna.backends import get_backend from dosna.engines import Engine from dosna.engines.base import EngineCon...
DiamondLightSource/DosNa
dosna/engines/jl.py
jl.py
py
6,004
python
en
code
11
github-code
90
41071433537
#!/usr/bin/env python from Bio import SeqIO import os import sys from collections import defaultdict from pprint import pprint import argparse import multiprocessing import re from os import listdir from os.path import isfile, join def checkoverlap(seq1, seq2): num = 0 diff = 0 for i, nucleotide in enumerate(s...
markphuong/nico.turridae
14generate/pick.best.seq.and.generate.ancestral.py
pick.best.seq.and.generate.ancestral.py
py
2,531
python
en
code
0
github-code
90
29232921005
import torch import torch.nn as nn import torch.optim as optim import torch.nn.functional as F import json with open('config.json', 'r') as file: config = json.load(file) block_size = config['block_size'] device = 'cuda' if torch.cuda.is_available() else 'cpu' n_embd = config['n_embd'] n_head = config['n_head...
uuzall/adaptive_attention_span
gpt.py
gpt.py
py
4,569
python
en
code
1
github-code
90
17767092055
""" Unit tests for the frontend code. """ from __future__ import division from __future__ import print_function from __future__ import unicode_literals import unittest import logging import ga4gh.datamodel as datamodel import ga4gh.frontend as frontend import ga4gh.protocol as protocol class TestFrontend(unittest.T...
srblum/hackathon-server
tests/unit/test_views.py
test_views.py
py
14,414
python
en
code
0
github-code
90
18320946919
import sys from io import StringIO import unittest import os # 再帰処理上限(dfs作成時に設定するのが面倒なので限度近い値を組み込む) sys.setrecursionlimit(999999999) def prepare_simple(n, mod=pow(10, 9) + 7): # n! の計算 f = 1 for m in range(1, n + 1): f *= m f %= mod fn = f # n!^-1 の計算 inv = pow(f, mod - 2, mo...
Aasthaengg/IBMdataset
Python_codes/p02862/s125003320.py
s125003320.py
py
3,135
python
en
code
0
github-code
90
23321689046
import CONSTANT from tools import time_train_test_split, data_sample_bykey_rate import pandas as pd import lightgbm as lgb class FeatSelect: def __init__(self): self.num_boost_round = 100 num_leaves = 63 self.params = { 'boosting_type': 'gbdt', 'objective': 'regress...
DeepBlueAI/AutoSeries
code_submission/feat_select.py
feat_select.py
py
2,437
python
en
code
15
github-code
90
18116200259
import math def kock(n,p1x,p1y,p2x,p2y): if(n==0): return sx = (2*p1x+p2x)/3.0 sy = (2*p1y+p2y)/3.0 tx = (p1x+2*p2x)/3.0 ty = (p1y+2*p2y)/3.0 ux = (tx-sx)*math.cos(math.radians(60)) - (ty-sy)*math.sin(math.radians(60)) + sx uy = (tx-sx)*math.sin(math.radians(60)) + (ty-sy)*math.co...
Aasthaengg/IBMdataset
Python_codes/p02273/s375697741.py
s375697741.py
py
566
python
en
code
0
github-code
90
18368024609
n = int(input()) a = [int(input()) for _ in range(n)] sort_a = sorted(a, reverse=True) amax = sort_a[0] asecond = sort_a[1] for i in range(n): tmp = a[i] if tmp == amax: print(asecond) else: print(amax)
Aasthaengg/IBMdataset
Python_codes/p02971/s436053557.py
s436053557.py
py
230
python
en
code
0
github-code
90
24342075985
import math from tkinter import * import numpy as np import random Leap = 1 Length = 5 Nofactions = 6 class Enviroment(object): """docstring for Enviroment.""" def __init__(self,sizes): self.pos = [10.0,7.0] self.theta = 0 self.obst = [[[4,2],[3,3],[2,2],[3,1]],[[4+2,2+2],[3+2,3+2],[2+...
japneet644/Random-codes
PS.py
PS.py
py
9,723
python
en
code
0
github-code
90
37111952594
class Board: '''Class represnting tic-tac-toe game board''' CROSS = '✖' CIRCLE = 'O' def __init__(self): ''' Initializing new empty board Last move is None by default ''' self._board = [[" ", " ", " "] for i in range(3)] self._left = None ...
kalchenkod/Lab13
board.py
board.py
py
3,254
python
en
code
0
github-code
90
26811184101
import sys n = int(input()) m = int(input()) floyd = [[int(1e12)]*n for _ in range(n)] for _ in range(m): x, y, w = map(int, sys.stdin.readline().split()) x -=1 y -=1 floyd[x][y] = min(floyd[x][y], w) def pa(): for line in floyd: for item in line: if item == int(1e12): print(0, end=" ") ...
cyw320712/problem-solving
Baekjoon/python/11404.py
11404.py
py
642
python
en
code
3
github-code
90
71320449898
from django.core.validators import MaxValueValidator, MinValueValidator from django.db import models from api_users_auth.models import CustomUser from titles.models import Title class Review(models.Model): score = models.IntegerField( validators=[ MinValueValidator(1, message='Введите число н...
bdcry/api_yamdb
api/models.py
models.py
py
1,904
python
en
code
0
github-code
90
15273588337
class Solution: def arrayRankTransform(self, arr: List[int]) -> List[int]: hashMap = {} ans = [1]*len(arr) for i,v in enumerate(arr): if v in hashMap: hashMap[v].append(i) else: hashMap[v] = [i] heapq.heapify(a...
kelvinleong0529/Leet-Code
1331-rank-transform-of-an-array/1331-rank-transform-of-an-array.py
1331-rank-transform-of-an-array.py
py
648
python
en
code
3
github-code
90
30697002074
import csv import os.path filelist = "file-list.txt" par_file = "csv/par-fontes.csv" lit_file = "csv/lit-fontes.csv" def csv_file (typo,csvfile): basename = os.path.basename(csvfile) base = os.path.splitext(basename)[0] return f"csv/{typo}-{base}.csv" def one_result (csvfile): with open (csvfile) as f: ...
hietjmo/frequentia
list-fontes-as-text.py
list-fontes-as-text.py
py
1,138
python
en
code
2
github-code
90
35518391297
import pathlib import re import sys from os import system from setuptools import setup, find_packages # 'setup.py publish' shortcut. if sys.argv[-1] == "publish": system("python setup.py sdist bdist_wheel") system("twine upload dist/*") sys.exit() if sys.version_info < (3, 6, 0): raise RuntimeError("...
mkb79/audible-cli
setup.py
setup.py
py
2,205
python
en
code
326
github-code
90
2728138646
from filters import IsPrivate from states import calculator as cal from loader import dp from aiogram.dispatcher import FSMContext from aiogram import types from aiogram.types import InlineKeyboardMarkup, InlineKeyboardButton @dp.message_handler(IsPrivate(), text='🧮 Калькулятор') async def calculator(message: types....
myelixrrrseees/PROTECT_AIOGRAM
handlers/users/calculator.py
calculator.py
py
1,251
python
en
code
0
github-code
90
12077481130
from django.core.paginator import Paginator, EmptyPage, PageNotAnInteger def paginate(queryset,page_no,page_size): paginator = Paginator(queryset, page_size) try: data = paginator.page(page_no) except PageNotAnInteger: # If page is not an integer, deliver first page. data = paginato...
hemanth7787/generic-online-store
utils/helpers.py
helpers.py
py
496
python
en
code
0
github-code
90
44649658083
# -*- coding: utf-8 -*- """ Created on Sat Apr 23 14:01:07 2022 @author: allen """ import pandas as pd import matplotlib.pyplot as plt df = pd.read_csv('flow_expert.csv') df = df[df['Time'] >= 0] good_flow = df[df['Flow'] == True] bad_flow = df[df['Flow'] == False] print(df.columns) for column in df...
cowonthelawn/ReBeater
FlowEDA.py
FlowEDA.py
py
1,250
python
en
code
0
github-code
90
34869969330
""" :func:`~pandas.eval` parsers. """ from __future__ import annotations import ast from functools import ( partial, reduce, ) from keyword import iskeyword import tokenize from typing import ( Callable, ClassVar, TypeVar, ) import numpy as np from pandas.errors import UndefinedVariableError imp...
pandas-dev/pandas
pandas/core/computation/expr.py
expr.py
py
25,160
python
en
code
40,398
github-code
90
44886267793
def sum_of_multiples(limit, multiples): nums = set() for m in multiples: if m == 0: continue curr = m while(curr < limit): print(f'multiple:{m}, curr: {curr}') nums.add(curr) curr += m return sum(nums) print(sum_of_multiples(10, ...
hemal7735/exercism
python/sum-of-multiples/sum_of_multiples.py
sum_of_multiples.py
py
329
python
en
code
0
github-code
90
18773146597
import pygame from random import randint, choice from block_size import block_size import color from messages import messages pygame.init() pygame.display.set_caption("SNAKE") MAX_SCALE = (pygame.display.Info().current_w, pygame.display.Info().current_h) MAX_SCALE_BLOCK_SIZE = block_size(MAX_SCALE[0], MAX_SCALE[1], m...
bhauvae/SnakeGame
main.py
main.py
py
12,766
python
en
code
0
github-code
90
12287252708
#!/usr/bin/python """ goal, feed in moquery output from text, json, or xml and create local dict that we can walk through and print FULL record matching user provided regex string - xml parse failure: snmp string with '&' character at at end cat file.xml | sed 's/&\]/\]/g' | sed 's/&"/"...
acpeaco2/section_parser
section_parser.py
section_parser.py
py
28,672
python
en
code
0
github-code
90
8815683968
import pytest import os import sys sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), '..', 'src'))) from mfa import mfa, listener import documenter as doc import time import multiprocessing as mp def worker(data): print(data) string, num, file, q = data start = time.time() res...
dyshes/webninja
test/test_mfa.py
test_mfa.py
py
1,240
python
en
code
0
github-code
90
13101733518
heigh = int(input('your heigh?')) weight = int(input('your weight')) ybmi = weight/heigh**2 if ybmi >= 30: print('very overweight') elif ybmi >=25: print ('overweight') elif ybmi >= 18.5: print('normal') else: print('underweight')
Johnbui93/buixuantruong-fundamental-d4e14
session2/bmi.py
bmi.py
py
248
python
en
code
0
github-code
90
42137397148
from odoo import models, fields, api , _ from dateutil import relativedelta from dateutil.relativedelta import relativedelta from datetime import datetime ,timedelta ,date class CareCard(models.Model): _name = 'care.card' card_no = fields.Char(string="Card Number",readonly=True,copy=False,default=lambda self: _...
khadegaAhmed/odooTraining-ass2
website-module/models/careCard.py
careCard.py
py
1,600
python
en
code
0
github-code
90
2315062098
import numpy as np import cv2 import tensorflow as tf from PIL import Image import glob from collections import defaultdict # Read original BDD val labels and only select labels with pedestrians def format_labels(images): format_labels = [] for img in images: for l in img['labels']: ...
iman-saleh/ethical-ai
bias_utils.py
bias_utils.py
py
12,111
python
en
code
1
github-code
90
18420907319
from itertools import accumulate n,k=map(int,input().split()) s=input() i=0 if s[0]=='1': lst=[] else: lst=[0] while i<n: j=i cnt=0 while j<n and s[i]==s[j]: cnt+=1 j+=1 lst.append(cnt) i=j if 2*k+1>=len(lst): print(n) exit(0) csum=list(accumulate(lst)) cur=...
Aasthaengg/IBMdataset
Python_codes/p03074/s976691993.py
s976691993.py
py
452
python
en
code
0
github-code
90
4993473729
from dateutil.parser import parse as date_parser from mock import Mock import pytest from easytrakt.models import Episode from easytrakt.models import Movie from easytrakt.models import MovieWatchlist from easytrakt.models import Season from easytrakt.models import Settings from easytrakt.models import Show def test...
lad1337/easytrakt
tests/unit/test_data_retrieval.py
test_data_retrieval.py
py
5,672
python
en
code
1
github-code
90
19602651216
""" Cross-platform clipboard syncing tool Copyright (C) 2013 Syncboard This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your opt...
syncboard/syncboard
src/gui_connections.py
gui_connections.py
py
18,329
python
en
code
0
github-code
90
71660735018
import modulo_csv def leer(archivo): """[Autor: Alfonso] [Ayuda: Lee el archivo linea por linea] """ lineas = [linea.rstrip('\n') for linea in archivo] return lineas def abro_archivo(archivo): """[Autor: Alfonso] [Ayuda: abre un archivo] """ # encoding="utf8" us...
valentinthourte/tp-algoritmos1
m_generar_archivos_csv.py
m_generar_archivos_csv.py
py
6,427
python
es
code
0
github-code
90
18297673039
import numpy n, m = [int(i) for i in input().split()] A = [int(i) for i in input().split()] sup_A = 10 ** 5 B = [0] * (1 << 18) for a in A: B[a] += 1 C = numpy.fft.fft(B) D = numpy.fft.ifft(C * C) ans = 0 cnt = 0 for i in range(2 * sup_A, -1, -1): d = int(D[i].real + 0.5) if cnt + d >= m: ans += (...
Aasthaengg/IBMdataset
Python_codes/p02821/s271119830.py
s271119830.py
py
388
python
en
code
0
github-code
90
44076104359
import threading import time import geometry_msgs.msg import nav_msgs.msg import rospy from ..utils.position2 import Position2 class GoalPlannerAdapter(object): def __init__(self, planner, map_adapter, robot_state, goal_topic_name, path_topic_name, planning_timeout, planner_rate, is_point=True,...
MisterMap/pytorch-motion-planner
neural_field_optimal_planner/ros/goal_planner_adapter.py
goal_planner_adapter.py
py
3,073
python
en
code
5
github-code
90
43325024074
class personal: def __init__(self, pilot, stewardess): self.pilot = pilot self.stewardess = stewardess class ticket: def __init__(self, ticket_type,ticket_cost): self.ticket_type = ticket_type self.ticket_cost = ticket_cost class Airplane: def __init__(self,model,gas,gas_co...
Torkvamedo/smx
Part2/HW_5.py
HW_5.py
py
1,157
python
en
code
0
github-code
90
18237669742
from flask import Blueprint, render_template, jsonify,request import sqlite3 admin_data_bp = Blueprint('admin_data_bp',__name__, template_folder='templates') DB_NAME = 'details2.db' TABLE_NAME = 'details2' @admin_data_bp.route('/admin_data',methods = ['GET','POST']) def admin_data(): if request.method == 'GET': ...
saijaligama/m_sche
services/admin_data_service.py
admin_data_service.py
py
667
python
en
code
0
github-code
90
18493120369
S = input() T = input() sts = set(S) stt = set(T) for i in range(26): c = chr(ord('a')+i) idx1 = [i for i, x in enumerate(T) if x == c] st1 = set([]) idx2 = [i for i, x in enumerate(S) if x == c] st2 = set([]) for j in idx1: if S[j] not in st1 and len(st1) > 0: print('No') exit() el...
Aasthaengg/IBMdataset
Python_codes/p03252/s434099665.py
s434099665.py
py
510
python
en
code
0
github-code
90
8638044435
# -*- coding: utf-8 -*- """ Spyder Editor This is a temporary script file. """ import os import pandas as pd newshade=[] dayofyear=1 shade=pd.read_csv("shade.csv") shade=shade.loc[shade['Date']==dayofyear] shade=shade.reset_index(drop=True) airmass=getAirmass(wdata)
kaiser34/unlv_met_station
test.py
test.py
py
273
python
en
code
0
github-code
90
73077482856
import numpy as np from scipy.fftpack import ifft from AudioDSP.spectrogram import STFT, OverlapAdd from AudioDSP import utils as U from AudioDSP.visualization import visualization as V # Param_ISTFT not necessary. Use Param_STFT. class ISTFT(U.NewModule): # ISTFT module def __init__(self, param_STFT=...
DavideBusacca/AudioDSP
spectrogram/ISTFT.py
ISTFT.py
py
5,552
python
en
code
0
github-code
90
37104393697
# -*- coding: utf-8 -*- import numpy as np from scipy.optimize import minimize from abacus.config import EPSILON class RiskAssessor: """ Used for the risk assessment of portfolio returns given an empirical return distribution. Risk assessment is found through standard measurements of Value at Risk and Ex...
Sinbad-The-Sailor/Abacus
src/abacus/utilities/risk_assessor.py
risk_assessor.py
py
5,885
python
en
code
15
github-code
90
18370889459
n = int(input()) a = list(map(int, input().split())) di = {} for i in a: if i in di: di[i] += 1 else: di[i] = 1 k = list(di.keys()) v = list(di.values()) if n%3!=0 and len(di)>1: print('No') elif len(di)==3 and v[0]==v[1]==v[2] and k[0]^k[1]^k[2]==0: print('Yes') elif len(di)==2 and ((v[...
Aasthaengg/IBMdataset
Python_codes/p02975/s996269201.py
s996269201.py
py
484
python
en
code
0
github-code
90
23713713662
from flask import url_for from flask_testing import TestCase from application import app from unittest.mock import patch class TestBase(TestCase): def create_app(self): return app class TestService3(TestBase): def test_all_activities(self): for _ in range(20): response = self.clien...
InaamIslam/DevOps_Project2
service3/testing/test_service3.py
test_service3.py
py
1,646
python
en
code
1
github-code
90
72063446058
import leitorpkmn from sys import stdin import xml.etree.ElementTree as ET import ataque class Pokemon: def __init__(self, atrib = ['', -1, -1, -1, -1, -1, -1, -1, -1, []]): if (len(atrib) < 10): print("Atributos faltando no Pokemon!!") while (len(atrib) < 10): atrib.append(-1) atrib[1] = -1 atrib[...
QuartetoFantastico/projetoPokemon
pokemon.py
pokemon.py
py
4,539
python
en
code
0
github-code
90
41833448670
#!/usr/bin/env python # coding: utf-8 # In[1]: SYSVOLT = 5 ADC_RESOLUTION = 4095 MAX_VOLT = 2.442 MIN_VOLT = 0 MIN_TEMP = -50 MAX_TEMP = 50 # In[2]: def adc_raw_value(v): if(v >= MIN_VOLT and v <= MAX_VOLT): ADC = (v*(ADC_RESOLUTION/SYSVOLT)) return round(ADC) else: return None ...
96ibman/datainsight_datascience_program
adc_to_temp/adc_to_temp.py
adc_to_temp.py
py
986
python
en
code
0
github-code
90
16471811244
import csv # Create frequency dictionary datasetNumber = 2 believabilityColStr = "True" # Change what value of row you're looking for (In this case True or False) filePrefix = believabilityColStr.upper() myDict = {} with open(f'./dataForSmallBarCharts/dataset_{datasetNumber}_with_urls.csv') as csv_file: # Choose whi...
chrisWyble/BarChartsInD3
frequencyCounter.py
frequencyCounter.py
py
3,303
python
en
code
0
github-code
90
42361987862
# def lengthOfLongestSubstring(s): # """ # :type s: str # :rtype: int # """ # curr_count = 0 # max_count = 0 # curr_s = "" # max_s = "" # # chars = {} # # for char in chars: # if char not in chars: # chars[char] = char # curr_s = curr_s + char # ...
priyankaparikh/algorithms
strings/longest_sub.py
longest_sub.py
py
1,141
python
en
code
2
github-code
90
10526604590
from pytube import YouTube from sys import argv link = argv[1] youtubeObject = YouTube(link) print("Currently downloading audio of: ", youtubeObject.title) print("From: ", youtubeObject.author) print("From: ", youtubeObject.length) audioFromObject = youtubeObject.streams.get_audio_only() audioFromObject.download('....
WojMam/youtube-downloader
downloadAudio.py
downloadAudio.py
py
338
python
en
code
2
github-code
90
30657719850
import scrapy import re from pymongo import MongoClient class PdgaSpider(scrapy.Spider): name = 'pdga' def __init__(self, number): self.start_urls = ['http://pdga.com/player/' + number + '/details'] def parse(self, response): client = MongoClient('mongodb+srv://newuser:NewUserPassword2021!!@cs4830.ie08b.mo...
noahfree/1000-rated-rounds-webscraper
python/spiders/pdga.py
pdga.py
py
1,053
python
en
code
0
github-code
90
2512653351
from sys import stdin input = stdin.readline n = int(input()) gw = 0 for _ in range(n): s = input().rstrip() stack = [] for i in s: if i == 'A': if stack and stack[-1] == i: stack.pop() else: stack.append('A') elif i == 'B': ...
0dOj/0dOj_Algorithm
Python/3000~3999/3986.py
3986.py
py
477
python
en
code
0
github-code
90
73379827815
import sys LEFT_CAM_ID = "0F259C0F" CENTER_CAM_ID = "1AE49C0F" RIGHT_CAM_ID = "A01B64BF" THERMAL_CAM_ID = None HUMAN_STR = { LEFT_CAM_ID: "left", CENTER_CAM_ID: "center", RIGHT_CAM_ID: "right", THERMAL_CAM_ID: "thermal" } CAM_ID = { "left": LEFT_CAM_ID, "center": CENTER_CAM_ID, "right": R...
Ztrura/Infosec_final
Infosec_final/const.py
const.py
py
1,434
python
en
code
0
github-code
90
7218975135
class UnionFind: def __init__(self, V): self.par = [-1 for _ in range(V)] self.siz = [1 for _ in range(V)] def root(self, i): if self.par[i] == -1: return i else: return self.par[i] == self.root(self.par[i]) def issame(self, x, y): return sel...
meshidenn/algorithm_and_data_structure
python/chap11/practice11.1.py
practice11.1.py
py
1,116
python
en
code
0
github-code
90
72994538538
import requests from requests import get from bs4 import BeautifulSoup import sqlite3 import json from secret_data import OMDb_API_Key import csv import sys # import plotly # import plotly.express as px # Caching imdb json IMDB_CACHE_FNAME = 'cache_imdb.json' try: cache_file = open(IMDB_CACHE_FNAME, 'r') cache...
rexchsu/si507
final_project.py
final_project.py
py
6,983
python
en
code
0
github-code
90
74099235178
""" Given the head to a singly linked list, where each node also has a “random” pointer that points to anywhere in the linked list, deep clone the list. """ class Node: def __init__(self, value, next=None, random=None): self.value = value self.next = next self.random = random def deepcop...
danny-hunt/Problems
random_list_clone/random_list_clone.py
random_list_clone.py
py
455
python
en
code
2
github-code
90
19378840446
# Given a string s, return the longest palindromic substring in s. class Solution: def longestPalindrome(self, s: str) -> str: size = len(s) if size < 2: return s start_idx = 0 max_length = 1 dp = [[False for _ in range(size)] for _ in range(size)] for ...
joneyyx/LeetCodes
elementaryAlgorithms/Dynamic Programming/5LongestPalindrome.py
5LongestPalindrome.py
py
1,071
python
en
code
0
github-code
90
3494401134
import os import os.path import xlrd # 读取文档路径 rootdir = r"D:\FromWget\test" # 将符合金融行业的文件名写入以下文档 file_object = open('Result.txt','w',encoding='utf-8') # 最后更新日期 last_Update_Date = "2018-06-30" # 结果集列表 finance_List = [] # 金融产品结果 last_Update_List = [] # 符合最后更新日期结果 grow_List = [] # 符合成长条件结果 # 读取文件,根据A16是否有值 判断 是否是金融行业 def ...
muyifang1/woodyblockQuant
python/RecordFinanceNames.py
RecordFinanceNames.py
py
2,984
python
zh
code
0
github-code
90
18028299129
N = int(input()) S = input() x = 0 xmax = 0 for i in range(N): if S[i] == "I": x += 1 elif S[i] == "D": x -= 1 if xmax <= x: xmax = x print(xmax)
Aasthaengg/IBMdataset
Python_codes/p03827/s629816347.py
s629816347.py
py
181
python
en
code
0
github-code
90
20697015695
from intervalframe import IntervalFrame from ailist import LabeledIntervalArray from math import e import numpy as np import pandas as pd import glob # Local imports from ..fragments import Fragments from ..io.read_sam import from_sam from ..segment.cnv import call_cnvs from ..correct.correct_intervals import calculat...
kylessmith/ngsfragments
ngsfragments/metrics/gene_activity.py
gene_activity.py
py
10,309
python
en
code
1
github-code
90
31695247551
import pytest from src.main.image_processor import ImageProcessor from constants import * from src.main.result_processor import ResultProcessor from src.main.alert_processor import AlertProcessor import datetime @pytest.fixture def local_alert_processor(): alert=AlertProcessor() return alert @pytest.fixtur...
sidharthbolar/raspberry-pi-wfh-efficiency
src/test/conftest.py
conftest.py
py
1,090
python
en
code
1
github-code
90
39892247830
hour, minute = input().split() hour = int(hour) minute = int(minute) if hour > 24 or minute > 60: print('잘못된 시간 입력입니다.') elif minute - 45 < 0: if hour - 1 < 0: hour = 24 - 1 else: hour -= 1 minute = (60 + minute) - 45 else: minute -= 45 print(hour, minute)
CukCoding/GimBab
WinterVacation2021/1주차/2884.py
2884.py
py
313
python
en
code
0
github-code
90
13810179989
from django.apps import AppConfig class EventConfig(AppConfig): default_auto_field = 'django.db.models.BigAutoField' name = 'event' def create_new_permissions(self): from django.contrib.contenttypes.models import ContentType from django.contrib.auth.models import Permission from ...
HackAssistant/hackassistant
event/apps.py
apps.py
py
1,670
python
en
code
6
github-code
90
18744250545
import torch from torch import nn def diceCoeffv2(pred, gt, eps=1, activation='sigmoid'): r""" computational formula: dice = (2 * tp) / (2 * tp + fp + fn) """ if activation is None or activation == "none": activation_fn = lambda x: x elif activation == "sigmoid": activation_fn ...
kaoxing/seg
mytrain/ModelClass/lossFunc.py
lossFunc.py
py
1,685
python
en
code
2
github-code
90
26251731268
howmany = int(input()) elems = list(map(int, input().split())) """ 순열 알고리즘의 key point : 하나씩 뽑아서 두고, 나머지 리스트에서 다시 재귀해서 그 뽑아 뒀던거랑 하나씩 붙이는 거! permutation([1,2,3,4],2) = ([1] + permutation([2,3,4],1)) and ([2] + permutation([1,3,4],1)) and ([3] + permutation([1,2,4],1)) and ([4] + permutation([1,2,3],1)) """ def perm(ls...
MaxKim-J/hufs-algorithm-study
yunhee/10819 - 차이를 최대로.py
10819 - 차이를 최대로.py
py
1,241
python
ko
code
1
github-code
90
40329846265
#!/usr/bin/env python3 # -*- coding: utf-8 -*- #导入需要的包 from pyecharts import options as opts from pyecharts.charts import Sankey #列全涉及的节点名称 nodes = [ {"name": "产品1"}, {"name": "产品2"}, {"name": "产品3"}, {"name": "产品4"}, {"name": "产品5"}, {"name": "产品6"}, {"name": "新增"}, ] #节点之间的关系和数量,source起...
gswyhq/hello-world
作图/桑基图.py
桑基图.py
py
1,539
python
en
code
9
github-code
90
23165053112
import random score_ordi = 0 score_player = 0 def end(who): if who == "player": input("\nVous avez gagné!") score_player += 1 elif who == "nobody": input("\nEgalité.") else: input("\nVous avez perdu.") score_ordi += 1 def manche(): choix_joueur = inp...
Bic3D/NSI
python/shifumi.py
shifumi.py
py
1,467
python
fr
code
0
github-code
90
2900478720
import os import tqdm import wandb import pandas as pd from pandas.api.types import is_list_like from typing import List, Dict, Any, Union def get_runs(project: str = "opentensor-dev/openvalidators", filters: Dict[str, Any] = None, return_paths: bool = False) -> List: """Download runs from wandb. Args: ...
opentensor/validators
analysis/utils.py
utils.py
py
3,855
python
en
code
9
github-code
90
4886833980
import datetime import sys import helpers from bson import Binary, Code import math import numpy as np import matplotlib.pyplot as plt import os from pylab import * def main(sessDB='sessionsNew',show=False,save=False): ''' ''' col = helpers.getCollection(sessDB) groups = getMaxMinForUsers(col) time...
mcmhav/suchBazar
statsMakers/userAges.py
userAges.py
py
4,372
python
en
code
0
github-code
90
18306017419
N = int(input()) A_list = [] for i in range(N): A = int(input()) A_list.append([list(map(int, input().split())) for _ in range(A)]) def judge(mask): for i in range(N): if (mask>>i & 1)==0: continue for xy in A_list[i]: x = xy[0]-1 y = xy[1] ...
Aasthaengg/IBMdataset
Python_codes/p02837/s622149285.py
s622149285.py
py
647
python
en
code
0
github-code
90
16376840794
from __future__ import print_function from flask import Flask, render_template, request import requests app = Flask(__name__) @app.route('/get-weather', methods=['POST']) def get_weather(): zipCode = request.form['zipcode'] apiKey = '2aa22bfd4f125e1fe25e5f74afdeec7b' url = 'https://api.openweathermap.org...
chinnu110/sample-project
weather-app/app.py
app.py
py
987
python
en
code
0
github-code
90
20746033031
# from model.backbone import resnet18_SFNet, resnet50_SFNet # 加载预训练模型与参数 # from model.model_Test import Test_model # from model.model_Updown_HMSA_InverForm_GSCNN_SFNet import Updown_HMSA_InverForm_GSCNN_SFNet from util.util import AverageMeter, poly_learning_rate, intersectionAndUnionGPU, find_free_port, get_args...
Yanhua-Zhang/MultiTrans
Project_MultiTrans_V0/model_summary_backbone.py
model_summary_backbone.py
py
1,670
python
en
code
0
github-code
90
1834843448
#!/usr/bin/env python # -*- coding:utf-8 -*- from pymongo import MongoClient import regex as re settings = { "ip":'localhost', #ip "port":27017, #端口 "db_name" : "mydb", #数据库名字 "set_name" : "test_set" #集合名字 } class MyMongoDB(object): def __init__(self): try: sel...
liuhyzhy0909/FMSNLP
MongoForFMS.py
MongoForFMS.py
py
1,516
python
en
code
0
github-code
90
73138074216
#!/usr/bin/python import os import sys from optparse import OptionParser import subprocess import requests def _get_project(): git_remote = subprocess.Popen(['git', 'remote', '-v'], stdout=subprocess.PIPE, stderr=subprocess.STDOUT) git_remote = git_remote.communicate() url = git_remote[0].split(' ')[0] ...
tomascanzoniero/git-tool
main.py
main.py
py
4,788
python
en
code
0
github-code
90
2036684907
#!/usr/bin/env python3 import asyncio import os import sys import logging import time from JDIN import config from JDIN import logger from JDIN import BaseProtocol trace = logging.getLogger(__name__) class Tester(): def __init__(self, ip, port): self.tcase = dict() self.__addr = ...
choibyoungyun/CLI
modules/JDIN/OAMTester.py
OAMTester.py
py
4,040
python
en
code
0
github-code
90
16627618737
from re import template from fastapi import FastAPI, Body from starlette.templating import Jinja2Templates from starlette.requests import Request import sqlalchemy engine = sqlalchemy.create_engine( 'mysql+pymysql://root:Makt0112pc-49466@localhost:3306/db_fastapi') app = FastAPI( title='FastAPIでつくるtoDoアプリケー...
poteto1212/fastapi_sql
controllers.py
controllers.py
py
1,975
python
en
code
0
github-code
90
20388946289
import typing as tp from pathlib import Path from sklearn.metrics import roc_auc_score from tg.grammar_ru.ml.components import GrammarMirrorSettings from tg.common.ml import batched_training as bt from tg.common.ml.batched_training import torch as btt from tg.common.ml.batched_training import mirrors as btm features...
okulovsky/grammar_ru
archive/SemyonKolesnikov/common/run_training.py
run_training.py
py
2,485
python
en
code
11
github-code
90
18036016739
n = int(input()) a = list(map(int, input().split())) flg = 0 a.sort() if n % 2 == 0: if a[0] == 1 and a[1] == 1: for i in range(2, n, 2): if a[i] == a[i + 1] and a[i - 1] + 2 == a[i]: continue else: flg = 1 break else: flg = 1 else: if a[0] == 0: for i in range(1, ...
Aasthaengg/IBMdataset
Python_codes/p03846/s225379130.py
s225379130.py
py
529
python
en
code
0
github-code
90
44848400666
import re import akshare as ak import datetime from pycnnum import cn2num def compare_4lpr(mystr,year,month,day): """ mystr:输入文本如“月利率0.2%” year,month,day:LPR参考的时间,格式为2022,2,21 return:转换后相应的月利率monthly_rate,是否大于4倍LPR """ # 1.提取给定时间的LPR lpr_df = ak.macro_china_lpr() # 一年期lpr lpr_1...
DongQian89/rate-comparison
rateTool/compare.py
compare.py
py
2,785
python
en
code
0
github-code
90
20368711951
class Solution: def rotate_left(self,people,value,index): if len(people) > 1100: return 0 # print("#input",people) for _ in range(value): people[index],people[index-1] = people[index-1],people[index] index -= 1 return people def reconstruc...
RishabhSinha07/Competitive_Problems_Daily
406-queue-reconstruction-by-height/406-queue-reconstruction-by-height.py
406-queue-reconstruction-by-height.py
py
1,002
python
en
code
1
github-code
90
18289640699
import sys # ## COMBINATION (MOD) ## # MOD = 10**9 + 7 # , N = 2*10**5 で 0.3s N_MAX = 10**5 + 1 # 問題サイズに合わせて変えておく fac = [1, 1] # 元テーブル facinv = [1, 1] # 逆元テーブル inv = [0, 1] # 逆元テーブル計算用テーブル for i in range(2, N_MAX + 1): fac.append((fac[-1] * i) % MOD) inv.append((-inv[MOD % i] * (MOD // i)) % MOD) f...
Aasthaengg/IBMdataset
Python_codes/p02804/s281186094.py
s281186094.py
py
971
python
ja
code
0
github-code
90
23427758432
import uuid import json import logging from urllib.parse import quote, urlencode from django.conf import settings from rest_framework.status import ( HTTP_500_INTERNAL_SERVER_ERROR, HTTP_400_BAD_REQUEST, ) from rest_framework.decorators import api_view from rest_framework.response import Response as RestRespo...
sysang/myinfoablr
server/myinfoapi/views.py
views.py
py
2,319
python
en
code
1
github-code
90
31290370192
from .nodes import Node from .player import Player from .tree import create_game_tree, branches_from_dealer from .cards import * class Game: """ Facilitates a game of poker """ def __init__(self, tree: Node): names = ['SB', 'BB'] cards = draw_random_cards(all_cards_excluding(), 9) ...
kailasbk/pokerbots-21
cfr/game.py
game.py
py
3,518
python
en
code
0
github-code
90
18340032469
odd='RUD' even='LUD' s=input() flag=0 for i in range(len(s)): a=i+1 if a%2==0: if s[i] not in even: flag=1 break else: if s[i] not in odd: flag=1 break if flag==1: print ('No') else: print ('Yes')
Aasthaengg/IBMdataset
Python_codes/p02910/s696277766.py
s696277766.py
py
238
python
en
code
0
github-code
90
38234500285
import functools import traceback from dataclasses import dataclass from enum import Enum, auto from typing import ( TYPE_CHECKING, Any, Callable, Dict, List, Optional, Set, Tuple, Union, ) import torch import torch.distributed as dist import torch.nn as nn import torch.nn.functiona...
fengbingchun/PyTorch_Test
src/pytorch/torch/distributed/fsdp/fully_sharded_data_parallel.py
fully_sharded_data_parallel.py
py
53,869
python
en
code
14
github-code
90
18188816809
import math import collections import fractions import itertools import functools import operator import bisect def solve(): n, m, k = map(int, input().split()) a = list(map(int, input().split())) b = list(map(int, input().split())) ruia, ruib = [0], [0] for i in range(n): ruia.append(a[i]+ruia[i])...
Aasthaengg/IBMdataset
Python_codes/p02623/s377283566.py
s377283566.py
py
607
python
en
code
0
github-code
90
34829702879
import argparse import cogapp import contextlib import io import os import os.path import random import shlex import shutil import sys import tempfile guid = None projects = None local = None def problem_number(s): try: n = int(s) if 0 < n <= 26: return n - 1 except ValueError: ...
Ralor/acm-conventions
generator/__main__.py
__main__.py
py
5,216
python
en
code
1
github-code
90
9583245882
# Leetcode 424 from collections import defaultdict class Solution: def characterReplacement(self, s: str, k: int) -> int: frequency = defaultdict(int) left = 0 max_length = 0 max_frequency = 0 for right,elem in enumerate(s): frequency[elem]+=1 max_fr...
JamilHaidar/LeetCodeExercises
Blind75/SlidingWindow/Longest_Repeating_Character_Replacement.py
Longest_Repeating_Character_Replacement.py
py
574
python
en
code
1
github-code
90