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
18162893279
from math import gcd from functools import reduce from collections import defaultdict n=int(input()) a=list(map(int,input().split())) if reduce(gcd,a)!=1: print("not coprime") exit() def primes(x): ret=[] for i in range(1,int(x**0.5)+1): if x%i==0: ret.append(i) if x//i!=i: ret.append(...
Aasthaengg/IBMdataset
Python_codes/p02574/s278382771.py
s278382771.py
py
509
python
en
code
0
github-code
90
10576732820
#!/usr/bin/env python from __future__ import division import numpy as np import scipy as sp from pylab import ion from scipy import signal as sig from scipy import optimize as opt from scipy.interpolate import interp1d #from scipy.io import loadmat import matplotlib as mpl from matplotlib.mlab import * from matplotli...
jllanfranchi/pygeneric
fitMechResPeaks.py
fitMechResPeaks.py
py
9,011
python
en
code
0
github-code
90
10598796120
from datetime import datetime class Publishing: def __init__(self, text): self.i = text def main(): while True: try: val = int(input( 'Enter 1 if you want to add NEWS,\nEnter 2 if you want to add Private Ad,\nEnter 3 if you want to add Joke value,\nType here and cli...
QaAleks/PhytonCourse
home_task5.py
home_task5.py
py
2,741
python
en
code
0
github-code
90
18017404631
from typing import Callable, List from pytorch_toolbelt.inference.tiles import ImageSlicer from pytorch_toolbelt.utils.fs import id_from_fname from pytorch_toolbelt.utils.torch_utils import ( tensor_from_rgb_image, tensor_from_mask_image, ) from torch.utils.data import Dataset, ConcatDataset class ImageMaskD...
SysCV/transfiner
pytorch_toolbelt/utils/dataset_utils.py
dataset_utils.py
py
4,812
python
en
code
501
github-code
90
73209397098
import logging import requests from assemblyline.common import forge config = forge.get_config() logger = logging.getLogger('assemblyline.ui') def get_apps_list(): apps = {'apps': []} if config.ui.discover_url: try: resp = requests.get(config.ui.discover_url, headers={'accept': 'applicati...
CybercentreCanada/assemblyline-ui
assemblyline_ui/helper/discover.py
discover.py
py
1,686
python
en
code
13
github-code
90
17506205021
from flask_restx import Namespace ,Resource from werkzeug.datastructures import FileStorage from app.models import db,User from flask_jwt_extended import jwt_required profile = Namespace('profile',description="Endpoint for modifying and updating user profile") profile_parser = profile.parser() profile_parser.add_arg...
Aaron-Ochieng/api
server/app/profile/__init__.py
__init__.py
py
1,486
python
en
code
0
github-code
90
17999696359
def main(): A, B, C = map(int,input().split()) temp = 1 for i in range(1, B+1): temp = A*i if temp%B == C: return 'YES' return 'NO' print(main())
Aasthaengg/IBMdataset
Python_codes/p03730/s141367032.py
s141367032.py
py
192
python
en
code
0
github-code
90
34839012964
import re import string f = open("mimic_paragraphs.txt", 'r') g = open("mimic_paragraphs_cleaned.txt", 'w') for line in f: target_sentence = line[:-1].lower() remove_newline = re.sub(r'\\n', ' ', target_sentence) contents_without_paren = re.sub(r'\(.*?\)', "", remove_newline) contents_without_names = ...
jacobjinkelly/clinical-ad
preprocess_pipeline/clean_mimic.py
clean_mimic.py
py
3,123
python
en
code
3
github-code
90
26870579215
""" Provide useful functions to run convergence studies. """ import datetime import hashlib import multiprocessing as mp import os import shutil import sys import numpy as np import saf.util.output as util_output from saf.action.solve import solve from saf.common.config import Config from saf.util.observedorder impo...
dmitry-kabanov/fickettmodel
saf/util/convergencestudy.py
convergencestudy.py
py
6,789
python
en
code
0
github-code
90
30372488393
import asyncio from functools import lru_cache from pathlib import Path from typing import Any, Optional import boto3 import botocore.client import botocore.config import botocore.configloader import botocore.exceptions from boto3.s3.transfer import TransferConfig from pydantic import Field, SecretStr from pydantic_se...
ghga-de/hexkit
src/hexkit/providers/s3/provider.py
provider.py
py
32,173
python
en
code
3
github-code
90
18259445449
from collections import deque S = deque(input()) Q = int(input()) q = [input().split() for _ in range(Q)] flag = True for x in q: if x[0] == "1": if flag: flag = False else: flag = True else: if x[1] == "1": if flag: S.appendleft(x[2]) else: S.append(x[2]) ...
Aasthaengg/IBMdataset
Python_codes/p02756/s902024903.py
s902024903.py
py
454
python
en
code
0
github-code
90
18540542379
from itertools import accumulate from collections import Counter n = int(input()) l = list(map(int,input().split())) acc = [0] + list(accumulate(l)) ans = 0 c = Counter(acc) for k,v in c.items(): ans += v*(v-1)//2 print(ans)
Aasthaengg/IBMdataset
Python_codes/p03363/s221242780.py
s221242780.py
py
231
python
en
code
0
github-code
90
33394786783
import os from django.shortcuts import reverse from django.contrib.auth.models import User from django.db import models from django.utils import timezone from django.utils.crypto import get_random_string from channels.db import database_sync_to_async from django_resized import ResizedImageField from . import util ...
NickJGG/mixjam
core/models.py
models.py
py
6,716
python
en
code
0
github-code
90
34731547467
#!/usr/bin/env python3 """ Defines `expectation`. """ import numpy as np pdf = __import__('5-pdf').pdf def expectation(X, pi, m, S): """ Calculates the expectation step in the EM algorithm for a GMM. X: A numpy.ndarray of shape (n, d) containing the data set. pi: A numpy.ndarray of shape (k,) contain...
keysmusician/holbertonschool-machine_learning
unsupervised_learning/0x01-clustering/6-expectation.py
6-expectation.py
py
1,694
python
en
code
1
github-code
90
18067581199
#!/usr/bin/python # -*- coding: UTF-8 -*- import sys def get_ints(): return map(int, sys.stdin.readline().strip().split()) def _main(): input() an = list(get_ints()) t = 0 old = 1000000000 while 1: ans = sq(t, an) g = sq(t+1, an) - ans t -= g / abs(g) if old...
Aasthaengg/IBMdataset
Python_codes/p04031/s257853811.py
s257853811.py
py
535
python
en
code
0
github-code
90
39307651570
from datetime import datetime, timedelta from django.http.response import JsonResponse from rest_framework.generics import ListCreateAPIView from .models import Candidate from .serializers import CandidateSerializer, WorkExperienceSerializer from .services import (commit_work_experience, get_formated_work_experience,...
Rostyslav97/candidates_application
core/views.py
views.py
py
1,140
python
en
code
0
github-code
90
24293408506
import tensorflow as tf from tensorflow import keras from scipy.io import loadmat, savemat from os import listdir from os.path import dirname, join as join import numpy as np import matplotlib import matplotlib.pyplot as plt from sklearn.model_selection import train_test_split from tensorflow.python.keras import Model...
ejkemper/ComputationalNeuroscienceProject
CN_project/Classify_latent_space.py
Classify_latent_space.py
py
3,229
python
en
code
0
github-code
90
10714904589
# -*- coding: utf-8 -*- import sys from ..decorators import linter from ..parsers.base import ParserBase @linter( name="black", install=[[sys.executable, "-m", "pip", "install", "-U", "black"]], help_cmd=["black", "-h"], run=["black"], rundefault=["black"], dotfiles=[], language="python"...
guykisel/inline-plz
inlineplz/linters/black.py
black.py
py
517
python
en
code
33
github-code
90
30513083935
# -*- coding: utf-8 -*- import random def selection_sort(collection): length = len(collection) for i in range(length): min_i = i for j in range(i+1, length): if collection[j] < collection[min_i]: min_i = j collection[i], collection[min_i] = collection[min_i...
fangniu/leetcode
sorts/selection_sort.py
selection_sort.py
py
585
python
en
code
0
github-code
90
13006962125
from django import forms class UploadFileForm(forms.Form): file = forms.FileField() CHOICES = (('png', 'PNG'), ('jpg', 'JPEG'), ('pdf', 'PDF'), ('bmp', 'BMP'), ('ico', 'ICO'), ('tiff', 'TIFF'), ('webp', 'WEBP'), ('csv', 'CSV'), ('xlsx', 'XLSX'), ('mp3', 'MP3'), ('wav', 'WAV'), ...
AdiH16/PyConverter
converter/forms.py
forms.py
py
634
python
en
code
0
github-code
90
18434513339
n,m=map(int,input().split()) a=[] b=[] for i in range(n): s=list(map(int,input().split())) a.append(s[0]) b.append(s[1]) c=zip(a,b) d=sorted(c) #print(d) #print(d[0][1]) yen=0 btl=0 for i in range(n): if d[i][1]+btl<m: yen+=d[i][0]*d[i][1] btl+=d[i][1] elif d[i][1]+btl>=m: ye...
Aasthaengg/IBMdataset
Python_codes/p03103/s817801970.py
s817801970.py
py
401
python
en
code
0
github-code
90
8595415855
#!/usr/bin/env python from hashlib import md5 from pprint import pprint from subprocess import Popen, PIPE import difflib import json import re import sys import textwrap import xml.etree.ElementTree as ET if len(sys.argv) < 3: print('Usage: difftr <ktr1> <ktr2>') exit(1) def wrap(s): return '\\n'.join(textwra...
dhanasgit/difftr
difftr.py
difftr.py
py
4,809
python
en
code
0
github-code
90
19641099304
try: import tkinter except ImportError: # python 2 import Tkinter as tkinter #tkinter._test() main_window = tkinter.Tk() main_window.title("Hello World") main_window.geometry('960x480') label = tkinter.Label(main_window, text="Hello World") label.pack(side='top') left_frame = tkinter.Frame(main_window) left...
klinetek/Python-Mastery
Modules/tkinterdemo.py
tkinterdemo.py
py
848
python
en
code
0
github-code
90
24815333219
import sys from os import listdir, environ from os.path import isdir, isfile, join, splitext, basename from distutils.dir_util import mkpath import json import posixpath import urllib.parse as urlparse from aiostream import stream from datetime import datetime import traceback import asyncio import requests import yaml...
mikhailfarberov/teleparser
app/vk/app.py
app.py
py
7,135
python
en
code
1
github-code
90
18321253579
mod = 10**9 + 7 _factorial = [1] def fact(n): ''' n! % mod ''' if n >= mod: return 0 _size = len(_factorial) if _size < n+1: for i in range(_size, n+1): _factorial.append(_factorial[i-1]*i % mod) return _factorial[n] _factorial_inv = [1] def fact_inv(n): ''' n!^-...
Aasthaengg/IBMdataset
Python_codes/p02862/s497136609.py
s497136609.py
py
1,362
python
en
code
0
github-code
90
18515818589
# -*- coding: utf-8 -*- """ A - Colorful Slimes 2 https://atcoder.jp/contests/agc026/tasks/agc026_a """ import sys def solve(N, slimes): prev = None ans = 0 for s in slimes: if s == prev: prev = None ans += 1 else: prev = s return ans def main(arg...
Aasthaengg/IBMdataset
Python_codes/p03296/s591640884.py
s591640884.py
py
486
python
en
code
0
github-code
90
31928397847
# Uses python3 def edit_distance(a, b): m = len(b) + 1 n = len(a) + 1 import numpy as np D = np.zeros((n, m), dtype=int) for i in range(n): D[i, 0] = i for j in range(m): D[0, j] = j for j in range(1, m): for i in range(1, n): if a[i-1]...
avdolgikh/Coursera_Algorithms
Tasks_execution/AlgorithmToolbox/w5_edit_distance.py
w5_edit_distance.py
py
1,141
python
en
code
0
github-code
90
17523095450
from __future__ import absolute_import, unicode_literals from .. import * # NOQA INSTALLED_APPS += ('test_without_migrations',) INSTALLED_APPS = [ cls for cls in INSTALLED_APPS if cls != 'whitenoise.runserver_nostatic' ] COMMON_PRODUCTION_ERROR_LOG_PATH = '/tmp/mayan-errors.log' TEMPLATES[0]['OPTIONS']['loade...
Fourdee/mayan-edms
mayan/settings/testing/base.py
base.py
py
666
python
en
code
null
github-code
90
74719614055
''' Volume Confirmation: Volume should ideally confirm the price movement. If the price of a stock is rising, higher volume is generally considered positive, indicating increased buying pressure. Conversely, if the price is falling, higher volume suggests greater selling pressure ''' import pandas as pd impor...
harshgupta1810/volume_analysis_stockmarket
volume_confirmation.py
volume_confirmation.py
py
1,497
python
en
code
0
github-code
90
18543743479
#095_D n, c = map(int, input().split()) x, v = [0], [0] for _ in range(n): a, b = map(int, input().split()) x.append(a) v.append(b) x.append(c) v.append(0) fr1, fr2 = [0 for _ in range(n+1)], [0 for _ in range(n+1)] fl1, fl2 = [0 for _ in range(n+2)], [0 for _ in range(n+2)] tmp1, tmp2 = 0, 0 for i in ran...
Aasthaengg/IBMdataset
Python_codes/p03372/s204971101.py
s204971101.py
py
766
python
en
code
0
github-code
90
18120719459
import math n = int(input()) x = [int(i) for i in input().split()] y = [int(i) for i in input().split()] D = [x for i in range(4)] for i in range(len(D)): if i == len(D) -1: D[i] = 0 for j in range(n): di = math.fabs(x[j]-y[j]) if D[i] < di: D[i] = di e...
Aasthaengg/IBMdataset
Python_codes/p02382/s989042947.py
s989042947.py
py
531
python
en
code
0
github-code
90
38240724945
# Display deptname and avg. salary from employees.txt def isnumber(s): try: v = float(s) return True except: return False f = open("employees.txt", "rt") # read text for line in f: parts = line.strip().split(",") if len(parts) < 2: continue name = parts[0] # ...
srikanthpragada/PYTHON_06_MAY_2021
demo/libdemo/dept_avg_salary.py
dept_avg_salary.py
py
571
python
en
code
0
github-code
90
15832782998
import typer from ToolingEnvironmentManager.Management import EnvironmentManager, process_params from SharedInterfaces.SharedTypes import StatusResponse from helpers.utils import yes_or_no from rich import print from rich.console import Console from helpers.auth_helpers import setup_auth import requests from typing imp...
provena/provena
admin-tooling/prov-store/graph_admin.py
graph_admin.py
py
3,562
python
en
code
3
github-code
90
11032440183
import json import time import unittest from functools import wraps from threading import Lock, Thread from app import app from data.queue import WorkQueue from initdb import initialize_database, populate_database, wipe_database QUEUE_NAME = "testqueuename" class AutoUpdatingQueue(object): def __init__(self, qu...
quay/quay
test/queue_threads.py
queue_threads.py
py
2,136
python
en
code
2,281
github-code
90
18212233259
#!/usr/bin/env python3 import math n = int(input()) mod = 10**9+7 data = {} zero_zero = 0 for i in range(n): a, b = list(map(int, input().split())) # # print(a, b) if a == 0 and b == 0: zero_zero += 1 continue gcd = math.gcd(a, b) a, b = a//gcd, b//gcd if a < 0: a, b ...
Aasthaengg/IBMdataset
Python_codes/p02679/s408198196.py
s408198196.py
py
2,422
python
en
code
0
github-code
90
20023356458
import requests import json import random as rand import html data_validation3=False while data_validation3==False: r=requests.get("https://opentdb.com/api.php?amount=1&category=18&type=multiple") if r.status_code==200: string=json.loads(r.text) category= string['results'][0]['category'] ...
josephfrancis-07/Science_Quiz_bot
Quiz using APIs.py
Quiz using APIs.py
py
3,060
python
en
code
0
github-code
90
32285734757
import simpy import numpy as np # Multichannel Queuing System Simulation processes class class QueuingSystemSimulation: def __init__(self, n, m, lambd, mu, v, env): # queuing system params self.n = n self.m = m self.lambd = lambd self.mu = mu self.v = v # emp...
MarsRool/MMoD
queueing_system_simulation.py
queueing_system_simulation.py
py
2,449
python
en
code
0
github-code
90
7464876174
# Modules import os import re # Open file txtpath = os.path.join('raw_data','paragraph_3.txt') with open(txtpath, "r") as txtfile: # Count the goals paragraph=txtfile.read() word=re.split(" ", paragraph) wordcount=len(word) Avg_Lettercount=sum([len(i) for i in word])/wordcount sentenc...
Wenchao-W/python-challenge
PyParagraph/main.py
main.py
py
767
python
en
code
0
github-code
90
35219510779
import sys from copy import deepcopy input = sys.stdin.readline n = int(input()) data = [list(map(int, input().split())) for _ in range(n)] #dfs로는 자꾸 시간초과가 나네 결국엔 dp로 가야하네 result = float('inf') ''' if n == 3: def dfs(start, x, y, score): global data, n, result if score >= result: retur...
yongwoo97/algorithm
gold/17404_RGB 거리 2.py
17404_RGB 거리 2.py
py
2,090
python
en
code
0
github-code
90
5645352186
# coding: utf-8 ''' Test our logging and formatting. ''' # ----------------------------------------------------------------------------- # Imports # ----------------------------------------------------------------------------- from typing import Optional, Union, Tuple, Mapping, Literal from io import StringIO imp...
cole-brown/veredi-code
logs/log/zest_log.py
zest_log.py
py
26,288
python
en
code
1
github-code
90
12172769002
#faces.py import numpy as np class Faces: def __init__(self, perm, mob, area, nodes, erel): self.nodes = nodes self.erel = erel self.area = area self.perm = perm self.mob = mob def area(self): v1 = self.nodes() v2 = self.nodes() volume = (1 / 2)...
tuliocavalcante/mpfa_3d
faces.py
faces.py
py
452
python
en
code
1
github-code
90
43723100962
# import the opencv library import cv2 # define a video capture object vid = cv2.VideoCapture(0) while(True): # Capture the video frame # by frame ret, img = vid.read() # Display the resulting frame cv2.imshow('frame', img) # Convert to graycsale img_gray = cv2.cvtColor(img, cv...
ElonMusksWife/TCP-IP-Xela-Unity
camera.py
camera.py
py
1,537
python
en
code
0
github-code
90
5167288082
import streamlit as st class Node: def __init__(self, key, terjemahan, gimmick, gimmick2): self.key = key self.terjemahan = terjemahan self.gimmick = gimmick self.gimmick2 = gimmick2 self.parent = None self.right = None self.left = None sel...
DivaR14/TUBES-STRUKDAT-Kelompok-4
terjemahanFIX.py
terjemahanFIX.py
py
11,431
python
en
code
0
github-code
90
25045059062
import logging import os from dotenv import load_dotenv class EnvironmentConfig: """Base class for configuration.""" """ Most settings can be defined through environment variables. """ # Load configuration from file load_dotenv( os.path.normpath( os.path.join(os.path.dirname(__fi...
hotosm/tasking-manager
backend/config.py
config.py
py
9,273
python
en
code
482
github-code
90
21990811546
import uvicorn from fastapi import FastAPI from fastapi.middleware.cors import CORSMiddleware from src.chat_utils import chat_routes from src.upload_utils import upload_router app = FastAPI() origin_list = [ 'http://localhost:5173', 'http://localhost', '*' ] app.add_middleware( middleware_class=CORSMiddleware...
pavanjava/fullstack_llm
knowledge_api/src/main.py
main.py
py
653
python
en
code
1
github-code
90
12752162722
from alembic import op import sqlalchemy as sa # revision identifiers, used by Alembic. revision = 'f3e84d5f288b' down_revision = '0630c23bf85b' branch_labels = None depends_on = None def upgrade(): # ### commands auto generated by Alembic - please adjust! ### op.drop_index('ix_users_email', table_name='use...
RoofBite/FastApiTasks
migrations/versions/f3e84d5f288b_.py
f3e84d5f288b_.py
py
685
python
en
code
1
github-code
90
20635664864
# coding: utf-8 import json import requests from http import HTTPStatus from . import NominatimError from . import find_config from . import find_uri REVERSE_PATH = "/reverse" class NominatimReverseError(NominatimError): """ Classe pour les erreurs liées au reverse du module Nominatim. ...
BeJulien/TP-Python
nominatim/reverse.py
reverse.py
py
2,736
python
fr
code
0
github-code
90
29163255384
#Python Program to Transpose a Matrix a1=[] res=[] n1=int(input("Enter number of rows in array:")) n2=int(input("Enter number of coloums in array:")) print("Enter the elements for array:") for i in range(0,n1): row=[] for j in range(0,n2): row.append(int(input())) a1.append(row) for i in ...
karthik-dasari/Python-programs
Program to Transpose a Matrix.py
Program to Transpose a Matrix.py
py
505
python
en
code
0
github-code
90
17996551749
N, M = map(int, input().split()) INF = float("inf") start = [] end = [] weight = [] node_cost = [-INF] * N for _ in range(M): a, b, c = map(int, input().split()) start.append(a - 1) end.append(b - 1) weight.append(c) node_cost[0] = 0 for _ in range(N - 1): for i in range(M): new_cost = nod...
Aasthaengg/IBMdataset
Python_codes/p03722/s253791383.py
s253791383.py
py
741
python
en
code
0
github-code
90
44552449637
''' CS 108 Created Fall 2014 Player @author: Kristofer Brink (kpb23) ''' import pygame, sys import math from pygame.locals import * import rectangle # cap function def cap(capped, speed): '''Caps speed (int, int) -> int ''' if speed > capped: speed = capped if speed < -capped: spe...
kpgbrink/chibiKenshin
player.py
player.py
py
11,252
python
en
code
0
github-code
90
72350953897
from src.contato import Contato from src.identificador import Identificador class Agenda: def __init__(self): self.contatos = [] def getContatos(self) -> list: return sorted(self.contatos, key=lambda contato: contato.getName()) def getQuantidadeDeContatos(self) -> int: return le...
ariellyg/miniprojetos3
agenda/src/agenda.py
agenda.py
py
2,561
python
pt
code
0
github-code
90
26654615342
from mss import mss import cv2, os,shutil, time, pickle import numpy as np from multiprocessing import Process from messages.screen_vp8enc_data import SCRN2VP8EncData class ScreenShotProcess(Process): def __init__(self, out_queue, dim, logger=None): super(ScreenShotProcess, self).__init__() self.d...
ahmad-hl/NebulaMCG
nebula_wcapture/Screenshot.py
Screenshot.py
py
2,254
python
en
code
5
github-code
90
18662087339
# coding = utf-8 class Solution(object): def twoSum(self, nums, target): """ :type nums: List[int] :type target: int :rtype: List[int] """ le = len(nums) for i in range(0,le): for j in range(i+1,le): if nums[i]+nums[j] == target: ...
mondon11/leetcode
0001twoSum.py
0001twoSum.py
py
1,008
python
en
code
0
github-code
90
41424557989
from config.utils.schemas import BasicAPISchema from drf_yasg import openapi from . import serializers, exceptions class ObjectSchema(BasicAPISchema): def retrieve(self): return self.swagger_auto_schema( operation_summary='Get house', operation_description='Get house', ...
EugeneDenkevich/Web-Travel_pub
backend/src/object/schemas.py
schemas.py
py
1,735
python
en
code
0
github-code
90
4517583062
import matplotlib.pyplot as plt import praw from settings import USERNAME, PASSWORD, CLIENT_ID, SECRET import pickle import random import numpy as np # ---------------------------------------------------------------------------- SUBREDDIT = 'neutralnews' NUMBER_OF_USERS_TO_LOOK_AT = 1000 SHUFFLE = True # -----------...
aryan096/Reddit-Echo-Chambers-Analysis
calc_participation.py
calc_participation.py
py
1,873
python
en
code
1
github-code
90
33684932948
""" Benchmark test for the speed of the parameter estimation iteration function """ import os,sys sys.path.append(os.path.abspath('crossroads_scripts')) from param_estimation import get_error_for_model, get_error_for_model_vst from gen_faust import Model, Split, Gain, UnitDelay import numpy as np import time # Test ...
jatinchowdhury18/CrossroadsEffects
test_scripts/q_test_bench.py
q_test_bench.py
py
1,257
python
en
code
30
github-code
90
4572892144
from django.contrib.auth import views as auth_views from django.urls import path from . import views app_name = 'blog' urlpatterns = [ path('', views.PostsView.as_view(), name='posts'), path('create/', views.CreatePostView.as_view(), name='create_post'), path('feedback/', views.leave_feedback, name='feed...
YanaSharkan/Blog
blog/urls.py
urls.py
py
1,086
python
en
code
0
github-code
90
72201259178
# Easy # Write a function that takes in a "special" array and returns its product sum. # "Special" array is a non-empty array that contains either integers or other "special" arrays. # The depth of a 'special' array is how far nested it is. For instance, the depth of [] is 1; # the depth of the inner array in [[]] is...
ArmanTursun/coding_questions
AlgoExpert/Recursion/Easy/Product Sum/Product Sum.py
Product Sum.py
py
1,265
python
en
code
0
github-code
90
18479831769
#-*-coding:utf-8-*- import sys input=sys.stdin.readline import decimal def main(): numbers=[] n = int(input()) t,a = map(int,input().split()) numbers=list(map(int,input().split())) dp=[] hensu=decimal.Decimal('0.006') for number in numbers: tmp=abs(t-number*hensu-a) dp.appen...
Aasthaengg/IBMdataset
Python_codes/p03220/s992948498.py
s992948498.py
py
412
python
en
code
0
github-code
90
20658877
from guppy import hpy import gc from flask import Flask, request, make_response, render_template from werkzeug.utils import secure_filename import pandas as pd import json import geopandas as gpd from geopandas.tools import sjoin from data_cleaning import read_upload, clean_lat_long from utils import generate_pdf ap...
DataKind-SF/san_jose_project
app.py
app.py
py
6,425
python
en
code
1
github-code
90
35373763446
import torch.utils.data as data import torch from PIL import Image import torchvision.transforms as transforms import numpy as np import random class BaseDataset(data.Dataset): def __init__(self): super(BaseDataset, self).__init__() def name(self): return 'BaseDataset' def initialize(self...
michaildoukas/head2head
data/base_dataset.py
base_dataset.py
py
3,429
python
en
code
286
github-code
90
6831859924
import os import re import pytest import testinfra.utils.ansible_runner testinfra_hosts = testinfra.utils.ansible_runner.AnsibleRunner( os.environ['MOLECULE_INVENTORY_FILE']).get_hosts('all') BINARIES = ['mongo', 'mongod', 'mongos', 'bsondump', 'mongoexport', 'mongobridge', 'mongofiles', 'mongoimport...
Percona-QA/psmdb-testing
psmdb-tarball/tests/test_psmdb_install.py
test_psmdb_install.py
py
1,954
python
en
code
0
github-code
90
34871158310
from datetime import datetime import numpy as np import pytest import pandas.util._test_decorators as td from pandas.core.dtypes.base import _registry as ea_registry from pandas.core.dtypes.common import is_object_dtype from pandas.core.dtypes.dtypes import ( CategoricalDtype, DatetimeTZDtype, IntervalDt...
pandas-dev/pandas
pandas/tests/frame/indexing/test_setitem.py
test_setitem.py
py
49,561
python
en
code
40,398
github-code
90
29442488213
import unittest from datetime import date, datetime print(f"NAME: In TEST_Helper: {__name__}") if __name__ == "__main__": import helper else: from . import helper class test_helper(unittest.TestCase): def test_compose_bhav_csv_name(self): t_date = date(2023, 11, 21) expected_output = 'cm...
akasmajhi/wesmckinney
src/common/test_helper.py
test_helper.py
py
4,232
python
en
code
0
github-code
90
35354591816
#! /usr/bin/env python #coding:utf-8 from docxtpl import DocxTemplate import datetime import yaml from star.common.util.OracleDbUtil import OracleDbUtil resource = yaml.load(open('../conf/bjvm.yaml'), Loader=yaml.FullLoader) db_host = resource['database']['db_host'] db_name = resource['database']['db_name'] db_usern...
StoneEpigraph/PythonTempUtils
star/bjvm/upload_electronic_repair_msg/MonthlyHealthRecordsReport.py
MonthlyHealthRecordsReport.py
py
8,306
python
en
code
0
github-code
90
18493488899
S=input() T=input() sd={} td={} cond=True for i in range(len(S)): if S[i] not in sd: sd[S[i]]=T[i] else: if sd[S[i]]!=T[i]: cond=False break if T[i] not in td: td[T[i]]=S[i] else: if td[T[i]]!=S[i]: cond=False break if con...
Aasthaengg/IBMdataset
Python_codes/p03252/s915063378.py
s915063378.py
py
361
python
en
code
0
github-code
90
10490604243
# Напишите проект, содержащий функционал работы с заметками. Программа должна уметь создавать заметку, # сохранять её, читать список заметок, редактировать заметку, удалять заметку. # Реализовать консольное приложение заметки, с сохранением, чтением, # добавлением, редактированием и удалением заметок. Заметка должна #...
ElenaPoganova/Note_Python
Note.py/note.py
note.py
py
5,456
python
ru
code
0
github-code
90
18154710217
""" Tilengine python example: Pixel mapping transform demo """ import sys sys.path.append("../src") from tilengine import Engine, Window, Tilemap, PixelMap from math import sin, radians # helper constants WIDTH = 400 HEIGHT = 240 # load layer assets and basic setup def setup_layer(layer, name): tilemap = Tilemap.f...
megamarc/PyTilengine
samples/pixel_map.py
pixel_map.py
py
1,005
python
en
code
24
github-code
90
31431544085
import matplotlib.pyplot as plt import matplotlib.patches as ptc # Function to be integrated. def func(x): return ((x**2)-1)/((x**2)+1) #----------------------------- # Get N amount of (x,y) points on the function from the starting point to the end point. def getPoints(N,start,end): xPoints = [] yPoints = []...
theHandgun/Python-Projects
riemann_sum/riemann.py
riemann.py
py
1,938
python
en
code
0
github-code
90
29966618504
class Banco: def __init__ (self, nome, idade, saldo): self.nome = nome self.idade = idade self.saldo = saldo def __str__(self): return f"Nome: {self.nome}, Idade: {self.idade} anos, Saldo: {self.saldo} reais" def saque (self, valor): self.valor = valor if se...
Bianca-oliveira/Exerc-cios
Ex-banco.py
Ex-banco.py
py
1,625
python
pt
code
0
github-code
90
10299417945
from __future__ import division from .. import gpu_utils from ..distributions import * import scipy as s import numpy as np # Import manually defined functions from .variational_nodes import MultivariateGaussian_Unobserved_Variational_Node # TODO: # - integrate into Z node using ix # U_GP_Node_mv class U_GP_Node_mv(...
Starlitnightly/omicverse
omicverse/mofapy2/core/nodes/U_nodes.py
U_nodes.py
py
7,911
python
en
code
119
github-code
90
21749564345
from math import ceil from drafter.utils import Rect, Border from drafter.layouts import Node, Row, Column from drafter.nodes import Text from ..common.boiler import boil from ..common.color import Color from ..common.utils import get_text_width, is_nan def sand(): t = Text( width='100%', ...
toggle-corp/palika-profile
core/report/page1/pop.py
pop.py
py
3,014
python
en
code
0
github-code
90
24801199880
import matplotlib.pyplot as plt import numpy as np import pywt from scipy.signal import find_peaks from scipy.interpolate import interp1d import os class OptReceiver: def __init__(self): self.h = None self.sig = None self.us = None self.noise_u = 0 self.rect = False ...
Eponeshnikov/TimeDelay
OptReceiver.py
OptReceiver.py
py
12,078
python
en
code
0
github-code
90
4291789763
import subprocess import os import sys import validators # status stores success # use whereis command to locate the process # output stores the location of process installed status, output = subprocess.getstatusoutput("whereis " +sys.argv[1]) #checking whether process exists or not if status !=0: print("process ...
vyaskartik20/OS_Project
receiver/test.py
test.py
py
1,476
python
en
code
0
github-code
90
22566030536
#希尔排序 #将数组列在一个表中并对列分别进行插入排序,重复这过程,不过每次用更长的列(步长更长了,列数更少了)来进行。 #最后整个表就只有一列了。将数组转换至表是为了更好地理解这算法,算法本身还是使用数组进行排序。 def ShellSort(ary): aryLength = len(ary) gap = aryLength / 2 #初始步长 while gap > 0: for i in range(gap, aryLength): tmp = ary[i] j = i for j i...
lyiker/Algorithms
Sort/ShellSort.py
ShellSort.py
py
677
python
zh
code
0
github-code
90
18109859929
from collections import deque n , q = map(int,input().split()) p , t = deque() , deque() for i in range(n): x , y = input().split() p.append(x) t.append(int(y)) time = 0 temp1 = "" temp2 = 0 while p: temp1 , temp2 = p.popleft() , t.popleft() if temp2 <= q : time += temp2 print(temp...
Aasthaengg/IBMdataset
Python_codes/p02264/s565069456.py
s565069456.py
py
453
python
en
code
0
github-code
90
1032209164
"""InVEST Sediment Delivery Ratio (SDR) module. The SDR method in this model is based on: Winchell, M. F., et al. "Extension and validation of a geographic information system-based method for calculating the Revised Universal Soil Loss Equation length-slope factor for erosion risk assessments in large ...
danielgis/invest
src/natcap/invest/sdr.py
sdr.py
py
49,420
python
en
code
0
github-code
90
18221809659
K=int(input()) A,B=map(int,input().split()) ans=0 i=1 while K*i<=1000: if A<=K*i and K*i<=B: ans=1 break i+=1 if ans==1: print("OK") else: print("NG")
Aasthaengg/IBMdataset
Python_codes/p02693/s252132145.py
s252132145.py
py
182
python
en
code
0
github-code
90
318129907
# -*- coding: utf-8 -*- from django.shortcuts import render from aaev.models import Login, Universidad, UniversidadHasCarrera from aaev.models import Carrera, Alumno, SolicitudRegistro, Login from aaev.models import Docente, DocenteHasMateria,Materia from django.shortcuts import redirect from django.views.decorators.cs...
acanosa/Proyecto-Software-AAEV-2.0
aaev2/aaev/views.py
views.py
py
6,671
python
es
code
1
github-code
90
39129129728
from django.db import models from catalog.models import Product from django.contrib.auth.models import User # Create your models here. class SetType(models.Model): class Meta: verbose_name = 'Тип сборки' verbose_name_plural = 'Типы сборки' ordering = ('title',) title = models.C...
4ulkoff/coso
calculate/models2.py
models2.py
py
3,119
python
en
code
0
github-code
90
40494579105
def decreaseRedHalf(picture): pixels = getPixels(picture) for index in range(0,len(pixels)/2): pixel = pixels[index] value = getRed(pixel) setRed(pixel,value * 0.5) # USAGE # ''' file = "C:\\somepicture.jpg" pict = makePicture(file) decreaseRedHalf(pict) explore(pict) '''
s3689004/COSC2452
ch04/4.8.0 Prog_45-decreaseRedHalf.py
4.8.0 Prog_45-decreaseRedHalf.py
py
288
python
en
code
0
github-code
90
26156717854
# -*- coding: utf-8 -*- # 링크 : https://arisel.notion.site/1261-e7c1d60de06f462892a50c0d16d46874 from sys import stdin from collections import deque class WallBreaker(object): def __init__(self, n: int, m: int, arr: list): self.n = n self.m = m self.arr = arr self.around = [(-1, 0), (0, -1), (1, 0)...
arisel117/BOJ
code/BOJ 1261.py
BOJ 1261.py
py
1,436
python
en
code
0
github-code
90
27094540548
from spack import * class PyScipy(PythonPackage): """SciPy (pronounced "Sigh Pie") is a Scientific Library for Python. It provides many user-friendly and efficient numerical routines such as routines for numerical integration and optimization.""" homepage = "http://www.scipy.org/" url = "https://...
matzke1/spack
var/spack/repos/builtin/packages/py-scipy/package.py
package.py
py
3,338
python
en
code
2
github-code
90
35509019337
# Enter your code here. Read input from STDIN. Print output to STDOUT #takes factorial of the integer def facto(num:int): if num==0: return int(1) else: return num*facto(num-1) #takes input, converts to integer def takeInput(): q = int(input()) n=[] m=[] for i in range(q): ...
mkaynarca/hackerrank_sols
Sums_of_Digit_Factorials/main.py
main.py
py
1,686
python
en
code
0
github-code
90
72329346218
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import models, migrations class Migration(migrations.Migration): dependencies = [ ('homepage', '0003_reviewcategory_reviews'), ] operations = [ migrations.CreateModel( name='Blog', fie...
BijoySingh/HomePage
homepage/migrations/0004_auto_20160107_0832.py
0004_auto_20160107_0832.py
py
1,747
python
en
code
0
github-code
90
73252508137
#!/usr/bin/env python3 import argparse import base64 import io import logging import sys from kubernetes import client, config from kubernetes.config import ConfigException from swift.common.ring import RingBuilder from ring_controller import RingController logger = logging.getLogger('ringcontroller') def load_con...
Juniper/contrail-operator
ringcontroller/main.py
main.py
py
2,732
python
en
code
18
github-code
90
30628374718
## RAINFALL STATISTICS import sys def main(): month_names = ['January' ,'Febuary' ,'March' ,'April' ,'May' ,'June' ,'July' ,'August' ,'September' ,'Ocotber' ,'November' ,'December'] num_months = 12 rain_list = [] count = 0 while count <= num_months: count += 1 for month in month_...
edunzer/MIS285_PYTHON_PROGRAMMING
WEEK 7/7.3.py
7.3.py
py
917
python
en
code
0
github-code
90
14001374358
### CS 777 Project: Clash of Clans # Jia Liang Ma # Packages import import os import sys import numpy as np import pandas as pd from pyspark.sql import functions as F from pyspark.sql import SparkSession from pyspark.sql.functions import col, sum from pyspark.sql.types import IntegerType, DoubleType from...
jasonmar310/CS777_FinalProject_CoC_PySpark
project2.py
project2.py
py
10,456
python
en
code
0
github-code
90
12570684480
from tkinter import * from dataWindow import * from matWindow import * from chartWindow import * mainWin = Tk() mainWin.geometry("500x330") mainWin.title("movie recommendation engine") mainLab = Label(mainWin, text = "추천 방식 선택", height = 2) mainLab.pack() dataRec = Button(mainWin, text = "Content Based Filtering", w...
LURKS02/recommendation_system
mainWindow.py
mainWindow.py
py
820
python
en
code
0
github-code
90
25188796679
""" Example implementation of code to run on the Cloud ML service """ import traceback import argparse import json import os from .import model import shutil import tensorflow as tf if __name__ == '__main__': # Create object of ArgumentParser class parser = argparse.ArgumentParser() # Input a...
mujahid7292/ML_With_TensorFlow_On_GCP
05.Art_And_Science_Of_Machine_Learning/WEEK_3/01.Using_Custom_Estimators/Practice/simple_rnn/trainer/task.py
task.py
py
2,201
python
en
code
1
github-code
90
1743189769
from django.shortcuts import render from django.http.response import JsonResponse from rest_framework.parsers import JSONParser from rest_framework import status from api.models import Profile from api.serializers import ProfileSerializer from rest_framework.decorators import api_view @api_view(['GET', 'POST', 'D...
sayakongit/drf-resume-api
api/views.py
views.py
py
2,196
python
en
code
0
github-code
90
18538627099
[A,B,C] = list(map(int,input().split())) K = int(input()) ini = [A,B,C] from itertools import permutations, combinations,combinations_with_replacement,product a=['A','B','C'] Ls = list(combinations_with_replacement(a,K)) ans=0 for L in Ls: ini=[A,B,C] # print('ini:',ini) # print('L:',L) for i in L: ...
Aasthaengg/IBMdataset
Python_codes/p03360/s854835355.py
s854835355.py
py
532
python
en
code
0
github-code
90
18070004889
def slove(): import sys input = sys.stdin.readline n, l = list(map(int, input().rstrip('\n').split())) a = list(map(int, input().rstrip('\n').split())) for i in range(1, n): if a[i] + a[i-1] >= l: print("Possible") for j in range(n-1, i, -1): print(j) ...
Aasthaengg/IBMdataset
Python_codes/p04035/s326169182.py
s326169182.py
py
484
python
en
code
0
github-code
90
37883710833
#!/usr/bin/env python3 # Problem 3: Largest prime factor # https://projecteuler.net/problem=3 import sys def euler003(number): factors = [] candidate = 2 while candidate ** 2 < number: if number % candidate == 0: factors.append(candidate) number = number / candidate ...
jkbockstael/projecteuler
euler003-proc.py
euler003-proc.py
py
609
python
en
code
0
github-code
90
26613934391
import socket from select import select def client(): """Main client function. Handles the socket creation, port error checking and if the server has taken to long to respond""" s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) port = int(input("Enter a port number: ")) #port = 1500 #Un...
NickWalton64/NetworkingAssignment
Client.py
Client.py
py
3,895
python
en
code
0
github-code
90
37096226785
from math import prod def parseFour(s): i = s[0] s = s[1:] if (i == '0'): return s[0:4] else: return s[0:4] + parseFour(s[4:]) def parseIZero(s): l = int(s[0:15], 2) ret = [] suml = 15 while (l > 0): r, le = parse(s[suml :(suml + l)]) l = l - le ...
Selvan66/DailyCoding
AdventOfCode/2021/Day16/main2.py
main2.py
py
1,673
python
en
code
0
github-code
90
43356916801
import glob import os from tqdm import tqdm import xml.etree.ElementTree as ET from Data_Processing.Raw_Train_Data.raw import possible_classes def write_data(): xml_files = glob.glob(os.path.join("D:\\facultate stuff\\licenta\\data\\train_imgs_full\\", "*.xml")) with open("D:\\facultate stuff\\licenta\\data\\...
dragosconst/licenta
code/Data_Processing/write_yolov4_txt.py
write_yolov4_txt.py
py
987
python
en
code
0
github-code
90
21183784802
import os import os.path as osp import sys BUILD_DIR = osp.join(osp.dirname(osp.abspath(__file__)), "build/service/") sys.path.insert(0, BUILD_DIR) import argparse import grpc import sdvs_pb2 import sdvs_pb2_grpc def main(args): host = f"{args['ip']}:{args['port']}" print(host) with grpc.insecure_channel...
AndyLinGitHub/Software-Defined-Video-Streaming
client.py
client.py
py
836
python
en
code
0
github-code
90
44866985876
# -*- coding: utf-8 -*- """ Created on Wed Jan 2 15:02:13 2019 @author: edwinaw """ import datetime print("Welcome, this program calculates in which year your will turn a 100 years old") name = input("Please enter your name \n") age = int(input("Please enter your age \n")) def calAge (age): yearToAdd = 100 - a...
EdwinaWilliams/MachineLearningCourseScripts
Python/CalculateAge100.py
CalculateAge100.py
py
484
python
en
code
0
github-code
90
20179685653
import cx_Freeze import sys base = None if sys.platform == "win32": base = "Win32GUI" shortcut_table = [ ("DesktopShortcut", # Shortcut "DesktopFolder", # Directory_ "Blast Cloud Word Game", # Name "TARGETDIR", # Component_ "[TARGETDIR]\PygameWordgame.exe", # Target None, # Argume...
rahulmis/BlastCloudWordGameUSingPythonPygame
PygameWordsetup.py
PygameWordsetup.py
py
1,168
python
en
code
3
github-code
90