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
43260246572
def bellmanford(s0, n0, edge0, inf=10**18): res = [inf] * n0 res[s0] = 0 for i in range(n0 * 2): for a, b, d in edge0: d *= -1 if res[a-1] + d < res[b-1]: res[b-1] = (res[a-1] + d if i < n0 else -inf) return res def main(): ans = bellmanford(0, N...
Shirohi-git/AtCoder
abc042-/abc061_d.py
abc061_d.py
py
544
python
en
code
2
github-code
13
35298723408
""" ・hokudaiの文字が登場した時、その文字に到達する通りはその一文字前までの通り数。 ・cが出てきたら辞書のcに1インクリメント ・hokudaiが出てきたら、その1文字前の文字の通り分足す(hが出てきたら、その時点であるcの通り数だけパターンがある)。 """ from collections import defaultdict mod = 10**9+7 s = list(input()) d = defaultdict(int) for i in range(len(s)): if s[i]=='c': d[s[i]] += 1 elif s[i] in 'hokudai': ...
nozomuorita/atcoder-workspace-python
abc/abc211/c.py
c.py
py
650
python
ja
code
0
github-code
13
72831127057
from Crypto.PublicKey import RSA from cryptography import x509 from cryptography.hazmat.primitives import hashes from cryptography.x509.oid import NameOID from cryptography import x509 from cryptography.hazmat.primitives import serialization from cryptography.hazmat.primitives import hashes from cryptography.hazmat.pri...
d4res/ca_backend
cer.py
cer.py
py
1,958
python
en
code
0
github-code
13
26428335626
have, start, k = map(int, input().split()) ans = 0 while have > 0: length = len(str(start)) howMany = (10 ** length - start) cost = k * (howMany) * length if cost <= have: ans += howMany have -= cost start = 10 ** length else: ans += max(0, have // (k * length)) have = 0 print(ans)
nachiketkanore/CP-Trash
solving/373B/sol.py
sol.py
py
299
python
en
code
2
github-code
13
23683712396
#!/usr/bin/env python3 # -*- coding: utf-8 -*- # File name : coerce.py # Author : Podalirius (@podalirius_) # Date created : 18 Sep 2022 import time from coercer.core.Filter import Filter from coercer.core.utils import generate_exploit_path_from_template from coercer.network.DCERPCSession i...
p0dalirius/Coercer
coercer/core/modes/coerce.py
coerce.py
py
7,407
python
en
code
1,421
github-code
13
32987211794
from sqlalchemy import create_engine from sqlalchemy.orm import sessionmaker from sqlalchemy import and_ # se importa el operador and from crear_tabla import * from configuracion import cadena_base_datos engine = create_engine(cadena_base_datos) Session = sessionmaker(bind=engine) session = Session() ...
PlataformasWeb-P-AA2022/trabajo-final-1bim-equipo_dinamico
consulta5.py
consulta5.py
py
782
python
es
code
0
github-code
13
6757465747
import importlib import os TRAINER_REGISTRY = {} def build_trainer(configuration, *rest, **kwargs): configuration.freeze() config = configuration.get_config() trainer = config.training.trainer trainer = TRAINER_REGISTRY[trainer](configuration) return trainer def register_trainer(name): d...
kienduynguyen/BoxeR
e2edet/trainer/__init__.py
__init__.py
py
978
python
en
code
126
github-code
13
72896322899
# SAMS 2018, Programming Section C ######################################### # Full name: Kameron Dawson # Andrew ID: ksdawson ######################################### # DUE DATE: Sunday August 6th, 5pm # SUBMIT THIS FILE TO AUTOLAB. LATE SUBMISSIONS WILL NOT BE ACCEPTED. # For this assignment, you...
ksdawson/python-learner-code
tetris-game.py
tetris-game.py
py
9,876
python
en
code
0
github-code
13
69804497617
import os, sys, collections import hindkit as kit class GlyphData(object): ITFDG = [] @staticmethod def split(line): return line.partition("#")[0].split() def __init__( self, glyph_order_name = "glyphorder.txt", ): self.glyph_order = [] self.dictionary = ...
itfoundry/hindkit
lib/hindkit/objects/glyphdata.py
glyphdata.py
py
3,823
python
en
code
8
github-code
13
28101948713
import yaml import json import geopandas as gpd gdf = gpd.read_file('output/ZHR/result.csv') gdf.to_file("output/ZHR/preview.geojson", driver='GeoJSON') # minx, miny, maxx, maxy = gdf.geometry.total_bounds # bbox = [minx, miny, maxx, maxy] # ['geo:%f,%f' % (bounds[1], bounds[0]), 'geo:%f,%f' % (bounds[3], bounds[2])] ...
Brieden/Work_density_time_map
exporter.py
exporter.py
py
1,356
python
en
code
0
github-code
13
37910296458
# # $Id: CaloClusterTopoGetter.py,v 1.10 2009-05-19 09:41:18 menke Exp $ # # File: CaloRec/python/CaloClusterTopoGetter.py # Created: September 2008, S.Menke # Purpose: Define default calibrated topo cluster algo and corrections # # Modified: May 4, 2009, P.Loch # Purpose: added H1-style cell calibration to TopoCluster...
rushioda/PIXELVALID_athena
athena/Calorimeter/CaloRec/python/CaloClusterTopoFromTowerGetter.py
CaloClusterTopoFromTowerGetter.py
py
9,560
python
en
code
1
github-code
13
42241527333
import os from datetime import datetime, timedelta from connectors.celery import celery # Delete Files which are 1 hour old def cleanup_directory(directory: str, threshold_minutes: int): current_time = datetime.now() for filename in os.listdir(directory): file_path = os.path.join(directory, filename) ...
Parth442002/metaPipeline
triggers/directory_cleanup.py
directory_cleanup.py
py
983
python
en
code
0
github-code
13
72724792019
# import openai import datetime import pyttsx3 import speech_recognition as sr from openai import OpenAI from decouple import config import re from transcribe import text_to_speech from gtts import gTTS client = OpenAI( api_key=config('OPENAI_API_KEY') ) # ¡Hola! Soy Chronos, tu asistente de calendario. ¿En qué p...
Sebastian-Loza05/Chronos
backend/chronos.py
chronos.py
py
10,965
python
es
code
0
github-code
13
7115122856
from tkinter import * from tkinter.ttk import * import random root = Tk() root.title("RPS!") root.geometry('228x200') root.resizable(0,0) choice = "" outcome = StringVar() compChoice = "" def setRock(): choice = "rock" compChoiceRand = random.randint(1,3) if (compChoiceRand == 1): comp...
proprr/python-projects
rps.py
rps.py
py
2,096
python
en
code
0
github-code
13
8017302928
#! /usr/bin/env python ## Python LHAPDF6 usage example import lhapdf import numpy as np import matplotlib.pyplot as plt import matplotlib.cm as cm from scipy import integrate as sint G_F = 1.188*10**(-5) #GeV^-2 M_W = 80.38 #GeV mp = 0.94 #GeV flav =np.append( np.arange(-5,0,1,dtype=int), np.arange(1,6,1,dtype=in...
rensverkade/HNL_DIS_Cascade
Dark_nu_trials/neutrino_cross_repro.py
neutrino_cross_repro.py
py
3,946
python
en
code
0
github-code
13
26572715906
#!/usr/bin/env python3 # -*- coding:utf-8 -*- ''' @File : sys_config.py @Desc : 系统配置文件 ''' # ********** 运行配置 ********** # # 基本运行配置 app_run_conf = { "HOST": "0.0.0.0", "PORT": 5000, "RELOAD": True, "WORKERS": 10, "DEBUG": True } SECRET_KEY = "xxx" # ********** 生产 与 测试 系统切换 ********** # # True :...
ytxfate/fastapi_template
project/config/sys_config.py
sys_config.py
py
631
python
zh
code
4
github-code
13
28548528871
# # @lc app=leetcode.cn id=206 lang=python3 # # [206] 反转链表 # from typing import Optional # @lc code=start # Definition for singly-linked list. # class ListNode: # def __init__(self, val=0, next=None): # self.val = val # self.next = next class Solution: # 递归 def reverseList(self, head: Opt...
orz23333/algorithm
python/206.反转链表.py
206.反转链表.py
py
1,266
python
en
code
0
github-code
13
72670227537
# -*- coding: utf-8 -*- import numpy as np import tensorflow as tf from tensorflow.python import pywrap_tensorflow tf.reset_default_graph() tf.set_random_seed(0) class ASDNetwork(object): def __init__(self, num_actions, num_features, sample_round, ...
lizzyhku/OASD
ASDNet.py
ASDNet.py
py
5,765
python
en
code
7
github-code
13
70476084178
def power(x, y, p=1000000007) : res = 1 x = x % p if (x == 0) : return 0 while (y > 0) : if ((y & 1) == 1) : res = (res * x) % p y = y >> 1 x = (x * x) % p return res t = int(input()) for u in range(t): a=int(input()) b, k=0, a while k>0: tmp = k%10 b=b*10+tmp k//=10 print(power(a,b))
baquyptit2001/ctdl-gt
luy_thua.py
luy_thua.py
py
320
python
en
code
0
github-code
13
27854355543
def func(st,x): tmp=st.replace('x',str(x)) return(eval(tmp)) #a,b는 해가 위치하는 구간, x는 소숫점 아래 유효숫자, func는 함수 def regula_falsi(a,b,x,calc): ans=0 pre=0 i=1 while(True): ans=(a*func(calc,b)-b*func(calc,a))/(func(calc,b)-func(calc,a)) if (func(calc,ans)<0): a=ans els...
sopipc167/MathwithPython
regulaFalsi.py
regulaFalsi.py
py
819
python
ko
code
0
github-code
13
29835185649
import chess from .evaluate import evaluate_position from .game_data import GameData INF = 10000000 def a_b_min_max_first_iteration(game_data, depth, is_maximizing_player): best_move = None best_value = -INF alpha = -INF beta = INF for move in game_data.board.legal_moves: game_data.push_...
Marius-likes-coding/chess-engine
chess-bot/engines/minmax_ab.py
minmax_ab.py
py
1,863
python
en
code
0
github-code
13
20350856282
## Point ## #1. target이 words 안에 있는 경우 index 저장 #2. target이 words 안에 없는 경우 0 반환 #3. words_graph와 begin_graph 생성 #4. dfs 이용하여 target까지의 거리 구하여 리스트에 누적 #5. 누적된 값 중에서 가장 작은 값 반환 (현재 테스트케이스에서는 필요 없는 구분) def solution(begin, target, words): list_length = len(words) word_length = len(begin) words_graph = [[] for ...
xonic789/coding-test
normal-beom/week9/PRO_43163_단어_변환.py
PRO_43163_단어_변환.py
py
1,529
python
en
code
2
github-code
13
7050030145
import numpy as np from numpy.linalg import norm, inv, eigh, det from itertools import product # from smith_form.gauss_elim import gauss_elim_np # from find_minimal_latt import standardize_prim_basis from smith_form.smith_form_C import smith_form import sympy as sp def latt_home(vec,tol=1e-6): vec = np.array([ np...
zine-phy/identifySSG
small_func.py
small_func.py
py
14,040
python
en
code
0
github-code
13
36706908925
""" Exercise 02a. Implement a program 'exercise_02a_thresh' that thresholds an input image exercise_02a_input_01.pgm at level 'value': exercise_02a_thresh exercise_02a_input_01.pgm value exercise_02a_output_01.pgm The thresholding operation is as follows: a pixel p will have a value of 255 in exercise_02a_output_01.p...
AlexanderLu98/IMAGE-PROCESSING-ANALYSIS-AND-CLASSIFICATION
Exercises_02ab/exercise_02a_thresh.py
exercise_02a_thresh.py
py
1,694
python
en
code
0
github-code
13
17039910134
#!/usr/bin/env python # -*- coding: utf-8 -*- import json from alipay.aop.api.constant.ParamConstants import * class AlipayEbppInvoiceMerchantEnterstatusQueryModel(object): def __init__(self): self._m_short_name = None self._process_id = None self._product_code = None @property ...
alipay/alipay-sdk-python-all
alipay/aop/api/domain/AlipayEbppInvoiceMerchantEnterstatusQueryModel.py
AlipayEbppInvoiceMerchantEnterstatusQueryModel.py
py
2,007
python
en
code
241
github-code
13
17617342650
import cv2 import numpy as np import yaml from loguru import logger from configs import configs from .utils import alpha_mask COLOR_RED = (0, 0, 255) COLOR_GREEN = (0, 255, 0) COLOR_BLUE = (255, 0, 0) COLOR_YELLOW = (0, 255, 255) COLOR_MAGENTA = (255, 0, 255) class Detector(object): def __init__(self, model_nam...
Mufanc/Genshin-SmartFishingRod
automaton/detector.py
detector.py
py
5,501
python
en
code
292
github-code
13
1025640643
import argparse import multiprocessing import logging import os, sys # get the path of the directory containing the current script parent_dir = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) sys.path.append(parent_dir) from gensim.models import Word2Vec from gensim.models import KeyedVectors from utils.u...
Turkish-Word-Embeddings/Word-Embeddings-Repository-for-Turkish
word2vec/word2vec.py
word2vec.py
py
4,590
python
en
code
1
github-code
13
23406704162
import json import sys import numpy as np def load_json(path): with open(path, 'r') as fr: result = json.load(fr) return result def write_json(path, d): with open(path, 'w') as fw: json.dump(d, fw) def softmax(logits): if type(logits) is list: logits = np....
easonnie/ChaosNLI
distnli/src/eval_scripts/format_file_for_entropy_plot.py
format_file_for_entropy_plot.py
py
1,286
python
en
code
26
github-code
13
41628401115
from django.shortcuts import render,redirect from .models import Room from django.db.models import Count from .models import Kernel def chat(request,room_name): return render(request, 'chat/chat.html', {"room":room_name}) def chatKernel(request): if request.method=="POST": name=request.POST.get("kernel",None...
alkemata/webServer
web/alkemata/alkemata/chat/views.py
views.py
py
1,057
python
en
code
0
github-code
13
74460751058
import os os.environ.setdefault("DJANGO_SETTINGS_MODULE", "webapp.settings") from branch.models import Results import csv with open("allotment.csv") as f: reader = csv.reader(f, delimiter=',') for row in reader: z = Results() z.roll_no = row[0] z.name = row[1] z.curr_branch = row[2] z....
ranaprathapthanneeru/branch-change-portal
application/import_results.py
import_results.py
py
356
python
en
code
0
github-code
13
30171906213
#!/usr/bin/env python from barobo.linkbot import Linkbot from barobo import BaroboCtx import time import sys if __name__ == "__main__": if len(sys.argv) < 2: print ("Usage: {0} <Com_Port> [Linkbot Serial ID]".format(sys.argv[0])) quit() if len(sys.argv) == 3: serialID = sys.argv[2] ...
davidko/PyBarobo
demo/test/with_Bluetooth/elad_motion_test_joint1.py
elad_motion_test_joint1.py
py
659
python
en
code
0
github-code
13
4702370200
import dropbox import os from dropbox.files import WriteMode class TransferData: def __init__(self, access_token): self.access_token = access_token def upload_file(self, file_from, file_to): dbx = dropbox.Dropbox(self.access_token) for root, dirs, files in ...
Malavika007/PRO-101
uploadFiles.py
uploadFiles.py
py
1,171
python
en
code
0
github-code
13
3847063178
# Databricks notebook source import pandas as pd from os import listdir from os.path import join, basename import struct import pickle import json import os from scipy import misc import datetime as dt from pyspark.sql.types import * from pyspark.sql.functions import udf from pyspark.ml.evaluation import MulticlassCla...
analytics-zoo/WorldBankPoC
vegnoveg/vegnonveg-fulltraining-nnframe.py
vegnonveg-fulltraining-nnframe.py
py
12,524
python
en
code
4
github-code
13
23407080762
from enum import Enum from pytorch_pretrained_bert import BertTokenizer, BertModel, BertAdam from pytorch_pretrained_bert.modeling import BertLayerNorm from data_utils.readers.span_pred_reader import BertSpanPredReader import flint.span_util as span_util import flint.torch_util as torch_util import torch.nn as nn fro...
easonnie/semanticRetrievalMRS
src/fever_models/nli/bert_v0_1.py
bert_v0_1.py
py
2,389
python
en
code
59
github-code
13
33081628100
from typing import List from collections import defaultdict from functools import reduce class Trie: def __init__(self): """ Initialize your data structure here. """ Trie = lambda: defaultdict(Trie) self.trie = Trie() def insert(self, word: str) -> None: """ ...
LNZ001/Analysis-of-algorithm-exercises
leetcode_ex/ex208-实现 Trie (前缀树) .py
ex208-实现 Trie (前缀树) .py
py
1,232
python
en
code
0
github-code
13
6166887094
import sqlite3 from sqlite3 import Error class DataBase: def __init__(self): self.conn = None self.cur = None def create_connection(self, db_file): """ create a database connection to a SQLite database """ try: self.conn = sqlite3.connect(db_file, check_same_thread...
gjlendrino/emt-srv
data_base.py
data_base.py
py
2,243
python
en
code
0
github-code
13
26017967966
import nucleus7 as nc7 from nucleus7.builders import data_pipe_builder from nucleus7.data.data_pipe import DataPipe from nucleus7.test_utils import test_utils class TestDataPipeBuilder(test_utils.TestCaseWithReset): def setUp(self): super(TestDataPipeBuilder, self).setUp() test_utils.register_new...
audi/nucleus7
tests/builders/data_pipe_builder_test.py
data_pipe_builder_test.py
py
2,599
python
en
code
35
github-code
13
11989884174
#!/usr/bin/env python3 # import argparse import csv import datetime import requests import re import urllib.parse from ratelimit import limits, sleep_and_retry parser = argparse.ArgumentParser(description='downloads historical coin pricing from coingecko.') parser.add_argument('--coin', help='what coin should we get'...
vijayp/token_staking_calculator
py/download_historical_pricing.py
download_historical_pricing.py
py
1,787
python
en
code
0
github-code
13
40334572983
"Test colorizer, coverage 93%." from idlelib import colorizer from test.support import requires import unittest from unittest import mock from functools import partial from tkinter import Tk, Text from idlelib import config from idlelib.percolator import Percolator usercfg = colorizer.idleConf.userCfg testcfg = { ...
kbengine/kbengine
kbe/src/lib/python/Lib/idlelib/idle_test/test_colorizer.py
test_colorizer.py
py
15,017
python
en
code
5,336
github-code
13
23918605786
import time import math def first_decorator(func): func() time_zero = time.time() time_to_complete = time.time() - time_zero print(f"Была вызвана функция {func.__name__} Затраченное время {time_to_complete}") a = float(input('введите длину: ')) b = float(input('введите ширину: ')) @first_decorator...
afinogenka/HW1
main.py
main.py
py
798
python
ru
code
0
github-code
13
41619152986
import pygame class FloatingText(): def __init__(self, text : str, position,display_surface): self.display_surface = display_surface self.font = pygame.font.Font(".//JUEGO 2//graphics//ui//ARCADEPI.TTF", 16) self.text = text self.text_surface = self.font.render(text, True, (100, 1...
AgustinSande/sandeAgustin-pygame-tp-final
codefiles/floating_texts.py
floating_texts.py
py
682
python
en
code
0
github-code
13
72324221138
# -*- coding: utf-8 -*- """ Created on Thu Mar 26 18:36:12 2020 @author: bugra """ try: from image_processing.wrappers import __init__ wrappers_exists = True except: wrappers_exists = False raise Exception('The simple_itk_filters subpackage is currently not available\ because the ...
bugraoezdemir/image_processing
image_processing/transforms/photometric/local_filtering/simple_itk_filters.py
simple_itk_filters.py
py
623
python
en
code
2
github-code
13
28774139360
from django.views.generic import TemplateView from django.shortcuts import render from django.conf import settings from django.urls import reverse from django.template import RequestContext from .models import Crochet, Order, Address, SiteSettings from .forms import CustomPayPalPaymentsForm, AddressForm import random ...
nic-gaffney/krochet
krochet/views.py
views.py
py
2,299
python
en
code
0
github-code
13
72425116818
# USAGE (from project's root directory) # python3 main.py --detect [source] import cv2 import numpy as np from PIL import Image from commons.PredictedClass import ClassList from commons.IAModel import IAModel from .. definitions import CHECKPOINT, TEST_DATA_PATH import argparse # construct the argument parser and pars...
lemmau/real-time-detector
core/src/detect.py
detect.py
py
1,384
python
en
code
0
github-code
13
40943777288
import os import requests from flask import Flask, request app = Flask(__name__) # Set up Facebook Messenger webhook @app.route('/webhook', methods=['GET', 'POST']) def webhook(): if request.method == 'GET': if request.args.get('hub.mode') == 'subscribe' and request.args.get('hub.verify_token') == 'YOUR_VERIFY...
Thakor-Yashpal/twitter-bot-open-source-
Automated Twitter Bot/tele-01.py
tele-01.py
py
1,331
python
en
code
0
github-code
13
40756803541
import requests from bs4 import BeautifulSoup import html5lib import Conversion import ecommerce_working headers = {"user-agent" : "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/112.0.0.0 Safari/537.36"} flipkart = '' amazon = '' name = input("Product Name:\n") flipkart_pri...
prajwolgiri/Ecommerce_comparision
main.py
main.py
py
1,544
python
en
code
0
github-code
13
9106497571
# -*- coding: utf-8 -*- ''' @Author: CaptainHu @Date: 2021年 07月 20日 星期二 10:32:12 CST @Description: path core 训练 ''' import argparse import torch from torch.utils.data import DataLoader import numpy as np from tqdm import tqdm from data import HxqData from model import WideResnet502 from memory_bank import MemoryBan...
captainfffsama/pathcore
train.py
train.py
py
1,771
python
en
code
3
github-code
13
41419323454
import os import jax import jax.numpy as jnp import flax import flax.linen as nn import msgpack.exceptions from pickle import UnpicklingError from flax.serialization import from_bytes, to_bytes from jax.sharding import NamedSharding from flax.core.frozen_dict import freeze, unfreeze from flax.traverse_util import flatt...
xingyaoww/LeTI
leti/utils/jax/convert_hf.py
convert_hf.py
py
30,570
python
en
code
58
github-code
13
37494573203
class Node: def __init__(self,data,next): self.data=data self.next=next class LinkedList: def __init__(self): self.head=None def insert_at_front(self,data): node=Node(data,self.head) #adds the inserted data by chaning head to next self.head=node def insert_at...
akinolajaye/DataStructureAlgorithms
linkedlist.py
linkedlist.py
py
2,167
python
en
code
0
github-code
13
71609432979
from Insan import Insan # Insan sinifindan insan modülünü ice aktarma class Calisan(Insan): def __init__(self, tc_no, ad, soyad, yas, cinsiyet, uyruk, sektor, tecrube, maas): super().__init__(tc_no, ad, soyad, yas, cinsiyet, uyruk) self.__sektor = self.kontrol_Sektor(sektor) # Calisanin sektorun...
didembi/finalprojesi
Calisan.py
Calisan.py
py
2,519
python
tr
code
0
github-code
13
43001126945
import random as rnd def sorted_square(array): output = [0] * len(array) in_l, in_r = 0, -1 out_point = -1 for i in range(len(array)): if abs(array[in_l]) >= abs(array[in_r]): output[out_point] = array[in_l] ** 2 in_l += 1 elif abs(array[in_r]) >= abs(array[in_...
programmer2215/Algorithms
sortedSquaredArray.py
sortedSquaredArray.py
py
641
python
en
code
0
github-code
13
35648751695
from __future__ import print_function from __future__ import division import os import codecs import collections from random import shuffle import numpy as np import pickle class Vocab: def __init__(self, token2index=None, index2token=None): self._token2index = token2index or {} self._index2tok...
scusec/Data-Mining-for-Cybersecurity
Project/2019/1/Code/dga_reader.py
dga_reader.py
py
4,276
python
en
code
66
github-code
13
69975863058
from tkinter import * # def button_clicked(): # new_text = inpu.get() # my_label.config(text=new_text) # window = Tk() # window.title("GUI Program") # window.minsize(500, 300) # # makes space around the labels / buttons all together # window.config(padx= 30, pady= 40) # # # pack, place and grid used to posi...
Kotravai/100-Days-of-Code
L27 - Unit converter/main.py
main.py
py
1,534
python
en
code
0
github-code
13
262829169
import math import sys while True: N = int(sys.stdin.readline().rstrip()) if N == 0: break arr = [1, 1] + [0] * (N * 2) Max = int(math.sqrt(N * 2)) cnt = 0 for i in range(2, Max + 1): # 2부터 2N까지의 소수를 구할거임 if arr[i] == 0: # 소수 판정 안 났으면 for j in...
jungho1209/Programmers-python
백준/Silver/4948. 베르트랑 공준/베르트랑 공준.py
베르트랑 공준.py
py
643
python
ko
code
0
github-code
13
24556840751
"""Unit tests for the red black tree module.""" import pytest import random from trees import tree_exceptions from trees.binary_trees import red_black_tree def test_simple_case(basic_tree): """Test the basic operations of a red black tree.""" tree = red_black_tree.RBTree() # 23, 4, 30, 11, 7, 34, 20, ...
burpeesDaily/python-sample-code
tests/test_red_black_tree.py
test_red_black_tree.py
py
3,844
python
en
code
10
github-code
13
30654866229
""" app/models/__init__.py from https://github.com/tiangolo/sqlmodel/issues/121#issuecomment-935656778 Import the various model modules in one place and resolve forward refs. """ # AccountOutputWithCustomer.update_forward_refs(CustomerOutput=CustomerOutput) # CustomerOutputWithAccounts.update_forward_refs(AccountOut...
RashminDungrani/password-manager
app/models/__init__.py
__init__.py
py
796
python
en
code
1
github-code
13
8934194913
import os, inspect currentdir = os.path.dirname(os.path.abspath(inspect.getfile(inspect.currentframe()))) parentdir = os.path.dirname(currentdir) os.sys.path.insert(0, parentdir) from .scene_bases import Scene import assets import pybullet class PlaneScene(Scene): multiplayer = False zero_at_running_strip_start_li...
MzXuan/RL_motion_plan
pybullet_gym/pybullet_ur5/scenes/stadium.py
stadium.py
py
2,047
python
en
code
2
github-code
13
73540064978
#add to list #fleraTal = input('skriv flera tal: ') #ls = fleraTal.split() #for e in ls: # print(e) #print(ls) #ls.remove('jag') #print(ls) talLista = [] fortsatta = 0 i = 0 while fortsatta == 0: inmatatTal = int(input('lägg till ett tal')) talLista.insert(i, inmatatTal) i+=1 for...
uaw71/grundlaggande_objektorienterad_programmering
labb5/add_to_list.py
add_to_list.py
py
375
python
en
code
0
github-code
13
17048754854
#!/usr/bin/env python # -*- coding: utf-8 -*- import json from alipay.aop.api.constant.ParamConstants import * class AppxVersionConfigVo(object): def __init__(self): self._id = None self._proportion = None self._ver = None @property def id(self): return self._id @id...
alipay/alipay-sdk-python-all
alipay/aop/api/domain/AppxVersionConfigVo.py
AppxVersionConfigVo.py
py
1,668
python
en
code
241
github-code
13
773950796
from django.urls import path from .views import ( CategoryApiView, PriceApiView, PostLenApiView, ProductFilterApiView, UserListView ) urlpatterns = [ path('filter/<slug:name>/', CategoryApiView.as_view(), name='filter_category'), path('user_list/', UserListView.as_view(), name='user-list'),...
Babushka312/my_3th_project
accounting/urls.py
urls.py
py
567
python
en
code
0
github-code
13
34181730504
import unittest from parameterized import parameterized import os from integration_tests.dataproc_test_case import DataprocTestCase METADATA = 'flink-start-yarn-session=false' class FlinkTestCase(DataprocTestCase): COMPONENT = 'flink' INIT_ACTION = 'gs://dataproc-initialization-actions/flink/flink.sh' T...
styleloungech/bi-dataproc-initialization-actions
flink/test_flink.py
test_flink.py
py
3,142
python
en
code
0
github-code
13
14645885365
from sqlalchemy import Column, ForeignKey, Identity, Integer, String, Table from stripe_openapi.file import File from . import metadata IssuingDisputeDuplicateEvidenceJson = Table( "issuing_dispute_duplicate_evidencejson", metadata, Column( "additional_documentation", File, Foreig...
offscale/stripe-sql
stripe_openapi/issuing_dispute_duplicate_evidence.py
issuing_dispute_duplicate_evidence.py
py
1,885
python
en
code
1
github-code
13
7453427822
from django.db.models import Count, Sum, F, Q from django.db.models.functions import TruncDay, TruncMonth from apps.core.models import Review, Order, OrderItem def get_count_review(): """ Вернет количество новых не проверенных отзывов: """ count_review = Review.objects.all().filter(published='checking').coun...
AlexKaikin/EVOshop
apps/manager/services/manager_servece.py
manager_servece.py
py
3,297
python
en
code
0
github-code
13
15519449313
#This program is a text-based RPG about exploring a haunted mansion and solving the mystery import csv class Room(): def __init__(self, name, description, exits, items, monster): self.name = name self.description = description self.exits = exits self.room_items = items self...
newpowalex/haunted-mansion-rpg
haunted-mansion.py
haunted-mansion.py
py
12,197
python
en
code
0
github-code
13
31071262089
# -*- encoding: utf-8 -*- """ https://hpyculator.readthedocs.io/zh_CN/latest/utils_api/hpyfunc.html#hpyfunc-dont-change-my-code 来自 Howie皓子 的优化 """ from typing import * import inspect def dont_change_my_code(fun: Callable, sign: str) -> None: """沙雕系列:别修改我的代码! 直接使用print输出hash值,未计算出结果则输出-1 :param fun: 不要修改...
Littlefean/SmartPython
python迷惑行为/我的代码一旦改了就报错/test2.py
test2.py
py
1,353
python
en
code
173
github-code
13
31449551405
#!/usr/bin/env python # -*- coding:utf-8 -*- # @File : spider_zhaopin.py # @Time : 2018/8/1 17:46 # @Author : dong ''' 爬取智联招聘信息 1.网站:https://www.zhaopin.com/ 2.输入关键字:java 3.从网页响应中找到 JS 脚本返回的 JSON 数据:Network --> XHR --> Preview 查看ajax返回的数据 Issues: 0.同名文件第二遍运行写入会乱码 1.大量数据重复 ''' import reques...
comeCU/coding-python
mySpider/0802/spider_zhaopin.py
spider_zhaopin.py
py
2,488
python
en
code
2
github-code
13
7867284512
from .base import BaseModel class PriceList(BaseModel): def __init__(self, items=None ): self.items = items if items else {} def add(self, item): self.items[item.article] = item def toList(self): return list(self.items.values()) def getItemByNumber(se...
alexander-schillemans/python-copaco-connections
copaco/models/pricelist.py
pricelist.py
py
1,666
python
en
code
0
github-code
13
4597624399
# def binary_search(arr,x): # low =0 # high = len(arr) -1 # mid = 0 # while low <= high : # mid = (high + low) // 2 # if arr[mid] < x: # low = mid +1 # elif arr[mid] > x: # high = mid -1 # else: # return mid # return -1 # arr = [2,3,4,10,40,80,109,111] # x = 109 # result = binary_search(ar...
sbagani/python_projects
binarysearch.py
binarysearch.py
py
868
python
en
code
0
github-code
13
73661639376
from celery import Celery from app.core.config import settings from app.task import celery_config def make_celery(): celery = Celery( "worker", backend=settings.CELERY_RESULT_BACKEND, broker=settings.CELERY_BROKER ) celery.conf.update(settings) celery.config_from_object(celery_config) re...
haicheviet/media-crawling
app/task/celery_app.py
celery_app.py
py
361
python
en
code
0
github-code
13
4043850327
__author__ = 'Eleonor Bart' #NEVER RUN ON SERVER import os from main import app from models import db, populate_db, LifeData, GrowthData, BirthStatusData import unittest import tempfile from flask_security import current_user class VTDairyDBTestCase(unittest.TestCase): def setUp(self): app.config['SQLAL...
ElBell/VTDairyDB
tests.py
tests.py
py
2,262
python
en
code
0
github-code
13
10530634598
# importing some useful packages import matplotlib.pyplot as plt import matplotlib.image as mpimg import matplotlib import numpy as np import cv2 from warnings import warn from collections import deque from sklearn.cluster import KMeans as ClusterFinder def grayscale(img): """Applies the Grayscale transform ...
tsbertalan/CarND-LaneLines-P1
laneLines.py
laneLines.py
py
17,506
python
en
code
null
github-code
13
71201238099
from os import name,getlogin,listdir import numpy as np from random import randint import dop ''' Задача 4 ''' print('Задание 4:\n Имя операционной системы: ',name, '\n Имя пользователя, вошедшего в терминал: ',getlogin(), '\n Список файлов и директорий в папке: ', ', '.join(map(str,listdir...
iozeryakov/PythonTenzor
7_lesson/7.py
7.py
py
1,674
python
ru
code
0
github-code
13
36984541134
from google.cloud import vision import io import os import functools import re import itertools import sys print(sys.path) from BillScanner.Receipt import Receipt DATE_REGEX = "\d\d?\.\d\d?\.\d{2}(\d{2})?" POST_REGEX = "(-?\d\d?[,\.]\d{2})" EURO_REGEX = "(eur|euro|€)" TOTAL_KEYWORD_REGEX = "(total|brutto|gesa[nm]t|sa...
JonasKlamroth/BillScanner
BillScanner/main.py
main.py
py
4,613
python
en
code
0
github-code
13
2158757415
#!/usr/bin/python3 import os # initialize asebamedulla in background and wait 0.3s to let asebamedulla startup os.system("(asebamedulla ser:name=Thymio-II &) && sleep 0.3") from shared.movement import look_for_april_tag import math from statistics import mean from shared.route_planner import turn_to_point from shar...
hvassup/SpareParts
Assignment 2/real/start.py
start.py
py
15,903
python
en
code
2
github-code
13
36038629535
import logging import os import pandas as pd from pathlib import Path import requests import urllib.request from selenium import webdriver from selenium.webdriver.common.by import By from selenium.webdriver.support.ui import WebDriverWait from selenium.webdriver.support import expected_conditions as EC from selenium.we...
kalyco/quarterly-earnings-scraper-and-parser
quarterly_report_crawler.py
quarterly_report_crawler.py
py
5,253
python
en
code
0
github-code
13
15673954845
#! /usr/bin/env python # -*- coding: utf-8 -*- # I hate Python 3. from __future__ import unicode_literals, print_function import argparse import xerox def vaporize(vape_me): """Solution shamelessly stolen from http://stackoverflow.com/a/8327034 by Ignacio Vazquez-Abrams""" normal = u' 0123456789abcdefghi...
Miserlou/Vape
vape/__init__.py
__init__.py
py
1,810
python
en
code
17
github-code
13
22424762896
from app import app, db from flask import jsonify, request from models import Patient, PatientSchema, Perscriber, PerscriberSchema, Perscription, PerscriptionSchema, Medication, MedicationSchema from datetime import datetime, date import ssl ssl._create_default_https_context = ssl._create_unverified_context from fdaap...
davidmetcal/flask-test
routes.py
routes.py
py
3,341
python
en
code
0
github-code
13
35789780218
def table_of_league(league: dict): """ Function for creating table of league, order by position (the most points in league). All win counts three points, draw counts one point. If some of team has equal total points, team with better goal difference are on better position then other. :param league: Leag...
pavle-potparic/python_exercises
DictAndSet/footbal/tabela_fk.py
tabela_fk.py
py
7,761
python
en
code
0
github-code
13
26957956183
import pandas as pd import numpy as np from sklearn.preprocessing import StandardScaler, OneHotEncoder from sklearn.model_selection import train_test_split from sklearn.ensemble import GradientBoostingClassifier from sklearn.metrics import accuracy_score, classification_report, confusion_matrix # Load the dataset data...
riyouuyt/Forage-British-Airways-Virtual-Experience
predicting customer buying behaviour/predictive_modeling_of_customer_bookings.py
predictive_modeling_of_customer_bookings.py
py
2,575
python
en
code
0
github-code
13
2355477207
# Kosaraju's Algorithm for Computing Strongly Connected Components (SCCs) # Discovers the strongly connected components of a directed graph using DFS # Analysis # Case TC SC Comments # ---- -- -- -------- # Worst O(n + m) O(n) # Average O(n + m) O(n) # Best O(n + m) O(n) # ...
andrewt110216/algorithms-and-data-structures
algorithms/kosaraju.py
kosaraju.py
py
3,202
python
en
code
0
github-code
13
37661049134
import random import string import sys import yaml from elasticsearch import Elasticsearch from loguru import logger import uuid def get_config(filepath, env): """ Get config daya :param filepath: config file path :param env: environment :return: config data as dict """ config_data = None...
enishaeshwar/state-of-indices
prerequisite/populate_es.py
populate_es.py
py
4,349
python
en
code
0
github-code
13
17041933014
#!/usr/bin/env python # -*- coding: utf-8 -*- import json from alipay.aop.api.constant.ParamConstants import * class AlipayIserviceAntassistantLlmConsultModel(object): def __init__(self): self._query = None self._session_id = None self._user = None @property def query(self): ...
alipay/alipay-sdk-python-all
alipay/aop/api/domain/AlipayIserviceAntassistantLlmConsultModel.py
AlipayIserviceAntassistantLlmConsultModel.py
py
1,772
python
en
code
241
github-code
13
28454115255
""" Create an image consisting of logo and text for use as the image for The Open Graph protocol's og:image metadata. https://ogp.me/#structured """ from __future__ import annotations import argparse from PIL import Image, ImageDraw, ImageFont def main() -> None: parser = argparse.ArgumentParser( descri...
hugovk/pixel-tools
og_image.py
og_image.py
py
2,474
python
en
code
29
github-code
13
60371809
import os import shutil from contextlib import contextmanager import hglib import pytest from mozilla_version.gecko import FirefoxVersion from treescript.exceptions import TaskVerificationError from treescript.gecko import merges from treescript.script import get_default_config @contextmanager def does_not_raise():...
mozilla-releng/scriptworker-scripts
treescript/tests/test_gecko_merges.py
test_gecko_merges.py
py
14,657
python
en
code
13
github-code
13
2061040481
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.contrib import admin from django.test import RequestFactory, TestCase from dynsettings.admin.model_admins import SettingAdmin from dynsettings.models import Setting admin.site.register(Setting, SettingAdmin) class SettingAdminTestCase(Tes...
infoscout/dynsettings
dynsettings/tests/test_model_admin.py
test_model_admin.py
py
1,206
python
en
code
0
github-code
13
15050143845
import requests import json def searchFunction(): # rating for OU is 1695 # rating for all other tiers is 1630 tiers = ['ou', 'uu', 'ru', 'nu', 'pu', 'zu'] tier = input("What tier do you want usage statistics for? Please enter 'OU', 'UU', 'RU', 'NU', 'ZU', or 'PU'. ").lower() while True: if tier in tiers: ...
crispinonicky/smogon-usage
Smogon Usage.py
Smogon Usage.py
py
902
python
en
code
0
github-code
13
3812701316
import sys sys.path.append("..") import collections from typing import List import torch import copy from model.MLP import * from model.VGG16 import * from model.ResNet18 import * from model.CNN import * from model.MobileNet import * from model.LeNet import * from model.AlexNet import * def aggregate_model( mode...
ShenJinglong/StalRingSFL
utils/model_utils.py
model_utils.py
py
3,418
python
en
code
1
github-code
13
27227733494
def persistence(num: int): """Return multiplicative persistence (which is the number of times you must multiply the digits in num until you reach a single digit) of a positive integer. """ if num < 10: return 0 multiplied_num = 1 for i in str(num): multiplied_num *= int(i) ...
alexgrck/Codewars
2022-11-17/persistent_bugger.py
persistent_bugger.py
py
362
python
en
code
0
github-code
13
11128392950
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ A module to calculate nearest neighbour lists """ import numpy as np import pandas as pd from src.calc import general_calc as gen_calc from src.calc import molecule_utils as mol_utils from src.system import type_checking as type_check class Density(gen_calc.Calc_Type...
blumberger/MD_Analysis_Scripts
src/calc/density.py
density.py
py
4,975
python
en
code
0
github-code
13
7632151418
import numpy as np import cv2 faceCascade = cv2.CascadeClassifier('./haarcascades/haarcascade_frontalface_default.xml') eyeCascade = cv2.CascadeClassifier('./haarcascades/haarcascade_eye.xml') face_id = input('\n enter user id end press <return> ==> ') print("\n [INFO] initializing face capture. look the camera and wa...
ram1219/StudyPython
simpleCamera.py
simpleCamera.py
py
1,603
python
en
code
0
github-code
13
351580343
""" Output: [’name’, ’age’] """ my_dict = { "name": "Sebastian", "age": 21 } def keys_01(dictionary): return [k for k in dictionary] def keys_02(dictionary): result = [k for k in dictionary] # result.append("break the program plz") if len(result) != len(dictionary): ...
moseswong74/pythonPractice
Dictionary/dict_all_keys.py
dict_all_keys.py
py
487
python
en
code
0
github-code
13
10844659812
from collections import deque import abc # -------------------------------------------------------------------- class IRender(metaclass=abc.ABCMeta): ''' The specification for the renderer of encoded objects. ''' __slots__ = () @abc.abstractclassmethod def value(self, name, value): ''...
galiminus/my_liveblog
components/ally-core/ally/core/spec/transform/render.py
render.py
py
6,884
python
en
code
0
github-code
13
37965083696
# This module is taken from # https://github.com/EiffL/Quarks2CosmosDataChallenge/blob/main/quarks2cosmos/galjax.py # author: EiffL import jax.numpy as jnp import jax import numpy as np def convolve(image, psf, return_Fourier=False): """Convolves given image by psf. Args: image: a JAX array of size [nx...
JonnyyTorres/Galsim_JAX
galsim_jax/convolution.py
convolution.py
py
4,956
python
en
code
1
github-code
13
12264664979
import os import sys import re import shutil # Input the destination destination = '/Users/anchit402/Desktop/Academics/OS' # In Windows = D:\\aayushi\\Documents\\someFolder directoryList = os.chdir(destination) print(os.getcwd()) files = os.listdir() # pattern = re.compile(r"SEM20\d\d-\d\d_(\w\w\w\d{4}).+\d-[A-Z][a-...
dhairyaostwal/Renaming-Script
RenamingFiles.py
RenamingFiles.py
py
663
python
en
code
4
github-code
13
29465541798
from tkinter import * from tkinter import messagebox import tkinter as tk from PIL import ImageTk, Image import ttkbootstrap as ttk from ttkbootstrap.constants import * import json from visualizar_RecetaDelDia import VentanaPrincipal as verReceta class VentanaPrincipal(ttk.Frame): """Clase que muestra TODAS las re...
kevinserrano01/RECETARIO
mostrar_Recetas.py
mostrar_Recetas.py
py
2,900
python
es
code
1
github-code
13
5145101166
import os import subprocess import sys import time from concurrent.futures import ThreadPoolExecutor from concurrent.futures import as_completed from distutils.dir_util import copy_tree from typing import Callable from typing import List from bugswarm.common import log from bugswarm.common.shell_wrapper import ShellW...
ucd-plse/Static-Bug-Detectors-ASE-Artifact
analyzers/annotations/main.py
main.py
py
4,593
python
en
code
5
github-code
13
35297620508
""" ・シンプルに条件を満たす数列を全列挙して判定 """ import sys sys.setrecursionlimit(100000000) n, m, q = map(int, input().split()) abcd = [list(map(int, input().split())) for _ in range(q)] ans = 0 def dfs(lst): global ans, n if len(lst)==n: # 長さがnになったなら、lstが各条件を満たすか判定 t = 0 for a, b, ...
nozomuorita/atcoder-workspace-python
abc/abc165/c.py
c.py
py
842
python
ja
code
0
github-code
13
72402174417
class Action: def __init__(self,name,parameters=[]): self.pointer = 0 self.content = [] self.name = name self.parameters=parameters self.parameters_values={} def add_content(self,name,value=None): self.content.append([name,value]) def nextaction(self,value=No...
bjonnh/prosper
actions.py
actions.py
py
3,316
python
en
code
0
github-code
13
43080019264
from gtts import gTTS import os import time m = 'text that will be played' language = 'bn' speech = gTTS(m, lang=language, slow=False) speech.save("speech.mp3") os.system("start speech.mp3") time.sleep(5) os.remove("speech.mp3")
Sahadat-Hossain-Sakil/Bangla-sign-language-classifiaction-with-CNN
sound.py
sound.py
py
239
python
en
code
0
github-code
13
30051719892
from sqlalchemy import create_engine, Column, VARCHAR, ForeignKey, NUMERIC from sqlalchemy.ext.declarative import declarative_base from sqlalchemy.orm import relationship, backref class Database: _base = declarative_base() class PlayerTable(_base): __tablename__ = "player" uuid = Column(VARC...
otakucraft/DBMigrate
RusbikMod3.02KahzerxMod4.0/KahzerxMod/models.py
models.py
py
3,219
python
en
code
1
github-code
13