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
31535948366
Ps = 2.3 Vs = 7.4 Pc = input("Entrez la pression courante : ") Vc = input("Entrez la voulume courante : ") if Pc > Ps and Vc > Vs: print("Arret immediat") elif Pc > Ps and Vc < Vs : print("Augmenter le volume de lenceinte") elif Pc < Ps and Vc > Vs: print("Diminuer le volume de lenceinte") else: prin...
Raike/esiea
1A/python/tp2/Enceinte.py
Enceinte.py
py
338
python
fr
code
0
github-code
90
5811984240
from PIL import Image import skimage as iaf import matplotlib.pyplot as plt import numpy as np import cv2 import pywt import pywt.data import argparse NO_OF_CHANNELS = 3 class ImageChannels(): def __init__(self): self.img_channel_B = [] self.img_channel_G = [] self.img...
mjain01/Copy-Move-Image-Forgery-Detection
Dywt_color.py
Dywt_color.py
py
3,449
python
en
code
8
github-code
90
10240116899
# Recursive Feature Elimination import pandas as pd from sklearn.feature_selection import RFE # RFE is algo specific from sklearn.linear_model import LogisticRegression # since o/p was discrete import warnings warnings.filterwarnings(action="ignore") filename = 'indians-diabetes.data.csv' hnames = [...
aksharanigam1112/MachineLearningIITK
packageML04/ML32.py
ML32.py
py
825
python
en
code
0
github-code
90
30552890555
import requests from bs4 import BeautifulSoup import re import pymongo from multiprocessing import Pool client = pymongo.MongoClient('localhost', 27017) mydb = client['mydb'] jianshu_shouye = mydb['jianshu_shouye'] headers = {'user-agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_3) AppleWebKit/537.36 (KHTML, li...
wsj2012/PythonLib
Practise/jianshu.py
jianshu.py
py
2,144
python
en
code
0
github-code
90
69878997736
import selenium from selenium import webdriver import time from selenium.webdriver.common.by import By from selenium.webdriver.common.keys import Keys from selenium.webdriver.chrome.options import Options import csv from selenium.webdriver.common.action_chains import ActionChains # 디버깅 모드 chrome_options = Options() ch...
jeongseokmandoo/NEXT_HW
Session5/naver3.py
naver3.py
py
1,782
python
en
code
0
github-code
90
3393496614
from typing import List import numpy as np import torch from torch import nn from base import GridWorldBase from utils import load_model, CWD, device class GWPgModel(nn.Module): def __init__(self, size: int, units: List[int]): super().__init__() self.size = size self.first = nn.Sequenti...
Akhilez/ml_api
grid_world/pg.py
pg.py
py
1,469
python
en
code
0
github-code
90
34998658929
from django.urls import path from . import views app_name = 'home-energy' urlpatterns = [ # ex: /home-energy/ path('', views.usage, name='usage'), # ex: /home-energy/usage.html path('usage.html', views.usage, name='usage'), # ex: /home-energy/latest_usage # ex: /home-energy/latest_usage/ ...
peterpickle/home-energy
web/home_energy/urls.py
urls.py
py
1,630
python
en
code
1
github-code
90
5044454452
def main(): _, X = map(int, input().split()) S = input() stack = [] for s in S: if stack and s == "U" and stack[-1] != "U": stack.pop() else: stack.append(s) for s in stack: if s == "U": X //= 2 elif s == "L": X *= 2 ...
valusun/Compe_Programming
AtCoder/ABC/ABC243/D.py
D.py
py
413
python
en
code
0
github-code
90
14419771643
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.contrib import admin # from django.contrib.auth import get_user_model from django.utils.translation import ugettext_lazy as _ # from django.utils.translation import ugettext_lazy as _, ungettext # from django_comments import get_model # from d...
NicolasMura/social-wall
social/admin.py
admin.py
py
5,263
python
en
code
0
github-code
90
18318297269
h,w,k = map(int, input().split()) S = [] for _ in range(h): S.append(list(input())) ans = [[0]*w for _ in range(h)] ans = [] first_row_flag = True first_row_cnt = 0 curr_num = 1 for i in range(h): row = [] curr_s_row = S[i] if '#' in S[i]: ichigo = 0 for j in range(w): if cu...
Aasthaengg/IBMdataset
Python_codes/p02855/s808095607.py
s808095607.py
py
798
python
en
code
0
github-code
90
34443913680
from collections import deque H,W = map(int,input().split()) c =[] c.append(['#' for _ in range(W+2)]) ans = [[0 for _ in range(W+2)]for _ in range(H+2)] score = 0 for i in range(H): tmp = list('#'+input()+'#') c.append(tmp) for j in range(W+2): if tmp[j] == '.': score += 1 c.append(['...
Hoshino0116/Programs
AtCoderBeginnerContest088-D.py
AtCoderBeginnerContest088-D.py
py
1,086
python
en
code
0
github-code
90
43841759627
# Course: CS261 - Data Structures # Author: Kent Chau # Assignment: 6 # Description: Graphs import heapq from collections import deque class DirectedGraph: """ Class to implement directed weighted graph - duplicate edges not allowed - loops not allowed - only positive edge weights - vertex nam...
kentomagento/DirectedAndUndirectGraphImplementation
d_graph.py
d_graph.py
py
14,206
python
en
code
0
github-code
90
17654873247
"""Dataclasses for Message Schedulers""" from enum import Enum from datetime import datetime, timedelta from dataclasses import dataclass, field from typing import Any class ScheduleType(Enum): """Class that defines the params that should be implement for APScheduler. Attributes ---------- DATE : in...
myaspm/interview
video-tools/app/libs/scheduler_models.py
scheduler_models.py
py
7,700
python
en
code
0
github-code
90
20940479678
#!/usr/bin/python ## convert text feed data into XML files import uuid from collections import namedtuple from lxml import etree from xml.sax.saxutils import unescape from bs4 import BeautifulSoup import re Person = namedtuple("Person", ["name", "id", "source", "title", "date", "snippet"]) trove_link = 'http://trov...
stevecassidy/trovenames
scripts/convert_xmls1.py
convert_xmls1.py
py
4,046
python
en
code
0
github-code
90
73173567655
''' Created on Sep 30, 2020 @author: pc ''' from pickletools import uint1 class BinOutput(object): ''' binary output ''' def __init__(self,hub,slave, offset): ''' Constructor ''' self._slave = slave self._hub = hub self._offset = offs...
jlola/homeassistant-config
custom_components/modified_modbus/ModbusStructure/BinOutput.py
BinOutput.py
py
2,112
python
en
code
0
github-code
90
13356021911
import os import pytest from unittest.mock import patch from api_flow.complex_namespace import ComplexNamespace from api_flow.context import Context @pytest.fixture def mock_from_yaml(): with patch.object(ComplexNamespace, 'from_yaml') as mock_from_yaml: yield mock_from_yaml @pytest.fixture(autouse=True...
rothomas/api_flow
tests/test_context.py
test_context.py
py
1,988
python
en
code
2
github-code
90
21204349852
from unityagents import UnityEnvironment class TennisEnv: def __init__(self, env_path): self.env = UnityEnvironment(file_name=env_path) self.brain_name = self.env.brain_names[0] brain = self.env.brains[self.brain_name] self.action_size = brain.vector_action_space_size self....
imed-bh/udacity-drl-multiagent
src/tennis_env.py
tennis_env.py
py
1,340
python
en
code
1
github-code
90
23649570523
def main(): output = "" print(output) for i in range(1, 101): if not i % 3: output += "fizz" if not i % 5: output += "buzz" print(f"{output or i}") output = "" if __name__ == "__main__": main()
FuriousSheep/100DaysOfCode
Day_005/FizzBuzz.py
FizzBuzz.py
py
276
python
en
code
0
github-code
90
12837914380
from backend.aux_funcs.aux_generic import response from backend.aux_funcs.aux_meeting import ( get_meeting_from_code, get_meeting_from_mod, user_is_mod, create_meeting, delete_meet_from_code, user_is_connected_to_meet, disconnect_user_from_meet ) from django.forms.models import model_to_dic...
firehellrain/my-turn
myturn/backend/views/meeting_views.py
meeting_views.py
py
3,054
python
es
code
1
github-code
90
31408805518
# Import HDFArchive and some TRIQS modules from h5 import HDFArchive from triqs.gf import * import triqs.utility.mpi as mpi # Import main SOM class from som import Som # Import statistical analysis functions from som.spectral_stats import spectral_avg, spectral_disp, spectral_corr energy_window = (-4.0, 4.0) # Energ...
krivenko/som
doc/examples/spectral_stats/example.py
example.py
py
2,737
python
en
code
15
github-code
90
3110742732
#!/usr/bin/env python3 # -*- coding: utf-8 -*- import numpy as np import pandas as pd import pathlib, pickle, copy, time import plotly.io as pio pio.renderers.default = 'browser' pd.options.plotting.backend = "plotly" from emhass.retrieve_hass import retrieve_hass from emhass.forecast import forecast from emhass.util...
davidusb-geek/emhass
scripts/load_forecast_sklearn.py
load_forecast_sklearn.py
py
11,826
python
en
code
196
github-code
90
18391661639
import sys L = list(sys.stdin.readline().strip()) mod = 10**9 + 7 ls = len(L) # 左からi桁目で、L以下が確定しているかどうか(True /False)の場合の(a, b)の組み合わせの総数 dp = [[0 for i in (True, False)] for _ in range(ls)] # 1からしか始まらない dp[0][False] = 2 dp[0][True] = 1 for i in range(ls-1): for j in (True, False): if L[i+1] == "1": ...
Aasthaengg/IBMdataset
Python_codes/p03015/s755917011.py
s755917011.py
py
750
python
ja
code
0
github-code
90
24092140085
import pandas as pd #fecha_apertura #fecha_internacion #pour chaque région #pour chaque mois #divide confirmed cases by death counts (with time delay?) def simplify(text): import unicodedata try: text = unicode(text, 'utf-8') except NameError: pass text = unicodedata.normalize('NFD', text).encode('ascii', 'i...
ReallyRad/ArgentinaIvermectina
CFRxMonthxRegion.py
CFRxMonthxRegion.py
py
2,795
python
en
code
0
github-code
90
42121865012
import numpy as np import torch from torch.autograd import Variable import glob import cv2 from PIL import Image as PILImage import Model as Net import os import time from argparse import ArgumentParser pallete = [[128, 64, 128], [244, 35, 232], [70, 70, 70], [102, 102, 156], ...
sacmehta/ESPNet
test/VisualizeResults.py
VisualizeResults.py
py
7,347
python
en
code
526
github-code
90
4175342429
class Solution(object): def findLadders(self, beginWord, endWord, wordList): """ :type beginWord: str :type endWord: str :type wordList: List[str] :rtype: List[List[str]] """ if endWord not in wordList: return [] wordList.remove(endWord) ...
HopeCheung/Programing-materials
leetcode/leetcode126-127(word lader).py
leetcode126-127(word lader).py
py
2,217
python
en
code
0
github-code
90
18010480569
def distance(coordinate1, coordinate2): x1 = coordinate1[0] y1 = coordinate1[1] x2 = coordinate2[0] y2 = coordinate2[1] return abs(x1 - x2) + abs(y1 - y2) def main(): n, m = map(int, input().split()) ab_lst = [list(map(int, input().split())) for _ in range(n)] cd_lst = [list(map(int, i...
Aasthaengg/IBMdataset
Python_codes/p03774/s504957999.py
s504957999.py
py
854
python
en
code
0
github-code
90
18494363149
from collections import Counter n,m=map(int,input().split()) primes=[] mod=10**9+7 def modinv(x): return pow(x,mod-2,mod) i=2 while i*i<=m: if m%i==0: while m%i==0: primes.append(i) m//=i i+=1 if m>1: primes.append(m) cnt=Counter(primes) invlst=[1]*(2*10**5) f...
Aasthaengg/IBMdataset
Python_codes/p03253/s994233855.py
s994233855.py
py
574
python
en
code
0
github-code
90
27576109652
from smtplib import SMTP, SMTPConnectError, SMTPAuthenticationError import mimetypes from email import encoders from email.message import Message from email.mime.audio import MIMEAudio from email.mime.base import MIMEBase from email.mime.image import MIMEImage from email.mime.multipart import MIMEMultipart from email....
twotwo/python-libs
smtp/mail_tool.py
mail_tool.py
py
8,728
python
en
code
0
github-code
90
42595506833
import numpy as np from implementations import * from proj1_utils import * from proj1_helpers import * def build_k_indices(y, k_fold, seed): """Build k indices for k-fold. Args: y (numpy.ndarray): ground truth labels k_fold (int) : number of current fold ...
AndresMontero/ML_2019_EPFL
projects/project1/scripts/proj1_cross_validation.py
proj1_cross_validation.py
py
11,700
python
en
code
1
github-code
90
12326144650
""" Common classes and methods library. This package is intended to provide reusable code classes and libraries that may be common to use by other projects. """ __author__ = "Brian Allen Vanderburg II" __copyright__ = "Copyright (C) 2018-2019 Brian Allen Vanderburg II" __license__ = "Apache License 2.0" __version__ ...
brianvanderburg2/python-mrbaviirc-common
mrbaviirc/common/__init__.py
__init__.py
py
609
python
en
code
0
github-code
90
18322092859
def main(): N, T = (int(i) for i in input().split()) AB = [[int(i) for i in input().split()] for j in range(N)] AB.sort() ans = 0 dp1 = [[0]*(T+1) for _ in range(N+1)] for i in range(N): for j in range(T): t = j - AB[i][0] if 0 <= t: dp1[i+1][j] =...
Aasthaengg/IBMdataset
Python_codes/p02863/s541124956.py
s541124956.py
py
518
python
en
code
0
github-code
90
22086790895
import asyncio import websockets from contextlib import suppress from threading import Thread from core.websocket.context import Context from core.module.message import * class WebsocketServer(Thread): def __init__( self, application, host, port ): super(WebsocketServer, self).__init__() self._...
Korbier/PyWsServer
core/websocket/server.py
server.py
py
2,638
python
en
code
0
github-code
90
33734765274
#twoinone_game.py import dark_room import Guess_game def help(): print("This is a two in one game!!\nThe adventure 'DARK ROOM' and the logical 'GUESS GAME'") print("Enter <D> to play 'DARK ROOM' | <G> for 'GUESS GAME'") print("As usual, Enter <quit> to quit and <help> to see this message again") def main(...
Kingdageek/Learn_Python
twoinone_game.py
twoinone_game.py
py
760
python
en
code
0
github-code
90
7866132716
# https://school.programmers.co.kr/learn/courses/30/lessons/42884 def solution(routes): answer = 1 routes = sorted(routes, key= lambda x: x[0]) print(routes) camera = routes[0][1] for idx, val in enumerate(routes[1:]): if val[0] <= camera: camera = min(camera, val[1]) els...
GitofHJH/Programmers-with-Python
Level_3/230329 단속카메라.py
230329 단속카메라.py
py
458
python
en
code
0
github-code
90
43962269017
def report(clf): """ Prints the metrics of a classification model """ # fit the classifier clf.fit(X_train, y_train) # make predictions y_pred = clf.predict(X_test) # print accuracy metrics report = classification_report(y_test, y_pred) print(report) fig, ax = plt...
shsobieski/CustomerSentiment
functions/report.py
report.py
py
400
python
en
code
2
github-code
90
12130780709
# -*- coding: utf-8 -*- """ .. codeauthor:: Daniel Seichter <daniel.seichter@tu-ilmenau.de> """ import os import numpy as np import cv2 from operator import attrgetter def load(filepath, mode=None): if not os.path.exists(filepath): raise IOError("No such file or directory: '{}'".format(filepath)) if ...
TUI-NICR/rgbd-person-perception
src/datasets/img_utils.py
img_utils.py
py
6,580
python
en
code
0
github-code
90
70986759336
import sys import os import matplotlib.pylab as plt from scipy.stats import norm def plot_normal(random_numbers, path=""): """ A function to graphically check a random distribution's fit to a theoretical normal. """ fig=plt.figure(figsize = (8,6)) # Create a figure to plot in (good habit) # His...
drewconway/strata_bootcamp
code/text_data/first_viz/first_viz.py
first_viz.py
py
837
python
en
code
94
github-code
90
18323731069
import sys read = lambda: sys.stdin.readline().rstrip() class Solution(object): def counting_tree(self, N, D): #import collections tot = 1 #cnt = collections.Counter(D) cnt = [0]*N for i in D: cnt[i]+=1 for i in D[1:]: tot = tot * cnt[i-1]%...
Aasthaengg/IBMdataset
Python_codes/p02866/s615350605.py
s615350605.py
py
546
python
en
code
0
github-code
90
36710031630
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import models, migrations class Migration(migrations.Migration): dependencies = [ ('servicelist', '0008_auto_20150526_1507'), ] operations = [ migrations.CreateModel( name='SiteConfiguration', ...
codaha/servicelist
servicelist/migrations/0009_siteconfiguration.py
0009_siteconfiguration.py
py
738
python
en
code
0
github-code
90
4657882620
""" This is a personal investment strategy that can be modified to suit your personal investment purposes. """ from investment_strategy.stock_investment_strategy import StockInvestmentStrategy class PersonalStrategy(StockInvestmentStrategy): """ Personal investment strategy. """ def recommend_good_s...
yangliunewyork/StockPicker
investment_strategy/personal_strategy.py
personal_strategy.py
py
2,609
python
en
code
2
github-code
90
10669002510
import telegram import UserData from User import User import logging import config logger = logging.getLogger("BotLogic") # Server token # token = "134496856:AAEJKACPo9RYAiZd5Q_GtXE9NGEDx5-e84o" # Dev token token = "134144850:AAH1DoOjDIXc27JZuKIl2xs_wjFPpKBNui0" admin_id = 93894659 def __check_user(user): if user...
PeterZhizhin/RUZBot
BotLogic.py
BotLogic.py
py
1,483
python
en
code
1
github-code
90
40942889120
# Why should you learn to write programs? 7746 # 12 1929 8827 # Writing programs (or programming) is a very creative # 7 and rewarding activity. You can write programs for # many reasons, ranging from making your living to solving # 8837 a difficult data analysis problem to having fun to helping 128 # someone else sol...
3mjay/PY4E
py4e/ex_11/ex_11_assignment.py
ex_11_assignment.py
py
1,023
python
en
code
0
github-code
90
18458096569
#!/usr/bin/env python3 # from numba import njit # input = stdin.readline # @njit def solve(n,a,b): delta = [b[i] - a[i] for i in range(n)] need = list(x for x in delta if x > 0) amari = list(sorted((abs(x) for x in delta if x < 0),reverse=True)) needScore = sum(need) if needScore > sum(amari): return -...
Aasthaengg/IBMdataset
Python_codes/p03151/s071976238.py
s071976238.py
py
626
python
en
code
0
github-code
90
26584454673
from datetime import datetime, timedelta from baseball_scraper import espn import pytest def test_scrape_probable_starters(espn_probable_starters): df = espn_probable_starters.scrape() print(df) assert(len(df.index) == 42) assert(df.iloc[20]['Name'] == 'James Paxton') assert(df.iloc[20]['espn_id']...
slippin-jim/sb
baseball_scraper/tests/test_espn.py
test_espn.py
py
645
python
en
code
0
github-code
90
17637162287
import re,sys,urllib2,HTMLParser, urllib, urlparse import xbmc, random #from resources.lib.libraries import cloudflare from resources.lib.lib import control def shrink_host(url): u = urlparse.urlparse(url)[1].split('.') u = u[-2] + '.' + u[-1] return u.encode('utf-8') IE_USER_AGENT = 'Mozilla/5.0 (Wi...
mrknow/filmkodi
plugin.video.mrknowtv/resources/lib/lib/client.py
client.py
py
14,353
python
en
code
66
github-code
90
18394354329
def d_maximum_sum_of_minimum(N, Nodes, C): # 根から始め、巡回した葉にCの大きなものから順に書き込んで行く。 import sys sys.setrecursionlimit(10**6) int_list = list(sorted(C)) graph = [[] for _ in range(N)] for u, v in Nodes: # 0-basedとする graph[u - 1].append(v - 1) graph[v - 1].append(u - 1) def traverse...
Aasthaengg/IBMdataset
Python_codes/p03026/s060799925.py
s060799925.py
py
1,036
python
en
code
0
github-code
90
40145123893
from scipy import ndimage import scipy as sp import numpy as np import pandas as pd def rawTextScansToDataframe(filename='scans.txt', gaussian=False, sigma=1): scanfile = open(filename, 'r') pd.DataFrame() name='' integration='' scans = [] for line in scanfile: line=line.strip() ...
ufecodyn/minispect
AIM2021/minispect.py
minispect.py
py
795
python
en
code
1
github-code
90
38163608025
import torch from mmseg.ops import resize from mmdeploy.core import FUNCTION_REWRITER from mmdeploy.utils import is_dynamic_shape @FUNCTION_REWRITER.register_rewriter( func_name='mmseg.models.decode_heads.ASPPHead.forward') def aspp_head__forward(ctx, self, inputs): """Rewrite `forward` for default backend. ...
fengbingchun/PyTorch_Test
src/mmdeploy/mmdeploy/codebase/mmseg/models/decode_heads/aspp_head.py
aspp_head.py
py
1,271
python
en
code
14
github-code
90
12078148164
import argparse import os import yaml parser = argparse.ArgumentParser() parser.add_argument('--bayes_dip_folder', type=str, default='results_walnut_sample_based_density') parser.add_argument('--baseline_mcdo_folder', type=str, default='results_baseline_walnut_mcdo_density') parser.add_argument('--patch_sizes', type=i...
educating-dip/bayes_dip
evaluation/create_walnut_density_table.py
create_walnut_density_table.py
py
1,719
python
en
code
2
github-code
90
70625873897
import os, sys, re, datetime, random, gzip, json, copy from tqdm import tqdm import pandas as pd import numpy as np from time import time from math import ceil from pathlib import Path import itertools import argparse import networkx as nx from sklearn.model_selection import ParameterGrid import torch import torch.nn ...
hoangntc/DyHNet
DyHNet/run_ablation_study.py
run_ablation_study.py
py
4,317
python
en
code
1
github-code
90
18298859329
from itertools import groupby def all_equal(iterable): g = groupby(iterable) return next(g, True) and not next(g, False) N, A, B = map(int, input().split()) if all_equal(map(lambda x: x % 2, (A, B))): print((B - A) // 2) else: print(min((A - 1, N - B)) + 1 + (B - A - 1) // 2)
Aasthaengg/IBMdataset
Python_codes/p02823/s742038959.py
s742038959.py
py
297
python
en
code
0
github-code
90
8350854658
import glob from sklearn.model_selection import train_test_split import tensorflow as tf # add import numpy as np from tensorflow.keras.layers import GlobalAveragePooling1D import numpy as np from tensorflow.keras import Model from nanoDoc2.network import cnnwavenet_decfilter DATA_LENGTH_UNIT = 60 DATA_LENGTH = 102...
uedaLabR/nanoDoc2
nanoDoc2_1/test/TestErrorAnalysis2.py
TestErrorAnalysis2.py
py
12,974
python
en
code
0
github-code
90
1621978371
from settings import settings from entity import Poop, AidKit import entity import pygame import asset import init from pygame.locals import * def call(): # fps 설정 dt = init.clock.tick(settings["fps_set"].main) # fps 구하기 fps = init.clock.get_fps() fontfps = pygame.font.Font(asset.font["NeoDunggeun...
jhk1090/PyAvoid
area_manager.py
area_manager.py
py
14,420
python
en
code
0
github-code
90
36910433865
import unittest from pychoco.model import Model from pychoco.objects.automaton.cost_automaton import CostAutomaton, make_single_resource from pychoco.objects.automaton.finite_automaton import FiniteAutomaton class TestCostRegular(unittest.TestCase): def testCostRegular1(self): m = Model() n = 10...
chocoteam/pychoco
tests/int_constraints/test_cost_regular.py
test_cost_regular.py
py
3,563
python
en
code
9
github-code
90
73669075497
from tkinter import * expression = "" def press(num): global expression expression = expression +str(num) equation.set(expression) def equalpress(): try: global expression total = str(eval(expression)) equation.set(total) expression = "" except: ...
NyanLinnZaw/nlz
calculator.py
calculator.py
py
2,651
python
en
code
0
github-code
90
16436585620
import bpy class SFMEditorPanel(bpy.types.Panel): bl_idname = "SFM_EDITOR_PANEL" bl_label = "SFM Editor" bl_space_type = 'VIEW_3D' bl_region_type = 'UI' bl_category = "Colmap" @classmethod def poll(cls, context): return (context.object is not None) def draw_header(self, contex...
NontawatWuttikam/blender-sfm-editor-plugin
main_panel.py
main_panel.py
py
947
python
en
code
0
github-code
90
23153074468
import asyncio, discord, validators, logging from .gallery import GalleryDownloader from .defaults import LOGGER_NAME logger = logging.getLogger(LOGGER_NAME) class DiscordClient(discord.Client): def __init__(self, mappings): self._loop = asyncio.get_event_loop() super().__init__(loop=self._loop)...
browningluke/dgdl
discord-gallerydl/app/discordClient.py
discordClient.py
py
3,762
python
en
code
1
github-code
90
6544301772
#merge sort #divide and conquer rule def merge(a,b): (c,m,n)=([],len(a),len(b)) (i,j)=(0,0) while (i+j)<(m+n): #loop until we reach the length of lists if i==m:#if a is empty c.append(b[j]) j+=1 elif j==n:#if b is empty c.append(a[i]) i+=1 ...
Ankuraxz/Python_DSA
sorting_algo/merge_sort.py
merge_sort.py
py
1,196
python
en
code
3
github-code
90
17941966269
from collections import deque s = deque(input()) ans = 0 while s: L = s[0] R = s[-1] if L == R: if 1 == len(s): break L = s.popleft() R = s.pop() continue elif L == 'x' and R != 'x': ans += 1 s.append('x') elif L != 'x' and R == 'x': ...
Aasthaengg/IBMdataset
Python_codes/p03569/s619361681.py
s619361681.py
py
431
python
en
code
0
github-code
90
17982020369
import sys sys.setrecursionlimit(10 ** 7) f_inf = float('inf') mod = 10 ** 9 + 7 def resolve(): x, a, b = map(int, input().split()) late = a - b if late >= 0: print("delicious") else: if x + late >= 0: print("safe") else: print("dangerous") if __name_...
Aasthaengg/IBMdataset
Python_codes/p03679/s291484444.py
s291484444.py
py
351
python
en
code
0
github-code
90
24623078921
import json from typing import Dict, Any import fastjsonschema from dragonchain.lib import keys from dragonchain.lib.dto import schema from dragonchain.lib.dto import model _validate_l5_block_at_rest = fastjsonschema.compile(schema.l5_block_at_rest_schema) def new_from_at_rest(block: dict) -> "L5BlockModel": "...
dragonchain/dragonchain
dragonchain/lib/dto/l5_block_model.py
l5_block_model.py
py
4,571
python
en
code
701
github-code
90
35934284046
# from pytesseract import image_to_string # from PIL import Image # im = Image.open(r'/Users/himankyadav/Desktop/hackillinois-fresheries/test1.jpg') # print(im) # with open("testOutput.txt", "w") as myfile: # myfile.write(image_to_string(im)) import requests import json API_KEY = "50732aac0d96a678b460b22c6eb07225" ...
him229/hackIllinois-fresheries
py files/test.py
test.py
py
2,978
python
en
code
8
github-code
90
7185390637
import os import sys import time import json import numpy as np from Reader import Config from PyQt5.QtWidgets import QApplication from PyQt5.QtWidgets import QWidget from PyQt5.QtWidgets import QTableWidget from PyQt5.QtWidgets import QTableWidgetItem from PyQt5.QtWidgets import QAbstractItemView from PyQt5...
whyeemcc/X
X/SDM.py
SDM.py
py
5,580
python
en
code
0
github-code
90
18367360179
import sys input = lambda: sys.stdin.readline().rstrip() def solve(): N, D = map(int, input().split()) if N < (D * 2 + 1): ans = 1 else: q, r = divmod(N, D * 2 + 1) ans = q + 1 if r > 0 else q print(ans) if __name__ == '__main__': solve()
Aasthaengg/IBMdataset
Python_codes/p02970/s616675230.py
s616675230.py
py
288
python
en
code
0
github-code
90
18042106899
#!python3 LI = lambda: list(map(int, input().split())) # input N, x = LI() A = LI() def main(): ans = 0 for i in range(1, N): s = A[i - 1] + A[i] d = max(0, s - x) ans += d A[i] -= min(d, A[i]) print(ans) if __name__ == "__main__": main()
Aasthaengg/IBMdataset
Python_codes/p03862/s701944630.py
s701944630.py
py
293
python
en
code
0
github-code
90
21352840381
from __future__ import print_function from Board import * from copy import deepcopy from Search import * #load a board from disk def loadBoard(filename): #fname = raw_input('Please provide a file and absolute path.. and then hit RETURN / ENTER \n') fname = filename with open(fname) as f: content = ...
rossms/ai_sbp
main.py
main.py
py
2,847
python
en
code
0
github-code
90
72743891177
""" replace common typos of names to unify them in the database """ typos = { "Matt": {"Mat", "Mattt", "\"Matt", "Matr", "Mtt"}, "Sam": {"San", "Nott", "Sma", "Sasm", "Sm", "Ssam"}, "Travis": {"Tarvis", "Travs", "Travia", "Traivs", "Tavis", "Trvis"}, "Taliesin": {"Taiesin", "Talisin", "Talisen", "Talei...
Findus23/cr-search
typo.py
typo.py
py
1,824
python
en
code
0
github-code
90
4650544378
from __future__ import print_function import numpy as np from scipy import optimize from scipy.optimize import minimize import matplotlib.pyplot as plt import pylab as pl #from sklearn.datasets import load_digits import math import csv import time #import matplotlib from matplotlib import cm import random ...
rpcoelho17/Simulated-Annealing
NeuralNetwMNSTV2_2.py
NeuralNetwMNSTV2_2.py
py
31,723
python
en
code
2
github-code
90
44355928916
import matplotlib.pyplot as plt x_values = range(1,1001) y_values = [x**2 for x in x_values] fig, ax = plt.subplots() ax.scatter(x_values,y_values,c=x_values,cmap=plt.cm.Blues,s=10) plt.savefig('square_plot.png') plt.show()
PythonProfessional83/Matplotlib_Plotly
1000_points_colormap.py
1000_points_colormap.py
py
226
python
en
code
0
github-code
90
22350903085
import brewer2mpl from discrete_cmap import discrete_cmap from colormaps import viridis def default_pcolor_args(data, anom=False): """Returns a dict with default pcolor params as key:value pairs Parameters ---------- data : numpy array anom : boolean True if positive/negative display is...
fallisd/validate3
pcolor.py
pcolor.py
py
1,514
python
en
code
0
github-code
90
21716700542
""" Unit tests for matIO.py module """ import pytest import os import numpy as np import pandas as pd import tempfile from spynal.tests.data_fixtures import MISSING_ARG_ERRS from spynal.matIO import loadmat, load, whomat, who, savemat, save # =========================================================================...
sbrincat/spynal
spynal/tests/test_matIO.py
test_matIO.py
py
9,383
python
en
code
8
github-code
90
24982123823
import torch import torch.nn as nn n_channel = 1 data = torch.randn(10, n_channel, 56, 56, 28) channel_list = [8, 16] n_conv_out_dim = 1000 encoder_layers = [ nn.Conv3d(n_channel, 8, (3, 3, 2), padding=1, stride=(2, 2, 1)), nn.Conv3d(8, 16, (3, 3, 3), padding=1, stride=(2, 2, 2)), nn.Conv3d(16, 32, (3,...
HiroIshida/snippets
python/ext_examples/pytorch_example/convnet/conv3d.py
conv3d.py
py
952
python
en
code
6
github-code
90
28124372000
import torch import torch.nn as nn import torch.nn.functional as F from utils import clones from model.sublayer import SublayerConnection, LayerNorm """ Created on Wed Feb 12 22:36:18 2020 @author: lizhenping decoder的整个代码框架同encoder基本相同,区别在于多传入一个memory,是encoder传入的状态向量。 decoder也有两层结构,在第一层同encoder相同 在第二层中传入encoder的状态向量...
zhenpingli/transformer-with-annotation
model/decoder.py
decoder.py
py
1,445
python
en
code
5
github-code
90
18293707979
import sys input = sys.stdin.readline def gcd(a, b): while b: a, b = b, a%b return a def lcm(a, b): return a//gcd(a, b)*b N, M = map(int, input().split()) a = list(map(int, input().split())) b = [ai//2 for ai in a] cnt = [0]*N for i in range(N): t = b[i] while t%2==0: cnt[i]...
Aasthaengg/IBMdataset
Python_codes/p02814/s371810033.py
s371810033.py
py
484
python
en
code
0
github-code
90
41709794826
class team: def __init__(team, name, points, wins, draws, losses, skill, goaldiff, championships): team.name = name team.points = points team.wins = wins team.draws = draws team.losses = losses team.skill = skill team.goaldiff = goaldiff tea...
varmagokul6/Champions-League-Simulation
Teams.py
Teams.py
py
508
python
en
code
1
github-code
90
34875169180
# -*- coding: utf-8 -*- """ Created on Mon Aug 27 13:28:39 2018 @author: tb267 """ from . import streams import numpy as np import pyqtgraph as pg import matplotlib.pyplot as plt import seaborn as sns # try: # import pyaudio # except ImportError: # pyaudio = None # except NotImplementedError: # pyaudio...
torebutlin/pydvma
pydvma/options.py
options.py
py
7,882
python
en
code
2
github-code
90
37755723475
""" Original training enviornment for meta-rl agent for the GSP task distribution used in Kumar et al. 2022. We used their enviornment (but turned of training on the control distribution). """ import gym from gym.utils import seeding from PIL import Image as PILImage from gym.spaces import Box from gym.spaces import...
sreejank/language_and_programs
small_env_4x4.py
small_env_4x4.py
py
10,111
python
en
code
4
github-code
90
15910698771
from math import sqrt import random from pytest import approx from gym_d2d.position import Position, get_random_position, get_random_position_nearby NUM_TEST_REPEATS = 10 class TestPosition: def test_distance(self): for _ in range(NUM_TEST_REPEATS): a_x, a_y = random.uniform(0, 500), rando...
davidcotton/gym-d2d
test/gym_d2d/test_position.py
test_position.py
py
1,485
python
en
code
19
github-code
90
7235155554
#!/usr/bin/env python # -*- coding: utf-8 -*- import boto3 import botocore import time import pytest import ddbsimple @pytest.fixture def test_basic_one(): assert 10 == 11 def test_basic_two(): assert 12 == 12 def testBasicThree(): assert 13 == 13 def createTestTable(client, tableName, checkExists=F...
bdastur/notes
aws/ddb/tests/test_basic.py
test_basic.py
py
7,667
python
en
code
4
github-code
90
18317051799
N = int(input()) A = [int(i) for i in input().split()] l = sum(A) ans = float("inf") t = 0 for i in range(N-1): t += A[i] ans = min(ans,abs(l-2*t)) #print("t,ans",t,ans) print(ans)
Aasthaengg/IBMdataset
Python_codes/p02854/s289996455.py
s289996455.py
py
189
python
en
code
0
github-code
90
70252829098
from PyQt4.QtCore import * from PyQt4.QtGui import * from qgis.core import * from qgis.utils import * ##STS=group ##fichier_nodes=vector point ##stop_id=field fichier_nodes ##fichier_arcs=vector line ##arc_id=field fichier_arcs ##rayon=number 50 arcs=processing.getObject(fichier_arcs) nodes=processing.getObject(fichi...
crocovert/scripts_qgis
accidents_arcs.py
accidents_arcs.py
py
1,071
python
en
code
2
github-code
90
32420635567
# Create a Resource Group and Storage Account in Microsoft Azure # Resource Groups are used to store and organize resources in Azure. # Storage Accounts are used to store & share your data & files in different formats. # Run this code from a python session on the Azure Cloud Shell. # After the resource group and st...
satyaibm/python_tutorial
Website.py
Website.py
py
5,141
python
en
code
0
github-code
90
18333016949
S = input() K = int(input()) if S.count(S[0]) == len(S): print(len(S)*K//2) exit() count = 0 i = 1 flg = [False] * len(S) while i < len(S): if S[i] == S[i-1]: count += 1 flg[i] = True i += 2 else: i += 1 count *= K if (not flg[len(S)-1]) and S[0] == S[-1]: a = 1 ...
Aasthaengg/IBMdataset
Python_codes/p02891/s069808944.py
s069808944.py
py
479
python
en
code
0
github-code
90
18566508949
def read(): H, W = map(int, input().split(' ')) Ss = [] for _ in range(H): Ss.append(input()) return H, W, Ss DIRS = [(-1, 0), (1, 0), (0, -1), (0, 1)] def add(p1, p2): return (p1[0] + p2[0], p1[1] + p2[1]) def ans(H, W, Ss): if Ss[0][0] == '#': print('0,0 #') retur...
Aasthaengg/IBMdataset
Python_codes/p03436/s439298843.py
s439298843.py
py
1,144
python
en
code
0
github-code
90
27129922045
import FeatureEngineering as fe from HomeDepotCSVReader import HomeDepotReader import pandas as pd import numpy as np # Color list adapted from # https://kaggle2.blob.core.windows.net/forum-message-attachments/108037/3713/most_common_colors.txt COLOR_LIST = ( "concrete", "white", "black", "brown", "gray", "chrome", "s...
jax79sg/IRDM2017
python/Feature_ColorMaterial.py
Feature_ColorMaterial.py
py
5,007
python
en
code
2
github-code
90
30937993801
import sys import os import magic def is_int(s): try: int(s) return True except ValueError: return False def is_float(s): try: float(s) return True except ValueError: return False def check(file_lines): if len(file_lines[0].split()) != 2: ...
jordiae/EmbeddingsUnitTesting
main.py
main.py
py
3,248
python
en
code
0
github-code
90
20264332041
# 2545-sort-the-students-by-their-kth-score # leetcode/medium/2545. Sort the Students by Their Kth Score # URL: https://leetcode.com/problems/sort-the-students-by-their-kth-score/description/ # # NOTE: Description # NOTE: Constraints # NOTE: Explanation # NOTE: Reference from typing import List class Solution: de...
polyglotm/coding-dojo
coding-challange/leetcode/medium/2545-sort-the-students-by-their-kth-score/2545-sort-the-students-by-their-kth-score.py
2545-sort-the-students-by-their-kth-score.py
py
722
python
en
code
2
github-code
90
20367966821
class Solution: def longestConsecutive(self, nums: List[int]) -> int: nums = set(nums) data = collections.Counter(nums) longest = 0 for i in nums: if i-1 not in nums: start = i-1 temp = 0 while data[start+1]>0: ...
RishabhSinha07/Competitive_Problems_Daily
128-longest-consecutive-sequence/128-longest-consecutive-sequence.py
128-longest-consecutive-sequence.py
py
449
python
en
code
1
github-code
90
39897528294
from pillow import * from tkinter import * root=Tk() root.title("Dictionary") root.geometry("600x400") background_image=tk.PhotoImage(bg.png) background_label = tk.Label(parent, image=background_image) background_label.place(x=0, y=0, relwidth=1, relheight=1) label_of_mutable = Label(root) label_of_imuta...
vrushubhosale/PROJECT-155
predefined_code.py
predefined_code.py
py
1,299
python
en
code
0
github-code
90
38039916439
class student: bebrilliant=5000 def __init__(self,name,rollno): self.name=name self.rollno=rollno self.lap=self.laptop def show(self): print(self.name,self.rollno) class laptop: def __init__(self,brand,ram,cpu): self.brand=brand se...
hemapython/2ndnewlife
claseinside.py
claseinside.py
py
766
python
en
code
0
github-code
90
33380919989
"""This module provides raster related classes based on torchgeo. Author: Theo Larcher <theo.larcher@inria.fr> """ from __future__ import annotations from pathlib import Path from typing import (TYPE_CHECKING, Any, Callable, Dict, Iterator, Optional, Sequence, Tuple, Union) import numpy as np im...
plantnet/malpolon
malpolon/data/datasets/torchgeo_datasets.py
torchgeo_datasets.py
py
22,589
python
en
code
3
github-code
90
18568152539
import sys sys.setrecursionlimit(10 ** 9 + 10) def input(): return sys.stdin.readline().strip() def resolve(): N = int(input()) A = list(map(int, input().split())) B = list(map(int, input().split())) biggerA = 0 biggerB = 0 task = 0 for i in range(N): # A[i]>B[i]なる全てのB[i]を埋めてA[i]<...
Aasthaengg/IBMdataset
Python_codes/p03438/s455368769.py
s455368769.py
py
687
python
en
code
0
github-code
90
18305775319
N = int(input()) xyss = [[] for _ in range(N)] for i in range(N): A = int(input()) for _ in range(A): x, y = map(int, input().split()) xyss[i].append((x-1, y)) ans = 0 for ptn in range(1<<N): conflict = False for i in range(N): if (ptn>>i) & 1: for x, y in xyss[i]: ...
Aasthaengg/IBMdataset
Python_codes/p02837/s277761364.py
s277761364.py
py
561
python
en
code
0
github-code
90
37238484744
import csv data = [ ["이름", "반", "번호"], ["한세진", 1, 20], ["권보미", 2, 40], ["한재인", 3, 10] ] file = open("student.csv", "w", encoding="utf-8-sig") writer = csv.writer(file) for d in data: writer.writerow(d) file.close()
billy0529/python
python basic/chapter10/03.csv.py
03.csv.py
py
267
python
en
code
0
github-code
90
27526126840
# -*- coding: utf-8 -*- import oss2 import configparser cp = configparser.ConfigParser() cp.read('myconfig.conf') accessKeySecret = cp.get('oss', 'accessKeySecret') accessKeyId = cp.get('oss', 'accessKeyId') endpoint = cp.get('oss', 'oss_endpoint') bucketname = cp.get('oss', 'bucketname') auth = oss2.Auth(accessKeyI...
ASTARCHEN/astardownload
astardownload/util/ossClientHelper.py
ossClientHelper.py
py
711
python
en
code
1
github-code
90
957620844
from aiogram.types import ReplyKeyboardMarkup, KeyboardButton, ReplyKeyboardRemove b1 = KeyboardButton('/Режим_работы_заведения') b2 = KeyboardButton('/Адрес и телефон') b3 = KeyboardButton('/Меню') b4 = KeyboardButton('Поделиться номером', request_contact=True) b5 = KeyboardButton('Отправить местоположение', request_...
SeregaFS/telegbot
keyboards/client_kb.py
client_kb.py
py
544
python
ru
code
0
github-code
90
70040727338
from flask import request from flask_restplus import Resource from app.main.util.decorator import admin_token_required, token_required from ...util.dto import * from ...service.intranet.zone_service import * api = ZoneDto.api _zone = ZoneDto.zone @api.route('/all') class ZoneList(Resource): @api.doc('list_of_zon...
bmaritim/float-transfer-python
app/main/controller/intranet/zone_controller.py
zone_controller.py
py
1,386
python
en
code
0
github-code
90
18154850179
#!/usr/bin/env python3 import sys import collections as cl def II(): return int(sys.stdin.readline()) def MI(): return map(int, sys.stdin.readline().split()) def LI(): return list(map(int, sys.stdin.readline().split())) def main(): N, X, M = MI() rep = [] rep_set = set([]) i = 1 rep.append(...
Aasthaengg/IBMdataset
Python_codes/p02550/s305359141.py
s305359141.py
py
906
python
en
code
0
github-code
90
7866073536
# https://school.programmers.co.kr/learn/courses/30/lessons/72412 from itertools import combinations from collections import defaultdict from bisect import bisect_left def solution(info, query): answer = [] csv = defaultdict(list) for i in info: condition = i.split()[:-1] score = int(i.spli...
GitofHJH/Programmers-with-Python
Level_2/230425 순위 검색 5252.py
230425 순위 검색 5252.py
py
1,376
python
en
code
0
github-code
90
2605294260
from datetime import datetime import pandas as pd import aiohttp import asyncio from time import sleep from dto import PRICE_DATA_DTO MARKET = 'ETHUSDT' MARKET_ALT = 'ETH-USD' MARKET_ALT_2 = 'ETH-USDT' class Parser: def __init__(self): self.urls = [ f'https://api.binance.com/api/v3/ticker/boo...
ReservExE/arbitrage_mipt
parse_data_class.py
parse_data_class.py
py
2,680
python
en
code
0
github-code
90