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
18105972879
def bubble_sort(A): swap_cnt = 0 for i in range(len(A)): for j in range(len(A) - 1, i, -1): if A[j] < A[j - 1]: A[j], A[j - 1] = A[j - 1], A[j] swap_cnt += 1 return A, swap_cnt n = int(input()) A = list(map(int, input().split())) A, swap_cnt = bubble_sor...
Aasthaengg/IBMdataset
Python_codes/p02259/s690490414.py
s690490414.py
py
371
python
en
code
0
github-code
90
13173298201
import pandas as pd import pickle import time import sys from datetime import timedelta from math import isnan class StatCruncher: def __init__(self, df_path, roster, teamStats, setType): self._df = pd.read_csv(df_path, compression='gzip', dtype=setType) self._roster = roster self._teamStat...
aleko-/nbacruncher
cruncher.py
cruncher.py
py
11,213
python
en
code
0
github-code
90
72014988138
from fastapi import FastAPI from fastapi.responses import HTMLResponse from starlette.middleware.cors import CORSMiddleware # 追加 import pandas as pd app = FastAPI() app.add_middleware( CORSMiddleware, allow_origins=["*"], allow_credentials=True, # 追記により追加 allow_methods=["*"], # 追記により追加 al...
nobusugahara-japan/fastapi-hpml
sample/main.py
main.py
py
2,531
python
en
code
0
github-code
90
17848451032
from flask import Blueprint, Flask, send_file, abort, jsonify, Response from flaskr import service from pathlib import Path import os IMG_PATH = Path("./flaskr") IMG = IMG_PATH / "data.png" bp = Blueprint("controller", __name__, url_prefix="/data") app = Flask(__name__) @bp.route("/get-sum", methods=["GET"]) def ge...
ethan-tauriainen/aeris_project
flaskr/controller.py
controller.py
py
1,228
python
en
code
0
github-code
90
73778754535
#!/usr/bin/python3 import json import time import requests import urllib.parse from selenium import webdriver from webdriver_manager.chrome import ChromeDriverManager from selenium.webdriver.common.by import By from selenium.webdriver.support import expected_conditions as EC from selenium.webdriver.support.ui import ...
Bora2k3/Writing_a_Web_Crawler_Using_Python
Week1/7_instagram/insta.py
insta.py
py
2,366
python
en
code
0
github-code
90
20850854182
class Solution: def smallerNumbersThanCurrent(self, nums): result = [] for element in range(len(nums)): j = 0 count = 0 while j < len(nums): if nums[element] > nums[j]: count += 1 j += 1 print("elemen...
Harishkumar18/data_structures
coding_problems/nos_smaller_current.py
nos_smaller_current.py
py
472
python
en
code
1
github-code
90
72367680938
from conexao.conexaoBD import ConexaoBD class AvisosDao: _conexaoBD = ConexaoBD() _conexao = _conexaoBD.criarConexao() def __int__(self): pass def adicionarAviso(self, vetorAtributos): cursor = self._conexao.cursor() sql = "INSERT INTO avisos (avi_id, avi_titulo, avi_descricao...
ArthurOliveira173/Repositorio-Estagio
dao/avisosDao.py
avisosDao.py
py
1,449
python
en
code
0
github-code
90
27388821095
import os import pandas as pd from sqlalchemy import create_engine from statsmodels.tsa.arima.model import ARIMA import matplotlib.pyplot as plt from dotenv import load_dotenv load_dotenv() def get_games_from_db(): engine = create_engine(f'postgresql://{os.getenv("DB_USER")}:{os.getenv("DB_PASSWORD")}@localhost/{...
kahlstorf1/pawnalytics
regression/arima.py
arima.py
py
1,093
python
en
code
0
github-code
90
43699407442
import pytest import urllib3 import deal def test_pure_silent(): @deal.pure def func(msg): if msg: print(msg) func(None) with pytest.raises(deal.SilentContractError): func('bad') def test_pure_safe(): func = deal.pure(lambda x: 1 / x) func(2) with pytest.rai...
life4/deal
tests/test_runtime/test_pure.py
test_pure.py
py
635
python
en
code
637
github-code
90
39250386924
from flask import Flask, request, render_template app = Flask(__name__) @app.route("/", methods=["GET", "POST"]) def zip_code(): if request.method == "GET": return render_template('task_2.html') elif request.method == "POST": code = request.form['code'] try: if isinstance(...
EwaJakub/Podstawy_Pythona
08_Dzien_4_-_praca_domowa/task_2.py
task_2.py
py
696
python
en
code
0
github-code
90
18388358319
P,Q,R=[int(s) for s in input().split(" ")] List=[P,Q,R,P] Ans=[] SUM=0 for i in range(3): SUM=List[i]+List[i+1] Ans.append(SUM) print(min(Ans))
Aasthaengg/IBMdataset
Python_codes/p03011/s653356569.py
s653356569.py
py
158
python
en
code
0
github-code
90
7514000881
""" Ziwei Zhu Computer Science and Engineering Department, Texas A&M University zhuziwei@tamu.edu """ from data_preprocessor import * import tensorflow as tf import time import argparse import os from JCA import JCA if __name__ == '__main__': neg_sample_rate = 1 date = time.strftime('%y-%m-%d', time.localtime...
Zziwei/Joint-Collaborative-Autoencoder
test.py
test.py
py
1,971
python
en
code
14
github-code
90
4107613692
from oauth2client.contrib.appengine import OAuth2Decorator OAUTH_DECORATOR = OAuth2Decorator( client_id='405427916132-5973brd7egkdsptqdck52992lvspvv0s.apps.googleusercontent.com', client_secret='sBgVwvA6caPGsb4vJY9mwROM', scope=[ 'https://www.googleapis.com/auth/userinfo.email', ], callbac...
atishn/hackathon-in-between
meetapp/handlers/oauth2callback.py
oauth2callback.py
py
347
python
en
code
0
github-code
90
18380449633
#!/usr/bin/env python # coding: utf-8 # In[ ]: import time import threading import datetime class Snow(object): def __init__(self, idx=None): init_date = time.strptime('2020-04-01 00:00:00', "%Y-%m-%d %H:%M:%S") self.start = int(time.mktime(init_date) * 1000) self.last = int(time.time...
lyt0527/Snowflakes
Snowflakes.py
Snowflakes.py
py
1,308
python
en
code
0
github-code
90
18927412801
import torch import torch.nn as nn import torch.nn.functional as F from options import opt class CapsuleNet_EM(nn.Module): def __init__(self, input_size, relation_vocab): super(CapsuleNet_EM, self).__init__() self.primary_caps = PrimaryCaps(16, 16) self.class_capsule = ClassCaps(16, relat...
foxlf823/ADExtractor
capsule_em.py
capsule_em.py
py
6,566
python
en
code
1
github-code
90
71052210537
#!/usr/bin/env python3 import os from cryptography.fernet import Fernet files = [] #add files to files array if file is a file for file in os.listdir(): if file == "encrypt.py" or file == "encryption.key" or file == "decrypt.py": continue if os.path.isfile(file): files.append(file) print(files) #read encrpy...
therealhalonen/PhishSticks
notes/rajala/Contents/decrypt.py
decrypt.py
py
723
python
en
code
4
github-code
90
25512653693
# Реверси клон Отелло import random as r import pygame as pg from settings import * import engine def draw_text(text, text_font, surface, x, y): text_obj = text_font.render(text, 1, TEXT_COLOR) text_rect = text_obj.get_rect() text_rect.topleft = (int(x), int(y)) surface.blit(text_obj, text_rect) de...
mysterioagent/Reversi
game.py
game.py
py
8,124
python
en
code
0
github-code
90
37011015727
import zmq import argparse import csv import random import time # Parse arguments parser = argparse.ArgumentParser('ZMQ Publisher') parser.add_argument('-port', default=random.randint(10000, 40000), help='The port to bind your process to', type=int) parser.add_argument('-topic', help='The topic to publish', required=T...
SKShah36/Design_Patterns
publisher.py
publisher.py
py
1,268
python
en
code
0
github-code
90
3044756946
import os, sys from ..cache import alembic from ....version.folder import Version from ....version.import_version import animation_film from .. import envrionment class ImportVersion(animation_film.ImportAnimationVersion): def __init__(self): """ Child of the version.export_version.Version ...
Djangotron/versionMaker
application/houdini/import_hou/animation.py
animation.py
py
7,165
python
en
code
0
github-code
90
40849183130
import scipy.io import numpy as np import matplotlib.pyplot as plt import os import logging from BasicTools import get_file_path, nd_index, wav_tools class Directivity(object): direct_dir = f'{os.path.dirname(__file__)}/SENSOR/Types' direct_type_all = [ 'bidirectional', 'cardoid', 'dipole', 'hemispher...
bingo-todd/RoomSimulator
RoomSimulator/Directivity.py
Directivity.py
py
6,339
python
en
code
2
github-code
90
18393291779
def main(): s = input() s = s.replace("BC", "D") ans = 0 cnt = 0 for i in range(len(s)): if s[i] == "A": cnt += 1 elif s[i]=="D": ans += cnt else: cnt=0 print(ans) main()
Aasthaengg/IBMdataset
Python_codes/p03018/s770402340.py
s770402340.py
py
254
python
en
code
0
github-code
90
12497266238
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Thu Jun 2 17:52:23 2022 @author: guilherme """ import pandas as pd from helper import load_normalized_data_classification from sklearn.ensemble import RandomForestClassifier from sklearn.datasets import make_classification from sklearn.model_selection imp...
guilherme9718/SI_Trab3_Regredir_Classificar
random_forest_classification.py
random_forest_classification.py
py
1,900
python
en
code
0
github-code
90
19018732915
from typing import List class Solution: def maxEqualSum(self, n1: int, n2: int, n3: int, s1: List[int], s2: List[int], s3: List[int]) -> int: tot1, tot2, tot3 = sum(s1), sum(s2), sum(s3) i, j, k = 0, 0, 0 while ((i < n1) and (j < n2) and (k < n3)): if (tot1 == tot2 == tot3): retu...
Tejas07PSK/lb_dsa_cracker
Greedy/Find maximum sum possible equal sum of three stacks/solution.py
solution.py
py
564
python
en
code
2
github-code
90
75038006376
#!/usr/bin/env python3 import yaml import argparse import sys parser = argparse.ArgumentParser( description='Release utility for the Graylog Docker image.') parser.add_argument('--get-graylog-version', help="Get Graylog image version.", action='store_true') parser.add_argument('--get-forwarder...
Graylog2/graylog-docker
release.py
release.py
py
1,676
python
en
code
320
github-code
90
39017292978
from django.http import HttpResponse from lazysignup.decorators import allow_lazy_user, require_lazy_user, require_nonlazy_user def view(request): r = HttpResponse() try: if request.user.is_authenticated(): r.status_code = 500 except TypeError: if request.user.is_authenticated:...
danfairs/django-lazysignup
lazysignup/tests/views.py
views.py
py
762
python
en
code
406
github-code
90
17999287320
from kivymd.app import MDApp from kivymd.uix.list import (TwoLineIconListItem, IconLeftWidget, ImageLeftWidget) from helpers import list_helper3 from kivy.lang.builder import Builder class DemoApp(MDApp): def build(self): screen = Builder.load_string(list_helper3) ret...
LivioAlvarenga/Tutoriais_Kivy_KivyMD
Tutorial_Geral/kivymd_Creating_List4.py
kivymd_Creating_List4.py
py
1,639
python
en
code
1
github-code
90
13627321783
# Halloween Candy # You go trick or treating with a friend. All, but three houses are giving away candy. One house # is giving away toothbrushes and two are giving out $1 bills. Given the total number of houses # visited, what is the chance of pulling a dollar bill from your bag? import math houses = int(input("...
HerBunny/LagomorphaLearning
Python for Beginners/HalloweenCandy.py
HalloweenCandy.py
py
476
python
en
code
1
github-code
90
41379750657
# -*- coding: utf-8 -*- import json import logging from kombu import Connection from celery.task import task from django.conf import settings log = logging.getLogger(__name__) USE_CELERYD = getattr(settings, "PYPO_USE_CELERYD", False) PLAYOUT_BROKER_URL = getattr(settings, "PLAYOUT_BROKER_URL", False) BROKER_QUEUE =...
digris/openbroadcast.org
website/base/pypo/gateway.py
gateway.py
py
1,064
python
en
code
9
github-code
90
18130927924
class Solution(object): def convert(self, s, numRows): """ :type s: str :type numRows: int :rtype: str """ sList = list(s) res = [[] for n in range(numRows)] length = len(s) if length < numRows: return s gap = numRows - 1 ...
sstrac/leetcode
zigzagConversion.py
zigzagConversion.py
py
988
python
en
code
0
github-code
90
20711735376
x = (input()) if not x.isdigit(): print(f"{x} 是一個不合法的輸入,無法運算。") else: factorial = 1 for i in range(int(x)+1): if i == 0: continue factorial = i*factorial print(factorial)
ice4869/python
Task07-02.py
Task07-02.py
py
226
python
en
code
0
github-code
90
33658347757
# https://leetcode-cn.com/problems/binary-tree-preorder-traversal/ class TreeNode: def __init__(self, x): self.val = x self.left = None self.right = None class Solution: def preorderTraversal(self, root: TreeNode) -> List[int]: res = [] def helper(root): if n...
algorithm004-04/algorithm004-04
Week 02/id_049/LeetCode_144_049.py
LeetCode_144_049.py
py
853
python
en
code
66
github-code
90
11873288610
import pandas as pd import warnings warnings.simplefilter("ignore") import re from sklearn.feature_extraction.text import TfidfVectorizer from nltk.corpus import stopwords from nltk.stem import PorterStemmer from nltk.tokenize import word_tokenize from sklearn.metrics.pairwise import cosine_similarity import tkinter ...
Abdelrhman-Sadek/My-Anime-GUI
Code/GUI/MAL_GUI.py
MAL_GUI.py
py
15,759
python
en
code
0
github-code
90
32452425979
from sys import stdin stdin = open("input.txt", "r") size = int(stdin.readline()) index = int(stdin.readline()) left = 1 right = size ** 2 while True : center = (left + right) // 2 limit = size if size < center else center cnt = 0 for num in range(1, limit + 1) : tmp = center ...
choekko/algorithm
Python/inHome/1300(k번째수).py
1300(k번째수).py
py
550
python
en
code
0
github-code
90
16866297058
# -*- coding: utf-8 -*- import os import sys from setuptools import find_packages, setup here = os.path.abspath(os.path.dirname(__file__)) # 'python setup.py build' shortcut if sys.argv[-1] == "build": os.system("python setup.py sdist bdist_wheel") sys.exit() # 'python setup.py check' shortcut if sys.argv[...
joshschmelzle/lscom
setup.py
setup.py
py
1,750
python
en
code
0
github-code
90
24907640487
import os import re import sys import gzip import glob import json import torch import logging import transformers import numpy as np import pandas as pd import seaborn as sns from typing import Optional from metrics import compute_metrics as run_metrics # workaround since hf already defines a function with this name...
TristesseBlue/seq2seq-agreement-attraction
core/run_seq2seq.py
run_seq2seq.py
py
30,014
python
en
code
0
github-code
90
29526669081
import sys import os # noqa sys.path.insert(0, ".") # noqa from utils.styled_plot import plt from utils.dataset import Dataset from classifiers.mlp import MLP import numpy as np import re from anchor import anchor_tabular from tests.config import WORKING_DIR module = __import__(f"{WORKING_DIR}.custom_lime", ...
automl-classroom/iML-ws21-ex04
tasks/anchors.py
anchors.py
py
3,750
python
en
code
0
github-code
90
29878136335
import json from numpy import ( integer, int64, floating, ndarray ) class NpEncoder(json.JSONEncoder): """ npEncoder. Numpy number encoder for json """ def default(self, o): if isinstance(o, (integer, int64)): return int(o) elif isinstance(o, floatin...
phenobarbital/asyncdb
asyncdb/utils/encoders/numpy.py
numpy.py
py
486
python
en
code
23
github-code
90
14205150079
from pathlib import Path import json import random from ..xiuxian2_handle import XiuxianDateManage from .bossconfig import get_config config = get_config() DATEPATH = Path() / "data" / "xiuxian" jingjie = ['练气境', '筑基境', '结丹境', '元婴境', '化神境', '炼虚境', '合体境', '大乘境', '渡劫境','真仙境','金仙境','太乙境'] sql_message = XiuxianDateManage(...
xipesoy/nonebot_plugin_xiuxian
nonebot_plugin_xiuxian/xiuxian_boss/makeboss.py
makeboss.py
py
1,235
python
en
code
null
github-code
90
42883785994
# -*- coding: utf-8 -*- import os import re import sys sys.path.append("/home/lishiyu/talib_test/bin_tools/") from common import * from datetime import datetime import xlsxwriter from collections import OrderedDict from cluster import hcl_mean from importlib import reload from bins import * from ent import db_ent imp...
lsy83971/talib_test
bin_tools/logit.py
logit.py
py
19,865
python
en
code
0
github-code
90
17438295970
from __future__ import absolute_import from __future__ import division from __future__ import print_function import six import tensorflow as tf def patches_1d(images, patch_width): """Extract patches along the last dimension of `images`. Thin wrapper around `tf.extract_image_patches` that only takes horizontal ...
tensorflow/moonlight
moonlight/util/patches.py
patches.py
py
2,218
python
en
code
321
github-code
90
18171875190
""" CNN_utils Author: Tim Burt This library holds backend functions for the ResNet class, z-slice channel preprocessing, and validation methods Parts of code based on package from https://github.com/taki0112/ResNet-Tensorflow """ import os os.environ['TF_CPP_MIN_LOG_LEVEL'] = '3' # or any {'0', '1', '2'} import wa...
tab10/Med3DResNet
ACVProject/CNN_utils.py
CNN_utils.py
py
7,232
python
en
code
3
github-code
90
39639374301
from models.sync_batchnorm import DataParallelWithCallback import models.generator as generators import models.discriminator as discriminators import os import copy import torch import torch.nn as nn from torch.nn import init import models.losses as losses from utils.diff_aug import DiffAugment class OASIS_model(nn....
cvpr-1915/code_1915
models/models.py
models.py
py
7,784
python
en
code
0
github-code
90
24483836449
import asyncio import time from contextlib import suppress from datetime import datetime from functools import partial from textwrap import dedent import discord from async_timeout import timeout from discord.ext import commands from discord.ext.menus.views import ViewMenuPages from humanize import intcomma from youtu...
Buster-2002/Brankobot
brankobot/cogs/music.py
music.py
py
15,396
python
en
code
0
github-code
90
37789022990
import json import logging import simplejson from django.conf import settings from django.http import HttpResponse from django.utils import timezone from rest_framework import mixins, status from astrobin_apps_images.api import constants, signals from astrobin_apps_images.api.mixins import TusCacheMixin from astrobin...
astrobin/astrobin
astrobin_apps_images/api/mixins/tus_create_mixin.py
tus_create_mixin.py
py
5,938
python
en
code
100
github-code
90
2604145630
from collections import Counter from string import punctuation import nltk; def content_text(text): stopwords = set(nltk.corpus.stopwords.words('english')) # 0(1) lookups with_stp = Counter() without_stp = Counter() with open(text) as f: #change encoding to UTF 8 if reading from charName2 ...
SaishRedkar/DataMining_IMDb
mostOccurringWords_filterStopWordsNLTK.py
mostOccurringWords_filterStopWordsNLTK.py
py
1,289
python
en
code
3
github-code
90
37854548621
from tkinter import * import random root = Tk() root.title("Dictionary") root.geometry("600x400") Dictionary = {"color":["red","orange","yellow","green","blue","purple","pink"]} def colorchange(): random_no = random.randint(0,6) print(Dictionary["color"][random_no]) root.configure(background = Di...
oakunicycle4399/colors
155.py
155.py
py
485
python
en
code
0
github-code
90
8217626875
from django.contrib.auth.decorators import login_required from django.core.paginator import Paginator from django.http.response import HttpResponseRedirect from django.shortcuts import redirect, render from django.urls import reverse_lazy from django.views.generic import DeleteView, UpdateView from .forms import Clien...
tunsmm/fitness_guide
fitness_guide/menu/views.py
views.py
py
13,680
python
en
code
1
github-code
90
36441303398
from queue import PriorityQueue import curses import time class Board(object): """ - Esta classe define um tabuleiro para o 8-Puzzle. - As telhas são denotadas usando 1-8, 0 denota uma peça em branco. """ def __init__(self, board=None, moves=0, previous=None): """ placa: array r...
marcelofilhogit/8-Puzzle
main.py
main.py
py
8,247
python
pt
code
0
github-code
90
22292511254
#!/usr/bin/env python3 # -*- coding: utf-8 -*- # Module: Plotting # Author: Paul David Harris # Created; 29 Jun 2022 # Modified: 21 July 2022 # Purpose: plotting functions for burstH2MM """ .. _plotting: Plotting ======== This section provides all the plotting functions for burstH2MM. Most functions take a H2MM_resul...
harripd/burstH2MM
burstH2MM/Plotting.py
Plotting.py
py
120,374
python
en
code
2
github-code
90
30003673255
from flask import Flask, redirect, request, render_template, flash, jsonify, Response, url_for from flask_debugtoolbar import DebugToolbarExtension from handlers import form_validate from forex import get_rate, validate_code app = Flask(__name__) app.config['SECRET_KEY'] = '1579' debug = DebugToolbarExtension(app) ap...
HeyImMatt/springboard-currency-conversion
app.py
app.py
py
1,541
python
en
code
0
github-code
90
18757111591
import torch.nn as nn import torch.nn.functional as F class Seq2Seq(nn.Module): def __init__(self, encoder, decoder, decode_function=F.log_softmax): super(Seq2Seq, self).__init__() self.encoder = encoder self.decoder = decoder self.decode_function = decode_function def flatten...
clovaai/ClovaCall
las.pytorch/models/Seq2Seq.py
Seq2Seq.py
py
1,324
python
en
code
213
github-code
90
36586011794
import time import torch from models import TransformerLayer from vanilla_model import TransformerSeqLayer as SeqLayer device=1 torch.cuda.set_device(device) torch.manual_seed(42) torch.cuda.manual_seed_all(42) iter=64 N=12 V=1000 def std_layer(B,M,H,K,V): emb = torch.nn.Embedding(V, H).cuda() X = torch.a...
berbuf/asct
test/test_speed.py
test_speed.py
py
1,567
python
en
code
1
github-code
90
18184741459
MOD = 10**9 + 7 def main(): N, K = map(int , input().split()) A = list(map(int, input().split())) if max(A) < 0 and K % 2 == 1: A.sort(reverse = True) ans = 1 for i in range(K): ans = ans*A[i]%MOD print(ans%MOD) elif K == N: ans = 1 for i in A: ans = ans*i%MOD print(an...
Aasthaengg/IBMdataset
Python_codes/p02616/s258207374.py
s258207374.py
py
1,904
python
en
code
0
github-code
90
70019620137
List8 = { "Acting Properly OR Misbehave(opposite)": [ "Decorous", "Demure", "Prim", "Propriety", "Seemly", "Execrable(Opposite)", "Flagrant(Opposite)", "Malfeasance(Opposite)", "Unbecoming(Opposite)", ], "Chaos OR Confusion": [ ...
ujjawalpoudel/jamboreeGREwordList
word_list/list8.py
list8.py
py
3,385
python
en
code
2
github-code
90
23475223488
import logging from django.http import HttpResponseRedirect from data_research.forms import ConferenceRegistrationForm from v1.handlers import Handler logger = logging.getLogger(__name__) class ConferenceRegistrationHandler(Handler): SUCCESS_QUERY_STRING_PARAMETER = 'success' """Query string parameter tha...
KonstantinNovizky/Financial-System
python/consumerfinance.gov/cfgov/data_research/handlers.py
handlers.py
py
2,577
python
en
code
1
github-code
90
25150488389
from selenium import webdriver from webdriver_manager.chrome import ChromeDriverManager # Sadece bu kismin alti degistirilecek list1 = "https://open.spotify.com/playlist/60Xe5cJDpcbiHbWwsayOsj?si=3b247bf0ece24ede" list2 = "https://open.spotify.com/playlist/4rEP2SYmsoGWRvXIc7W6qd?si=45ca9bff1d1c4794" # Sadece bu kismi...
mustafakendiguzel/Pyhton-Spotify-finding-same-music-with-playlist-Web-Scraping-
selen.py
selen.py
py
1,624
python
en
code
0
github-code
90
2630709381
import numpy as np import sys sys.path.append('python_agent/src') from game import Connect4State from my_model import Connect4Model from mcts import MCTS, MCTSNode from parallel_mcts import ParallelMCTS, ParallelMCTSNode def play_game(model, starting_player=1): state = Connect4State() state.current_player = st...
Ryuichi-Student/Connect4
python_agent/main.py
main.py
py
1,732
python
en
code
0
github-code
90
14023919397
import os from django.conf import settings from django.contrib.auth.models import User from django.contrib.postgres.search import SearchVectorField from django.contrib.postgres.indexes import GinIndex from django.db import models from django.utils.html import format_html class BuyerListing(models.Model): website...
VikasNeha/CustomSupplierSolutions_Backend
opportunity/models.py
models.py
py
18,753
python
en
code
0
github-code
90
18146661819
import fileinput W = input() cnt = 0 for T in fileinput.input(): if T.rstrip() =='END_OF_TEXT': break T = T.lower().split() cnt += T.count(W) # print(T, cnt) print(cnt)
Aasthaengg/IBMdataset
Python_codes/p02419/s132495260.py
s132495260.py
py
195
python
en
code
0
github-code
90
210871616
def process_text(t): t = t.replace('\n', '') return t def process_compname(t): try: i2 = t.index('公司') i2 = i2 + 2 except ValueError: i2 = 20 compname = t[0:i2] for d in '关于对 ': compname = compname.replace(d, '') return compname
rchopinw/Financial-News-Scraping
text_tools.py
text_tools.py
py
318
python
en
code
1
github-code
90
1303242803
import theano import theano.tensor as T import numpy as np from Initializations import glorot_uniform,zero,alloc_zeros_matrix,glorot_normal,numpy_floatX,orthogonal,one,uniform import theano.typed_list from theano.sandbox.rng_mrg import MRG_RandomStreams as RandomStreams from Activations import relu,LeakyReLU,tanh,sigmo...
chuckgu/Alphabeta
theano/library/Layers.py
Layers.py
py
8,306
python
en
code
0
github-code
90
18275184639
n = input() k = int(input()) digit = len(n) dp0 = [[0 for i in range(k+1)] for j in range(digit+1)] dp1 = [[0 for i in range(k+1)] for j in range(digit+1)] dp1[1][1] = 1 dp0[1][1] = int(n[0])-1 for i in range(1, digit+1): dp0[i][0] = 1 for i in range(2, digit+1): for j in range(1, k+1): num = int(n[i-...
Aasthaengg/IBMdataset
Python_codes/p02781/s398657764.py
s398657764.py
py
619
python
en
code
0
github-code
90
18450483869
import sys input = sys.stdin.buffer.readline import numpy as np def main(): N,K = map(int,input().split()) a = list(map(int,input().split())) l = max(max(a),K).bit_length() a = np.array(a) num,ans = 0,0 for i in reversed(range(l)): base = 2**i bit = (a>>i)&1 cnt = np.cou...
Aasthaengg/IBMdataset
Python_codes/p03138/s623106157.py
s623106157.py
py
618
python
en
code
0
github-code
90
18039102169
s = input()[::-1] ls = ['dream', 'dreamer', 'erase', 'eraser'] ls = [ls[i][::-1] for i in range(4)] ans = 'YES' i = 0 while i < len(s): ng = 1 for j in range(4): if s[i:i+len(ls[j])] == ls[j]: i += len(ls[j]) ng = 0 if ng: ans = 'NO' break print(ans)
Aasthaengg/IBMdataset
Python_codes/p03854/s999295898.py
s999295898.py
py
310
python
en
code
0
github-code
90
10678129527
import datetime from secrets import token_urlsafe from fastapi import APIRouter, Depends, HTTPException from pydantic import parse_obj_as from typing import List from sqlalchemy.sql import select from sqlalchemy.orm import Session from models.model import t_Course, t_Seat,t_Student from config.db import getDBSession f...
Nahemah1022/Seat-Reservation-System
web-backend/routes/course.py
course.py
py
2,896
python
en
code
0
github-code
90
18305960929
import sys input = sys.stdin.readline def main(): # 証言が矛盾していないかチェックする def check(bit): for i in range(n): if not bit & (1 << i): continue for human, is_honest in a[i]: if is_honest == 1 and (bit & (1 << human)): continue ...
Aasthaengg/IBMdataset
Python_codes/p02837/s537587163.py
s537587163.py
py
1,039
python
en
code
0
github-code
90
19117792087
# -*- coding: utf-8 -*- import torch from torch import nn,optim,tensor from torch.nn import functional as F from ..config.config import (PRICE_MODEL_PARAMS as pmp,DEVICE) class EncoderRNN(nn.Module): max_length = pmp.batch_size def __init__(self, input_size, hidden_size=128): super().__init__() ...
DRACOsource/biddinggame
biddinggame/solutions/attention.py
attention.py
py
6,280
python
en
code
5
github-code
90
14875035316
import streamlit as st import pandas as pd import numpy as np import matplotlib.pyplot as plt import seaborn as sns @st.cache(allow_output_mutation=True) def load_data(): df = pd.read_csv('crunchbase.csv', encoding='utf-8', delimiter=',') return df st.title('Companies that got acquired or issued Ipo') df = l...
jhapranav98/Startup_Success_prediction
Target_value_visualization.py
Target_value_visualization.py
py
1,125
python
en
code
0
github-code
90
70401249256
# Import necessary libraries import psycopg2 from pymongo import MongoClient from decimal import Decimal import datetime import threading import logging import json import os from time import sleep # Load configuration from JSON file with open("config.json", "r") as f: config = json.load(f) # Initialize logging f...
Tvkoushik/postgres-mongo-migrator
migration.py
migration.py
py
5,272
python
en
code
0
github-code
90
43020263140
from nonebot import on_command from nonebot.params import CommandArg from nonebot.plugin import PluginMetadata from nonebot.adapters.onebot.v11 import MessageEvent, Message from .data_source import check_text, random_text __plugin_meta__ = PluginMetadata( name="枝网查重", description="查询发病小作文重复率", usage="1、查...
noneplugin/nonebot-plugin-asoulcnki
nonebot_plugin_asoulcnki/__init__.py
__init__.py
py
1,796
python
en
code
13
github-code
90
15972767905
# for data preprocessing import os import json import sqlite3 import pandas as pd import numpy as np from collections import defaultdict import datetime import time from datetime import date, timedelta import sys sys.path.append('../src/features') from build_features import feats # for LSTM/RNN from sklearn.model_...
miloncl/System-Usage-Analysis
src/models/lstm_model.py
lstm_model.py
py
6,484
python
en
code
0
github-code
90
25770153943
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ author: Ewen Wang email: EwenWangSH@cn.ibm.com company: IBM """ import warnings warnings.filterwarnings('ignore') import random random.seed(0) import time import json import pickle import pandas as pd import matplotlib.pyplot as plt im...
Ewen2015/DataScienceNotes
xgb/DevXGB.py
DevXGB.py
py
10,942
python
en
code
0
github-code
90
44876782856
#!python def linear_search(array, item): """return the first index of item in array or None if item is not found""" # implement linear_search_iterative and linear_search_recursive below, then # change this to call your implementation to verify it passes all tests #return linear_search_iterative(array, ...
mediassumani/CS-1.3
source/search.py
search.py
py
3,309
python
en
code
0
github-code
90
3870578877
import numpy as np import pandas as pd import json import pickle #import cPickle from DsaPAML import MetaFeaturesCalculation_copy as MFC import torch from DsaPAML.DualAutoEncoder4_norm import DualAutoEncoder #from sklearn.preprocessing import MinMaxScaler import heapq import torch.utils.data as Data # from torchviz i...
JACKLPJ/DsaPAML
GetModels_sub.py
GetModels_sub.py
py
8,640
python
en
code
0
github-code
90
20239468369
#!/usr/bin/env python import rospy from slam_msgs.msg import StateWithCovariance import numpy as np from matplotlib import pyplot as plt from matplotlib.patches import Ellipse import threading from Error_Function import ErrorFunction class PltPoint(): def __init__(self,x,y,covx,covy,color,label,ax): self....
Nolando/experimental_ass3
Lab3_SLAM/PlotSLAM.py
PlotSLAM.py
py
5,071
python
en
code
0
github-code
90
16622787576
# https://adventofcode.com/2021/day/12 import pathlib import time from collections import defaultdict from collections import deque script_path = pathlib.Path(__file__).parent input = script_path / 'input.txt' # Right answers: 5178 / 130094 (~but test 2 gives wrong answer!) LUCK? WHY? input_test = script_path / ...
TragicMayhem/advent_of_code
aoc_2021/day12/aoc2021d12.py
aoc2021d12.py
py
4,741
python
en
code
0
github-code
90
4296771722
import numpy as np import matplotlib.pyplot as plt from matplotlib.animation import FuncAnimation # Create some random data x = np.linspace(0, 10, 100) y = np.sin(x) # Create a figure and axes fig, ax = plt.subplots() # Create an empty line object line, = ax.plot([], []) # Set the axis limits ax.set_xlim(0, 10) ax....
ss555/deepFish
servo-experiment/results/t.py
t.py
py
724
python
en
code
0
github-code
90
35183198391
# Напишите функцию, которая проверяет является ли число степенью двойки. # Если истинно выведите True, иначе False. def is_pow2(n): if n == 1: return True elif n > 1: return is_pow2(n / 2) else: return False if __name__ == "__main__": n = int(input("Enter the number: ")) ...
amina-wq/python-step-academy
List,dict comprehension/task10.py
task10.py
py
452
python
ru
code
0
github-code
90
74197046376
''' Created on Jul 8, 2019 @author: Mahamat Oumar ''' from django.shortcuts import render, redirect from django.contrib.auth.decorators import login_required @login_required def medical_professional_directory(request): '''This view gets all the available organizations.''' context_dict = {} # Check whe...
hamoody-omar/Coorganate
medical_professional/views/medical_professional_directory.py
medical_professional_directory.py
py
609
python
en
code
1
github-code
90
17944777319
n,k,*L=map(int,open(0).read().split()) X=[];Y=[] for x,y in sorted((x,y) for x,y in zip(*[iter(L)]*2)): X.append(x) Y.append(y) ans=float("inf") for i in range(n-k+1): for j in range(i+k-1,n): w=X[j]-X[i] l=sorted(Y[i:j+1]) h=min(My-my for my,My in zip(l,l[k-1:])) ans=min(ans,w*h) print(ans)
Aasthaengg/IBMdataset
Python_codes/p03576/s136121584.py
s136121584.py
py
303
python
en
code
0
github-code
90
18421781569
short = 10 ans = 0 for i in range(5): n = int(input()) if short > n%10 and n%10 > 0: short = n%10 ans += (n//10)*10 if n%10 > 0: ans += 10 ans -= 10 if short > 0 else 0 print(ans+short)
Aasthaengg/IBMdataset
Python_codes/p03076/s060577901.py
s060577901.py
py
218
python
en
code
0
github-code
90
73139563818
import torch import torch.nn as nn import numpy as np from torch.autograd import Variable import torch.nn.functional as F import matplotlib.pyplot as plt import torch.nn.init as init import functools import torchvision from dbpn import Net as DBPN try: from dcn.deform_conv import ModulatedDeformConvPack as DCN exc...
lovepiano/SMFN_For_360VSR
modules.py
modules.py
py
15,022
python
en
code
28
github-code
90
18387182789
n=int(input()) a=list(map(int,input().split())) a.sort() hu=0 for b in a: if b<0: hu+=1 else: break if hu==0: hu=1 if hu==n: hu=n-1 ansl=[] nowl=a[0] for i in range(hu,n-1): ansl.append((nowl,a[i])) nowl-=a[i] nowr=a[n-1] for i in range(1,hu): ansl.append((nowr,a[i])) no...
Aasthaengg/IBMdataset
Python_codes/p03007/s164934991.py
s164934991.py
py
424
python
en
code
0
github-code
90
20572576294
import json from tqdm import tqdm class BoundingBoxProcessor: def __init__(self, input_path, iou_threshold=0.9, validation=True): self.input_path = input_path self.iou_threshold = iou_threshold self.validation = validation self.read_data() def read_data(self): with ope...
AleksandrSim/strong_sort_yolox
src/strong_sort/scripts/get_moving_objects.py
get_moving_objects.py
py
2,798
python
en
code
0
github-code
90
22556916736
from pici.helpers import create_co_contributor_graph, create_commenter_graph import pandas as pd import scrapy from scrapyscript import Job, Processor import logging import numpy as np import json from urllib.parse import urlparse from pici.community import Community, CommunityFactory class PPCommunity(Community): ...
phihes/pici
pici/communities/preciousplastic.py
preciousplastic.py
py
3,069
python
en
code
1
github-code
90
41896677114
from Xlib import X, XK # import text # import styles from clipboard import copy from constants import TARGET from editor import open_editor, commands pressed = set() events = [] def event_to_string(self, event): mods = [] if event.state & X.ShiftMask: mods.append('Shift') if event.state & X....
SingularisArt/inkscape-mappings
normal.py
normal.py
py
5,950
python
en
code
8
github-code
90
21065400509
from base.selenium_driver import SeleniumDriver from base.locators import Locators from base.common import Common class Candidate(SeleniumDriver): def __init__(self, driver): self.driver = driver self.locators = Locators self.common = Common(driver) self.select_recruitment_by_id = ...
adityaTask/HRM
Pages/Recruitment/candidate.py
candidate.py
py
1,517
python
en
code
0
github-code
90
41983787384
import sys import uproot4 import awkward1 as ak import numpy import math import time def geteta(mupx, mupy,mupz): mup = numpy.sqrt(mupx**2 + mupy**2 + mupz**2) mueta = numpy.log((mup + mupz)/(mup - mupz))/2 return (mueta) def getphi(mupx, mupy): muphi = numpy.arctan2(mupy, mupx) return (mu...
ramankhurana/test
test.py
test.py
py
7,153
python
en
code
0
github-code
90
34271307147
import os import requests import random from flask import Flask, jsonify, request from flask_cors import CORS from backend.blockchain.blockchain import Blockchain from backend.wallet.wallet import Wallet from backend.wallet.transaction import Transaction from backend.wallet.transaction_pool import TransactionPool fro...
jabhax/blockchain-app
python-blockchain/backend/app/__init__.py
__init__.py
py
3,933
python
en
code
0
github-code
90
25336224821
from django import forms from django.utils.translation import gettext as _ from initialarticle.models import InitialArticle from articlecategory.models import ArticleCategoryManager class InitialArticleCreateForm(forms.Form): def __init__(self, *args, **kwargs): request = kwargs.pop('request') s...
hayk-manukyan-dev/online-newspaper
initialarticle/forms.py
forms.py
py
1,761
python
en
code
0
github-code
90
23858833620
import torch.nn as nn from torchvision import models class Resnet18(nn.Module): '''simple resnet classifier''' def __init__(self, output_num=31): super(Resnet18, self).__init__() model = models.resnet18(pretrained=False) self.conv1 = model.conv1 self.bn1 = model.bn1 se...
agil27/TCAV_PyTorch
tcav/models.py
models.py
py
1,150
python
en
code
9
github-code
90
8181785472
from django.shortcuts import render, redirect import random import os import hashlib from datetime import datetime from django.http import HttpResponse,HttpResponseRedirect from django.views import View # from .models import people from django.db import connection def credit_check(request): email = None try: ...
Lyteyagami12/Django-With-Custom-SQL
daraz/checkout/checkout.py
checkout.py
py
6,917
python
en
code
0
github-code
90
25292654890
# Django settings for annotator project. import os PROJECT_ROOT = os.path.abspath(os.path.dirname(__file__)) DEBUG = True TEMPLATE_DEBUG = DEBUG ADMINS = ( ('Mark Wilding', 'mark.wilding@ed.ac.uk'), ) MANAGERS = ADMINS DATABASE_ENGINE = 'sqlite3' DATABASE_NAME = os.path.join(PROJECT_ROOT, "sequences.db") # Lo...
markgw/jazzparser
annotator/annotator/settings.py
settings.py
py
2,773
python
en
code
5
github-code
90
15523322709
# Python Imports from typing import Optional, Union # Third Party Imports from fastapi import Depends from sqlalchemy import func from sqlmodel import Session, column, select # Local Imports from app.core import get_logger from app.definitions.general import EmissionType, FuelType from app.infrastructure import get_d...
Arkemix30/hack-the-future-api
app/repositories/fuel_repo.py
fuel_repo.py
py
10,028
python
en
code
0
github-code
90
27087907008
import re import llnl.util.tty as tty import llnl.util.multiproc as mp from spack.architecture import OperatingSystem from spack.util.module_cmd import get_module_cmd class Cnl(OperatingSystem): """ Compute Node Linux (CNL) is the operating system used for the Cray XC series super computers. It is a very st...
matzke1/spack
lib/spack/spack/operating_systems/cnl.py
cnl.py
py
2,542
python
en
code
2
github-code
90
39101627239
class Solution: def removeDuplicateLetters(self, s: str) -> str: counts = collections.Counter(s) stack = [] _set = set() for ss in s: counts[ss] -= 1 if ss in _set: continue while stack and ss < stack[-1] and counts[stack[-1]] > 0 :...
HANITZ/Algorithm
LeetCode/Medium/0316-remove-duplicate-letters/0316-remove-duplicate-letters.py
0316-remove-duplicate-letters.py
py
455
python
en
code
0
github-code
90
31711193871
from sklearn import svm from sklearn.model_selection import StratifiedKFold, cross_val_score from sklearn.ensemble import RandomForestClassifier from sklearn.feature_selection import RFECV, RFE from sklearn.preprocessing import StandardScaler, MinMaxScaler, RobustScaler import matplotlib.pyplot as plt from openpyxl imp...
sidharthgurbani/RCC_Proj
featureSelectAndClassify.py
featureSelectAndClassify.py
py
2,870
python
en
code
0
github-code
90
18043424999
import sys input=sys.stdin.readline h,w=map(int,input().split()) a=[] for i in range(h): sub=input().rstrip() a.append(sub) check=True for i in range(h): for j in range(w): if a[i][j]=='#': for k in range(h): for l in range(w): if (i>k and j<l) or (i<k...
Aasthaengg/IBMdataset
Python_codes/p03937/s325945685.py
s325945685.py
py
475
python
en
code
0
github-code
90
7566856767
import json import time import datetime from utils.by_selector import Selector, standard_app_sign def check_frontend_sign(): sign = Selector().get_frontend_sign() if sign['sign'] == standard_app_sign['sign']: print('MD5 检测通过,API 在掌握中') else: print('Warning: MD5 检测未通过,API 可能已被修改') p...
Toby-Shi-cloud/BUAAInsignificantUtils
by_select.py
by_select.py
py
5,542
python
en
code
0
github-code
90
36234189382
import tensorflow as tf ## we will see how to declare variables and use them. ## usage of get_variable ## we will also see how declaring and initialization of variables are separate operations ## type of v1 - tensorflow.python.ops.variables.RefVariable v1 = tf.get_variable(name = 'v1', dtype=tf.int32, shape =1) v2...
in-tandem/deep_learning
tensorflow_learnings/tf_variables.py
tf_variables.py
py
2,122
python
en
code
1
github-code
90