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
73045995175
""" .. module:: mapper.py :license: GPL/CeCIL :platform: Unix, Windows :synopsis: Maps CMIP5 CIM (v1) model documents to lightweight IPython format. .. moduleauthor:: Mark Conway-Greenslade <momipsl@ipsl.jussieu.fr> """ import os import pyessv import convertor import defaults import mappings from lib.mode...
ES-DOC/cmip6
lib/models/init_json_from_cmip5/mapper.py
mapper.py
py
4,115
python
en
code
0
github-code
90
3628056552
""" ---------------- theia.cli.parser ---------------- Theia CLI main :mod:`argparse` parser. """ import argparse def get_parent_parser(name, desc=''): """Creates the main (parent) :class:`argparse.ArgumentParser` for Theia CLI. Defines the main argument options such as theia server host, port, verbosity ...
theia-log/theia
theia/cli/parser.py
parser.py
py
1,071
python
en
code
2
github-code
90
41145265969
import tkinter as tk class GAMEPAD_WIDGET: canvas = None IMAGE_CANVAS_WIDTH = 180 IMAGE_CANVAS_HEIGHT = 80 CIRCLE_SIZE = 10 CIRCLES_WIDTH = 2 buttons = { "A": {"position": (0.8, 0.7), "type": "circle"}, "B": {"position": (0.85, 0.6), "type": "circle"}, "X": {"position":...
02900/Xbox360ControllerListener
gamepad_widget.py
gamepad_widget.py
py
2,390
python
en
code
0
github-code
90
18354749459
s = input() t = input() len_s = len(s) a = ord('a') dictionary = {chr(a + i): [[], 0] for i in range(26)} for i in range(len_s): dictionary[s[i]][0].append(i) dictionary[s[i]][1] += 1 repeat = 0 cur_index = -1 for c in t: indices, len_indices = dictionary[c] if len_indices == 0: repeat = 0 cur_index = -...
Aasthaengg/IBMdataset
Python_codes/p02937/s994332464.py
s994332464.py
py
622
python
en
code
0
github-code
90
18120671039
n = int(input()) x = list(map(int, input().split())) y = list(map(int, input().split())) p1 = 0 p2b = 0 p3b = 0 pn = 0 for i in range(n): p1 += abs(x[i] - y[i]) p2b += abs((x[i] - y[i]) ** 2) p3b += abs(((x[i] - y[i]) ** 3)) p2 = p2b ** 0.5 p3 = p3b ** (1 / 3) pn = max([abs(x[i] - y[i]) for i in range(n)]) pri...
Aasthaengg/IBMdataset
Python_codes/p02382/s937611080.py
s937611080.py
py
394
python
en
code
0
github-code
90
18578979789
N,Y=map(int,input().split()) for x in range(Y//10000+3): for y in range(Y//5000+3): z = N-x-y if z < 0:break SUM = 10000*x + 5000*y + 1000*z if SUM == Y: print(x,y,z) exit() elif SUM > Y:break print(-1,-1,-1)
Aasthaengg/IBMdataset
Python_codes/p03471/s835982863.py
s835982863.py
py
243
python
en
code
0
github-code
90
40326470315
#! /usr/lib/python3 # -*- coding: utf-8 -*- from setuptools import setup from setuptools.extension import Extension from Cython.Build import cythonize from Cython.Distutils import build_ext from pathlib import Path import shutil # 使用python setup.py build_ext构建项目之后 # 用python setup.py bdist_wheel创建wheel格式! class MyB...
gswyhq/hello-world
cython相关/使用Cython来保护Python代码库/src/setup.py
setup.py
py
2,011
python
zh
code
9
github-code
90
1563494996
import numpy as np import tensorflow as tf from tensorflow.keras import layers from sklearn.model_selection import train_test_split from sklearn.metrics import r2_score from eppa_exp1jr_scenario_discovery_main import SD sd_obj = SD("GLB_RAW", "REF_GLB_RENEW_SHARE") X = sd_obj.get_X() print(X.shape) Y = sd_obj.get_y_by...
TheKenster1729/Renewables-Scenario-Discovery-for-Paper
neural_net.py
neural_net.py
py
1,346
python
en
code
0
github-code
90
15024281824
import csv import os, sys import re name_of_script = "csv_iterator.py" path_to_script = sys.argv[0][:-len(name_of_script)] sys.path.insert(0, os.path.abspath(path_to_script + "../..")) from scrapers.Normalizer.common.Filenames import * from scrapers.Normalizer.common.TypeValidatorRegexes import compile_list_of_option...
lsc1025/Web-Scraper
Normalizer/csv_iterator.py
csv_iterator.py
py
5,918
python
en
code
0
github-code
90
5418273066
import math iData = [] f = [] c = 10 while c < 90001: iData.append(c) c = c + 1 for i in range(len(iData)): a = iData[i] m = list(str(iData[i])) for index, item in enumerate(m): m[index] = int(item) l = len(m) s = 0 for i in range(0, l): s = s + math.factorial(m[i]) ...
Code-Law/Ex
Factorial_and_Sum.py
Factorial_and_Sum.py
py
376
python
en
code
0
github-code
90
73914508775
import os import sqlite3 try: from munkicon import worker except ImportError: from .munkicon import worker # Keys: 'kext_teams' # 'kext_bundles' # 'kext_team_bundle' class SQLiteDB(): """SQLite""" def __init__(self, db='/var/db/SystemPolicyConfiguration/KextPolicy'): self._db = d...
carlashley/munkicon
src/processors/kext.py
kext.py
py
3,219
python
en
code
7
github-code
90
31397612420
import argparse from datetime import datetime import gym import numpy as np import torch import torch.nn.functional as F from PIL import Image from torch import nn, optim from torchvision.transforms.functional import resize device = torch.device("cuda:1" if torch.cuda.is_available() else "cpu") def convert_pong_obs...
novucs/reinforcebot
agent/graphing/cartpole_rendered.py
cartpole_rendered.py
py
7,131
python
en
code
1
github-code
90
11078753918
import csv import re import numpy as np import matplotlib.pyplot as plt # list of csv files files = [".\Water_3_Assigned.csv", ".\Water_3_Unssigned.csv", ".\Water_3_Unmatched.csv"] all_mzs = [] all_file_names = [] all_int = [] # load data from csv files for file in files: mz = [] Intensi...
waibel-123/PSManalysis
Step6Modulo1/GenerateModuloPlots.py
GenerateModuloPlots.py
py
1,389
python
en
code
0
github-code
90
27092848538
from spack import * class PerlCairo(PerlPackage): """Perl interface to the cairo 2d vector graphics library""" homepage = "http://search.cpan.org/~xaoc/Cairo/lib/Cairo.pm" url = "http://search.cpan.org/CPAN/authors/id/X/XA/XAOC/Cairo-1.106.tar.gz" version('1.106', '47ca0ae0f5b9bc4c16a27627ff48b...
matzke1/spack
var/spack/repos/builtin/packages/perl-cairo/package.py
package.py
py
433
python
en
code
2
github-code
90
18353891349
import sys sys.setrecursionlimit(10 ** 8) input = sys.stdin.readline def dfs2(conj, p=0, t=0, past_p=None, visit=set(), second_visit=set()): # 距離と探索経路を返す。デクリメントされている場合は、decrement=True にする visit.add(p) for q in conj[p]: if q == past_p: # 逆流した際の処理 continue if q in seco...
Aasthaengg/IBMdataset
Python_codes/p02936/s911896931.py
s911896931.py
py
1,234
python
ja
code
0
github-code
90
19967068126
from typing import Tuple from django.shortcuts import render from django.http import HttpResponse, HttpResponseRedirect from django.db import connection from django.contrib import messages def login(request): notfound = True cursor = connection.cursor() if request.method == "POST": email = request...
Sanat2002/DBMS-Project
EmployeeApp/views.py
views.py
py
9,253
python
en
code
0
github-code
90
72292291178
# -*- coding: utf-8 -*- """ Created on Mon Jul 11 16:34:30 2016 @author: EvgenyKashin """ import requests import json import math import time from collections import Counter from collections import defaultdict import re import random import sys import getopt import config msg_url = 'https://api.vk...
EvgenyKashin/MessagesGenerator
generator.py
generator.py
py
18,788
python
en
code
2
github-code
90
37949785299
import matplotlib.pyplot as plt import numpy as np import sys def plot_amp(fName, lim=200, lw=2): p_bench_file = fName + 'ps_bench.npz' bench_file = fName + 'ANN_fmeas.npz' pg_amp = fName + 'AMP_PG.npz' damp = fName + 'ANNAMAP_FMeas_new.npz' struct_ann = fName + 'struct_fone_.npz' p_bench_data...
purushottamkar/DeepPerf
deep_non_decomp_src/plot_FMeas.py
plot_FMeas.py
py
1,383
python
en
code
2
github-code
90
73951276456
import numpy as np import matplotlib.pyplot as plt from spline_traj_optm.models.vehicle import VehicleParams, Vehicle def test_vehicle(): # vp = VehicleParams(np.zeros((5, 2)), np.zeros((5, 2)), # 10.0, -20.0, 15.0, -15.0, 80.0, 30.0) # v = Vehicle(vp) # print(v.lookup_acc_circle(la...
HaoruXue/spline-trajectory-optimization
spline_traj_optm/tests/test_vehicle.py
test_vehicle.py
py
1,548
python
en
code
1
github-code
90
27451385118
wait = 0 start = 1 end = 2 numDic = { "0": 0, "1": 1, "2": 2, "3": 3, "4": 4, "5": 5, "6": 6, "7": 7, "8": 8, "9": 9 } class Solution: def __init__(self): self.status = wait self.ans = 0 self.isNegativ...
HappyMarmota/leetPy
8.py
8.py
py
1,674
python
en
code
0
github-code
90
43922618419
import streamlit as st import json import socket from time import sleep from .charts import * from utils.car_definition import Car def setup(): st.session_state.car = Car() col1, col2, col3, col4 = st.columns([5, 1, 2, 1], gap="small") speed_gauge_fig = speed_gauge() tire_chart_fig = tire_pressure_a...
JayantTaneja/CarGPT
utils/dashboard_utils.py
dashboard_utils.py
py
6,319
python
en
code
0
github-code
90
1873081795
## Search NBA players stats by name import requests # This allows us to make requests to the web # Get the player name player_name = input("Enter the player name: ") # Asks the user to enter the player name # Get the player stats response = requests.get("https://www.balldontlie.io/api/v1/players?search=" + player_...
olivier987654/A_Year_Of_Python
2022-11-02/2022_11_02.py
2022_11_02.py
py
951
python
en
code
0
github-code
90
15661524072
"""empty message Revision ID: 2dee5482b0f5 Revises: c4a9d1172b35 Create Date: 2017-04-08 16:07:27.929000 """ from alembic import op import sqlalchemy as sa # revision identifiers, used by Alembic. revision = '2dee5482b0f5' down_revision = 'c4a9d1172b35' branch_labels = None depends_on = None def upgrade(): # ...
mistacker/BBS
migrations/versions/2dee5482b0f5_.py
2dee5482b0f5_.py
py
669
python
en
code
3
github-code
90
28941540201
import sqlite3 import numpy as np import io import logging import argparse import os import glob def adapt_array(arr): """ http://stackoverflow.com/a/31312102/190597 (SoulNibbler) """ out = io.BytesIO() np.save(out, arr) out.seek(0) return sqlite3.Binary(out.read()) def convert_array(text)...
FredWe/touch_project
data/create_db.py
create_db.py
py
2,153
python
en
code
0
github-code
90
25008402584
from typing import List, Optional, Any, Dict class Solution: def subsets(self, nums: List[int], lo: int, hi: int) -> List[List[int]]: if lo == hi: return [[]] else: i = lo while i < hi and nums[i] == nums[lo]: # Getting the index where nums[i]...
hvijaycse/Leetcode
problems/90.py
90.py
py
1,101
python
en
code
0
github-code
90
6564605886
# read file by file name f = open("jay.txt", "r") print(f.read()) f.close() # read file by full file path g = open("/home/juwon/Desktop/cloudComputingLessons/pythonForCloud/advancePython/fileHandling/thankYouLord.txt", "r") print(g.read()) g.close() # read a file with specific encoding # h = open("home/juwon/Desktop/...
juw0n/pythonForCloud
advancePython/fileHandling/readFile.py
readFile.py
py
753
python
en
code
0
github-code
90
26723597702
from bs4 import BeautifulSoup import requests import pandas as pd import numpy as np from openpyxl import workbook headers = {"user-agent":"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/106.0.0.0 Safari/537.36"} from time import sleep liste =[] pages = np.arange(1,...
yarkinus95/seniorproject
main.py
main.py
py
1,071
python
en
code
0
github-code
90
5445506707
# Imports and setup import pandas as pd import numpy as np import matplotlib.pylab as plt import seaborn as sns from tensorflow.keras.preprocessing.sequence import pad_sequences from sklearn.tree import DecisionTreeClassifier from sklearn.neighbors import KNeighborsClassifier from sklearn.neighbors import KNeighborsRe...
SimonValentino/BirdRecognition
main.py
main.py
py
3,021
python
en
code
0
github-code
90
18303841209
import sys sys.setrecursionlimit(10**6) n,g,s = map(int,input().split()) G = [[] for _ in range(n)] for i in range(n-1): a,b = map(int,input().split()) G[a-1].append(b-1) G[b-1].append(a-1) def dfs(V,v,d): if V[v] != -1: return V[v] = d for nv in G[v]: dfs(V,nv,d+1) if len(G[g-1])==1 and G[g-...
Aasthaengg/IBMdataset
Python_codes/p02834/s861725848.py
s861725848.py
py
511
python
en
code
0
github-code
90
5336037155
from collections import deque dq = deque(['a', 'b', 'c']) dq.append(1) # 右边加 dq.appendleft(2) # 左边加 dq.insert(2, 'x') # 下标为2的位置插入 dq.pop() # 弹出右边 dq.popleft() # 弹出左边 dq.remove('x') # 删除指定元素 dq.reverse() # 反转 print(dq)
PeppaYao/shepherding-problem
python_basic/deque.py
deque.py
py
286
python
zh
code
2
github-code
90
18176243749
def main(): A, B, C = input_ints() K = input_ints() while K > 0: if A >= B: B *= 2 elif B >= C: C *= 2 K -= 1 if A < B < C: print('Yes') else: print('No') def input_ints(): line_list = input().split() if len(line_list) == ...
Aasthaengg/IBMdataset
Python_codes/p02601/s752715241.py
s752715241.py
py
585
python
en
code
0
github-code
90
70361924136
from math import ceil import warnings warnings.filterwarnings("ignore") import pandas as pd import numpy as np import matplotlib.pyplot as plt import requests import json import datetime from amplitude_cut import plot_outburst, from_database_lasair, galactic_latitude, dc_mag, batch_get_lightcurves, SIMBAD_EXCLUDES, ...
ykwang1/archival_alert_processing
get_candidates.py
get_candidates.py
py
4,929
python
en
code
0
github-code
90
12191241232
#using double Quotes firstMethod="Hello,World This is first Methos" print(firstMethod) #second way single Quotes seconMethod='Hello ,Word' print(seconMethod) #using triple quotes third_method="""This is a multi-line string.""" print(third_method) #string formating first method s1='Hello' s2="world" print(s1+", "+s2...
TulasiSubrahmanyam/JalaAssignments
Python Assignment/PythonStrings_1.py
PythonStrings_1.py
py
554
python
en
code
0
github-code
90
9946024580
import glob, os, sys if not os.path.exists('result'): os.makedirs('result') filenames = "*.ads" if len(sys.argv) > 1: if sys.argv[1] == 'all': filenames = "*.ad*" elif sys.argv[1] == "internal": filenames = "*.adb" def CountBrackets(i, content): bracketsopen = content[i].count("(") - ...
thindil/roboada
roboada.py
roboada.py
py
7,333
python
en
code
0
github-code
90
7753849425
from flask import Flask,request, jsonify, abort from models import setUpDb, Blog from flask_cors import CORS #Create a database for blogs and allow the backend server to access them with the ability to GET POST DELETE and PATCH def createApi(): app = Flask(__name__) setUpDb(app) #Seting up cross origi...
Mulcro/React-App
backend/app.py
app.py
py
2,971
python
en
code
0
github-code
90
26035221166
import json import logging from six.moves import urllib from google.appengine.api import urlfetch from google.appengine.ext import ndb from google.appengine.runtime import apiproxy_errors from components import auth from components import utils from components.auth import delegation from components.auth import token...
luci/luci-py
appengine/components/components/net.py
net.py
py
11,955
python
en
code
74
github-code
90
34947653997
"""3) Создайте метод класса для работы с БД. В БД: Если передан 1 аргумент, вставить в таблицу запись с числом 3. Если переданы 2 аргумента: проверить, что второй аргумент является числом. Если условие верно, то удалить первую запись с БД. Если переданы 2 аргумента, их значения не известны, а 3 является числом, то обно...
Alesya-Laykovich/alesya_laykovich_homeworks
homework_23/task_03.py
task_03.py
py
2,249
python
ru
code
0
github-code
90
72764568937
# This script calculates the prime numbers no larger than an upper bound, # which is provided as an integer argument. The primes are written to a file, # one on each line. The output filename is also provided as an argument. import argparse from math import floor, sqrt # This is the function that calculates and outp...
PDXDevCampJuly/atifar
pre_assignment_stuff/primes.py
primes.py
py
2,224
python
en
code
0
github-code
90
71283369897
import sys class TextJustifyDyn: def __init__(self, txt, line_length): self.txt = txt self.line_length = line_length def ugly_score(self, txt_length): if txt_length <= self.line_length: return (self.line_length - txt_length) ** 2 else: return sys.maxsiz...
cutajarj/DynamicProgrammingInPython
justify/text_justify_dyn.py
text_justify_dyn.py
py
1,329
python
en
code
11
github-code
90
73332705898
# goorm / 기타 / 상품 유통 # https://level.goorm.io/exam/43078/1b-상품-유통/quiz/1 # 부동소수점 오차로 인한 문제 def find(n): i = 1 while str(n * i).split('.')[1] != '0': i += 1 return i t = int(input()) denom = [] num = [] for _ in range(t): n, r = map(int, input().split()) tax = list(map(int, input().split())...
devwithpug/Algorithm_Study
python/goorm/기타/goorm_43078.py
goorm_43078.py
py
557
python
ko
code
0
github-code
90
18014940589
def solve(): N,C,K = map(int, input().split()) T = [int(input()) for _ in range(N)] T.sort() num = 1 bus_pos = T[0] ret = 1 for t in T[1:]: # print(t,ret,num,bus_pos) if num < C and t <= bus_pos+K: num += 1 else: ret += 1 num =...
Aasthaengg/IBMdataset
Python_codes/p03785/s060991715.py
s060991715.py
py
387
python
en
code
0
github-code
90
74699021415
from rest_framework.serializers import HyperlinkedModelSerializer from classroomapi.models import Highlight, HighlightRect class HighlightRectSerializer(HyperlinkedModelSerializer): class Meta: model = HighlightRect fields = ['x1', 'x2', 'y1', 'y2', 'width', 'height', 'page_number', 'parent_id'] ...
jacobsieradzki/inf-project-server
classroomapi/serializers/highlight_serializer.py
highlight_serializer.py
py
635
python
en
code
0
github-code
90
35612995910
import pygame class Settings: """A class to store all setting for alien invasion""" def __init__(self): """Initialize the games static settings""" # Screen settings self.screen_width = 1200 self.screen_height = 800 self.bg_color = (230, 230, 230) self.bg_image ...
quantenmagier/Carls_studies-electric_boogalo
settings.py
settings.py
py
1,473
python
en
code
2
github-code
90
36440342985
# -*- coding: utf-8 -*- """ ND-Gridded cubic smoothing spline implementation """ import collections.abc as c_abc from numbers import Number from typing import Tuple, Sequence, Optional, Union import numpy as np from scipy.interpolate import PPoly, NdPPoly from ._base import ISplinePPForm, ISmoothingSpline from ._t...
espdev/csaps
csaps/_sspndg.py
_sspndg.py
py
11,346
python
en
code
145
github-code
90
27516136173
""" pyqt-experiment.py Setup a dial, a linked form field, a button, and an image and get input from the dial and form. Author: Wes Modes <wmodes@csumb.edu> Date: Feb 25, 2019 """ import sys from PyQt5.QtWidgets import QApplication, QWidget, QPushButton, \ QDial, QHBoxLayout, QVBoxLayout, QGridLayout, QSpinBo...
MichaelOrt/cst205
pyqt/pyqt-experiment.py
pyqt-experiment.py
py
2,353
python
en
code
1
github-code
90
2512709841
import heapq from collections import defaultdict from sys import stdin input = stdin.readline for i in range(int(input())): maxheap = []; minheap = []; maxabd = defaultdict(int,{}); minabd = defaultdict(int,{}) for i in range(int(input())): order = input().split(); x = int(order[1]) if order[0...
0dOj/0dOj_Algorithm
Python/7000~7999/7662.py
7662.py
py
1,407
python
en
code
0
github-code
90
28790760395
def format_duration(seconds): if seconds == 0: return "now" strtime = "" minutes = int(seconds / 60) # num minuts hours = int(minutes / 60) # num hours days = int(hours / 24) # num days years = int(days / 365) # num years sec = ("and " if seconds % 60 > 0 and seconds > 60 e...
sciucca8/Python_PracticeAndMore
CodeWars/Num_in_Time(MISSINGTESTCASES).py
Num_in_Time(MISSINGTESTCASES).py
py
1,416
python
en
code
0
github-code
90
13005458415
import os from data import BreastTumor from torch.utils.data import DataLoader import torch import torch.nn.functional as F import numpy as np from tqdm import tqdm from skimage import transform import SimpleITK as sitk import nibabel as nib from nibabel import io_orientation from data_transform import Norm, RandomCrop...
Abner228/SmileCode
SimPLe/stage3/infer.py
infer.py
py
4,675
python
en
code
0
github-code
90
38878819845
# Import flask dependencies from flask import Blueprint # Import input validators from application.inputs.Words import ListInputs, CreateInputs, UpdateInputs # Import models from application.models.Word import Word # Import services from application.services.WordsService import WordsService # Import view rendering ...
smchugh/balderdash
application/controllers/Words.py
Words.py
py
4,722
python
en
code
1
github-code
90
16543168879
import wasp import icons import io import sys class PagerApp(): """Show a long text message in a pager.""" NAME = 'Pager' ICON = icons.app def __init__(self, msg): self._msg = msg self._scroll = wasp.widgets.ScrollIndicator() def foreground(self): """Activate the applicat...
wasp-os/wasp-os
wasp/apps/system/pager.py
pager.py
py
4,840
python
en
code
752
github-code
90
35175741791
"""Legg til lat, long og postal code til psychologist-modell Revision ID: 8571931c3820 Revises: Create Date: 2023-11-13 08:31:47.368145 """ from alembic import op import sqlalchemy as sa # revision identifiers, used by Alembic. revision = '8571931c3820' down_revision = None branch_labels = None depends_on = None ...
freddygot/psykiskhjelp
migrations/versions/8571931c3820_legg_til_lat_long_og_postal_code_til_.py
8571931c3820_legg_til_lat_long_og_postal_code_til_.py
py
1,199
python
en
code
0
github-code
90
24997002285
from re import X import numpy as np from scipy.signal import lfilter from tqdm import tqdm import pdb # def hamming(N): # return np.array([0.54 - 0.46 * np.cos(2 * np.pi * n / (N - 1)) for n in range(N)]) def segment(signal, W=256, SP=0.4, Window=None): if Window is None: Window = np.hamming(W) L ...
8igfive/MyASR
tools/wiener_scalart.py
wiener_scalart.py
py
4,049
python
en
code
3
github-code
90
35225829589
r"""Rules for classification and regression trees. Tree visualisations usually need to show the rules of nodes, these classes make merging these rules simple (otherwise you have repeating rules e.g. `age < 3` and `age < 2` which can be merged into `age < 2`. Subclasses of the `Rule` class should provide a nice interf...
biolab/orange3
Orange/widgets/visualize/utils/tree/rules.py
rules.py
py
7,254
python
en
code
4,360
github-code
90
13090871295
class Solution: def combinationSum2(self, candidates, target): res = [] candidates.sort() def backtrack(i, _target, subset): if i == len(candidates): if _target == 0: res.append(subset[:]) return # Include number ...
magdumsuraj07/data-structures-algorithms
questions/striever_SDE_sheet/52_combination_sum_II.py
52_combination_sum_II.py
py
758
python
en
code
0
github-code
90
4820232
from http import HTTPStatus from typing import List, Optional, Dict from uuid import UUID from fastapi import APIRouter, Depends, HTTPException, Query, Security from fastapi.security import HTTPAuthorizationCredentials, HTTPBearer from fastapi_cache.decorator import cache from async_service.core.config import JwtSett...
Dmitry426/Async_API_assigment_1
async_service/api/v1/film.py
film.py
py
3,516
python
en
code
0
github-code
90
70232297578
import cv2 from pyspin.spin import make_spin, Box1 from vidstab import VidStab class ClickAndDrop: """ Class for selecting a region of interest on a frame by click and dropping the mouse over the desired area, and cropping that frame to include the pixels inside the ROI only. """ frame_size = (128...
Adamouization/Content-Based-Video-Retrieval-Code
app/video_operations.py
video_operations.py
py
4,744
python
en
code
15
github-code
90
13213949553
#Python program to implement server side of chat room. import socket import select import sys from _thread import * server = socket.socket(socket.AF_INET, socket.SOCK_STREAM) server.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1) if len(sys.argv) != 3: print ("Correct usage: script, IP address, port ...
adit-yaa/chat_room_py3
chat_server.py
chat_server.py
py
2,516
python
en
code
0
github-code
90
2539747188
"""bkhelloworld URL Configuration The `urlpatterns` list routes URLs to views. For more information please see: https://docs.djangoproject.com/en/3.2/topics/http/urls/ Examples: Function views 1. Add an import: from my_app import views 2. Add a URL to urlpatterns: path('', views.home, name='home') Class-...
BakeMark/bkhelloworld
src/bkhelloworld/bkhelloworld/urls.py
urls.py
py
1,307
python
en
code
0
github-code
90
35469134557
class Element: def __init__(self, wartosc, nastEl=None): self.wartosc = wartosc self.nastEl = nastEl def setWart(self, nowaWart): self.wartosc = nowaWart def getWart(self): return self.wartosc def setNastEl(self, nastElem): self.nastEl = nastElem def getNa...
ArkadiuszDomaros/PythonLessons
zad1/zadanie1/zadanie1.py
zadanie1.py
py
2,438
python
en
code
0
github-code
90
18267501999
n,a,b = map(int, input().split()) mod = 10**9+7 def cmb(n,r): a,b = 1,1 for i in range(r): a = a * (n-i) % mod b = b * (i+1) % mod return a * pow(b, mod-2, mod) %mod print((pow(2, n, mod) - cmb(n,a) - cmb(n,b) - 1)%mod)
Aasthaengg/IBMdataset
Python_codes/p02768/s890269187.py
s890269187.py
py
249
python
en
code
0
github-code
90
20907287613
import sys from collections import deque input = sys.stdin.readline N, M = map(int, input().split()) adj = [[] for _ in range(N+1)] visited = [False for _ in range(N+1)] for i in range(M): u, v = map(int, input().split()) adj[u].append(v) adj[v].append(u) def bfs(st): if visited[st]: return 0...
scalalang2/ps
atcoder/abc288/c.py
c.py
py
665
python
en
code
0
github-code
90
27549672406
from sys import stdin, stdout def chiefHopper(buildings): minEnergy = 0 for height in reversed(buildings): minEnergy = (1 + height + minEnergy) // 2 return minEnergy if __name__ == '__main__': n = int(stdin.readline()) arr = list(map(int, stdin.readline().rstrip().split())) result = ch...
sathiiii/Hackerrank-Solutions
Greedy/ChiefHopper.py
ChiefHopper.py
py
372
python
en
code
1
github-code
90
43532027724
#!/usr/bin/env python ''' This is a boiler plate script that contains an example on how to subscribe a rostopic containing camera frames and store it into an OpenCV image to use it further for image processing tasks. Use this code snippet in your code or you can also continue adding your code in the same file ''' f...
amanpanditap/Vitarana-Drone
src/vitarana_drone/scripts/qr_detect.py
qr_detect.py
py
1,632
python
en
code
0
github-code
90
18106223049
def selection(a, n): cnt = 0 for i in range(n): flag = 0 minj = i for j in range(i+1,n): if a[j] < a[minj]: minj = j flag = 1 if flag == 1: temp = a[minj] a[minj] = a[i] a[i] = temp cnt +=...
Aasthaengg/IBMdataset
Python_codes/p02260/s081117850.py
s081117850.py
py
513
python
en
code
0
github-code
90
42589986956
import os, sys, glob try: sys.path.append(glob.glob('../carla/dist/carla-*%d.%d-%s.egg' % ( sys.version_info.major, sys.version_info.minor, 'win-amd64' if os.name == 'nt' else 'linux-x86_64'))[0]) except IndexError: pass # try: # sys.path.append(glob.glob('/opt/carla-simulato...
Praneeth-Avula/Sensor-Fusion
Mems Lidar.py
Mems Lidar.py
py
14,918
python
en
code
0
github-code
90
8375000096
import textwrap from typing import Generator from typing import Any import yaml from .. import tools from . import Section # ===== def make_config_dump(config: Section, indent: int=4) -> str: return "\n".join(_inner_make_dump(config, indent)) def _inner_make_dump(config: Section, indent: int, _level: int=0)...
pikvm/kvmd
kvmd/yamlconf/dumper.py
dumper.py
py
1,805
python
en
code
178
github-code
90
71661238376
class Planet: ''' Planet details ''' one_year_in_days = 365.25 def __init__(self, name, diameter, no_of_moons, length_of_year): length_of_year = length_of_year self.name = name self.no_of_moons = no_of_moons self.length_of_year = length_of_year self.diameter = int(...
yogeshjean12/Thoughtworks-Python-Assignments
Planet_problem.py
Planet_problem.py
py
1,702
python
en
code
0
github-code
90
14724134466
# -*- coding: utf-8 -*- """ Created on Tue Feb 2 14:22:08 2021 @author: MTAEXAM """ scort = [] while True: insort = int(input("分數")) if insort =="": break else: scort.append(insort) scort2 = sorted(scort,reverse=True) #scort.sort() # scort.reverse()...
henry0727/MTApython
D2分數.py
D2分數.py
py
375
python
en
code
0
github-code
90
8804972232
# Retrieviung instance import boto3 ec2client = boto3.client('ec2') response = ec2client.describe_instances( Filters=[ { 'Name': 'tag:Name', 'Values': [ 'Controller', ] }, ], ) # for reservation in response["Reservations"]: # ...
TanmayC2001/Serverin-Devops-Integration
app/test.py
test.py
py
783
python
en
code
0
github-code
90
18172270619
import sys, math from collections import defaultdict, deque, Counter from bisect import bisect_left, bisect_right from itertools import combinations, permutations, product from heapq import heappush, heappop from functools import lru_cache input = sys.stdin.readline rs = lambda: input().strip() ri = lambda: int(input()...
Aasthaengg/IBMdataset
Python_codes/p02595/s832011539.py
s832011539.py
py
662
python
en
code
0
github-code
90
29542359777
# -*- coding: utf-8 -*- # @Time : 2021/11/20 7:49 # @Author : 模拟卷 # @Github : https://github.com/monijuan # @CSDN : https://blog.csdn.net/qq_34451909 # @File : 415. 字符串相加.py # @Software: PyCharm # =================================== """ """ from leetcode_python.utils import * class Solution: def __ini...
monijuan/leetcode_python
code/AC1_easy/415. 字符串相加.py
415. 字符串相加.py
py
3,335
python
en
code
0
github-code
90
34562263074
from __future__ import absolute_import from __future__ import division from __future__ import print_function from __future__ import unicode_literals from caffe2.python import core from hypothesis import given import caffe2.python.hypothesis_test_util as hu import hypothesis.strategies as st import numpy as np class ...
facebookarchive/AICamera-Style-Transfer
app/src/main/cpp/caffe2/python/operator_test/lengths_tile_op_test.py
lengths_tile_op_test.py
py
1,408
python
en
code
81
github-code
90
3578681680
import heapq INF = int(1e9) # 연결되지 않았다는 의미의 무한 거리로 10억을 설정 def dijkstra_faster(n, m, information, start): # 모든 노드의 연결 정보를 그래프화하기 graph = [[] for _ in range(n + 1)] for data in information: # data[0] -> data[1]로 가는 비용이 data[2] graph[data[0]].append((data[1], data[2])) # 최단 거리 테이블을 모두 무한으...
choscode/coding-test
basics/dijkstra_faster.py
dijkstra_faster.py
py
1,682
python
ko
code
0
github-code
90
25136204332
from tqdm import tqdm from icecream import ic import pandas as pd import os import ast import json import evaluate ogpath = 'multidomain_predictions/hiporank/mbart_predictions/' files = [f for f in os.listdir(ogpath) if os.path.isfile(os.path.join(ogpath, f))] meteor = evaluate.load('meteor') chrf = evaluate.load('ch...
DhavalTaunk08/XWikiGen
evaluation/evaludate_multidomain.py
evaludate_multidomain.py
py
2,445
python
en
code
2
github-code
90
40357047551
# -*- coding: utf-8 -*- """ Spyder Editor This is a temporary script file. """ print() N=100 a=1 b=1 luku=a+b print (a) print (b) while luku < N: print(luku) a=b b=luku luku=a+b #%% #Ltasaera laina print() k=200000 #laina määrä p=3#vuosikorkoproseni N=120#maksue...
MariaShulgina19/Data-analytiikan-perusteet-
1ver1.py
1ver1.py
py
1,020
python
fi
code
0
github-code
90
12016348104
from django.contrib import admin from django.contrib.auth.admin import UserAdmin as UserAdmin from .forms import UserCreationForm, UserChangeForm from .models import User, Seat, Flight, Airport, Carrier, Ticket, PasswordResetToken, FlightClass @admin.register(User) class AppUserAdmin(UserAdmin): form = UserChange...
Victoradukwu/AllFlightsAPI
app/admin.py
admin.py
py
4,229
python
en
code
0
github-code
90
17977931569
import queue N = int(input()) edges = [[] for _ in range(N)] for _ in range(N - 1): a, b = map(int, input().split()) edges[a - 1].append(b - 1) edges[b - 1].append(a - 1) from1 = [N] * N fromN = [N] * N que = queue.Queue() que.put((0, 0)) while (not que.empty()): vertex, dist = que.get() if from...
Aasthaengg/IBMdataset
Python_codes/p03660/s239012250.py
s239012250.py
py
807
python
en
code
0
github-code
90
4295900162
import numpy as np from matplotlib import pyplot as plt from sklearn.utils import shuffle path_list = ['./linear_fish_exp.npz', './processed_fish_move.npz'] #'./linear_fish_exp_na_croped.npz', path_list = './servo/replay_buffer.pkl' #example of save buffer from rlutils.cnn_utils import process_buffer_epmty_imgs,save_b...
ss555/deepFish
VAE/datasets/visu.py
visu.py
py
866
python
en
code
0
github-code
90
18530438739
# -*- coding: utf-8 -*- n = int(input()) ln = list(map(int, input().replace('W', '0 ').replace('E', '1 ').split())) # 先头だけ先に计算(do-while相当) w_sum = 0 # 西侧で振り返る人 sum_min = e_sum = sum(ln) - ln[0] # 东侧で振り返る人 for i in range(1, n-1): #sum_min = min(sum_min, sum(ln[i+1:n]) + (i - sum(ln[0:i]...
Aasthaengg/IBMdataset
Python_codes/p03339/s697653044.py
s697653044.py
py
602
python
zh
code
0
github-code
90
25400720258
from pytorch_lightning.callbacks.early_stopping import EarlyStopping import pytorch_lightning as pl from preprocessing import prepross_fun from preprocessing import data_augmentation import numpy as np import torch as t import torchmetrics def basic_trainer(train_d,test_d,model,bs,epochs,early_stopping=0): train_l...
Filliboy/EEG_thesis
training_n_evaluation/train_n_eval.py
train_n_eval.py
py
3,867
python
en
code
0
github-code
90
11261808412
from smart_bear.backlinks import printer from smart_bear.backlinks.lexer import EOL, BacklinksHeading, InlineText from smart_bear.backlinks.parser import BacklinksBlock, Note, Title from .lexer import ( EOL, BacklinkPrefix, BacklinkSuffix, BearID, InlineCode, InlineText, QuoteTick, ) def ...
shawnkoh/smart-bear
smart_bear/backlinks/test_printer.py
test_printer.py
py
3,466
python
en
code
0
github-code
90
25345120649
class Party: def __init__(self, name, info): self.name = name self.info = info self.votes = 0 def __str__(self): return f"{self.name} {self.info} {self.votes}" def add_votes(self, votes): self.votes += votes def get_percentage(self, total_votes): retur...
daifuku48/lab1MOtaDO
SA lab 1/B/refactorLab1TaskB.py
refactorLab1TaskB.py
py
3,321
python
en
code
1
github-code
90
74105814695
from django.shortcuts import render, redirect from . forms import UserRegisterForm from django.views.generic import ListView, DetailView, UpdateView from . models import employee, employeePhone, volunteer, volunteerPhone, animal, specialAnimal, specialNeed, animalFood, park, exhibit from django.urls import reverse_lazy...
emilyava0804/DB-Final-AC
users/views.py
views.py
py
1,776
python
en
code
1
github-code
90
34870948490
import numpy as np import pytest from pandas.core.dtypes.cast import construct_1d_arraylike_from_scalar from pandas.core.dtypes.dtypes import CategoricalDtype from pandas import ( Categorical, Timedelta, ) import pandas._testing as tm def test_cast_1d_array_like_from_scalar_categorical(): # see gh-19565...
pandas-dev/pandas
pandas/tests/dtypes/cast/test_construct_from_scalar.py
test_construct_from_scalar.py
py
1,780
python
en
code
40,398
github-code
90
79263217
#! /usr/bin/python # -*- coding:utf-8 -*- #======================# #---脚本名:writeLog.py #---作者:zhongjiajie #---日期:2016/03/20 #---功能:对操作过程写日志 #======================# import time #===日志模块===# #获取当前系统时间 返回 年-月-日 时:分:秒 def getNowTime(): return time.strftime('%Y-%m-%d %H:%M:%S',time.localtime(time.time())) #---写错误日志...
daixu/Python_Car
writeLog.py
writeLog.py
py
977
python
zh
code
null
github-code
90
8570388166
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Mon Oct 23 21:11:51 2017 @author: yen """ import statsmodels.discrete.discrete_model import numpy as np # linear algebra import pandas as pd # data processing, CSV file I/O (e.g. pd.read_csv) import xgboost as xgb from sklearn.grid_search import GridSearch...
Conradyen/Motion-detection
old code/Boosting.py
Boosting.py
py
3,469
python
en
code
0
github-code
90
18527805229
n=int(input()) def keta(num): s = str(num) sm=0 for i in range(len(s)): sm+=int(s[i]) return sm ans=10**10 for a in range(1,n): b=n-a ans=min(ans,keta(a)+keta(b)) print(ans)
Aasthaengg/IBMdataset
Python_codes/p03331/s443189810.py
s443189810.py
py
208
python
en
code
0
github-code
90
5045108122
def main(): s = input() fb, sb = s.index("B"), len(s) - s[::-1].index("B") - 1 fr, sr = s.index("R"), len(s) - s[::-1].index("R") - 1 k = s.index("K") if fb % 2 != sb % 2 and fr < k < sr: print("Yes") else: print("No") if __name__ == "__main__": main()
valusun/Compe_Programming
AtCoder/ABC/ABC297/B.py
B.py
py
299
python
en
code
0
github-code
90
36397539634
from plotter.plotgenerator import StagePlotGenerator,\ WorkloadPlotGenerator, RTPlotGenerator from parser.StageFileParser import StageFileParser BASE_INPUT_PATH = '/home/vince/cosbench-data/results/' BASE_OUTPUT = '/home/vince/cosbench-data/graphs-ii/' ceph_workload_ids = [55] ceph_workload_ids.extend([i for i in...
icclab/cosbench-plot
examples/example.py
example.py
py
7,900
python
en
code
9
github-code
90
27768850843
# importing the libraries import pickle import matplotlib.pyplot as plt from sklearn.ensemble import RandomForestClassifier from sklearn.metrics import classification_report, plot_confusion_matrix from sklearn.model_selection import train_test_split import dataset_handling def run_random_forest(): # Loading th...
RadhikaRanasinghe/ICDS-Mini-Hackathon-2021
random-forest.py
random-forest.py
py
4,144
python
en
code
1
github-code
90
44033110015
'''Set up the package configuration, including logging''' import tempfile import logging import os import coloredlogs import yaml import yaconfig temp_dir = tempfile.gettempdir() # Configuration variables metaconfig = yaconfig.MetaConfig( yaconfig.Variable("store", type=str, default=temp_dir, help="Path to the ...
eclipse-opensmartclide/smartclide-smart-assistant
smartclide-dle/smartclide-dle/smartclide_dle/iamodeler/config.py
config.py
py
2,691
python
en
code
4
github-code
90
9125214195
# Create your views here. from collections import OrderedDict from django_filters.rest_framework import DjangoFilterBackend from rest_framework.pagination import PageNumberPagination from rest_framework.response import Response from rest_framework import filters from rest_framework import viewsets from rest_framework....
parity-asia/hackathon-2023-summer
projects/14-DeepDiary/Backend/article/views.py
views.py
py
6,003
python
en
code
14
github-code
90
7256818212
from django.conf.urls import url from django.contrib import admin from inventory.views import ( AddItemView, ItemListView, ajax_checkout_item, ajax_checkin_item, ajax_useup_item, ajax_get_items_by_category_html, ajax_get_items_by_category, ajax_get_list_html, ajax_get_list_items_out...
ianmann56/cru_inventory
inventory/urls.py
urls.py
py
1,383
python
en
code
0
github-code
90
37230517040
import numpy as np class Perceptron: def __init__(self, intInputCount, floatThreshold, floatBias, floatLearningRate): # Ağırlık matrisi üretir self.matrixWeights = np.random.uniform(low=-1, high=1, size=intInputCount) # İstenen sonuç matrisi üretir self.matrixDesired = np.random.ra...
UgurIpekduzen/ANN-Python
Single Layer Perceptron/Mathematical Calculation/perceptron.py
perceptron.py
py
2,074
python
tr
code
0
github-code
90
1547898304
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import models, migrations class Migration(migrations.Migration): dependencies = [ ('appointments', '0001_initial'), ] operations = [ migrations.RenameField( model_name='event', old_nam...
anna777/ttAvalon
appointments/migrations/0002_auto_20170405_2039.py
0002_auto_20170405_2039.py
py
747
python
en
code
0
github-code
90
25765831265
#--------------------------------------------- # CS2020 # # Baristas at MoonDeer Coffee earn the basic # hourly wage of $9.95. They receive time-and-a-half # of their basic rate for overtime hours (those # over 40 hours). In addition, they receive a # commission on the sales they generate while # tending the e...
ZakiRucker/GradSchoolCoding
CS2020/Week4/compute_total_wage.py
compute_total_wage.py
py
1,478
python
en
code
0
github-code
90
16438726860
def sort_012(input_list): """ Function to sort 0, 1, 2 values value 0 moves to the left of list value 2 moves to the right of list value 1 stays at the middle of list Input: input list of number 0, 1, 2 Return: Sorted values """ # initialise pointer of position of value 0 and 2 ...
NONTAWAT149/udacity_dsa3
problem_4.py
problem_4.py
py
2,218
python
en
code
0
github-code
90
18048076009
mod = 1000000007 eps = 10**-9 def main(): import sys input = sys.stdin.readline S = input().rstrip('\n') a = S.find("C") b = S.rfind("F") if 0 <= a < b: print("Yes") else: print("No") if __name__ == '__main__': main()
Aasthaengg/IBMdataset
Python_codes/p03957/s120165298.py
s120165298.py
py
271
python
en
code
0
github-code
90
12104227799
#This is data preparatory script for the SNP data import os from collections import Counter import numpy as np import pandas as pd import shlex import subprocess from tqdm import tqdm #BEFORE RUNNING THIS CONVERT .BED FILES FOR EACH TRAIN AND TEST FOLDS TO .PED TO READ LIKE TEXT FILE # Being i...
mvrl/ADNI_Genetics
Genomics/data_prep.py
data_prep.py
py
7,522
python
en
code
6
github-code
90
31283306252
from openerp.osv import osv, fields class job_cat_byname(osv.osv_memory): _name = 'job.cat.byname' _description = 'print job category report by name' _rec_name = 'job_cat_name' _columns = { 'job_cat_name' : fields.many2one( 'job.categories', 'Job Category', required=True, onupdate='c...
karim-omran/openerp-addons
job_categories/wizard/job_cat_byname.py
job_cat_byname.py
py
658
python
en
code
0
github-code
90