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
38722920889
import csv, os os.chdir(r'') # set working directory, store files for analysis (the Fishbook script outputs) in this folder outputFile = open(r'', 'w', newline='') # set output file name and path outputWriter = csv.writer(outputFile) for csvFilename in os.listdir('.'): listLaneNo = ['Lane Number']...
yijie-geng/Fishbook
Fishbook assay/poolSocialScore.py
poolSocialScore.py
py
1,027
python
en
code
0
github-code
90
17039855860
t = int(input()) for _ in range(t): n = list(input()) onecount = 0 zerocount = 0 for i in n: if i == '1': onecount = onecount + 1 elif i == '0': zerocount = zerocount + 1 if onecount == 1 or zerocount == 1: print('Yes') else: print('No')
rajujha373/Codechef
PRACTICE/beginners/LONGSEQ.py
LONGSEQ.py
py
272
python
en
code
1
github-code
90
23046728081
''' 902. Numbers At Most N Given Digit Set Hard Given an array of digits, you can write numbers using each digits[i] as many times as we want. For example, if digits = ['1','3','5'], we may write numbers such as '13', '551', and '1351315'. Return the number of positive integers that can be generated that are less th...
aditya-doshatti/Leetcode
umbers_at_most_n_given_digit_set_902.py
umbers_at_most_n_given_digit_set_902.py
py
1,071
python
en
code
0
github-code
90
72207967978
# -*- coding: utf-8 -*- # @Time : 2019/10/23 0023 10:47 # @Author : 没有蜡笔的小新 # @E-mail : sqw123az@sina.com # @FileName: N-Queens II.py # @Software: PyCharm # @Blog :https://blog.csdn.net/Asunqingwen # @GitHub :https://github.com/Asunqingwen """ The n-queens puzzle is the problem of placing n queens on an n×n ch...
Asunqingwen/LeetCode
hard/N-Queens II.py
N-Queens II.py
py
1,297
python
en
code
0
github-code
90
33472245488
import subprocess import sys from contextlib import contextmanager from pathlib import Path from typing import Iterator import pytest from pkg_resources import Requirement from pkginfo import Wheel from vulcan.builder import resolve_deps from vulcan.isolation import get_executable @contextmanager def verbose_called...
optiver/vulcan-py
tests/cli/test_builder.py
test_builder.py
py
3,160
python
en
code
10
github-code
90
38469778439
from selenium import webdriver import requests from bs4 import BeautifulSoup import yagmail from datetime import date import lxml from selenium.webdriver.common.by import By from selenium.webdriver.common.keys import Keys from selenium.webdriver.support.ui import WebDriverWait chrome_options = webdriver.ChromeOptions(...
GermanPaul12/Daily-Mail-PythonAnywhere
Files/automating_web.py
automating_web.py
py
1,516
python
en
code
0
github-code
90
31547321753
""" Module containing the 'Board' which consists of the piece positions and piece state """ # pylint: disable=no-value-for-parameter # pylint: disable=import-outside-toplevel import re import utils from fen import FENParser, FENBuilder from settings import FEN_START_STATE, UNICODE_PIECES, FILE_NUMBERS, NOTATION, ALLEGI...
rhys-hodio/chess-py
chessboard/board.py
board.py
py
11,409
python
en
code
0
github-code
90
38992902814
from __future__ import annotations import typing import toolstr from ctc import binary from ctc import evm from ctc import rpc def get_command_spec(): return { 'f': async_decode_command, 'help': 'decode EVM call data', 'args': [ {'name': 'args', 'nargs': '+'}, ], ...
0xmzz/checkthechain
src/ctc/cli/commands/compute/decode_command.py
decode_command.py
py
2,131
python
en
code
null
github-code
90
18318969690
from datetime import datetime, timedelta from typing import Optional # from fastapi.security import OAuth2PasswordBearer, OAuth2PasswordRequestForm from jose import JWTError, jwt # from pydantic import BaseModel # from schemas import schemas # from routes import users from fastapi import HTTPException, status SECRET...
anuran-roy/c4-backend-project2
auth/tokengen.py
tokengen.py
py
1,707
python
en
code
0
github-code
90
4958525091
# Given a string s, find the longest palindromic substring in s. You may assume that the maximum length of s is 1000. # Example: # Input: "babad" # Output: "bab" # Note: "aba" is also a valid answer. # Example: # Input: "cbbd" # Output: "bb" #Manacher's Algo class Solution: def longestPalindrome(self, s): ...
boxu0001/practice
py3/dynamicProgramming/S5_LongestParlingdrom.py
S5_LongestParlingdrom.py
py
1,741
python
en
code
0
github-code
90
18829343314
#Determinar si un numero es o no es primo def es_primo(numero): if numero <= 1: return False for i in range(2, int(numero**0.5) + 1): if numero % i == 0: return False return True def main(): numero = int(input("Ingrese un número entero mayor que 1: ")) if es...
Kevin-Andres-Garavito/kevin_python
Plan mejoramiento/Ciclos/Ejercico2.py
Ejercico2.py
py
492
python
es
code
0
github-code
90
360755578
# -*- coding: utf-8 -*- """ PolymorphicModel Meta Class Please see README.rst or DOCS.rst or http://bserve.webhop.org/wiki/django_polymorphic """ from django.db import models from django.db.models.base import ModelBase from manager import PolymorphicManager from query import PolymorphicQuerySet # PolymorphicQuer...
maskedduck/twitranet
polymorphic/base.py
base.py
py
7,582
python
en
code
1
github-code
90
39244288697
import logging from usautobuild.actions import ApiCaller, Builder, Dockerizer, Gitter, Licenser, Uploader, DiscordChangelogPoster, tag_as_stable from usautobuild.cli import args from usautobuild.config import Config from usautobuild.logger import Logger from usautobuild.utils import git_version log = logging.getLogge...
unitystation/build-script
main.py
main.py
py
1,484
python
en
code
0
github-code
90
27504795219
"""Test module for blueprint-from-raw-template module.""" import json import unittest from mock import MagicMock from stacker.blueprints.raw import ( get_template_params, get_template_path, RawTemplateBlueprint ) from stacker.variables import Variable from ..factories import mock_context RAW_JSON_TEMPLATE_PATH ...
cloudtools/stacker
stacker/tests/blueprints/test_raw.py
test_raw.py
py
7,457
python
en
code
706
github-code
90
18355647919
import sys readline = sys.stdin.readline MOD = 10 ** 9 + 7 INF = float('INF') sys.setrecursionlimit(10 ** 5) def main(): K, X = map(int, readline().split()) res = [x for x in range(X - K + 1, X + K)] print(*res) if __name__ == '__main__': main()
Aasthaengg/IBMdataset
Python_codes/p02946/s079455045.py
s079455045.py
py
267
python
en
code
0
github-code
90
74696681255
import numpy as np from scipy.special import digamma, polygamma N = np.array([ 9, 9, 10, 12, 6]) M = 5 k = 4 V = 32 alpha = np.random.dirichlet(10*np.ones(k),1)[0] beta = np.random.dirichlet(np.ones(V),k) gamma = np.tile(alpha,(M,1)) + np.tile(N/k,(k,1)).T def test_converge2(): tol = 10**(-2) loss1 = ...
yangbaovera/latent-dirichlet-allocation
unit_test/test_converge2.py
test_converge2.py
py
490
python
en
code
0
github-code
90
9198027117
class Solution: def searchLeft(self, nums, target, left, right): while left <= right: mid = (left + right)//2 if nums[mid] < target: left = mid + 1 else: right = mid - 1 return left def searchInsert(self, nums, target)...
TPIOS/LeetCode-cn-solutions
First Hundred/0035.py
0035.py
py
416
python
en
code
0
github-code
90
27924120491
import math import torch from torch.nn.functional import _Reduction from .MSECriterion import MSECriterion """ This file implements a criterion for multi-class classification. It learns an embedding per class, where each class' embedding is a point on an (N-1)-dimensional simplex, where N is...
sibozhang/Text2Video
venv_vid2vid/lib/python3.7/site-packages/torch/legacy/nn/ClassSimplexCriterion.py
ClassSimplexCriterion.py
py
3,860
python
en
code
381
github-code
90
27661791530
import math import imageio import datetime import numpy as np from scipy.fftpack import dct, idct image = imageio.imread('sample.png') size = 256 _in = np.array(image) _out = np.array([[0.0]*size]*size, dtype='f') _out2 = np.array([[0.0]*size]*size, dtype='f') def dct_1d(array, a_size): array1 ...
Larvichee/StolenProjects
My Own Projects/Discrete Cosine Transform/DCTniDCT2.py
DCTniDCT2.py
py
3,393
python
en
code
0
github-code
90
18159113745
import torch from torch import nn __all__ = ["scatter_add"] def scatter_add( x: torch.Tensor, idx_i: torch.Tensor, dim_size: int, dim: int = 0 ) -> torch.Tensor: # 用于对具有相同索引的值进行求和 """ Sum over values with the same indices. Args: x: input values idx_i: index of center atom i ...
1Bigsunflower/schnetpack
src/schnetpack/nn/scatter.py
scatter.py
py
968
python
en
code
null
github-code
90
17952225929
a,b,c,d,e,f = map(int,input().split()) water = [] sugar = [] for i in range(0,1000): for j in range(0,1000): if (100*i*a + 100*j*b ) <= f: water.append(100*i*a + 100*j*b) if c*i + d*j <= f: sugar.append(c*i+d*j) water = list(set(water)) water.sort() water.remove(0)...
Aasthaengg/IBMdataset
Python_codes/p03599/s321336494.py
s321336494.py
py
717
python
en
code
0
github-code
90
71174325417
from django.urls import path from django.conf.urls import include from . import views # Create your views here. app_name = "dominus.team" urlpatterns = [ ## --- Team --- ## Do we move them back? :) path("team/register", views.RegisterTeamView.as_view(), name="registerTeamView"), path("team/<int:team_id>/...
afk-studio/gladiatorus
dominus/team/urls.py
urls.py
py
686
python
en
code
0
github-code
90
1974588945
""" this code is under Apache-2.0 license from PyThaiNLP library. https://github.com/PyThaiNLP """ import re from typing import List, Optional from pythaiaddr.util.trie import Trie from pythaiaddr.tokenize.newmm import segment def word_tokenize( text: str, keep_whitespace: bool = True, ) -> List[str]: if...
thirawat69/PyThaiAddr
pythaiaddr/tokenize/tokenizer.py
tokenizer.py
py
538
python
en
code
2
github-code
90
72457285736
# This function uses tmp var def shellsort_shift(arr): gap = len(arr) // 2 while gap > 0: for right in range(gap, len(arr)): key = arr[right] left = right while left >= gap and key < arr[left - gap]: arr[left] = arr[left - gap] left -=...
7riatsu/procon-book
sort/shellSort.py
shellSort.py
py
995
python
en
code
0
github-code
90
25375025381
# Non-abundant sums # Problem 23 # https://projecteuler.net/problem=23 # A perfect number is a number for which the sum of # its proper divisors is exactly equal to the number. # For example, # the sum of the proper divisors of 28 would be 1 + 2 + 4 + 7 + 14 = 28, # which means that 28 is a perfect number. # # A numbe...
UrlBin/ProjectEuler
Problem_23.py
Problem_23.py
py
1,708
python
en
code
0
github-code
90
18476326699
#!/usr/bin/env python3 import itertools n = int(input()) must = set(["3", "5", "7"]) count = 0 for i in itertools.product("0357", repeat=10): num = int("".join(i)) set_ = set(list(str(num))) if 0 in set_: continue if set_ != must: continue if int("".join(i)) <= n: # print...
Aasthaengg/IBMdataset
Python_codes/p03212/s616232066.py
s616232066.py
py
394
python
en
code
0
github-code
90
9891839838
# To enable all SSL methods use: SSLv23 # then add options to disable certain methods # https://bugs.launchpad.net/pyopenssl/+bug/1020632/comments/3 import binascii import io import os import struct import threading import typing import certifi from kaitaistruct import KaitaiStream from OpenSSL import SSL import sele...
wkeeling/selenium-wire
seleniumwire/thirdparty/mitmproxy/net/tls.py
tls.py
py
17,480
python
en
code
1,689
github-code
90
18258474359
a, b = map(int, input().split()) i = 1 f = 0 while True: if int(i*0.08)==a and int(i*0.1)==b: print(i) f = 1 break if int(i*0.08)>a: break i += 1 if not f: print(-1)
Aasthaengg/IBMdataset
Python_codes/p02755/s699364373.py
s699364373.py
py
213
python
en
code
0
github-code
90
30337954177
#!/usr/bin/python3 """ Main file """ import oca import time def main(): """ Main function """ oca_hw = oca.OpenCanalyzerHw('/dev/tty.usbmodem401') oca_hw.start() oca_hw.sync() oca_hw.send_message([0x33, 0x34]) oca_hw.send_message([0x35, 0x36]) oca_hw.send_message(b"Hello World!") tim...
Open-Canalyzer/Tools
python_communication_test/main.py
main.py
py
516
python
en
code
0
github-code
90
31544161085
from PyQt4.QtGui import * from PyQt4.QtCore import * from PyQt4 import QtTest import os class CardLabel(QLabel): def __init__(self, window, name=None): super().__init__(window) self.setAlignment(Qt.AlignCenter) self.setStyleSheet("color:red;") if not name: self.setImage(o...
cmh1027/matgo
view/GUI_game.py
GUI_game.py
py
15,609
python
en
code
0
github-code
90
73332690858
# https://programmers.co.kr/learn/courses/30/lessons/77486 def sell(dic, answer, seller, value): to = int(value * 0.1) answer[seller] += value - to if dic[seller] != "-" and to > 0: sell(dic, answer, dic[seller], to) def solution(enroll, referral, seller, amount): answer = {} dic...
devwithpug/Algorithm_Study
python/Programmers/2021_Dev-Matching_웹_백엔드_개발자/77486.py
77486.py
py
807
python
en
code
0
github-code
90
72201265258
# Medium # You're given an array of integers and another array of three distinct integers. The first array is guaranteed to # only contain integers that are in the second array, and the second array array represents a desired order for the # integers in the first array. For example, a second array of [x, y, z] represe...
ArmanTursun/coding_questions
AlgoExpert/Sorting/Medium/Three Number Sort/Three Number Sort.py
Three Number Sort.py
py
1,896
python
en
code
0
github-code
90
18350128039
import bisect N, K = map(int, input().split()) a = list(map(int, input().split())) MOD = 10**9 + 7 ans = 0 a.reverse() lst2 = sorted(a) memo = {} for i in range(N): if not a[i] in memo: memo[a[i]] = bisect.bisect_left(lst2, a[i]) ans += K * (K - 1) // 2 *memo[a[i]] for i in range(1, N): lst = sorte...
Aasthaengg/IBMdataset
Python_codes/p02928/s271378710.py
s271378710.py
py
413
python
en
code
0
github-code
90
24609459290
from random import* from Omamoodul import* n=[] p=[] while True: print("1- registreerimine ") print("2- autoriseerimine ") print("3- välja ") print("4- muuta nimi või parool") print("5- unustanud parooli taastamine ") print("6- kui sa tahad vadata teie parool ") v=input("vali number: ") ...
ViktorijaIvanova/registjauto
registjauto/registjauto.py
registjauto.py
py
1,126
python
et
code
0
github-code
90
11594198420
# Dragalia Lost Manifest Parser to download the essential latest (2.0) assets for Private Server purposes, made with love by Ceris # This version relies solely on the asset name, and ignores any older versions of the same asset. import sys import os import hashlib import json import requests import threading import ...
CerisWhite/dl-merged-manifests
EssentialAssets_iOS.py
EssentialAssets_iOS.py
py
8,549
python
en
code
0
github-code
90
73245694377
from typing import Any, Dict, Optional, Union, List from sqlalchemy.orm import Session import uuid from app.core.security import get_password_hash, verify_password from app.crud.base import CRUDBase from app.models.transaction import Transaction from app.schemas.transaction import TransactionCreate, TransactionUpdate...
yudjinn/nwbnk-api
src/app/crud/transaction.py
transaction.py
py
2,649
python
en
code
0
github-code
90
35219766329
import sys input = sys.stdin.readline n, k = map(int, input().split()) data = [list(map(int, input().split())) for _ in range(n)] test = [] for _ in range(k): test.append(list(map(int, input().split()))) su = [[0] * n for _ in range(n)] for i in range(n): for j in range(n): if i == 0 and j == 0: ...
yongwoo97/algorithm
silver/11660_구간합구하기5.py
11660_구간합구하기5.py
py
991
python
en
code
0
github-code
90
4494069771
from django.urls import path from posts import views from posts.apps import PostsConfig app_name = PostsConfig.name urlpatterns = [ path('', views.index, name='index'), path('create/', views.post_create, name='post_create'), path('group/<slug:slug>/', views.group_posts, name='group_list'), path( ...
AlexandrVasilchuk/hw04_tests
yatube/posts/urls.py
urls.py
py
608
python
en
code
2
github-code
90
7738653702
# -*- encoding: utf-8 -*- """ @File : file_utils.py @Time : 2020_01_28-23:02:59 @Author : zhenwang @Description : - Version 1.0.0: File created. """ def get_vars_from_file(mod_path, default=None, raise_exception=False): import ast ModuleType = type(ast) with open(mod...
moliqingwa/DRLND
p2_continuous-control/file_utils.py
file_utils.py
py
1,300
python
en
code
1
github-code
90
13173427476
import os, json, traceback, time from qgis.core import * from PyQt4.QtCore import * from PyQt4.QtGui import * from PyQt4.QtNetwork import * from DlgWaiting import DlgWaiting from GeosismaWindow import GeosismaWindow as gw # SpatiaLite imports from pyspatialite import dbapi2 as db class DownloadRequests(DlgWaiting): ...
faunalia/rt_geosisma_offline
DownloadRequests.py
DownloadRequests.py
py
7,428
python
en
code
0
github-code
90
32886565235
#coding=utf-8 from __future__ import print_function import numpy as np import numpy.random as nrd from uniform import UniformPattern class RWProperyPattern(): WRITE = 1 READ = 0 def __init__(self, base, write_ratio): self.base = base if write_ratio < 0: print("Warning! write_ratio ge 0. Asssuming write_ra...
FacelessManipulator/CachedBench
patterns/rw.py
rw.py
py
1,634
python
en
code
0
github-code
90
2409077669
import copy from ly_kernel.db.BaseModel import * import pickle from base64 import b64encode, b64decode from enums.FlowEnums import FlowOpType,SpecsNodeType from ly_service.utils import Time import json class FlowOp(BaseModel): """ 模板 """ __tablename__ = 'wf_flow' id = db.Column(db.Integer, prim...
ZainLiu/YXtest
workflow/src/models/FlowOp.py
FlowOp.py
py
16,916
python
en
code
0
github-code
90
12551682248
#!/usr/bin/python """Example with a core infra: network switches and controller Archi considered here: C1 - controller - connected to both AP - Access Points - and S - Switches H1 could be seen as a potentiel server or broker located within the network AP1 ---- ----AP4 / / AP2 -- S1 <- ...
lmendiboure/mn-wifi-experiments
core-architecture/vanet-sumo-core.py
vanet-sumo-core.py
py
3,534
python
en
code
0
github-code
90
4255361788
# Imports import time from machine import Pin # Start print("Starting Blink MicroPython program") # Set up led = machine.ADC(0) # an analog pin ADC0 # Infinite loop while True: # Read the value, value range 0-65535 value = led.read_u16() # Print to console print(value) # Delay time.sleep(0.1)...
oscgonfer/sensors_dsp_lectures
01_introduction/examples/PiPico/MicroPython/02_LightSensor.py
02_LightSensor.py
py
321
python
en
code
6
github-code
90
6947642901
# Definition for singly-linked list. # class ListNode(object): # def __init__(self, val=0, next=None): # self.val = val # self.next = next class Solution(object): def deleteDuplicates(self, head): """ :type head: ListNode :rtype: ListNode """ ref = [] ...
bittu876/leetcode_
0083-remove-duplicates-from-sorted-list/0083-remove-duplicates-from-sorted-list.py
0083-remove-duplicates-from-sorted-list.py
py
1,076
python
en
code
0
github-code
90
14595633086
#!/usr/bin/env python # coding: utf-8 import pickle import numpy as np from flask import Flask with open('model_rf.bin', 'rb') as f_in: dv, rf = pickle.load(f_in) app = Flask('wine') wine = { 'alcohol': 20.5, 'sulphates': 0.74, 'citric acid': 0.66, 'volatile acidity': 0.04 } @app....
cmh-ds4a/ml_zoomcamp
final_project/predict_app.py
predict_app.py
py
621
python
en
code
0
github-code
90
34017734368
import sys ex = {"c": "CAUTION:", "x": "EXCEPTION:"} count_of_words = {} try: file = open("words.txt") data = file.read() if len(data) < 1: raise Exception("You have provided empty file.") words_list = data.split() for word in words_list: count_of_words[word] = count_of_words.get(word,0) +...
pranayb-konverge/python-for-everybody
count-words.py
count-words.py
py
825
python
en
code
0
github-code
90
73884502057
#!/usr/bin/env python ''' create a plot for every systematic uncertainty in a datacard ROOT file with up, down and nominal distribution usage: python DrawDatacardSysts.py datacard.root output ''' #from __future__ import division from ROOT import * from sys import argv as cl import re import os import sys gStyle.Set...
KIT-CMS/Z_early_Run3
SignalFit/DrawDatacardSysts.py
DrawDatacardSysts.py
py
11,523
python
en
code
0
github-code
90
9681500817
#!/usr/bin/env python3 import glob import os PATH = "." files = [] for x in os.walk(PATH): for y in glob.glob(os.path.join(x[0], '*.md')): files.append(y) files[-1] = files[-1].replace(".", "", 1) sidebar_file = open('_sidebar.md', 'w') name = "Home" file = "/" sidebar_file.write(f"* [{name}]({...
miautomation/docsify-example
docs/_other/soneji-sidebar.py
soneji-sidebar.py
py
1,101
python
en
code
0
github-code
90
12731613731
from HqYhoo import DateFormat import json import hqutil as hqu import hqpdutil as hqpdu class HqCollect: def __init__(self, tick): self.collect = { 'tick': tick, 'defaultLastnDays': 10, 'lldays': {} } self.pdCollect(tick) def pdCollect(self, tick): df = hqu.pdtick(tick) h...
jbtwitt/jb-app
py/hqcollect.py
hqcollect.py
py
1,496
python
en
code
0
github-code
90
36398352091
""" 3. Count Numbers Read a list of integers in range [0…1000] and print them in ascending order along with their number of occurrences. """ numbers = sorted(list(map(int, input().split(" ")))) count = 1 for i in range(0, len(numbers)): if i < len(numbers) - 1: if numbers[i] == numbers[i + 1]: ...
stefanv877/PythonFundamentals_SoftUni
ListExercises/CountNumbers.py
CountNumbers.py
py
467
python
en
code
0
github-code
90
22487662614
# !SKA#0001 24/10/2022 import datetime class log(): def __init__(self,message) -> None: with open("log.txt", "a") as log: now = datetime.datetime.now() now_str: str = now.strftime("%Y-%m-%d %H:%M:%S") log.write(f"{now_str} - {message}\n")
woseek/pax
util/Logging.py
Logging.py
py
289
python
en
code
0
github-code
90
1120069947
from Object_Detection import logger from pathlib import Path from box import ConfigBox from ensure import ensure_annotations from box.exceptions import BoxValueError import os import yaml @ensure_annotations def read_yaml_file(file_path:Path)->ConfigBox: """ reads yaml file and returns Args: fi...
arun73822/Object_Detection_Yolov5
src/Object_Detection/util/utility.py
utility.py
py
1,154
python
en
code
0
github-code
90
17131644033
#importing several packages import requests #https requests from bs4 import BeautifulSoup #web scrapping import smtplib #emailBody from email.mime.multipart import MIMEMultipart from email.mime.text import MIMEText import datetime #system date and time manipulation now=datetime.datetime.now() #email conten...
SushantDEV23/Aut0mation_Project
NewsScrapper.py
NewsScrapper.py
py
1,680
python
en
code
0
github-code
90
17948860739
N,M,K = map(int, input().split()) NG_flag = True for i in range(0,N+1): for j in range(0,M+1): if i*M + j*N - 2*i*j == K: NG_flag = False print("Yes") break if NG_flag == False: break else: print("No")
Aasthaengg/IBMdataset
Python_codes/p03592/s180069471.py
s180069471.py
py
272
python
en
code
0
github-code
90
34537089979
from typing import List class Solution: #时间复杂度:O(m*n) #空间复杂度O(n) def nextGreaterElement(self, nums1: List[int], nums2: List[int]) -> List[int]: ans=[] for i in nums1: flag=False for index,j in enumerate(nums2): if i == j: flag=Tru...
zhengyaoyaoyao/leetcodePython
leetcode/easy/496. 下一个更大元素 I.py
496. 下一个更大元素 I.py
py
1,771
python
zh
code
0
github-code
90
24116758893
from urllib import request, parse import json def get_json_data(url): req = request.Request(url) req.add_header('OS', 'Android') req.add_header('VERSION', '82') req.add_header('CHANNEL', '360') req.add_header('User-Agent', 'nowcoder android 2.21.3.3091') with request.urlopen(req) as f: ...
MyCloudream/python_test
reptile/Test02.py
Test02.py
py
1,855
python
en
code
2
github-code
90
14201090783
from django import template from django.conf import settings from payments.forms import CardTokenForm, ChangePlanForm, SubscribeForm register = template.Library() @register.inclusion_tag("payments/_change_plan_form.html", takes_context=True) def change_plan_form(context): context.update({ "form": Chan...
bluekite2000/dsp
payments/templatetags/payments_tags.py
payments_tags.py
py
857
python
en
code
0
github-code
90
18422445999
import sys readline = sys.stdin.readline MOD = 10 ** 9 + 7 INF = float('INF') sys.setrecursionlimit(10 ** 5) def main(): a = [int(input()) for _ in range(5)] b = [(x + 9) // 10 * 10 for x in a] ans = INF for i in range(5): ans = min(ans,sum(b) - b[i] + a[i]) print(ans) if __name__ == ...
Aasthaengg/IBMdataset
Python_codes/p03076/s875486504.py
s875486504.py
py
343
python
en
code
0
github-code
90
5785944885
import logging import smtplib import sys from email.mime.multipart import MIMEMultipart from email.mime.text import MIMEText from django.conf import settings from cms.models import Vulnerability logger = logging.getLogger('log') def attention(receiver, maintainer, cve_info): """send attention message to person r...
Open-Infra-Ops/icms
cms/utils/send_attention.py
send_attention.py
py
3,324
python
en
code
0
github-code
90
6890499235
import os import sys import ROOT import argparse import copy import time from datetime import datetime sys.path.append('../RDFprocessor/framework') sys.path.append('../Common/data') from RDFtree import RDFtree from samples_2016_ul import samplespreVFP from genSumWClipped import sumwClippedDict sys.path.append('python/'...
emanca/wproperties-analysis
templateMaker/runBkg_ul.py
runBkg_ul.py
py
6,653
python
en
code
0
github-code
90
5772137266
class Persona: def __init__(self, nombre, edad, dni): self.nombre = nombre self.edad = edad self.dni = dni def constructor(self, nombre, edad, dni): self.nombre = nombre self.edad = edad self.dni = dni # getters for each attribute - Regla primero los getter...
DanielUTN/django2023_ejercicios_integradores
ejercicio6.py
ejercicio6.py
py
1,651
python
es
code
0
github-code
90
36839490496
def main(): fraction = get_input() percentage = into_percentage(fraction) print_output(percentage) def get_input(): while True: try: fraction = input("Fraction: ") if fraction[2] >= fraction[0] and fraction[1] == "/": split_fraction = fraction.split("/") ...
Cozkou/cs50p-exercises
fuel.py
fuel.py
py
747
python
en
code
0
github-code
90
41227103839
def curling(red_stones, yellow_stones, r_stone, r_house): red_squared_distances = [x**2 + y**2 for x, y in red_stones] yellow_squared_distances = [x**2 + y**2 for x, y in yellow_stones] return sum( d <= (r_house + r_stone) ** 2 and ((not yellow_stones or d <= min(yellow_squared_distances)))...
alexbouayad/google-kickstart
2022/round-g/curling/solution.py
solution.py
py
1,012
python
en
code
0
github-code
90
20615837
# -*- coding: utf-8 -*- import discord import asyncio import TOKEN import importer import datetime from send import Command from commands.background import * from discord.ext import commands import sys import os import time prefix = TOKEN.prefix loop = asyncio.get_event_loop() try: os.system('cls') except: o...
DATAKOREA/DATAKOREA
main.py
main.py
py
3,206
python
en
code
0
github-code
90
36343018867
import ipaddress import json from requests.api import delete from termcolor import colored, cprint from cloudflare import createDNSRecord, deleteDNSRecord, getZoneRecords, isValidDNSRecord, getZoneId from tailscale import getTailscaleDevice, isTailscaleIP from config import getConfig import sys def main(): conf...
marc1307/tailscale-cloudflare-dnssync
app/app.py
app.py
py
3,627
python
en
code
113
github-code
90
34108906464
import pickle import numpy as np import torch import torch.nn as nn import torch.optim as optim from torch.utils.data import DataLoader from torchvision import utils from torchvision.utils import save_image from tqdm import tqdm import config from dataset import (CompressedImageDataset, ImageDataset, ...
vvh413/compression
classification/train.py
train.py
py
4,820
python
en
code
0
github-code
90
3760027871
from django.dispatch import receiver from django.db.models.signals import pre_delete, post_save from bookings.models import Invitation from .models import Notification, Booking @receiver(post_save, sender=Invitation) def send_notification_on_invite_sent(sender, instance, **kwargs): """ Sends a user a notific...
OliverCadman/dept_ci_ms4
social/signals.py
signals.py
py
2,612
python
en
code
1
github-code
90
42196587987
dic = { 'emp1': {'name': 'Jhon', 'salary': 7500}, 'emp2': {'name': 'Emma', 'salary': 8000}, 'emp3': {'name': 'Brad', 'salary': 6500} } for k in dic: print(k) for k2 in dic[k]: print(k2, ":", dic[k][k2]) dic['emp3']['salary'] = 8500 for k in dic: print(k) for k2 in dic[k]: pri...
alexeiakimenko/portfolio
HomeWork/hw 12.02/salary.py
salary.py
py
343
python
en
code
0
github-code
90
30737620993
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Wed Aug 28 12:40:23 2019 last update 20 oct 2019 @author: Hektor & Wilton to change the number of runs go to function UBVRI_tools line 708 To determine reliable errors set bootstrap = True at line 79 the input file must have at least the following columns:...
hektor-monteiro/OCFit
UBVRI/OCFit_UBVRI_V2.py
OCFit_UBVRI_V2.py
py
14,515
python
en
code
1
github-code
90
44237601196
from .exceptions import UserNotFound from .user import User, Role available_users = [User("Dominik", "Dominik", "Z", 100, Role.USER, )] def find_user_by_login(login): lower_case_login = login.lower() for user in available_users: if lower_case_login == user.login.lower(): return user r...
DominikZazula1/Pyton-Wtajemniczenie
mod_2/new_movies/users_directory.py
users_directory.py
py
340
python
en
code
0
github-code
90
31473228477
#https://wingnim.tistory.com/39 import math import torch import torch.nn as nn import torch.nn.functional as F import torch import torch.nn as nn import torch.optim import torch.utils.data import torchvision.transforms as transforms import torchvision.datasets as datasets device = torch.device('cuda' if torch.cuda....
SlowMonk/pytorch_
classification/models/Densenet.py
Densenet.py
py
7,150
python
en
code
0
github-code
90
13637229055
# The challange consisted of checking string format which I've done # using regex and then doing a simple calculation def get_check_digit(input): import re r = re.compile('\d-\d{2}-\d{6}-x') if len(input) == 13: if r.match(input): stripped = input[:-2].replace("-","") s = 0 ...
Andycko/UniCode-20-21
11_TheArchives/solution.py
solution.py
py
493
python
en
code
0
github-code
90
18091046066
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ inkavail.py This file is part of InkTools. InkTools is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (a...
mc6312/inktools
inkavail.py
inkavail.py
py
46,003
python
ru
code
0
github-code
90
11032606963
import base64 import json import os import uuid from collections import namedtuple from contextlib import contextmanager import pytest from httmock import HTTMock, urlmatch from util.config.provider import KubernetesConfigProvider def normalize_path(path): return path.replace("/", "_") @contextmanager def fak...
quay/quay
util/config/provider/test/test_k8sprovider.py
test_k8sprovider.py
py
4,682
python
en
code
2,281
github-code
90
23005331751
import re import os import sqlalchemy from . import utils ChannelMetadata = None ContentNode = None File = None class WebViewApi(object): def __init__(self, main_window): self.__main_window = main_window global ChannelMetadata, ContentNode, File from .models import session, Base ...
endlessm/kolibri-webview-demo
kolibri_webview_demo/web_view_api.py
web_view_api.py
py
5,998
python
en
code
0
github-code
90
14420737281
n = int(input()) data = [input() for _ in range(n)] result = 0 for st in data: ch = [st[0]] flag = True for i in range(1, len(st)): if ord(st[i]) != ord(st[i-1]): if st[i] in ch: flag = False break else: ch.append(st[i]) if...
Hong-kee/Algorithm-Study
hyuns/String/1316_그룹단어체커.py
1316_그룹단어체커.py
py
362
python
en
code
2
github-code
90
17549010987
import tensorflow as tf from .psd import calculate_psd import tensorflow_probability as tfp import tensorflow.signal as tfs @tf.function def planck(N: int, nleft: int, nright: int) -> tf.Tensor: """ Create a Planck-taper window. Parameters ---------- N : int The total number of sampl...
mrknorman/py_ml_tools
whiten.py
whiten.py
py
11,656
python
en
code
0
github-code
90
8541715538
def solve_part_one(puzzle_input): sorted_bag = sorted(puzzle_input) sorted_bag.append(sorted_bag[-1] + 3) current_joltage = 0 one_jolt_differences = 0 three_jolt_differences = 0 for adapter in sorted_bag: current_difference = adapter - current_joltage if current_difference == 1:...
AlessandroW/AdventOfCode-2020
Python/day10.py
day10.py
py
1,563
python
en
code
0
github-code
90
18108132949
def insertionSort(A, n, g, cnt): for i in range(g, n): v = A[i] j = i - g while j >= 0 and A[j] > v: A[j+g] = A[j] j = j - g cnt += 1 A[j+g] = v return [cnt, A] def shellSort(A, n): cnt = 0 a = 1 G = [] while a <= n: G....
Aasthaengg/IBMdataset
Python_codes/p02262/s410673889.py
s410673889.py
py
689
python
en
code
0
github-code
90
34060384396
print('''####################### ##Grupo da Maioridade## #######################''') print('→←'*30) from datetime import date branco = '\033[m' azul = '\033[1;36m' vermelho = '\033[1;31m' idade = list() cont = cont1 = 0 for p in range(1, 8): nascimento = int(input(f'Digite o ANO DE NASCIMENTO da {p}º pessoa → ')) ...
dougfunny1983/Hello_Word_Python3
ex054.py
ex054.py
py
618
python
pt
code
0
github-code
90
1789312425
# https://leetcode.com/problems/subsets-ii/ # In the array A at every step we have two choices for each element either we can # ignore the element or we can include the element in our subset class Solution: def subsetsWithDup(self, nums: List[int]) -> List[List[int]]: # sort the array -> needed to skip th...
danish-faisal/Striver-s-SDE-Sheet
Recursion - Day 9/subsets-2.py
subsets-2.py
py
1,188
python
en
code
0
github-code
90
18111350189
li1 = [] li2 = [] for i, s in enumerate(input()): if s == "\\": li1.append(i) elif s == "/" and li1: j = li1.pop() c = i - j while li2 and li2[-1][0] > j: c += li2[-1][1] li2.pop() li2.append((j, c)) if li2: li3 = list(zip(*li2))[1] print(s...
Aasthaengg/IBMdataset
Python_codes/p02266/s368824415.py
s368824415.py
py
388
python
en
code
0
github-code
90
73133244138
import requests from bs4 import BeautifulSoup from csv import DictWriter, DictReader from random import choice response = requests.get('https://quotes.toscrape.com/') soup = BeautifulSoup(response.text, "html.parser") excavated_html = soup.find_all( class_ ="quote" ) # capture author, author quote , href of ...
aynfrancesco06/python_scraping_mini_game
webscrape.py
webscrape.py
py
3,804
python
en
code
0
github-code
90
35989235365
import sys sys.path.append('./model/RAFT/core') import yaml import random import torch import torchmetrics import lpips import time import cv2 import os.path as osp import numpy as np import torch.distributed as dist from argparse import ArgumentParser from torch.utils.data import DataLoader from model.MBD import MBD...
zzh-tech/Animation-from-Blur
valid_video.py
valid_video.py
py
7,890
python
en
code
57
github-code
90
5977225561
import pygame.font # pygame.font可将文本渲染到屏幕 class Button(): def __init__(self,ai_settings,screen,msg): '''初始化按钮的属性''' self.screen = screen self.screen_rect = screen.get_rect() # 设置按钮其他属性和尺寸 self.w...
xiaocong-Fu/alien_WarGame
pyfile/pyGame/button.py
button.py
py
1,654
python
zh
code
0
github-code
90
23045587443
""" step09.py: t-SNE with R2-score data """ import argparse import matplotlib import matplotlib.pyplot import pandas import seaborn import sklearn.manifold import step00 if __name__ == "__main__": parser = argparse.ArgumentParser() parser.add_argument("input", type=str, help="Input TAR.gz file") parser.ad...
CompbioLabUnist/dream_challenge-anti-pd1_response
jwlee230/Program/Python/step09.py
step09.py
py
1,604
python
en
code
0
github-code
90
18212566819
import sys, math, itertools, collections, bisect input = lambda: sys.stdin.buffer.readline().rstrip().decode('utf-8') inf = float('inf') ;mod = 10**9+7 mans = inf ;ans = 1 ;count = 0 ;pro = 1 def gcd(a, b): while(b != 0): a, b = b, a % b return a def lcm(m,n): return (m*n)//gcd(m,n) n = int(in...
Aasthaengg/IBMdataset
Python_codes/p02679/s800664858.py
s800664858.py
py
971
python
en
code
0
github-code
90
35599879467
# This file is part of Slice2Print. # # Slice2Print is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # # Slice2Print is distributed in t...
mprochnow/Slice2Print
slice2print/ui/dialog.py
dialog.py
py
2,606
python
en
code
2
github-code
90
18354200699
import sys read = sys.stdin.read readline = sys.stdin.readline readlines = sys.stdin.readlines sys.setrecursionlimit(10 ** 9) INF = 1 << 60 MOD = 1000000007 def main(): S = readline().strip() T = readline().strip() N = len(S) M = len(T) SS = S + S A = [False] * 26 for c in S: A[...
Aasthaengg/IBMdataset
Python_codes/p02937/s324758280.py
s324758280.py
py
1,072
python
en
code
0
github-code
90
40374763886
from pymongo import MongoClient client = MongoClient("localhost", 27017) db = client.WDMOV ewi_building = [4.373502, 51.998847] runtimes = [] for i in range(0, 200): runtime = db.stops.find({ "loc": { "$near": { "$geometry": { "type": "Point", ...
8uurg/WDMOV
mongo/static/closest-stop.py
closest-stop.py
py
598
python
en
code
0
github-code
90
17825798535
import web3 from .tokens import eth, dai w3 = web3.Web3(web3.Web3.HTTPProvider(f"https://mainnet.infura.io/v3/{os.environ['INFURA_KEY']}")) with open('offchain/uniswap-v3/quoter.abi', 'r') as f: quoter_abi = f.read() uniswap_v3_quoter = w3.eth.contract(address="0xb27308f9F90D607463bb33eA1BeBb41C27CE5AB6", abi=quo...
carterjfulcher/flashloan-arbitrage
offchain/main.py
main.py
py
421
python
en
code
0
github-code
90
18303096079
import sys N = int(input()) # 5^26 > 10^18 if N % 2 == 1: print(0) sys.exit() ans = 0 mul = 1 for i in range(1, 27): mul *= 5 add = N // (2 * mul) if add == 0: break ans += add print(ans)
Aasthaengg/IBMdataset
Python_codes/p02833/s988045750.py
s988045750.py
py
214
python
en
code
0
github-code
90
18004212869
n = int(input()) a = list(map(int, input().split(" "))) res1 = 0 sum = 0 # sei, hu, sei, hu.... # guu, ki, guu, ki for i in range(n): sum += a[i] if sum <= 0 and i%2 == 0: res1 += abs(sum) + 1 sum = 1 elif sum >= 0 and i%2 == 1: res1 += abs(sum) + 1 sum = -1 # hutuuni...
Aasthaengg/IBMdataset
Python_codes/p03739/s746234668.py
s746234668.py
py
616
python
en
code
0
github-code
90
29442068573
def main(): n = int(input()) for _ in range(n): t = int(input()) arr = list(map(int, input().split())) index = arr.index(min(arr)) arr[index] += 1 multi = 1 for i in arr: multi *= i print(multi) if __name__ == "__main__": main()
Alexey-Home/Codeforses
800/1873B.py
1873B.py
py
309
python
en
code
0
github-code
90
18381407359
import sys def input(): return sys.stdin.readline().rstrip() def main(): n, k = map(int, input().split()) full = (n-1)*(n-2)//2 if k > full: print(-1) else: num = full-k print(num+n-1) for i in range(2, n+1): print(1, i) for i in range(2, n): ...
Aasthaengg/IBMdataset
Python_codes/p02997/s013134525.py
s013134525.py
py
499
python
en
code
0
github-code
90
22048681513
################################################################################ # Run 'sh init_sner' in the terminal before running this script # ################################################################################ import os import PyPDF2 import textract from os import walk from nltk.token...
polly63/NLP_Sentiment_Analysis
keyword_extraction.py
keyword_extraction.py
py
2,143
python
en
code
9
github-code
90
15992778740
import os import torch import os.path as osp import torch.nn as nn import torch.nn.functional as F from lib.core.config import BASE_DATA_DIR from lib.models.spin import Regressor from torch.autograd import Variable ## class TemporalAttention(nn.Module): def __init__(self, attention_size, seq_len, ...
MPS-Net/MPS-Net_release
lib/models/mpsnet.py
mpsnet.py
py
8,322
python
en
code
81
github-code
90
18583945529
n,a,b=map(int,input().split()) ans=0 for i in range(n): i+=1 ii=str(i) cnt=0 for j in ii: cnt+=int(j) if a<=cnt<=b: ans+=int(ii) print(ans)
Aasthaengg/IBMdataset
Python_codes/p03478/s003805913.py
s003805913.py
py
175
python
en
code
0
github-code
90
24225375866
import flask from flask import Flask from flask import jsonify from flask import request from PIL import Image import io import os from io import BytesIO import flask import json from flask_cors import CORS import requests import torch from fastai import * from fastai.vision import load_learner from fastai.vision impor...
akkiaffine/Raymonds_Fabric
fabrication.py
fabrication.py
py
3,001
python
en
code
0
github-code
90