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
18056955699
s = input() k = int(input()) ans = [] for c in s[:-1]: to_a = (ord('z')-ord(c)+1) % 26 if k < to_a: ans.append(c) else: k -= to_a ans.append('a') else: c = s[-1] x = ord(c)-ord('a') y = (k+x) % 26 ans.append(chr(ord('a')+y)) print(''.join(ans))
Aasthaengg/IBMdataset
Python_codes/p03994/s121699193.py
s121699193.py
py
300
python
en
code
0
github-code
90
30072402830
from django_filters import rest_framework as filters from django_filters.utils import get_model_field class BaseFilters(filters.FilterSet): """ https://django-filter.readthedocs.io/en/master/guide/tips.html?highlight=help_text#adding-model-field-help-text-to-filters django-filter不会用到model的help_text...
liushiwen555/unified_management_platform_backend
utils/core/filters.py
filters.py
py
997
python
en
code
0
github-code
90
20712281599
import re import itertools with open('input.txt') as file: data = file.readlines() data = [line.strip() for line in data] fields, tickets = [], [] for line in data: if 'or' in line: fields.append(line) elif ',' in line: tickets.append(line.split(',')) def get_ranges (a,b,c,d): o...
tabers77/Advent-of-Code
2020/day16/day16_p1.py
day16_p1.py
py
1,072
python
en
code
1
github-code
90
4956362405
import os, io from subprocess import call import requests import base64 import yaml import json with open("/home/pi/.homeassistant/secrets.yaml", 'r') as secrets: secret = yaml.load(secrets) apikey_baidu = secret['baidu_body_apikey'] secretkey_baidu = secret['baidu_body_secretkey'] ha_token = secret['token'] ...
wittyfilter/homeassistant
recog_people.py
recog_people.py
py
2,707
python
en
code
2
github-code
90
13306881071
""" Kernel estimation methods. """ from numpy import atleast_1d as in1d, atleast_2d as in2d from sklearn import neighbors import numpy as np ROOT_2PI = np.sqrt(2 * np.pi) KERNEL_RADIUS_RATIO = 0.35 NUM_NEIGHBORS = 10 class AdaptiveGaussianKernel(object): """ Nearest neighbors method for estimating density...
jdmonaco/spikemaps
spikemaps/kernels.py
kernels.py
py
5,093
python
en
code
0
github-code
90
41244018483
import streamlit as st from src.data_management import load_house_data import numpy as np import matplotlib.pyplot as plt import seaborn as sns import ppscore as pps sns.set_style("whitegrid") def page2_house_price_study(): # load data df = load_house_data() # hard copied from sales price correlation st...
Shida18719/heritage-housing-issues
app_pages/page_house_price_study.py
page_house_price_study.py
py
6,285
python
en
code
0
github-code
90
29542913917
# -*- coding: utf-8 -*- # @Time : 2022/5/7 17:18 # @Author : 模拟卷 # @Github : https://github.com/monijuan # @CSDN : https://blog.csdn.net/qq_34451909 # @File : 1901. 找出顶峰元素 II.py # @Software: PyCharm # =================================== """一个 2D 网格中的 顶峰元素 是指那些 严格大于 其相邻格子(上、下、左、右)的元素。 给你一个 从 0 开始编号 的 m x n ...
monijuan/leetcode_python
code/AC2_normal/1901. 找出顶峰元素 II.py
1901. 找出顶峰元素 II.py
py
2,621
python
zh
code
0
github-code
90
20638586281
import random import time import us import geonamescache from selenium import webdriver from selenium.webdriver.common.by import By from fake_useragent import UserAgent import requests import re from config import BaseConfig as conf from app.models import Site, Location, URL, City from app.logger import log def set_b...
Simple2B/RealEstateParser
app/controllers/selenium/urls.py
urls.py
py
6,127
python
en
code
0
github-code
90
34855182473
from functools import cache import json import typing from dataclasses import dataclass, field from fastapi import FastAPI, HTTPException, Response from cached import cached app = FastAPI() @dataclass class Profile: id: str name: str website: str github: str linkedin: str twitter: str educ...
rein14/fastapi-profile
main.py
main.py
py
1,360
python
en
code
0
github-code
90
18297616549
n, m = map(int, input().split()) l = list(map(int, input().split())) l.sort() import bisect def func(x): C = 0 for p in l: q = x -p j = bisect.bisect_left(l, q) C += n-j if C >= m: return True else: return False l_ = 0 r_ = 2*10**5 +1 while l_+1 < r_: c_ = (l_+r_)//2 if func(c_): ...
Aasthaengg/IBMdataset
Python_codes/p02821/s181670765.py
s181670765.py
py
584
python
en
code
0
github-code
90
25769833906
# multiAgents.py # -------------- # Licensing Information: You are free to use or extend these projects for # educational purposes provided that (1) you do not distribute or publish # solutions, (2) you retain this notice, and (3) you provide clear # attribution to UC Berkeley, including a link to http://ai.berkeley.e...
psxxj/Pacman_AI
PJ2_MultiagentSearch/multiAgents.py
multiAgents.py
py
12,352
python
en
code
0
github-code
90
71213154537
from __future__ import unicode_literals import frappe from frappe.model.document import Document class CustomerRemovalRequest(Document): def validate(self): contact = _get_contact(self.customer) if not contact: frappe.msgprint("There is no Contact found on this customer. Contact fields will not be used.") ...
iRaySpace/pdpl
pdpl/pdpl/doctype/customer_removal_request/customer_removal_request.py
customer_removal_request.py
py
998
python
en
code
0
github-code
90
10052642653
from django import template register = template.Library() extract_types = { 0: "blind (0)", 1: "forced (1)", 2: "manual (2)", } @register.filter def extract_type(value): """ Returns a string format for the extract_type column in the extracted source table. """ if not value: r...
transientskp/banana
banana/templatetags/extract_type.py
extract_type.py
py
358
python
en
code
4
github-code
90
7694916989
"""Do the image""" import time from dataclasses import dataclass from typing import Iterable import os import logging import easygui from PIL import Image class NotRGBRGBA(Exception): """dumb.""" def __str__(self) -> str: """are.""" return 'you are not supposed to see this' STI_NAME = 'sti...
i-winxd/STIPhoto-generator
main.py
main.py
py
7,689
python
en
code
1
github-code
90
37931081734
import unittest from insert_into_a_sorted_circular_linked_list import Node, Solution class TestInsertIntoASortedCircularLinkedList(unittest.TestCase): def test_example_1(self): head = Node(val=1) head.next = Node(val=3) head.next.next = Node(val=4) head.next.next.next = head ...
saubhik/leetcode
tests/test_insert_into_a_sorted_circular_linked_list.py
test_insert_into_a_sorted_circular_linked_list.py
py
957
python
en
code
3
github-code
90
7134974576
from functools import wraps import asyncio def retry_timeout(times=3, sleep=5): async def make_try(times_flag, func, args, kwargs): times_flag += 1 try: await asyncio.sleep(sleep) return await func(*args, **kwargs) except asyncio.exceptions.TimeoutError: ...
JoryPein/book-spider
utils/aio_retry.py
aio_retry.py
py
793
python
en
code
0
github-code
90
33666772685
import numpy as np import pandas as pd from tensorflow.keras.models import Sequential from tensorflow.keras.layers import Dense from sklearn.model_selection import train_test_split from sklearn.metrics import mean_squared_error, r2_score #주어진 데이터를 바탕으로 따릉이 대여량을 예측 해보세요! # 1. 데이터 path = './_data/ddarung/' ...
JDanmuji/BitCamp_AI
keras/keras15_1_dacon_ddarung1.py
keras15_1_dacon_ddarung1.py
py
3,147
python
ko
code
0
github-code
90
31972000051
word1 = input("Enter a word: ").lower() word2 = input('pick a second word').lower() fixed = sorted(word1) refixed = "".join(fixed) fixed1 = sorted(word2) refixed2 = "".join(fixed1) if refixed == refixed2: print('these are anagrams ') else: print('these are not anagrams')
davidl0673/pythonstuff
lab17_part2.py
lab17_part2.py
py
307
python
en
code
0
github-code
90
11188971284
from flask import request from demo_api.common import create_api from sgnlp.models.rst_pointer import ( RstPointerParserConfig, RstPointerParserModel, RstPointerSegmenterConfig, RstPointerSegmenterModel, RstPreprocessor, RstPostprocessor, ) app = create_api(app_name=__name__, model_card_path="...
aisingapore/sgnlp
demo_api/rst_pointer/api.py
api.py
py
1,914
python
en
code
32
github-code
90
10829926382
#**************************************************************************************************************************** #Importing libraries #**************************************************************************************************************************** import argparse, os, time, glob, sys import te...
hazutecuhtli/Create_Your_Own_Image_Classifier
Predict.py
Predict.py
py
4,090
python
en
code
0
github-code
90
25961932270
import tensorflow as tf from tensorflow import keras from tensorflow.keras import layers from tensorflow.keras.applications import MobileNetV2 from functools import partial import ee_strats.uncertainty_sampling as uncertainty_sampling '''Configuration file for the Trainer''' LABELER_IP = "http://127.0.0.1:3334" BATC...
kangzi/Online-Active-Learning
trainer/config.py
config.py
py
3,010
python
en
code
0
github-code
90
43835949230
from PyWebSystem.PyUtil.pw_logger import logmessage from PyWebSystem.PyUtil.pw_extra_methods import id_generator from django.template import Template from PyWebSystem.PyUtil.DickUpdate import pw_loop from PyWebSystem.customtags.pw_definePrimaryNode import definePrimaryNode def LayoutRepeat(context, *args, **kwargs): ...
anji-a/PyWebSystem
PyWebSystem/customtags/pw_LayoutRepeat.py
pw_LayoutRepeat.py
py
3,307
python
en
code
0
github-code
90
18681156748
import yaml from ax.util.const import SECONDS_PER_MINUTE VALID_VERSIONS = ["v1"] class AXPlatformConfigDefaults: # Default platform manifest / config file info DefaultManifestRoot = "/ax/config/service/standard/" DefaultPlatformConfigFile = "/ax/config/service/config/platform-bootstrap.cfg" # Crea...
zhan849/argo
platform/source/lib/ax/platform/component_config/platform_config.py
platform_config.py
py
4,112
python
en
code
null
github-code
90
23301495216
''' Given a non-empty string s and a dictionary wordDict containing a list of non-empty words, add spaces in s to construct a sentence where each word is a valid dictionary word. Return all such possible sentences. Note: The same word in the dictionary may be reused multiple times in the segmentation. You may assume ...
ahujapankaj16/CompetitiveProgramming
WordBreakII.py
WordBreakII.py
py
1,907
python
en
code
0
github-code
90
18397469349
# bit全順列列挙 def bitall(n): parm = [] for i in range(1<<n): # 0/1の組み合わせは1<<n(=2**n)通り存在。 on = [0 for _ in range(n)] # とりあえず全て0にしておく。 for j in range(n): if i & (1<<j): # iのj桁目が1となっている場所をonにする。 on[j] = 1 parm.append(on) ...
Aasthaengg/IBMdataset
Python_codes/p03031/s903884300.py
s903884300.py
py
1,026
python
ja
code
0
github-code
90
40662814392
#!/usr/bin/env python # *-* encoding: utf-8 *-* import numpy as np import scipy.spatial from scipy.special import lambertw from typing import Optional, Tuple class PoolTest: EPSILON = 1e-12 a: np.ndarray b: np.ndarray N: np.ndarray p: np.ndarray n_subpop: int n_indiv: np.ndarray @sta...
g-pichler/group-testing
pooltesting/pooltest.py
pooltest.py
py
16,203
python
en
code
0
github-code
90
35645216645
# -*- coding: utf-8 -*- ''' from wordcloud import WordCloud import jieba import time seg_list = jieba.cut("Python123!Python123为你提供优秀的 Python 学习工具、教程、平台和更好的学习体验。", cut_all=True) word_split = " ".join(seg_list) # 显示中文需要的字体,以下是 Windows 系统的设置 # MacOS 中 font_path 可以设置为:"/System/Library/fonts/PingFang.ttc" my_wordclud = Wor...
zzm99/Simple-code-demo
py123/untitled1.py
untitled1.py
py
2,480
python
en
code
1
github-code
90
19181537096
import os from dotenv import load_dotenv from flask import Flask, flash, request, redirect, url_for, render_template from steganography import encrypt, decrypt load_dotenv() app = Flask(__name__) app.secret_key = "cairocoders-endnalan" app.config['UPLOAD_FOLDER'] = os.getenv("UPLOAD_FOLDER") app.config['MAX_CONTEN...
python237/steganography
app.py
app.py
py
3,362
python
en
code
0
github-code
90
20672243486
# **************************************************************************** # # Plot the last configuration encountered in the simulation of a specific file # # **************************************************************************** import pyalps import matplotlib.pyplot as plt import numpy as np import sys im...
domischi/mcpp
scripts/plot-last-configuration.py
plot-last-configuration.py
py
3,256
python
en
code
3
github-code
90
41808326684
from turtle import back from numpy import roll from student.models import Batch,Branch, Performance,Semester, Student def get_select_sem_backlog_analysis(sem): sem = Semester.objects.get(id=sem.id) students = Student.objects.filter(sem=sem.id) backlog_count = 0 for i in students: if Perfor...
nikhilap784/Student-Result-Analysis--main
result/student/multi_sem_analysis/Sem_backlog_data_analysis.py
Sem_backlog_data_analysis.py
py
756
python
en
code
0
github-code
90
18115334079
#coding:utf-8 #1_5_B def merge_sort(array): if len(array) > 1: L, countL = merge_sort(array[0:len(array)//2]) R, countR = merge_sort(array[len(array)//2:]) return merge(L, R, countL+countR) if len(array) == 1: return [array, 0] def merge(L, R, count=0): L.append(10**9+1) ...
Aasthaengg/IBMdataset
Python_codes/p02272/s287066787.py
s287066787.py
py
752
python
en
code
0
github-code
90
15045425380
#!/usr/bin/env python """ Summarize pipeline output across data sets. # TODO: - handle seperator in _convert_filepaths_to_dataframes """ import re import pathlib import numpy as np import pandas as pd import StyleFrame from functools import partial def convert_filepaths_to_dataframes(func): """Given a potentia...
sims-lab/cloneseq
summarize_cloneseq_results.py
summarize_cloneseq_results.py
py
6,333
python
en
code
0
github-code
90
70386599016
# from trie import Trie from DB.trie import Trie from os import getcwd,walk from DB.archiveDB import ArchiveDB def initializeDB(): path = getcwd() global_path = path + '/2021-archive' small_path = global_path + '/RFC' initialize_from_directories(small_path) return insert_archiveDB_to_trie() ...
ChavaIsrael/Auto-Complete
DB/initializationDB.py
initializationDB.py
py
1,226
python
en
code
0
github-code
90
72292943658
def dfs(graph, v, visited): # 함수가 호츨된다함은 곧 해당 노드에 대한 방문이다. print(v, end=" ") visited[v] = True # 노드 자신과 연결된 다른 노드가 방문되지 않았을 경우 방문을 재귀적으로 진행한다. for i in graph[v]: if not visited[i]: dfs(graph, i, visited) # 1~8번 까지의 노드가 존재. 그리고 각각의 노드는 다음과 같이 연결되어있음 # (가중치 없는 인접리스트 형태) graph = [[], [2, 3, 8], [1, 7...
ldgeao99/Python-Algorithm-Study
이것이 코딩 테스트다/CHAPTER 05 - DFS BFS/5-8(DFS Basic).py
5-8(DFS Basic).py
py
691
python
ko
code
0
github-code
90
41473147454
from flask import Flask, render_template, request from flask_cors import CORS, cross_origin import assignment app = Flask('app') cors = CORS(app) app.config['CORS_HEADERS'] = 'Content-Type' @app.route('/stats', methods = ['GET']) @cross_origin() def get_oregon_trail_stats(): return dict( day = assignm...
andreybutenko/oregon-trail-flask
main.py
main.py
py
1,106
python
en
code
0
github-code
90
22762077739
from __future__ import absolute_import from __future__ import division from __future__ import print_function import functools from dragon.vm import torch from dragon.vm.torch import nn from seetadet.core.config import cfg from seetadet.data.targets.ssd import AnchorTargets from seetadet.ops.build import build_loss f...
seetaresearch/seetadet
seetadet/models/dense_heads/ssd.py
ssd.py
py
3,428
python
en
code
1
github-code
90
42528108891
import cv2 as cv imag=cv.imread('pmo.jpg') img=cv.resize(imag,(700,600)) #without considering the aspect ratio cv.imshow('resized',img) cv.imshow('image',img) gray=cv.cvtColor(img,cv.COLOR_BGR2GRAY) cv.imshow('gray',gray) haar_cascade =cv.CascadeClassifier('haar_face.xml') faces_rect=haar_cascade.detectMultiScale(...
Aryasah/OpenCv-Learning
face.py
face.py
py
531
python
en
code
0
github-code
90
43121606277
from django import forms from django.contrib.auth.models import User from django.contrib.admin import widgets from app.librarys.models import Librarys, LibrarysStorage, Librarian from app.librarys.validators import validation_librarys_address, validation_librarys_name class LibrarysForm(forms.ModelForm): library...
IgorCurukalo/first1
first/app/librarys/forms.py
forms.py
py
1,528
python
en
code
0
github-code
90
35072069111
import random exceed_smart_contract:str = '0x1eae15d9f4fa16f5278d02d2f8bda8b0dcd31f71' #max_drop_per_person = int(input('What is the maximum amount of Exceed are we are dropping per person here?')) x = [] y = [] for i in range(100): y = random.random() * 1200 zz = round(y, 8) x.append(zz) whitespace_con...
Exceed-Arthur/airdroptool
arbitrary_values.py
arbitrary_values.py
py
573
python
en
code
0
github-code
90
1813078576
# -*- coding: utf-8 -*- """ Created on Fri Apr 17 18:25:00 2020 @author: Rajesh """ ''' Pie Chart :- --------- ''' import matplotlib.pyplot as plt exp_vals = [1400,600,300,410,250] exp_labels = ['Home Rent','Food','Phone/Internet bill','Car','Other Utilities'] plt.axis() plt.pie(exp_vals,labels=exp_labels , radiu...
Rajesh-sharma92/FTSP_2020
CodeBasics_Pandas/Matplotlib_CB/Pie_Chart_Matplotlib.py
Pie_Chart_Matplotlib.py
py
1,768
python
en
code
3
github-code
90
4964488822
def smooth_grid_table() : import dismod_at import copy import collections # file_name = 'example.db' connection = dismod_at.create_connection( file_name, new = True, readonly = False ) cursor = connection.cursor() # # create smooth table ptype = 'integer primar...
bradbell/dismod_at
example/table/smooth_grid_table.py
smooth_grid_table.py
py
3,507
python
en
code
6
github-code
90
18731104670
# This code is written by harsh. def uidCheck(s): upper = 0 digits = 0 if len(s) != 10: return False for i in range(len(s)): for j in range(i + 1, len(s)): if s[i] == s[j]: return False for i in range(len(s)): if not s[i].isalnum(): ret...
harshsinghs1058/python_hackerrank_solutions
Validating_UID.py
Validating_UID.py
py
692
python
en
code
1
github-code
90
71027570217
from sklearn.ensemble import RandomForestRegressor from sklearn.utils.validation import check_is_fitted from joblib import Parallel, delayed from sklearn.ensemble._base import _partition_estimators import threading import numpy as np class RandomForestRegressor2(RandomForestRegressor): def __init__(self, ...
KastnerRG/sherlock
src/RandomForest.py
RandomForest.py
py
2,532
python
en
code
6
github-code
90
9777450270
from PyQt5.QtCore import pyqtSignal, Qt from brickv.plugin_system.plugin_base import PluginBase from brickv.plugin_system.plugins.nfc_rfid.ui_nfc_rfid import Ui_NFCRFID from brickv.bindings.bricklet_nfc_rfid import BrickletNFCRFID from brickv.async_call import async_call from brickv.spin_box_hex import SpinBoxHex cla...
Tinkerforge/brickv
src/brickv/plugin_system/plugins/nfc_rfid/nfc_rfid.py
nfc_rfid.py
py
10,335
python
en
code
18
github-code
90
17975276539
def resolve(): ''' code here ''' import math N, K = [int(item) for item in input().split()] As = [int(item) for item in input().split()] gcd = As[0] for item in As[1:]: gcd = math.gcd(gcd, item) res = 'IMPOSSIBLE' max_A = max(As) if max_A > K: if K ...
Aasthaengg/IBMdataset
Python_codes/p03651/s927744113.py
s927744113.py
py
472
python
en
code
0
github-code
90
8880338037
""" autor: Valentina Garrido Main game module """ import glfw from OpenGL.GL import * import sys import scene_graph_3D as sg import easy_shaders as es import lighting_shaders as ls import basic_shapes as bs from model import * from controller import Controller import basic_shapes_extended as bs_ext from models.Ene...
malva28/Cat-Jump-3D
codigo/cat_jump.py
cat_jump.py
py
6,535
python
en
code
0
github-code
90
3161446457
# -*- coding: utf-8 -*- # @Author : DevinYang(pistonyang@gmail.com) __all__ = ['summary'] from collections import OrderedDict import torch import torch.nn as nn import numpy as np def _flops_str(flops): preset = [(1e12, 'T'), (1e9, 'G'), (1e6, 'M'), (1e3, 'K')] for p in preset: if flo...
FreeformRobotics/Divide-and-Co-training
utils/summary.py
summary.py
py
7,086
python
en
code
99
github-code
90
73827948778
#!/usr/bin/env python from time import sleep import PySimpleGUI as sg from matplotlib.pyplot import pause # Usage of Graph element. layout = [[sg.Graph(canvas_size=(500, 100), graph_bottom_left=(0, 0), graph_top_right=(2000, 2000), background_color='white', enable_events=True, key='graph')]] window = sg.Window('Grap...
Borgotto/InputRaceTelemetry
test.py
test.py
py
736
python
en
code
0
github-code
90
32322385999
#!/usr/bin/env python3 import gzip import sys import struct import io import mmap # much of this is based on https://github.com/HearthSim/UnityPack/wiki/Format-Documentation class bytestream: def __init__(self, by): self._full_by = by self._by = memoryview(self._full_by) def bytes(self, n): ret = bytes(self...
Alcaro/misctoys
unity-extract.py
unity-extract.py
py
12,554
python
en
code
2
github-code
90
32631391761
#!/usr/bin/env python3 # Author: DMR import os import sys def cube_root(num): """Use bisection search to find the cube root of a number""" epsilon = 0.01 low = 0 high = num guess = (high + low) / 2.0 while abs(guess**3 - num) >= epsilon: if guess**3 < num: low = guess ...
dmr-git/py
guttag/cube2.py
cube2.py
py
771
python
en
code
0
github-code
90
71019959977
from http.server import HTTPServer, BaseHTTPRequestHandler from pathlib import Path import socket import pygame as pg import threading import time HOST = socket.gethostbyname(socket.gethostname()) PORT = 9999 print(socket.gethostname(), HOST) save = Path("saves/save1.txt") class HTTPRequestHandler(BaseH...
SwinkyWorks/Top-down-game
httpServer.py
httpServer.py
py
6,458
python
en
code
0
github-code
90
70725932778
from django.test import TestCase from django.urls import resolve, reverse from question.models import Answer, Question, Tag from user.models import User class QuestionView(TestCase): @classmethod def setUp(cls): user = User( username="testuser", email="test@usertest.com", password="testuse...
varusN/hasker
hasker/hasker/tests/tests_views.py
tests_views.py
py
2,464
python
en
code
0
github-code
90
3827848158
import os import logging config_path = 'config/' def dir_check(directory): if not os.path.isdir(directory): os.makedirs(directory) def image_to_binary(file_name): if os.path.isfile(file_name): with open(file_name, 'rb') as image_file: image_data = image_file.read() else: ...
Jamezzz5/screenshotmaster
ssm/utils.py
utils.py
py
443
python
en
code
0
github-code
90
40851531341
import openai import base64 import os testKey = os.environ.get('API_KEY') #print(testKey) openai.api_key = testKey breakpoint() file = open("result.txt", "r") #story = "" for i,a in enumerate(file.readlines()): completion = openai.ChatCompletion.create( model='gpt-4', messages=[ {"role": "system", ...
mrwadepro/ai-gameplay-generator
storyBoardGeneration/generative.py
generative.py
py
2,054
python
en
code
0
github-code
90
18204978329
import numpy as np N = int(input()) A = [] B = [] for i in range(N): a, b = [int(x) for x in input().split()] A.append(a) B.append(b) C = np.array(A) D = np.array(B) m_inf = np.median(C) m_sup = np.median(D) if N % 2 == 0: ans = 2 * m_sup - 2 * m_inf + 1 else: ans = m_sup - m_inf + 1 print(int...
Aasthaengg/IBMdataset
Python_codes/p02661/s402755377.py
s402755377.py
py
326
python
en
code
0
github-code
90
16466829364
import re from flask_restful import Resource, reqparse from models import Scoreboard from views import DBSession, get_rankings from sqlalchemy.orm.exc import NoResultFound # Username legality check: 4-50 alphanumeric characters USERNAME_REGEX = re.compile('^[a-zA-Z0-9._-]{4,50}$') # accept and parse POST score_parser...
chrisx8/Ballzzz
scoreboard/api.py
api.py
py
2,710
python
en
code
0
github-code
90
18558667599
n,m = map(int,input().split()) if n > 1 and m > 1: num_9 = (n-2) * (m-2) ans = num_9 elif (n == 1) ^ (m == 1): if n == 1: num = m else: num = n ans = num - 2 else: ans = 1 print(ans)
Aasthaengg/IBMdataset
Python_codes/p03417/s645403024.py
s645403024.py
py
222
python
en
code
0
github-code
90
27087651458
from __future__ import print_function import sys import re import argparse from llnl.util.argparsewriter import ArgparseWriter, ArgparseRstWriter import spack.main from spack.main import section_descriptions description = "list available spack commands" section = "developer" level = "long" #: list of command for...
matzke1/spack
lib/spack/spack/cmd/commands.py
commands.py
py
3,198
python
en
code
2
github-code
90
3388727325
import socket #server = socket.gethostname() server = "192.168.0.9" port = 8080 print(f"server is {server}. port no is {port}.start service.") s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) s.bind((server, port)) # IPとポート番号を指定します s.listen(5) while True: clientsocket, address = s.accept() print(f"Con...
WhiteRabbit82651/study
python3/server.py
server.py
py
479
python
en
code
0
github-code
90
29570836116
# Test Part 1 # def yield_next_multiple(input_number): # output_number = 0 # while True: # yield output_number # output_number += input_number # # # sequence = yield_next_multiple(5) # for i in range(5): # print(next(sequence)) # Test Part 2 # main_sequence = range(10000000000000000) # ma...
Surya-77/personal-advent-of-code-2020
Day13/13_test.py
13_test.py
py
2,951
python
en
code
1
github-code
90
14065240491
import unittest from datetime import datetime import iris import numpy as np from iris.coord_systems import GeogCS, TransverseMercator from iris.coords import DimCoord from iris.tests import IrisTest from improver.metadata.constants.attributes import MANDATORY_ATTRIBUTE_DEFAULTS from improver.metadata.constants.mo_at...
metoppv/improver
improver_tests/orographic_enhancement/test_OrographicEnhancement.py
test_OrographicEnhancement.py
py
33,266
python
en
code
95
github-code
90
18311241399
import sys read = sys.stdin.read T1, T2, A1, A2, B1, B2 = map(int, read().split()) answer = 0 v1 = A1 - B1 v2 = A2 - B2 d = v1 * T1 + v2 * T2 if d == 0: print('infinity') exit() elif v1 * d > 0: print(0) exit() if v1 * T1 % -d == 0: print(v1 * T1 // -d * 2) else: print(v1 * T1 // -d * 2 + 1)
Aasthaengg/IBMdataset
Python_codes/p02846/s086829182.py
s086829182.py
py
319
python
en
code
0
github-code
90
6381336038
points = [ { 'name': 'Ariful Islam', 'point': 2425, 'answer': 1625, 'explanation': 15, 'subject': 785, 'refer': 0, 'image': 'profile-pic.jpeg', }, { 'name': 'পিপীলিকা পাঠান', 'point': 340, 'answer': 50, 'explanation': 15...
naimurhasan/python-pillow-info-graphic-image-point
points.py
points.py
py
805
python
en
code
0
github-code
90
18245320259
from collections import defaultdict N, X, Y = map(int, input().split()) ctr = defaultdict(int) for i in range(1, N + 1): for j in range(i + 1, N + 1): d = min(j - i, abs(i - X) + 1 + abs(j - Y)) ctr[d] += 1 for i in range(1, N): print(ctr[i])
Aasthaengg/IBMdataset
Python_codes/p02726/s460725783.py
s460725783.py
py
272
python
en
code
0
github-code
90
9894798838
from rest_framework.exceptions import PermissionDenied from rest_framework import status class InvalidUserException(PermissionDenied): status_code = status.HTTP_403_FORBIDDEN default_detail = "User information inconsistent" default_code = 'invalid' def __init__(self, detail, status_code=None): ...
Wkeirn7/drip_backend
api/exceptions.py
exceptions.py
py
421
python
en
code
0
github-code
90
9322350695
from assertpy import assert_that import server class TestLoadClubs: def test_load_clubs_data(self): # initialisation clubs_json = [ {"name": "Simply Lift", "email": "john@simplylift.co", "points": "13"}, {"name": "Iron Temple", "email": "admin@irontemple.com", "points": "4...
PierreRtec/P11_Rondeau_Pierre
tests/tests_unitaires/test_server_unit.py
test_server_unit.py
py
1,277
python
en
code
0
github-code
90
15454835224
# -*- coding: utf-8 -*- import sys from PyQt5 import QtCore, QtGui from PyQt5.QtWidgets import (QApplication, QMainWindow, QFrame, QMenu, QMenuBar, QStatusBar, QAction, QLabel, QPushButton, QWidget) from mainframe import MainFrame from client import Client from...
markizdesadist/BaseSTO
windowstomodel/BaseSTO.py
BaseSTO.py
py
14,843
python
en
code
0
github-code
90
4342251549
from django.db import models from django.contrib.auth import get_user_model from account.models import LevelAndSection, Level from datetime import datetime from django.utils.text import slugify from account.models import FacultyProfile, StudentProfile from django.db.models.signals import post_save from django.dispatch ...
joshuariveramnltech/projectDMCA-
grading_system/models.py
models.py
py
5,608
python
en
code
0
github-code
90
73411567977
# Author: Zhang Huangbin <zhb _at_ iredmail.org> # # Purpose: Reject senders listed in per-user blacklists, bypass senders listed # in per-user whitelists stored in Amavisd database (@lookup_sql_dsn). # # Note: Amavisd is configured to be an after-queue content filter in iRedMail. # with '@lookup_sql_dsn...
iredmail/iRedAPD
plugins/amavisd_wblist.py
amavisd_wblist.py
py
13,634
python
en
code
42
github-code
90
70747815336
#this is the config_load.py in Config_files directory to loading all json config import json import os def load_json_config(file_path): with open(file_path, 'r') as file: return json.load(file) def load_all_configs(base_dir): config_dir = os.path.join(base_dir, 'Config_files') gNodeB_json_path = ...
natanzi/RAN-Fusion
Config_files/config_load.py
config_load.py
py
703
python
en
code
0
github-code
90
18285568039
N=int(input()) xl=[] for _ in range(N): x,l=map(int,input().split()) xl.append([x+l,2*l]) xl.sort() r=-10**9 ans=0 for i in range(N): if xl[i][0]-xl[i][1]>=r: ans+=1 r=xl[i][0] print(ans)
Aasthaengg/IBMdataset
Python_codes/p02796/s298618554.py
s298618554.py
py
217
python
en
code
0
github-code
90
32087559760
import sys n = int(input()) l = [] for i in range(n): temp = sys.stdin.readline().strip() l.append(temp) l = list(set(l)) l.sort() l.sort(key = len) for i in l: print(i)
denmark-dangnagui/baekjoon
1181.py
1181.py
py
182
python
en
code
0
github-code
90
41566380084
from dash import Dash, dcc, html import plotly.graph_objs as go # Daten für den Graphen x_data = [1, 2, 3, 4, 5] y_data = [2, 4, 6, 8, 10] # Plotly Trace erstellen trace = go.Scatter( x=x_data, y=y_data, mode='lines', name='Linien' ) # Layout für das Dash-Dashboard layout = go.Layout( title='Test...
malikljajic/DSE_Projekt_SoSe2023
Graphtest.py
Graphtest.py
py
765
python
en
code
0
github-code
90
33661669907
# 20191117 """ DP: 1. 分治 2. 状态定义 3. DP方程 """ class Solution: def rob(self, nums: List[int]) -> int: if not nums or len(nums) == 0: return 0 n = len(nums) a = [[0] * 2 for _ in range(n)] a[0][0] = 0 a[0][1] = nums[0] for i in range(1, n): ...
algorithm004-04/algorithm004-04
Week 05/id_069/LeetCode-198-069.py
LeetCode-198-069.py
py
913
python
en
code
66
github-code
90
11673634037
import torchvision.datasets.video_utils from torchvision.datasets.video_utils import VideoClips from torchvision.datasets.utils import list_dir from torchvision.datasets.folder import make_dataset from torchvision.datasets.vision import VisionDataset import numpy as np import ffmpeg import random def ge...
jeffhernandez1995/VideoVIT
old/default_torch_videodataset.py
default_torch_videodataset.py
py
3,821
python
en
code
0
github-code
90
28890128928
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Tue Oct 2 11:49:50 2018 @author: eo """ # --------------------------------------------------------------------------------------------------------------------- #%% Imports import cv2 import numpy as np from collections import deque # -----------------...
EricPacefactory/eolib
video/video_callbacks.py
video_callbacks.py
py
59,440
python
en
code
0
github-code
90
13267819422
import os import torch import torch.distributed as dist import pdb os.makedirs('results/', exist_ok=True) os.makedirs('weights/', exist_ok=True) class res50_1x: def __init__(self, args, val_mode=False): data_root = '/home/feiyu/Data/coco2017/' self.gpu_id = args.gpu_id if not val_mode: ...
feiyuhuahuo/PAA_minimal
config.py
config.py
py
4,896
python
en
code
10
github-code
90
3639833295
import pytest import os import numpy as np import datetime import spiceypy as spice from importlib import reload import json import unittest from unittest.mock import MagicMock, PropertyMock, patch from conftest import get_isd, get_image_label, get_image_kernels, convert_kernels, compare_dicts import ale from ale.d...
victoronline/ale
tests/pytests/test_kaguya_drivers.py
test_kaguya_drivers.py
py
5,259
python
en
code
null
github-code
90
299205835
from motor import motor import RPi.GPIO as GPIO "Set this equal to the number of steps in a 360 degree rotation of yoru stepper motor" MAX_STEPS = 360 class water_gun: shots_remaining = 100 current_x = (MAX_STEPS / 2) current_y = (MAX_STEPS / 4) def move_x(self, degrees): if degrees < 0: #Removing unecess...
myoj/pi-water
water_gun.py
water_gun.py
py
1,778
python
en
code
0
github-code
90
25787318834
# -*- coding: utf-8 -*- """ Created on Fri Jan 13 10:55:46 2017 @author: Lucie """ # AFCM ## Librairies utilisées import pandas as pd from mca import mca import numpy as np import matplotlib.pyplot as plt import pylab ## Lecture des données # Definition du chemin où sont situées les données : path = 'C:/Users/R...
OliviaJly/segmentation-multicanale
AFCM.py
AFCM.py
py
3,194
python
fr
code
0
github-code
90
18483839869
from collections import deque N = int(input()) A_list = sorted([int(input()) for _ in range(N)]) if N == 2: print(abs(A_list[0] - A_list[1])) exit() if N == 3: a0,a1,a2 = A_list print(max(abs(a0-a1) + abs(a1-a2),abs(a1-a2) + abs(a2-a0) ,abs(a0-a2) + abs(a0-a1))) exit() q = deque(A_list) res_...
Aasthaengg/IBMdataset
Python_codes/p03229/s932250597.py
s932250597.py
py
1,234
python
en
code
0
github-code
90
20512269257
from django.urls import path from . import views urlpatterns = [ # recommend path('recommend/anonymous/', views.recommend_anonymous), # 메인 추천리스트(비회원) path('recommend/<int:user_pk>/', views.recommend_user), # 메인 추천리스트(회원) path('recommend/allrandom/', views.all_random), # 올랜덤 선택 한개 # search movie pa...
jonghopark1014/Clickflix
Clickflix_back/movies/urls.py
urls.py
py
795
python
en
code
0
github-code
90
16316969463
from tkinter import ttk import cv2 import numpy as np import os import torch import torch.nn as nn import torch.nn.functional as F import random from torchvision import models import librosa import librosa.display # import torchaudio import copy import scipy.ndimage as ndimage from config import * # from visualization...
MinglangQiao/visual_audio_saliency
utils1.py
utils1.py
py
9,440
python
en
code
2
github-code
90
6330855645
from plasma.flex.messaging.selector import LexerError literals = ('(', ')', ',') reserved = ('AND', 'BETWEEN', 'IN', 'IS', 'LIKE', 'NOT', 'NULL', 'OR', 'ESCAPE') # List of token names. This is always required tokens = ( 'NUMBER', 'STRING', 'BOOLEAN', 'VARIABLE', 'PLUS', 'MINUS', '...
hydralabs/plasma
plasma/flex/messaging/selector/sql92lexer.py
sql92lexer.py
py
1,574
python
en
code
1
github-code
90
15206158179
# Given a number N find the sum of all the even valued terms in the fibonacci sequence less than or equal to N. # Try generating only even fibonacci numbers instead of iterating over all Fibonacci numbers. # Sample Input 1: # 8 # Sample Output 1 : # 10 # Sample Input 2: # 400 # Sample Output 2: # 188 n = int(input()) ...
farhan528/Coding-Problems
Problems/even_fibonacci_sum.py
even_fibonacci_sum.py
py
572
python
en
code
0
github-code
90
807661572
import random import re from .fuzz_utils import ( replace_random, filter_candidates, random_string, num_tautology, string_tautology, num_contradiction, string_contradiction, ) def reset_inline_comments(payload: str): positions = list(re.finditer(r"/\*[^(/\*|\*/)]*\*/", payload)) ...
yangheng95/DaNuoYi
DaNuoYi/evolution/fuzzer.py
fuzzer.py
py
5,900
python
en
code
5
github-code
90
18405646949
from collections import deque n = int(input()) e = {} for i in range(n-1): u,v,w = map(int,input().split()) if u not in e: e[u] = [[v,w]] else: e[u].append([v,w]) if v not in e: e[v] = [[u,w]] else: e[v].append([u,w]) que = deque() que.append([1,0,0]) ans = [-1 f...
Aasthaengg/IBMdataset
Python_codes/p03044/s074170156.py
s074170156.py
py
1,126
python
en
code
0
github-code
90
40271072537
import pandas as pd from rdkit.Chem import Descriptors from rdkit import Chem df_guts=pd.read_csv('../results/guts_smiles.csv', sep=";", encoding= 'unicode_escape') df_drugs=pd.read_csv('../results/drugs_smiles.csv', sep=";", encoding= 'unicode_escape') df_drugs['mol'] = df_drugs.canonical_smiles.apply(lambda x: Chem....
corgazp/tfm-uoc
scripts/prepareSNF_files.py
prepareSNF_files.py
py
2,405
python
en
code
0
github-code
90
33510139438
import pinocchio as pin import numpy as np # Create model and data model = pin.buildSampleModelHumanoidRandom() data = model.createData() # Set bounds (by default they are undefinded) model.lowerPositionLimit = -np.matrix(np.ones((model.nq,1))) model.upperPositionLimit = np.matrix(np.ones((model.nq,1))) q = pin.ra...
zhangOSK/pinocchio
examples/python/kinematics-derivatives.py
kinematics-derivatives.py
py
1,523
python
en
code
0
github-code
90
8292115818
from django.db.models.signals import post_save from django.dispatch import receiver from .models import Vendor, OpeningHours, Day @receiver(post_save, sender=Vendor) def post_save_user(sender, instance, created, **kwargs): print("signals called for vendor") try: if created: for day_choice ...
neilravi7/tasteswift
vendor/signals.py
signals.py
py
1,029
python
en
code
0
github-code
90
29425363678
from django.shortcuts import redirect, render from django.contrib import messages from user.models import UserDetails def profile(request): if request.user.is_authenticated: userd=UserDetails.objects.get(user=request.user) return render(request,'dashboard/profile.html',{'userd':userd}) else: ...
Aayush5sep/CollegeWorks
dashboard/views.py
views.py
py
844
python
en
code
1
github-code
90
43663374963
# Code for producing Figure 2 in the report. import matplotlib.pyplot as plt import numpy as np import matplotlib font = {'family' : 'normal', 'weight' : 'bold', 'size' : 22} matplotlib.rc('font', **font) samples = 100000 with open("data/probs_different_its.txt") as f: lines ...
Snoeprol/stochastic_simulations
Assignment_code/iterations_derivative.py
iterations_derivative.py
py
1,198
python
en
code
0
github-code
90
30382898848
from json import dumps as json_dumps from requests import get as requests_get, put as requests_put, post as requests_post from lib.helper import ssdp_discovery, hex_to_hue, portup # --------------------------- # HUE Handling # --------------------------- class Hue: def __init__(self, settings): self.set...
tomaae/WooferBot
src/lib/hue.py
hue.py
py
7,516
python
en
code
6
github-code
90
3849032062
import os import time import traceback import json import decimal import boto3 import twint from boto3.dynamodb.conditions import Key, Attr from botocore.exceptions import ClientError from scrapelog import ScrapeLog logger = ScrapeLog() # Helper class to convert a DynamoDB item to JSON. class DecimalEncoder(json.JS...
enoreese/project_scrape
tests/single_scrape.py
single_scrape.py
py
6,127
python
en
code
0
github-code
90
19862714954
from functools import wraps from queue import Queue import numpy as np from copy import copy, deepcopy from queue import Queue def bfs(all_sons): def bfs_(fun): @wraps(fun) def decorated(executor): queue = Queue() visited = set() root = executor.graph.nodes[0] ...
GIS-PuppetMaster/DB4AI
utils.py
utils.py
py
1,433
python
en
code
0
github-code
90
35410742875
#_*_coding:utf-8_*_ from django.conf.urls import url from .views import * urlpatterns = [ url(r"^login",Logins.as_view()), url(r"^register$", register), url(r"^db_movie$", db_movie), # url(r"^index", index), ]
zzdn/douban_project
apps/users/urls.py
urls.py
py
237
python
en
code
0
github-code
90
72365619177
from ast import iter_fields import numpy # 전프레임의 공과의 거리비교 def diff_xy(coords): coords = coords.copy() diff_list = [] for i in range(0, len(coords)-1): if coords[i] is not None and coords[i+1] is not None: point1 = coords[i] point2 = coords[i+1] diff = [abs(point...
kpuce2022CD/Pierrot
analysis_application/Functions/bounce.py
bounce.py
py
2,348
python
en
code
2
github-code
90
34448868738
class Settings: # 存储游戏的设置类 def __init__(self): '''初始化游戏设置,屏幕设置''' self.screen_width = 1200 self.screen_height = 600 self.bg_color = (230, 230, 230) self.ship_speed = 0.5 self.ship_limit = 3 self.bullet_speed = 1.5 self.bullet_width = 3 se...
lijikun123/plane_game
setting.py
setting.py
py
642
python
en
code
0
github-code
90
40562609281
#!/usr/lib/python3 import requests import json import yaml def LineFilter(workdirectory,AuthToken,tenantid,portal,starttimenanosec,endtimenanosec) : reportfile = open(workdirectory + "/Report.yml") parsedreportfile = yaml.load(reportfile,Loader=yaml.FullLoader) payload={} headers = { 'Authorizat...
UditOpsramp/UATPipeline
TestCases/LineFilter.py
LineFilter.py
py
1,762
python
en
code
0
github-code
90
13942237464
import win32com.client import json import base64 metadata_filename = "metadata.json" class UserSystem: def __init__(self): with open(metadata_filename) as f: try: self.j = json.load(f) self.user_information = self.j[2] except: self.j =...
sunyiwei24601/MiniSql
SystemManagement/System_Login.py
System_Login.py
py
1,882
python
en
code
0
github-code
90