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
18574264219
n = int(input()) ti,xi,yi = 0,0,0 found = True for _ in range(n): t, x, y = map(int, input().split()) root = abs(x-xi)+abs(y-yi) if root > (t-ti) or (t-ti-root)&1: found = False ti,xi,yi = t,x,y print("Yes" if found else "No")
Aasthaengg/IBMdataset
Python_codes/p03457/s010825287.py
s010825287.py
py
259
python
en
code
0
github-code
90
9275450701
import argparse import sys import re import logging # Create the parser my_parser = argparse.ArgumentParser(description='User/bot chat client for chatychaty server') # Requierd comand line arguments for clinet.py my_parser.add_argument('Ip', metavar='ip', type=str, ...
Oslo-Metropolitan-University-OsloMet/individual-portfolio-assignment-1-piotrpajchel
div/arpars_example.py
arpars_example.py
py
2,023
python
en
code
0
github-code
90
23089582393
import torch import torch.nn as nn class LinearParameterizer(nn.Module): def __init__(self, num_concepts, num_classes, hidden_sizes=(10, 5, 5, 10), dropout=0.5, **kwargs): """Parameterizer for compas dataset. Solely consists of fully connected modules. Parameters --------...
AmanDaVinci/SENN
senn/models/parameterizers.py
parameterizers.py
py
4,939
python
en
code
30
github-code
90
74218943337
#!python3 print("part 1") groups = open('day_6_input.txt').read().strip().split('\n\n') tot = 0 for g in groups: count = len(set(g.replace('\n', ''))) tot = tot + count print(tot) print("part 2") tot = 0 for g in groups: pps = g.split('\n') res = None for p in pps: if res is None: ...
asvinours/adventofcode
2020/day_6_solution.py
day_6_solution.py
py
428
python
en
code
0
github-code
90
41305259174
from . import views from django.urls import path from django.conf import settings from django.conf.urls.static import static # Configure URL patterns for the web application urlpatterns = [ path('', views.index, name='index'), # Home page path('search/', views.search_papers, name='search_papers'), path('...
Zaheer-10/PaperMate-RecSys
PaperMate_ui/GUI/urls.py
urls.py
py
1,066
python
en
code
0
github-code
90
17106766996
import sys input = sys.stdin.readline n, k = map(int, input().split()) bag = [(0, 0)] knapsack = [[0 for _ in range(k + 1)] for __ in range(n + 1)] for _ in range(n): bag.append(tuple(map(int, input().split()))) for i in range(1, n + 1): for j in range(1, k + 1): w = bag[i][0] v = bag[i][1] ...
kyj098707/BOJ
boj/09. dp/12865.py
12865.py
py
504
python
en
code
0
github-code
90
32452237682
import requests import os import datetime import xhtml2pdf.pisa as pisa from django.views.generic.base import ContextMixin from django.conf import settings from django import template from django.contrib.sites.shortcuts import get_current_site from django.template.loader import render_to_string from django.urls import...
riccardorav/codeExample
python/projects/utils.py
utils.py
py
17,596
python
en
code
0
github-code
90
38049202324
import numpy as np from scipy import * import matplotlib.pyplot as plt # introduce all my variables and creates my matrix errk = 1 errf = 1 tol = 1e-4 iters = 0 a = 4.0 D = 1.0 E = 0.7 vE = 0.6 h = 0.1 k = 0.1 n = int((a - (-1 * a)) / h) nps = n + 1 flux = np.transpose(np.matrix(np.ones(n - 1))) flux /= np.linalg.norm...
willkable/NE155-HW6-Files
HW 6 Problem 4.py
HW 6 Problem 4.py
py
1,512
python
en
code
0
github-code
90
17959260279
N = int(input()) P = list(map(int,input().split())) ans = 0 for i in range(N): if P[i] == i+1: if i < N-1: now = P[i] P[i] = P[i+1] P[i+1] = now ans += 1 print(ans)
Aasthaengg/IBMdataset
Python_codes/p03612/s036191064.py
s036191064.py
py
223
python
en
code
0
github-code
90
20666858100
def teamData(data) : data = data.split(",") return [ data[0] , { "points" : 3 * int(data[1]) + int(data[3]) } , { "gd" : int(data[4]) - int(data[5]) } ] def createScoreBoard(SCOREBOARD,TEAMDATA) : if len(SCOREBOARD) == 0 : SCOREBOARD[0] = TEAMDATA else : rank = 0 while ...
pxxptm/Data-Structure-KMITL
9_5.py
9_5.py
py
1,522
python
en
code
0
github-code
90
18208461879
import sys input = lambda: sys.stdin.readline().rstrip() def solve(): N = int(input()) A = list(map(int, input().split())) v = [tuple() for _ in range(N + 1)] v[N] = (A[N], A[N]) if A[0] != 0: if A[0] == 1 and N == 0: print(1) exit() else: pri...
Aasthaengg/IBMdataset
Python_codes/p02665/s708017457.py
s708017457.py
py
1,045
python
en
code
0
github-code
90
33787257857
from django.db.models import Q from django.http import HttpResponse from django.utils import timezone from urllib.parse import urlencode from tools.constants import CODE_NOT_EXISTS from tools.constants import CODE_SUCCESS from tools.constants import MSG_GET_EXCHANGE_RATE_SUCCESS from tools.constants import MSG_GET_CU...
ben-ying/DjangoApps
tools/views/exchange_views.py
exchange_views.py
py
4,706
python
en
code
0
github-code
90
725732155
from __future__ import print_function from .compat import string_types from .enc import enc_default from os.path import basename import sys, inspect, traceback max_val_len = 70 def ext_traceback(to=None, dump_locals=False): message = u'' tb = sys.exc_info()[2] while True: if not tb.tb_next: break tb = tb.tb_n...
mk-fg/fgc
fgc/err.py
err.py
py
2,100
python
en
code
0
github-code
90
26086019120
from data_structures.binary_tree import BinaryTree def tree_intersection(one, two): list = [] common = [] i = 0 for node in one.in_order(): list.append(node) print(list) for node in two.in_order(): if list[i] == node: common.append(node) i+=1 return co...
alsosteve/data-structures-and-algorithms
python/code_challenges/tree_intersection.py
tree_intersection.py
py
325
python
en
code
0
github-code
90
6072486450
from sqlalchemy import select from sqlalchemy.ext.asyncio import AsyncSession from starlette.datastructures import FormData from starlette.exceptions import HTTPException from starlette.responses import RedirectResponse, Response from bot.slon_bot import bot from db.auth import Request from db.db import async_session ...
danantur/DIPLOM
web/backend_views.py
backend_views.py
py
2,279
python
en
code
0
github-code
90
21286618118
"""ITOPOD Sniping script.""" import time # Helper classes from classes.features import Adventure, GoldDiggers, MoneyPit, Inventory from classes.helper import Helper from classes.stats import Tracker import constants as const Helper.init(True) Helper.requirements() tracker = Tracker(5) while True: # main loop ...
kujan/NGU-scripts
itopod_snipe.py
itopod_snipe.py
py
685
python
en
code
22
github-code
90
24988313587
import datetime as dt import pandas as pd import threading import numpy as np import time from bmp280_median_logger import BMP280 def write_data(filename, w_time, *args): """ Writes str representations of input to specified file. :param filename: str :param w_time: str time representation :param ...
kriete/bmp280_median_logger
bmp280_median_logger/Bmp280Reader.py
Bmp280Reader.py
py
2,768
python
en
code
0
github-code
90
86706588646
""" Script to load a dataset. """ import argparse import pathlib from project.dataset.oper_dataset import ( load_dataset, save_selected_ids, ) from project.core_config import create_and_validate_config def main(): parser = argparse.ArgumentParser() parser.add_argument( "--profile", ty...
aleobons/wildlife_species_project
package/project/dataset/load_dataset.py
load_dataset.py
py
2,443
python
en
code
0
github-code
90
5501517732
""" Завдання №23. Визначити, чи є задане шестизначне число “щасливим” (сума перших трьох цифр має дорівнювати сумі останніх трьох цифр)? """ while True: try: n = input("Введіть шестизначне число: ") assert len(n) == 6 int(n) break except (AssertionError, ValueError): ...
ohiliazov/kpi
programming/term1/b23.py
b23.py
py
853
python
uk
code
1
github-code
90
36219528887
# 2156 : 포도주 시식 import sys input = sys.stdin.readline n = int(input()) wines = [int(input()) for _ in range(n)] if n == 1: answer = wines[0] elif n == 2: answer = wines[0]+wines[1] else: d = [0] * n d[0] = wines[0] d[1] = wines[0]+wines[1] d[2] = max(wines[0]+wines[2], wines[1]+wines[2], d[1]...
yuhalog/algorithm
BOJ/Dynamic-Programming/2156-2.py
2156-2.py
py
466
python
en
code
0
github-code
90
39531322385
from odoo import models, fields, api, _ from odoo.exceptions import UserError from odoo import tools class AnalyticOvertime(models.Model): _name = 'analytic.overtime' _order = 'id desc' _description = "Analytic Overtime" _inherit = ['mail.thread'] name = fields.Char('Task Name', required=True, tr...
mooosamir/SFC-odoo-addons-hr-sa
saudi_hr_overtime_request/models/analytic_overtime_request.py
analytic_overtime_request.py
py
12,218
python
en
code
0
github-code
90
2189049196
''' ジェネレータ Pythonのシーケンスを作るオブジェクト ジェネレータはイテレータのデータソースとなることが多い range()なども使われている xrange() python2で使える yieldを駆使して、処理を記載する ''' def my_range(first=0, last=10, step=1): number = first while number < last: yield number number += step ranger = my_range() print(type(ranger)) for x in ranger: pri...
mogubess/python_test
nyumon/4chapter/07_generator.py
07_generator.py
py
475
python
ja
code
0
github-code
90
3351621471
import pytest import requests import os url = 'http://127.0.0.1:5000' end_point = os.path.join(url, 'my_api', 'Contacts') def test_index_page(): r = requests.get(url+'/') assert r.status_code == 404 def test_base_api_page(): r = requests.get(url=end_point) assert r.status_code == 200 def test_get...
dcgithubaccount/FlaskApiProject
tests/test_endpoints.py
test_endpoints.py
py
1,339
python
en
code
1
github-code
90
71396148136
# -*- coding: utf-8 -*- """ Created on Mon Mar 20 09:50:19 2017 @author: alexr """ import json from wit import Wit from misc_fn import dump, load from datetime import datetime from interactions_1 import greetings """Main file for interacting with xera_v1.0""" # access_token taken from wit.ai (serve...
onestroke/xera_v1.0
master.py
master.py
py
1,094
python
en
code
0
github-code
90
11245286510
#!/usr/bin/env python # -*- coding: utf-8 -*- PKG = 'hironx_ros_bridge' # rosbuild needs load_manifest try: import roslib import hironx_ros_bridge except: import roslib; roslib.load_manifest(PKG) import hironx_ros_bridge from hironx_ros_bridge import hironx_client as hironx import unittest class Test...
start-jsk/rtmros_hironx
hironx_ros_bridge/test/test_hironx_ik_noinit.py
test_hironx_ik_noinit.py
py
1,212
python
en
code
10
github-code
90
70904630377
def dfs(idx): stack.append(idx) visited[idx] = True # 일단 방문함 next_idx = graph[idx] # 현재 정점이 가리키는 정점 if visited[next_idx]: if next_idx in stack: global cnt cnt += len(stack[stack.index(next_idx):]) return else: dfs(next_idx) if __name__ == "__main__...
dohun31/algorithm
2021/week_09/210902/9466.py
9466.py
py
887
python
ko
code
1
github-code
90
17122667588
from PIL import Image, ImageDraw import face_recognition print("Loading known face image(s)") josh_image = face_recognition.load_image_file("josh.jpg") mahesh_image = face_recognition.load_image_file("mahesh.jpg") dan_image = face_recognition.load_image_file("dan.jpg") joe_image = face_recognition.load_image_file("jo...
BogacSabuncu/IoT_DoorBell
face_recog_trial/multiple_faces_trial.py
multiple_faces_trial.py
py
2,664
python
en
code
1
github-code
90
19701492582
from .request_processor import RequestProcessor from .response_messages import * class UserActivityRequestProcessor(RequestProcessor): required_input_keys = ['access_token', 'user_id'] def process(self): try: payload = self.request.json except: payload = None er...
SomebodyOnceToldMeI/StarNavi-test-task
request_processors/user_activity_request_processor.py
user_activity_request_processor.py
py
1,003
python
en
code
0
github-code
90
13467858738
import cv2 import numpy as np import math import sys import time from imutils import contours import imutils import RPi.GPIO as GPIO GPIO.setwarnings(False) #throttle throttlePin = 25 # Physical pin 22 in3 = 23 # physical Pin 16 in4 = 24 # physical Pin 18 #Steering steeringPin = 22 # Physical Pin 15...
parthchhabra0611/self_driving_car
prc1.py
prc1.py
py
6,247
python
en
code
1
github-code
90
45611846880
from store.models import Product COMPARE_SESSION_ID = 'compare' class Compare: def __init__(self, request): self.session = request.session compare = self.session.get(COMPARE_SESSION_ID) if not compare: compare = self.session[COMPARE_SESSION_ID] = {} self.compare = comp...
ali-nsr/advanced-ecommerce
compare/compare.py
compare.py
py
1,031
python
en
code
1
github-code
90
74024011177
# Definition for singly-linked list. # class ListNode: # def __init__(self, x): # self.val = x # self.next = None class Solution: def rotateRight(self, head: ListNode, k: int) -> ListNode: if head == None or head.next == None: return head l1 =head ...
njuptwh/leetcode
leetcode_61.py
leetcode_61.py
py
679
python
en
code
0
github-code
90
28270834504
"""Add Asset Revision ID: 21daeed6a2a5 Revises: c86b94ff772b Create Date: 2022-12-16 18:06:24.042483 """ import sqlalchemy as sa import sqlalchemy.dialects.postgresql as pg from alembic import op from sqlalchemy.ext.compiler import compiles # revision identifiers, used by Alembic. revision = "21daeed6a2a5" down_rev...
felnne/pytest-alembic-experiments
src/coke/alembic/versions/21daeed6a2a5_asset.py
21daeed6a2a5_asset.py
py
1,933
python
en
code
0
github-code
90
70762287338
""" Crea una función que lea una cadena de caracteres y determine si es un pangrama, si lo es devuelve True, en caso contrario devuelve False. Un pangrama es una frase que contiene todas las letras del alfabeto al menos una vez. Ejemplo: nombreFuncion("hola mundo")//Devuelve: False nombreFuncion("abcdefghijklmnopqrstu...
AlexSR2590/logica_python
3-Ejercicios-logica/ejercicio60.py
ejercicio60.py
py
686
python
es
code
0
github-code
90
21617544608
class Solution: def setBits(self, N): # code here #method 1 count = 0 while N > 0: if N & 1 == 1: count += 1 N = N >> 1 return count #method 2 def recurse(N): if N == 0: return 0 if N % 2 == 0: N = N // 2 return recurse(N) els...
sgowdaks/CP_Problems
bit_manipulation/count_the_ones.py
count_the_ones.py
py
533
python
en
code
0
github-code
90
30495222491
import numpy def crop_image(image, crop_mask, crop_internal=False): """Crop an image to the size of the nonzero portion of a crop mask""" i_histogram = crop_mask.sum(axis=1) i_cumsum = numpy.cumsum(i_histogram != 0) j_histogram = crop_mask.sum(axis=0) j_cumsum = numpy.cumsum(j_histogram != 0) ...
leosv123/customcellprofiler
utilities.py
utilities.py
py
1,492
python
en
code
0
github-code
90
36677377641
import pandas as pd import os import opendatasets as od pwd = os.getcwd() dataset_url = 'https://www.kaggle.com/rodsaldanha/arketing-campaign' od.download(dataset_url) data_dir = './arketing-campaign' pwd = os.getcwd() df = pd.read_csv(pwd+"/arketing-campaign/marketing_campaign.csv", sep = ';') # These columns are...
KipkorirC/Market-analysis
cleaning_processing_scripts/cleaning_data.py
cleaning_data.py
py
2,232
python
en
code
0
github-code
90
21722220581
#!/usr/bin/env python # coding: utf-8 # In[1]: import pandas as pd import numpy as np import datetime,time import math import matplotlib.pyplot as plt from numpy import nan as NaN from scipy import stats #绘图 import seaborn as sns from collections import Counter # 统计函数 from scipy.stats import * from numpy.random impo...
niushufeng/Bitcoin_Python
code/1000min.py
1000min.py
py
4,915
python
en
code
0
github-code
90
13174207494
from replit import db import msg write = msg.Formatting() # default respond if 'respond' not in db.keys() : db['respond'] = False def get_data_respond() : return db['respond'] def set_data_respond(bool) : if 'respond' in db.keys() : db['respond'] = bool def store_data(data) : # jika key 'datalist' udh ...
boedegoat/mang-etan-bot
datalist.py
datalist.py
py
941
python
en
code
1
github-code
90
35225748809
import os from os import path as osp import numpy as np import pandas as pd import seaborn as sns from skeleton_tools.utils.constants import NET_NAME, DB_PATH from skeleton_tools.utils.tools import read_pkl, get_video_properties, init_directories, read_json, write_json pd.set_option('display.expand_frame_repr', False...
TalBarami/SkeletonTools
skeleton_tools/utils/evaluation_utils.py
evaluation_utils.py
py
14,925
python
en
code
0
github-code
90
36702644814
#!/usr/bin/env python3 # -*- coding:utf-8 -*- from __future__ import unicode_literals, print_function """ This code provides a gamecontroller client for the RoboCup Humanoid League. .. moduleauthor:: Nils Rokita <0rokita@informatik.uni-hamburg.de> .. moduleauthor:: Robert Kessler <8kessler@informatik.uni-hamburg.de>...
MosHumanoid/bitbots_thmos_meta
humanoid_league_misc/humanoid_league_game_controller/src/humanoid_league_game_controller/receiver.py
receiver.py
py
9,262
python
en
code
3
github-code
90
32847616725
import pygame import os from pygame.locals import * from locals import * import data from object import Gameobject from animation import Animation class Tile(Gameobject): def __init__(self, screen, tilex, tiley, set = "brown", tileclass = "wall"): Gameobject.__init__(self, screen, True) se...
geofmatthews/csci321
pyweek/whichwayisup_b055/lib/tile.py
tile.py
py
910
python
en
code
2
github-code
90
43395620433
#Practise basic examples from #https://github.com/aymericdamien/TensorFlow-Examples/blob/master/notebooks/1_Introduction/basic_operations.ipynb import tensorflow as tf a=tf.constant(2) b=tf.constant(3) with tf.Session() as sess: print(sess.run(a),sess.run(b),sess.run(a+b),sess.run(a*b)) a=tf.placeholder(tf.in...
nbodapati/C-Python-Coding-
Tensorflow/basic_examples.py
basic_examples.py
py
925
python
en
code
0
github-code
90
73647918376
# # 파이게임 기본(클래스) import pygame import random import cmath vec = pygame.Vector2 # 전역상수 SCREEN_X = 640 * 2 # 화면 넓이 SCREEN_Y = 480 * 2 # 화면 높이 FPS = 60 class Tank(pygame.sprite.Sprite): def __init__(self, root, pos, color, layer): self.game = root self.groups = self.game.all_sprites self...
freshmea/weizman_python_class
inclass/7-5_gravity2.py
7-5_gravity2.py
py
8,870
python
en
code
5
github-code
90
7915448415
''' Created on May 8, 2023 @author: klein test connection to dropbox ''' import dropbox import datetime import time from pathlib import Path from os.path import expanduser class TestDropBox(object): def __init__(self,local_dir = None , dropbox_dir = None , dropbox_file = None, tokenfile = None, loop_time = ...
pabloemma/LCWA
test_progs/test_dropbox.py
test_dropbox.py
py
5,574
python
en
code
0
github-code
90
21154609061
from database import getSession from player import Player from replay import Replay from sqlalchemy import func, and_ import datetime now = datetime.datetime.now() Past30 = now - datetime.timedelta(days=30) Past7 = now - datetime.timedelta(days=7) Past1 = now - datetime.timedelta(days=1) filter_week = (Replay.start_t...
DrCognito/ODotaMetaQueryPro
test_vis.py
test_vis.py
py
996
python
en
code
0
github-code
90
14546207112
from flask import request, Response import dbh import json import traceback def list_tweets(): # set user_id using args.get so it's not mandatory. try: user_id = request.args.get('userId') tweet_id = request.args.get('tweetId') except ValueError: return Response("Input was not a number!", mimetype="...
Shawnwood97/HotTakesBackend
tweets.py
tweets.py
py
9,982
python
en
code
0
github-code
90
42318942638
# 레이블링 함수 - cv2.connectedComponents # cv2.connectedComponents(image, labels=None, connectivity=None, ltype=None) -> retval, labels # • image: 8비트 1채널 영상 # • labels: 레이블 맵 행렬. 입력 영상과 같은 크기. numpy.ndarray. # • connectivity: 4 또는 8. 기본값은 8. # • ltype: labels 타입. cv2.CV_32S 또는 cv2.CV_16S. 기본값은 cv2.CV_32S. # • retval: 객체 ...
nhs04047/opencv_python_study
P15/labelling.py
labelling.py
py
2,475
python
ko
code
0
github-code
90
42323416030
def safe_pawns(pawns): s = 0 for x,y in pawns: x = ord(x) y = int(y) s = s + ((chr(x+1)+str(y-1)) in pawns or (chr(x-1)+str(y-1)) in pawns) return s if __name__ == '__main__': # These "asserts" using only for self-checking and not necessary for auto-testing assert safe_paw...
rawgni/empireofcode
pawn_brotherhood.py
pawn_brotherhood.py
py
532
python
en
code
0
github-code
90
33669793711
from tracemalloc import stop n1 = int(input("Digite um número inteiro qualquer: ")) mult = 0 if (n1 == 1): mult += 1 for x in range(2, n1): if (n1 % x == 0): # Se o resto for 0 significa q não é primo então aumenta o mult mult += 1 if(mult == 0): # Se o mult for 0 é primo print("É primo...
herudegan/Segunda-Fase
python/lista4 - for/ex7.py
ex7.py
py
363
python
pt
code
0
github-code
90
73619975657
from pathlib import Path import numpy as np import seaborn as sns import matplotlib.pyplot as plt from matplotlib import colors import torch import torch.nn as nn import torch.nn.functional as F from skimage.metrics import structural_similarity as ssim import copy LANDCOVER_CLASSES = { 0: "Clouds", 62: "Artifi...
xianyangcmu/HaRes
utils/visualization.py
visualization.py
py
37,453
python
en
code
0
github-code
90
18743960099
from sklearn import datasets from sklearn.linear_model import Ridge from azureml.explain.model.tabular_explainer import TabularExplainer from azureml.contrib.explain.model.explanation.explanation_client import ExplanationClient from sklearn.model_selection import train_test_split from azureml.core.run import Run from s...
ilserg70/Microsoft-Azure-AI-Camp-2019
Azure-Examples/AzureML/how-to-use-azureml/explain-model/explain-on-amlcompute/run_explainer.py
run_explainer.py
py
2,035
python
en
code
1
github-code
90
70496454377
from typing import List import cProfile import sys from tqdm import tqdm from list.linked.linkedlist import LinkedList sys.maxsize = 1000_000_000_000_000 class PrimeGenerator(object): def __init__(self, max_bound: int): self._max_bound = max_bound def generate(self) -> int: primes = self...
zaldis/RSA
primer/prime_generator.py
prime_generator.py
py
2,194
python
en
code
0
github-code
90
18493416269
from collections import defaultdict s=input() t=input() lis=defaultdict(lambda:"A") lis2=defaultdict(lambda:"A") for i,val in enumerate(s): if lis[val]=="A": lis[val]=t[i] else: if lis[val]!=t[i]: print("No") exit() for i,val in enumerate(t): if lis2[val]=="A": ...
Aasthaengg/IBMdataset
Python_codes/p03252/s772579353.py
s772579353.py
py
431
python
en
code
0
github-code
90
18533217509
n=int(input()) a=[int(input()) for _ in range(n)] if a[0]!=0: print(-1) exit() a.reverse() pre=a[0] tmp=pre ans=0 for ai in a[1:]: if ai>=pre: ans+=tmp pre=ai tmp=ai elif ai+1==pre: pre=ai else: print(-1) exit() ans+=tmp print(ans)
Aasthaengg/IBMdataset
Python_codes/p03347/s145926033.py
s145926033.py
py
268
python
en
code
0
github-code
90
16703431087
""" The geometric parameters are written to vbs files for electromeganetic modelling @author: Hao Yuan """ import os import re import numpy as np def vbs_cmd_output(it, hh, Position, GeoFerrite, flag): # Read vbs file filename = "WPT_baseline.vbs" with open(filename) as f: VBS...
hyuanmech/MOPSO
geo_parameters_update.py
geo_parameters_update.py
py
5,011
python
en
code
0
github-code
90
18259458899
s=input() q=int(input()) m=0 from collections import deque s=deque(s) for i in range(q): l=list(map(str,input().split())) if l[0]=="1": m+=1 m%=2 else: if m==0: if l[1]=="1": s.appendleft(l[2]) else: s.append(l[2]) else: if l[1]=="1": s.append(l[2]) ...
Aasthaengg/IBMdataset
Python_codes/p02756/s911388304.py
s911388304.py
py
403
python
en
code
0
github-code
90
39922096145
import time import decimal from utils import DB from sql_scripts import StationsScript_V from sql_scripts import DGUsScript_V from sql_scripts import RastrGenScript_V from sql_scripts import GeneratorsScript_V from sql_scripts import GUsScript_V from sql_scripts import NBlockScript_V from sql_scripts import NodesScrip...
konstantinov90/calc_factory
eq_db/vertica_corrections.py
vertica_corrections.py
py
6,684
python
en
code
0
github-code
90
18681054528
from future.utils import with_metaclass from jsonschema import validate, ValidationError from ax.exceptions import AXIllegalArgumentException from ax.util.singleton import Singleton class Annotations(with_metaclass(Singleton, object)): ax_ea_docker_enable = { "$schema": "http://json-schema.org/schema#",...
zhan849/argo
platform/source/lib/ax/platform/annotations.py
annotations.py
py
2,645
python
en
code
null
github-code
90
73885154217
#!/usr/bin/env python # -*- coding: utf-8 -*- import ROOT import random def main(): outputfile = ROOT.TFile("test_distributions.root", "RECREATE") hist1 = ROOT.TH1F("source", "source", 100, 0., 100.) hist2 = ROOT.TH1F("target", "target", 100, 0., 100.) for i in range(100000): hist1.Fill(random...
KIT-CMS/sm-htt-analysis
quantile-method/ThrowExampleDistributions.py
ThrowExampleDistributions.py
py
479
python
en
code
2
github-code
90
10122429402
# import libraries import json import os import os.path import sys from pathlib import Path import datetime class fileio: #class for All operations #path variabel is for path of the data store file path=None #constructor def __init__(self,path=None): #if path is given than we wi...
jjimenpanchal/Freshworks
App.py
App.py
py
3,582
python
en
code
0
github-code
90
38867312176
import requests import time import os.path #url = "https://umod.org/plugins/search.json?query=&page=1&sort=downloads&sortdir=desc&filter=&categories%5B%5D=rust&author=" #scraper = cloudscraper.create_scraper() #html = scraper.get(url).text #page_soup = soup(html, "html.parser") # #site_json=json.loads(page_so...
josuefreire1/umod-rust-plugins-list
scraper.py
scraper.py
py
2,954
python
en
code
0
github-code
90
14187143221
__author__ = 'josh' from django.conf.urls import patterns, url from git_updater import views urlpatterns = patterns('', # author urls url(r'^admin/updates/$', views.UpdatesListView.as_view(), name='update_list'), url(r'^admin/updates/apply/$', views.apply_all_updates, name='do_updates') )
XerxesDGreat/library-app
git_updater/urls.py
urls.py
py
303
python
en
code
0
github-code
90
31078199284
import queue import random q = queue.PriorityQueue() class Job(object): def __init__(self, priority, description): self.priority = priority self.description = description print("New job description") def __cmp__(self, other): return cmp(self.priority, other.priority) q = que...
sudeep0901/python
src/concurrency in python/python concurrecy/30.threadpriority_queue.py
30.threadpriority_queue.py
py
460
python
en
code
0
github-code
90
8326555809
medio = int(input("Cuantos numero de en medio quieres agarrar:")) refe1 = int(input("Ingrese el Valor de la semilla 1:")) refe2 = int(input("Ingrese el Valor de la semilla 2:")) repe = int(input("Cuantas veces quieres repetir:")) lista = [] NumeroN = refe1 divisorizq = 0 divisorder = 0 pivote = 0 longitud = 0 for i in ...
PhelerRdz/C_Sharp
ProductosMedios/main.py
main.py
py
1,226
python
es
code
0
github-code
90
12883816695
from __future__ import print_function, absolute_import import json import logging import os from traitlets import Bool from jupyterlab.tests.test_app import ProcessTestApp HERE = os.path.dirname(os.path.realpath(__file__)) class ServicesTestApp(ProcessTestApp): """A notebook app that runs a mocha test.""" ...
sboreti/jupyterlab
packages/services/test/run-test.py
run-test.py
py
1,845
python
en
code
0
github-code
90
43125592937
import matplotlib.pyplot as plt import imageio import numpy as np def display_npy(img, save=False, filename='out'): """Displays a numpy matrix as a PNG image Parameters ---------- img : MxNx3 image with RGB colors save : indicates whether to save the image filename : the name to s...
kpetridis24/image-rendering
inc/Helpers/display.py
display.py
py
1,814
python
en
code
0
github-code
90
19330557721
import sys import pykafka import json import tweepy from tweepy import OAuthHandler from tweepy import Stream from tweepy.streaming import StreamListener class TweetsListener(StreamListener): def __init__(self, kafkaProducer): super(TweetsListener, self).__init__() print ("Tweets Kafka producer in...
T4M1R/cs523-bdt
kafkaTweetProducer.py
kafkaTweetProducer.py
py
1,825
python
en
code
1
github-code
90
73884960937
""" ############################################################ Module: ForceInd Purpose: Calculate the Force Necessary for the individual molecules. Call Functions From SymmDerivInd. Notice: Some Functions are specific to Keras backend. Theano Backend has a quite different implementation of the gradient calculatio...
KIT-Workflows/DFTB-Neural-Net
WaNos/NN-2G/src/Calculator/ForceInd.py
ForceInd.py
py
9,447
python
en
code
2
github-code
90
33062969981
from do import run from tools import splitext_plus ADAPTER = "TCAGAGTTCTACAGTCCGACGATC" def run_cuadapt(file_in): """remove adapter""" adapter = ADAPTER output = "%s-clean%s" % (splitext_plus(file_in)[0], ".fastq") cmd = ("cutadapt -g {adapter} --discard-untrimmed -O 10 " " --minimum-leng...
lpantano/seqcluster-helper
sqhelper/quality.py
quality.py
py
422
python
en
code
2
github-code
90
18184238429
import sys s2nn = lambda s: [int(c) for c in s.split(' ')] ss2nn = lambda ss: [int(s) for s in ss] ss2nnn = lambda ss: [s2nn(s) for s in ss] i2s = lambda: sys.stdin.readline().rstrip() i2n = lambda: int(i2s()) i2nn = lambda: s2nn(i2s()) ii2ss = lambda n: [sys.stdin.readline().rstrip() for _ in range(n)] ii2sss = lambda...
Aasthaengg/IBMdataset
Python_codes/p02615/s735665587.py
s735665587.py
py
1,090
python
en
code
0
github-code
90
41332904310
try: size=int(input("enter the size of an array :")) except ValueError as e: print(e) exit(1) rohit=[] for i in range(size): value=int(input(f"enter the array element at location {i+1} :")) rohit.append(value) sorted_array=sorted(rohit) print("our original array is :",rohit) print("your sorted arr...
rohit9098singh/python_programming
ch2_10sorting_array.py
ch2_10sorting_array.py
py
353
python
en
code
0
github-code
90
73378606058
import os import torch import torch.distributed as dist import time import functools from torchdistpackage import setup_distributed_slurm # reference: https://github.com/NVIDIA/nccl-tests/blob/master/doc/PERFORMANCE.md # algbw = Size/time # bus_bw = algbw * fraction * (n-1)/n mode_2_frac = dict( all_reduce = 2, ...
KimmiShi/TorchDistPackage
torchdistpackage/dist/py_comm_test.py
py_comm_test.py
py
2,368
python
en
code
6
github-code
90
38347480436
#Author: Thomas Keefe #Email: tjk819@gmail.com #Date: 12/03/2023 from Inventory import Inventory def main(): inventory = Inventory() #Your program should have appropriate methods such as: #add a new vehicle lightning_mcqueen = inventory.make_car("Ford", "Fusion", "red", 2007, 195000) subaroo = in...
KeefeT/CSUGlobal
ITS320_Basic_Programming/tjs_code/ITS320-portfolio/main.py
main.py
py
1,457
python
en
code
0
github-code
90
18406529269
# https://atcoder.jp/contests/abc126/tasks/abc126_e class UnionFind(): # https://www.slideshare.net/chokudai/union-find-49066733 # 作りたい要素数nで初期化 # 使用するインスタンス変数の初期化 def __init__(self, n): self.n = n # root[x]<0ならそのノードが根かつその値が木の要素数 # rootノードでその木の要素数を記録する # root[x]>=0の場合は、特に...
Aasthaengg/IBMdataset
Python_codes/p03045/s179116287.py
s179116287.py
py
2,656
python
ja
code
0
github-code
90
31142094858
# -*- coding: utf-8 -*- """Module with read/write utility functions which are *not* based on the Dataiku API""" from typing import AnyStr from typing import List import pandas as pd # ============================================================================== # CLASS AND FUNCTION DEFINITION # ====================...
dataiku/dss-plugin-nlp-offline-translation
python-lib/plugin_io_utils.py
plugin_io_utils.py
py
1,338
python
en
code
3
github-code
90
18314824478
from flask import Flask,render_template,flash,redirect,request,session from flask_uploads import UploadSet,IMAGES,configure_uploads from excel_operate import * import os app = Flask(__name__) app.config.from_object('config') #1. 这个东西是用来存储文件的,当用户上传到同名文件的时候,可以自动加后缀 #2. app要配置UPLOADED_FILE_DEST 属性,指出操作文件的目录在哪 其中'FILE' 与...
haduoken/web_excel
app.py
app.py
py
4,710
python
en
code
2
github-code
90
20903927882
import argparse import ast import multiprocessing import numpy as np import os import sys from functools import partial import paddle import paddle.fluid as fluid import reader from config import * from desc import * from model import fast_decode as fast_decoder from train import pad_batch_data, pad_phoneme_data, pre...
PaddlePaddle/Research
NLP/ACL2019-JEMT/infer.py
infer.py
py
12,514
python
en
code
1,671
github-code
90
73564565098
''' Created on Oct 12, 2018 Scientific Notation input: 9000 output: 9*10^3 @author: Roman Blagovestny ''' def scinotdown(n): cz=0 n=float(n) if n<1 and n>-1: while n<1 and n>-1: cz+=1 n*=10 return str(n)+"*10^-"+str(cz) if n>1 or n<-1: whil...
darkblaro/Python-code-samples
scientificNotation.py
scientificNotation.py
py
589
python
en
code
0
github-code
90
18430811899
from collections import defaultdict mod = 10**9+7 n = int(input()) s = list(input()) ans = 1 dd = defaultdict(lambda:0) for i in s: dd[i] += 1 for key in dd: ans *= dd[key]+1 ans %= mod ans -= 1 print(ans)
Aasthaengg/IBMdataset
Python_codes/p03095/s235840572.py
s235840572.py
py
217
python
en
code
0
github-code
90
41792759808
#!/usr/bin/env python # # Remove some benchmark from a JSON file produced by futhark-bench's --json # option. # # This is useful if we accidentally added some pointless programs that # just obscure things. import json import sys remove = sys.argv[1] files = sys.argv[2:] removed = False i = 0 for fp in files: wit...
diku-dk/futhark
tools/remove-from-bench-json.py
remove-from-bench-json.py
py
871
python
en
code
2,199
github-code
90
39471609916
import random import string from random import randint from django.http import HttpResponse, JsonResponse from django.shortcuts import render, redirect from django.db import connection from django.core.mail import send_mail from django.shortcuts import render # Create your views her def home(request): return ren...
krati909/url-shortening-
urlshort/views.py
views.py
py
2,589
python
en
code
0
github-code
90
70780140136
import pathlib from pathlib import Path import subprocess from dolfin import ( File, Function, FunctionSpace, HDF5File, Mesh, MeshFunction, MeshValueCollection, VectorFunctionSpace, XDMFFile, ) import meshio import numpy as np from cardiac_benchmark_toolkit.data import DEFAULTS, MA...
Reidmen/cardiac_benchmark_toolkit
src/cardiac_benchmark_toolkit/mesh_generation.py
mesh_generation.py
py
12,211
python
en
code
0
github-code
90
18494247479
'''h2d5 ポイントは重複組み合わせ(仕切りと中身)と素因数因数分解 N+素因数分解の指数-1から指数を選ぶ組み合わせ(指数-1が仕切りの枚数) nPr=n!/(n-r)! nCr=n!/(n-r)!*r!=(n*(n-1)*...*(n-r+1))/r!(分子分母は共にr個) ''' import math MOD=10**9+7 def comb(n,r): nPr=1 fact_r=1 for i in range(r): nPr*=n-i fact_r*=r-i return nPr//fact_r N,M=map(int,input().split()) fact={} for...
Aasthaengg/IBMdataset
Python_codes/p03253/s863387281.py
s863387281.py
py
846
python
ja
code
0
github-code
90
44027329357
#settings game import pygame class Settings(): #Parameters def __init__(self): #standart settings self.screen_width = 1000 self.screen_height = 700 self.bg_color = (230, 230, 230) self.bg_image = pygame.image.load('img/bg.png') #settings of ship self.ship_speed_factor = 1.5 self.ship_limit = 3 #set...
Crying-Soul/alien_invasion-Python-Game-
settings.py
settings.py
py
1,497
python
en
code
0
github-code
90
5309785290
# -*- coding: utf-8 -*- """ Created on Mon Oct 24 17:09:07 2022 @author: Hammad Hassan """ def SearchA(Arr, x): num=[] for i in range(len(Arr)): if(Arr[i]==2): num.append(i) return num X = [22,2,1,7,11,13,5,2,9] print(SearchA(X,2))
hamadhassan/Data-Structures-and-Algorithms
Preperation/Mid-Term Preperation/Manual1.py
Manual1.py
py
278
python
en
code
0
github-code
90
40006492055
#adding 2 number(linked list) # Definition for singly-linked list. # class ListNode(object): # def __init__(self, val=0, next=None): # self.val = val # self.next = next class Solution(object): def push(self,new_data): new_node=ListNode(new_node) new_node.next=self.head se...
sarahasan17/Leetcode-questions
adding2numbers.py
adding2numbers.py
py
1,304
python
en
code
0
github-code
90
932566186
from django.contrib.auth import get_user_model from rest_framework import serializers from rest_framework.validators import UniqueTogetherValidator from communities.models import Channel, ChannelRole, Membership class MembershipSerializer(serializers.ModelSerializer): """ Serializer used in MembershipViewSet...
javierclavijo/tandem-backend
tandem/common/serializers.py
serializers.py
py
1,318
python
en
code
0
github-code
90
30506275543
from django.core.management.base import BaseCommand, CommandError from axes.utils import reset class Command(BaseCommand): args = '' help = ("resets any lockouts or failed login records. If called with an " "IP, resets only for that IP") def handle(self, *args, **kwargs): if args: ...
chipperdrew/talkEdu
axes/management/commands/axes_reset.py
axes_reset.py
py
405
python
en
code
0
github-code
90
21794274839
#!/usr/bin/python # -*- coding: utf-8 -*- """ - accounts.models ~~~~~~~~~~~~~~~~~ - This file contains the Accounts(user) models that will map into DB tables. """ # future from __future__ import unicode_literals # 3rd party import os, uuid from imagekit.models import ImageSpecField from imagekit.processors import ...
veris-neerajdhiman/v-user
accounts/models.py
models.py
py
4,194
python
en
code
0
github-code
90
36843985637
""" This module defines the URL patterns for the main app. It imports the path function from django.urls and the views.py file from the main app. It sets the app_name variable to "main" and the urlpatterns variable to a list of paths. """ from django.urls import path from . import views app_name = "main" urlpattern...
sitamgithub-MSIT/codewithmaps
main/urls.py
urls.py
py
430
python
en
code
0
github-code
90
42226912355
# Importar las bibliotecas necesarias from pyspark.sql import SparkSession from pyspark.sql.functions import regexp_replace, when, col import json import tkinter as tk # Crear una sesión de Spark spark = SparkSession.builder.appName("estaciones").getOrCreate() # Definir las rutas de los archivos ruta_datos = '/home/g...
Jhosep99/Mapeo-de-Estaciones-meteorol-gicas
trabajo_estaciones/estaciones.py
estaciones.py
py
5,162
python
es
code
0
github-code
90
18317681257
# -*- coding: utf-8 -*- from __future__ import absolute_import, unicode_literals from six import StringIO import pytest from django.core.management import call_command @pytest.mark.django_db() def test_command(): ret = call_command('createanonymoususer') assert ret is None @pytest.mark.django_db() def tes...
saxix/django-anonymoususer-permissions
tests/test_command.py
test_command.py
py
991
python
en
code
1
github-code
90
35012762675
from . import views from django.urls import path app_name="main" urlpatterns=[ path('', views.home, name="home"), path('aboutus', views.aboutus, name="aboutus"), path('media', views.media, name="media"), path('allvideos', views.allvideos, name="allvideos"), path('allphotos', views.allphotos, name=...
adityanathtiwari2019/akali
main/urls.py
urls.py
py
1,139
python
en
code
0
github-code
90
18454535009
import sys import numpy as np import numba from numba import jit read = sys.stdin.buffer.read readline = sys.stdin.buffer.readline readlines = sys.stdin.buffer.readlines @jit def main(n): ans = [n] m = 0 while not ans[m] in ans[:m]: if n%2 == 0: n /= 2 ans.append(n) else: n = 3 * n + 1...
Aasthaengg/IBMdataset
Python_codes/p03146/s652693946.py
s652693946.py
py
409
python
en
code
0
github-code
90
25698548832
""" Created: 13 May 2020 Author: Jordan Prechac """ import logging logger = logging.getLogger(__name__) from revibe.utils import getattr_or_get from accounts.models import CustomUser from content import models # ----------------------------------------------------------------------------- def get_album_id(obj): ...
Revibe-Music/core-services
notifications/utils/objects.py
objects.py
py
1,888
python
en
code
2
github-code
90
18305689239
n=int(input()) p=2 from itertools import product iterator=product(range(p),repeat=n) #for idxs in iterator: # print(idxs) L=[[] for i in range(n)] for i in range(n): a=int(input()) for _ in range(a): L[i].append(list(map(int,input().split()))) ans=0 for idxs in iterator: cnt_honest=0 for i i...
Aasthaengg/IBMdataset
Python_codes/p02837/s156110650.py
s156110650.py
py
594
python
en
code
0
github-code
90
14302813220
import nevergrad as ng from nevergrad.optimization.base import Optimizer from objective_functions import rank_function_v1 from nevergrad_algorithm_base import NevergradAlgorithmBase algorithm = NevergradAlgorithmBase( ng.families.ParametrizedBO( utility_kind="ei", utility_kappa=1, utility_...
samuelstroschein/bachelor-thesis
src/old/lego_inspired.py
lego_inspired.py
py
1,521
python
en
code
1
github-code
90
74661466216
#------------------------------- # COMP.SEC.220 Tutorial 8 # Batuhan Dilek # 152177373 #------------------------------- import os import random import string import struct from Cryptodome.Cipher import AES from Cryptodome import Random from Cryptodome.Hash import SHA256 import mysql.connector import codecs import time ...
batuhan-dilek99/Cryptography
tutorial8.py
tutorial8.py
py
5,549
python
en
code
0
github-code
90
19994777821
from __future__ import absolute_import, division, print_function from collections import namedtuple import numpy as np import tensorflow as tf import tensorflow.contrib.slim as slim monodepth_parameters = namedtuple('parameters', 'encoder, ' 'height,...
val-iisc/GD-UAP
depth_estimation/monodepth_files/monodepth_model.py
monodepth_model.py
py
9,031
python
en
code
65
github-code
90
43891589116
# refresh a discord api token def refresh_token(old_rtoken): from requests_oauthlib import OAuth2Session import oauthlib.oauth2 import common.credentials.discord as _discord import common.logger as _logger client_id = _discord.client_id client_secret = _discord.client_secret redirect_url ...
jowrjowr/tri_common
maint/discord/refresh.py
refresh.py
py
1,006
python
en
code
0
github-code
90