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
74854234897
def json_to_html(input): html = '<table class="table table-striped" style="width:100%">' html+="<tr>" for key in input[0]: html+='<th>' + str(key) + "</th>" html+="</tr>" for row in range(0, len(input)): html+="<tr>" for key in input[row]: html+='<td...
ewenw/YelpMyProfessors
json_to_html.py
json_to_html.py
py
432
python
en
code
0
github-code
13
1598085
class TreeNode: def __init__(self, val=0, children=[]): self.val = val self.children = children def getDiameter(root: TreeNode | None) -> int: """ N = number of nodes in the tree ------------- Time: O(N) Space: O(N) """ def dfs(root: TreeNode | None) -> tuple[int, int]...
ironwolf-2000/Algorithms
Graphs/Trees/Diameter/diameter.py
diameter.py
py
1,379
python
en
code
2
github-code
13
25103133833
"""Target monitoring via SSH""" import base64 import getpass import hashlib import logging import os.path import re import tempfile import time from collections import defaultdict from xml.etree import ElementTree as etree from ...common.util import SecuredShell from ...common.interfaces import MonitoringDataListener ...
Alcereo/LoadTestingToolsCentos
tank/tank_src/yandextank/plugins/Monitoring/collector.py
collector.py
py
19,951
python
en
code
0
github-code
13
74442165456
import os from stage import Stage import subprocess class Test(Stage): """ Class that containing and operating tests. """ def __init__(self, script_path, parent_module_name, interrupt_if_fail, is_logging, log_file_path, only_fail_notification): """ Parameters ...
xp10rd/simple-test-tool
src/test.py
test.py
py
1,654
python
en
code
0
github-code
13
1539323137
# Карасёв ИУ7-16Б # Вводится матрица, найти столбец,в котором больше всего 0, перенести его в конец (сдвиг матрицы). mtrx = [] zero_count = 0 to_compare = 0 zero_index = 0 m = int(input('Введите количество строк в матрице: ')) n = int(input('Введите количество столбцов в матрице: ')) print('Введите матрицу: ') for i ...
aversionq/University-tasks
BMSTU_1st_Semester/lab_7/lab7_3.py
lab7_3.py
py
1,162
python
ru
code
0
github-code
13
9088461120
#https://www.acmicpc.net/problem/16986 #백준 16986번 인싸들의 가위바위보 (구현, BFS) #import sys #input = sys.stdin.readline from itertools import permutations def dfs(p1,p2,idx,wins,player): global result if wins[0] == k : result = 1 return if wins[1] == k or wins[2] == k : return if idx[0] ...
MinsangKong/DailyProblem
08-16/4-1.py
4-1.py
py
1,181
python
en
code
0
github-code
13
35299277548
# @nzm_ort # https://github.com/nozomuorita/atcoder-workspace-python # import module ------------------------------------------------------------------------------ from collections import defaultdict, deque, Counter import math from itertools import combinations, permutations, product, accumulate, groupby, chain from ...
nozomuorita/atcoder-workspace-python
abc/abc226/B/answer.py
answer.py
py
825
python
en
code
0
github-code
13
19110580670
from django.urls import path from . import views urlpatterns = [ path('', views.home, name="home"), path('about/', views.about, name="about"), path('aboutContent/', views.aboutContent, name="aboutContent"), path('education/', views.education, name="education"), path('workExp/', views.workExp, na...
NikhilSegu/django_expensify
expensify/urls.py
urls.py
py
462
python
en
code
0
github-code
13
4578697640
import numpy as np from .SegReader import SegReader class MIMOSegReader(SegReader): def __init__(self,flist_name, data_root, batchsize,cropsize,step,samplerate,cell, img_trans,gt_trans,joint_trans, withgt=True, bandlist=None, samp...
ChenKQ/rsreader
rsreader/netreader/MIMOSegReader.py
MIMOSegReader.py
py
4,046
python
en
code
2
github-code
13
69901044499
# -*- coding: utf-8 -*- ''' ____ _____ ______ _____ / __ \| __ \| ____| __ \ /\ | | | | |__) | |__ | |__) | / \ | | | | ___/| __| | _ / / /\ \ | |__| | | | |____| | \ \ / ____ \ \____/|_| |______|_| \_\/_/ \_\ @author: VMware Korea CMP TF ''' #====...
vmware-cmbu-seak/opera
src/drivers/postgresql.py
postgresql.py
py
6,829
python
en
code
0
github-code
13
73141314259
import numpy as np from tqdm import tqdm, trange from random import random, randint from environment import KArmsBandit import matplotlib.pyplot as plt import math class EGreedyPolicy: def __init__(self, K, epsilon=0.1): self.K = K # 动作空间 self.Q = [5 for _ in range(K)] # 每个动作的...
dourgey/Reinforcement-Learning-Implements-With-PyTorch
bandits/policy.py
policy.py
py
4,472
python
en
code
0
github-code
13
26739170419
# import the function that will return an instance of a connection from flask_app.config.mysqlconnection import connectToMySQL from flask_app.models import dojo # model the class after the user table from our database class Ninja: def __init__(self,data): self.id = data['id'] self.first_name ...
ChristianQ98/coding_dojo
python/Flask_MySQL/DB_Connection/dojos_and_ninjas/flask_app/models/ninja.py
ninja.py
py
1,975
python
en
code
0
github-code
13
31868567218
from Test.TestBase import * import datetime from Worker import Worker from Repair import Repair class TestRepair(MockTest): def testSimpleSchedule(self): repair_dct = {'repair_id': 12, 'repair_time': datetime.datetime(2022, 12, 29, 19, 50, 50), 'repair_state': '调度中', 'fault_name': '下水道', ...
renke999/ooad-lab2
Test/TestWorker.py
TestWorker.py
py
1,138
python
en
code
3
github-code
13
27706494503
import json import os import numpy import datetime import DataUtility from DataUtility import DataSetFormat, DataSetType import Constants as Constant def get_number_of_arrays_for_sensor(sensor): if sensor == DataUtility.Sensor.EMG: return Constant.NUMBER_OF_EMG_ARRAYS elif sensor == DataUtility.Senso...
Tonychausan/MyoArmbandPython
src/Utility.py
Utility.py
py
5,376
python
en
code
3
github-code
13
42035419631
import argparse from PIL import Image import os.path def put_center(size, color, img_path, out_path): im2 = Image.open(img_path) if not color: color = im2.getpixel((0, 0)) im1 = Image.new("RGB" ,size , color=color) im1_width, im1_height = im1.size im2_width, im2_height = im2.size back_i...
simhisancak/wp_gen
main.py
main.py
py
1,687
python
en
code
0
github-code
13
2167120520
from aiohttp import ClientSession from genie_common.utils import create_client_session, build_authorization_headers from spotipyio.logic.authentication.spotify_session import SpotifySession class SessionsComponentFactory: @staticmethod def get_spotify_session() -> SpotifySession: return SpotifySession...
nirgodin/radio-stations-data-collection
data_collectors/components/sessions_component_factory.py
sessions_component_factory.py
py
1,352
python
en
code
0
github-code
13
25901084676
from qgis.core import QgsExpressionNode, QgsExpression, QgsExpressionNodeBinaryOperator class UnsupportedExpressionException(Exception): pass binaryOps = [ "Or", "And", "PropertyIsEqualTo", "PropertyIsNotEqualTo", "PropertyIsLessThanOrEqualTo", "PropertyIsGreaterThanOrEqualTo", "Prop...
tomchadwin/qgis2web
qgis2web/bridgestyle/qgis/expressions.py
expressions.py
py
5,642
python
en
code
494
github-code
13
42428851051
import boto3 class GLOBAL_CONFIG: client = boto3.client('ssm') LANGUAGES = { 'ar': 'Arabic', 'zh': 'Chinese', 'en': 'English', 'fr': 'French', 'ru': 'Russian', 'es': 'Spanish' } GLOBAL_KWARGS = { 'lang': 'en', 'site_availab...
dag-hammarskjold-library/metadata-un-org
metadata/config.py
config.py
py
554
python
en
code
0
github-code
13
12779256791
# ############################################################################# # RISClientDEA.py # This module provides a wrapper for Requests HTTP Verbs, and additional functions for interface with RIS # # ############################################################################# # The information contained herein...
richa92/Jenkin_Regression_Testing
robo4.2/fusion/tests/DEA/resource/iLO/PERISClient.py
PERISClient.py
py
7,945
python
en
code
0
github-code
13
73607397136
from typing import Iterable, Optional, TypeVar import torch from torcheval.metrics.functional.classification.f1_score import ( _binary_f1_score_update, _f1_score_compute, _f1_score_param_check, _f1_score_update, ) from torcheval.metrics.metric import Metric TF1Score = TypeVar("TF1Score") TBinaryF1Sc...
pytorch/torcheval
torcheval/metrics/classification/f1_score.py
f1_score.py
py
8,264
python
en
code
155
github-code
13
6558771590
import os import requests from pathlib import Path import argparse import codecs exchanges = "exchanges" timeSeriesValues = "timeSeriesValues" websites = "websites" countryCurrencies = "countryCurrencies" exchangeUrl = "http://127.0.0.1:8080/assets/crypto-currency-exchange-complete" timeSeriesValuesUrl = "http://127....
43ndr1k/Mappinng-Cryptocurrencies-with-News
backend/cryptoSkript/Main.py
Main.py
py
3,840
python
en
code
0
github-code
13
34536891391
#!/usr/bin/python import numpy as np from pprint import pprint import csv import math, time import random LEARNING_RATE = 1 num_iterations = 1000000 def get_perceptron(features, truth): w = np.zeros(features.shape[1]) #w[-1] = 1 w = np.matrix(w) for i in range(num_iterations): misclassified_points = 0 ...
ohnorobo/machine-learning
Perceptron.py
Perceptron.py
py
3,389
python
en
code
1
github-code
13
19502373792
import pyttsx3 engine = pyttsx3.init('sapi5') voices = engine.getProperty('voices') engine.setProperty('voice',voices[1].id ) # Ravi 1 , David - 2 , zira - 3 , hetal - 0 #print(voices[1]) engine.setProperty('rate', 170) def Say(Text): print(" ") print(f" Mark_IV : {Text}") engine.say...
Himanshu6453/Artificial-Intelligent-Assistant-Mark-
Speak.py
Speak.py
py
372
python
en
code
1
github-code
13
23176690330
import numpy as np import pandas as pd import re import phonenumbers import warnings warnings.simplefilter('ignore') # set the max columns to none pd.set_option('display.max_columns', None) country_details = { 'India': {'code': 'IN', 'code_number': 91, 'len_with_code': 12, 'len_without_code': 10}, 'South Afric...
Adityag009/Phone-Number-Validation-and-Processing-for-International-Contacts
main.py
main.py
py
6,983
python
en
code
0
github-code
13
28081762870
# 문제 설명 # 정수가 담긴 리스트 num_list가 주어질 때, num_list의 원소 중 짝수와 홀수의 개수를 담은 배열을 return 하도록 solution 함수를 완성해보세요. # 제한사항 : 1 ≤ num_list의 길이 ≤ 100, 0 ≤ num_list의 원소 ≤ 1,000 # 호출 결과 : num_list = [1, 2, 3, 4, 5], sum_result = [2, 3] def solution(num_list): len1 = len(num_list) num1 = 0 num2 = 0 num_jac = [] num...
Thompsonclass/Coding_Test_UsingPython
Level0-Python/CodingTestExample07.py
CodingTestExample07.py
py
1,167
python
ko
code
1
github-code
13
13102793764
import wx from automata.organism import Organism from layout import spring_layout import itertools import support WIN_WIDTH = 800 # Main window width WIN_HEIGHT = 800 # Main window height FORCE_FQ = 100 # The frequency of a force-directed algorithm updates in ms ITERATION_FQ = 1000 # The frequency of organism's ...
olya-d/growing-graph
screen.py
screen.py
py
3,937
python
en
code
0
github-code
13
38834254970
import logging import mock from dining_philosophers.constants import PhilosopherState from dining_philosophers.philosophers import Philosopher from dining_philosophers.forks import Fork class TestPhilosophers: def test_create_philosopher(self): ID = 0 left_fork = Fork(0) right_fork = Fo...
lievi/dining_philosophers
tests/test_philosophers.py
test_philosophers.py
py
3,045
python
en
code
4
github-code
13
42158005520
import sys import pandas as pd import numpy as np import re import nltk from nltk.tokenize import word_tokenize from nltk.corpus import stopwords from nltk.stem.wordnet import WordNetLemmatizer import os from src.data import load_save_data from sklearn.pipeline import Pipeline from sklearn.model_selection import tra...
Hannemit/disaster_response
src/models/train_classifier.py
train_classifier.py
py
6,419
python
en
code
0
github-code
13
34988894699
#coding=utf-8 ''' F(n) = F(1, n) + F(2, n) + ... + F(n, n). Optimal Substructure: Given a sequence 1…n, we pick a number i out of the sequence as the root, then the number of unique BST with the specified root F(i), is the cartesian product of the number of BST for its left and right subtrees. ...
claire-tr/algorithms
96_Unique_Binary_Search_Trees.py
96_Unique_Binary_Search_Trees.py
py
828
python
en
code
0
github-code
13
73871228499
"""Define the Transport layer between AioWeb3 client and the Web3 server This file includes 3 implementations of the Transport layer: - IPCTransport: for IPC connection - WebsocketTransport: for WebSocket connection - HTTPTransport: for HTTP connection They share a common interface defined by `BaseTransport`. """ im...
desktable/aioweb3
aioweb3/transport.py
transport.py
py
15,686
python
en
code
0
github-code
13
42818857925
def triangular_number_prompt(): """Prompts user for an n value for triangular number calculation. .. note:: This function is designed to work in conjunction with triangular_number() from this same module. :except ValueError: The user is notified that the value for n may only be a p...
smallpythoncode/csci161
assignments/assignment03/jahnke_kenneth_3.py
jahnke_kenneth_3.py
py
9,692
python
en
code
0
github-code
13
42135326136
import signal import sys import ssl from SimpleWebSocketServer import WebSocket, SimpleWebSocketServer, SimpleSSLWebSocketServer from optparse import OptionParser import json clients = [] class SimpleEcho(WebSocket): def handleMessage(self): tab_data = json.loads(self.data) # import ipdb; ipdb.set_t...
domspad/synchropazzo
synchropazzo_server.py
synchropazzo_server.py
py
1,731
python
en
code
1
github-code
13
6576240536
#!/usr/bin/python # -*- coding: utf-8 -*- import networkx as nx import matplotlib.pyplot as plt from graph_utility import * #------------------------------------------------------------------------------- def plot_degree_dist (graph, path): """Plot log-log degree distribution of the graph and save the figure ...
lazzova/protein-interaction
python-src/interaction_graph_info.py
interaction_graph_info.py
py
9,840
python
en
code
0
github-code
13
73395768978
import numpy as np import matplotlib.pyplot as plt import cv2 import glob # termination criteria criteria = (cv2.TERM_CRITERIA_EPS + cv2.TERM_CRITERIA_MAX_ITER, 30, 0.001) # 方格的宽度,单位mm square_size = 27.5 # prepare object points, like (0,0,0), (1,0,0), (2,0,0) ....,(6,5,0) objp = np.zeros((9 * 6, 3), np.float32) objp...
lijian103/demo_py_opencv
CalibarateCamera.py
CalibarateCamera.py
py
2,993
python
en
code
6
github-code
13
32799121801
import json import os from datetime import datetime import mock import pytest from dallinger.experiment import Experiment from dallinger.models import Participant from dallinger.mturk import MTurkQualificationRequirements, MTurkQuestions class TestModuleFunctions(object): @pytest.fixture def mod(self): ...
Dallinger/Dallinger
tests/test_recruiters.py
test_recruiters.py
py
57,547
python
en
code
113
github-code
13
34483489516
#!/usr/bin/env python3 import json import os import shutil import subprocess import sys import appdirs import click from termcolor import cprint, colored PROGRAMS_FILE = os.path.join( appdirs.user_config_dir("engi", "PurpleMyst"), "programs.json" ) def choose(programs): cprint(f"Choose a program to install"...
PurpleMyst/engi
engi.py
engi.py
py
3,755
python
en
code
0
github-code
13
34736561829
# coding: utf-8 ''' Created on Jun 14, 2011 FP-Growth FP means frequent pattern the FP-Growth algorithm needs: 1. FP-tree (class treeNode) 2. header table (use dict) This finds frequent itemsets similar to apriori but does not find association rules. @author: Peter ''' class treeNode: def __init...
lucelujiaming/luceluMachineLearingInAction
Ch12/fpGrowth.py
fpGrowth.py
py
15,240
python
zh
code
0
github-code
13
20761621885
import pygame import random WIDTH = 800 HEIGHT = 600 FPS = 30 WHITE = (255, 255, 255) BLACK = (0, 0, 0) RED = (255, 0, 0) GREEN = (0, 255, 0) BLUE = (0, 0, 255) pygame.init() pygame.mixer.init() screen = pygame.display.set_mode((WIDTH, HEIGHT)) pygame.display.set_caption("SPACE INSANITY BETA") clock = pygame.time.Cl...
colgoo21/AWESOMENESS
Cole_Demo3.py
Cole_Demo3.py
py
3,352
python
en
code
0
github-code
13
43263442292
n, m = map(int, input().split()) mod = 10**9+7 fact = [1] for i in range(1, max(n, m) + 1): fact.append(fact[-1] * i % mod) if abs(n - m) >= 2: print(0) elif abs(n - m) == 1: print(fact[n] * fact[m] % mod) elif abs(n - m) == 0: print(2 * fact[n] * fact[m] % mod)
Shirohi-git/AtCoder
arc058-/arc076_a.py
arc076_a.py
py
281
python
en
code
2
github-code
13
11928331595
from urllib.request import urlopen from bs4 import BeautifulSoup import pandas as pd url = "https://www.basketball-reference.com/leagues/NBA_2020_per_game.html".format() html = urlopen(url) soup = BeautifulSoup(html, features="html.parser") soup.findAll('tr', limit=2) headers = [th.getText() for th in soup.findAll...
ShCHewitt/DFSAlgo
old_code/dataScrape.py
dataScrape.py
py
588
python
en
code
1
github-code
13
15340273984
"""Receipt class to handle a receipt with filtering and parsing""" import logging from pathlib import Path import imghdr import numpy as np import pandas as pd from PIL import Image import matplotlib.pyplot as plt import pytesseract as ocr import pypdfium2 as pdfium from skimage.color import rgb2gray from skimage.tra...
max3-2/pybudgetbook
pybudgetbook/receipt.py
receipt.py
py
15,406
python
en
code
0
github-code
13
36322900563
from turtle import * from math import * def draw(a,n,end): t=0 while t<=end: x=a*sin(n*t)*cos(t) y=a*sin(n*t)*sin(t) goto(x,y) t+=0.01 # draw(100,3/2,12.56) def draw_heart(): up() t=0 a=100 while t<2 * pi: x=a*(1-sin(t))*cos(t) y=a*(1-sin(t))*sin(...
initialencounter/code
Python/算法/27玫瑰曲线.py
27玫瑰曲线.py
py
987
python
en
code
0
github-code
13
35189584840
import os from collections import defaultdict from flask import render_template, redirect, url_for, flash, send_from_directory from flask_login import current_user, login_required from app.crud import * from app.models import * from app import app, login_manager GAMES = ("dota2", "overwatch", "csgo") def unauthor...
kerniee/kruzhok-games-front
app/views/all.py
all.py
py
1,986
python
en
code
0
github-code
13
13375105153
import tensorflow as tf class NetModel(tf.keras.Model): def __init__(self, feature_size): super(NetModel, self).__init__() self.feature_size = feature_size model = [] model += [ tf.keras.layers.Conv2D(filters=self.feature_size, kernel_size=3, strides=2, padding='SAME'...
taki0112/tf-torch-template
tensorflow_src/tf_network.py
tf_network.py
py
914
python
en
code
34
github-code
13
40890036461
#!/usr/bin/python3.7 # 0=KathyUbuntu, 1=westteam def get_settings(machine): if machine == 0: chain0 = 24442 url30 = "http://78.47.206.255:18003" url40 = "http://78.47.206.255:18004/jsonrpc" settings_d = {"chain": chain0, "url3": url30, "url4": url40} return settings_d ...
nmschorr/nulspy-requests
src/user_inputs/settings_main.py
settings_main.py
py
798
python
en
code
0
github-code
13
14890177801
from collections import deque import parameters as pt import utils as ut # 관건 1-A: 무지성으로 옆사람이랑 짝 지어주기 def get_next_user(waiting_queue, user_id, grades, matched): if len(waiting_queue) > 0: next_user = waiting_queue.popleft() matched.add(next_user) return next_user else: return ...
jkjan/PS
Kakao_2022_2/algorithms.py
algorithms.py
py
6,834
python
ko
code
0
github-code
13
22209818252
import requests import sys import argparse from bs4 import BeautifulSoup parser = argparse.ArgumentParser(description='Retrieve and Tabularize Bluetooth GATT Characteristics or Services') parser.add_argument('type', choices=['characteristics', 'services', 'all'], help='Whether to retrieve characteristics, services, or...
linkoep/gatt_scrape
main.py
main.py
py
5,810
python
en
code
0
github-code
13
6422942814
from django.shortcuts import render from .models import Setting from Product_app.models import Product # Create your views here. def HomePage(request): context = {} if Setting.objects.exists(): setting = Setting.objects.get(id=1) context={'setting':setting} if Product.objects.exists(): ...
ALVI0017/ecommerce_with_django
ecommerceApp/views.py
views.py
py
519
python
en
code
0
github-code
13
23062943686
def sortear(* num): from time import sleep from random import randint for c in range(1, 6): lista.append(randint(1, 10)) print(f'A lista sorteada foi {lista}') def somapar(* valores): soma = 0 print('Os valores pares na lista é: ', end='') for v in lista: if v % 2 == 0: ...
lucassale/python
Revisão para certificado/ex100 FUNÇÃO - sortear e somar.py
ex100 FUNÇÃO - sortear e somar.py
py
481
python
pt
code
0
github-code
13
27964586360
#%matplotlib inline # useful additional packages #import math tools import numpy as np # We import the tools to handle general Graphs import networkx as nx # We import plotting tools import matplotlib.pyplot as plt from matplotlib import cm from matplotlib.ticker import LinearLocator, FormatStrFormatter # impor...
codecrap/QIProject
CopyPaste.py
CopyPaste.py
py
5,965
python
en
code
3
github-code
13
74043927056
# -*- coding: utf-8 -*- """Parametric Spatial Audio (PARSA). .. plot:: :context: reset import numpy as np import matplotlib.pyplot as plt plt.rcParams['axes.grid'] = True import spaudiopy as spa N_sph = 3 # Three sources x_nm = spa.sph.src_to_sh(np.random.randn(3, 10000), ...
chris-hld/spaudiopy
spaudiopy/parsa.py
parsa.py
py
33,008
python
en
code
118
github-code
13
20203559763
from typing import * import os import json def is_facade_path(name: str) -> bool: path = os.path.join("NNStructure", name) if os.path.isdir(path): subfiles = os.listdir(path) return "facade.py" in subfiles return False def find_facades() -> List[str]: items = os.listdir("NNStructure...
KennelTeam/Tic-Tac-Toe-Player
utils/nn_iterator.py
nn_iterator.py
py
1,018
python
en
code
0
github-code
13
8671032304
import pickle import numpy as np import matplotlib.pyplot as plt from ProMP import ProMP,ProMPTuner # ----------- Import position and orientation trajectories -----# with open('/root/catkin_ws/MP/MP.txt', 'rb') as handle_1: data = handle_1.read() data = pickle.loads(data,encoding='latin1') position = np.array(da...
TAFFI98/Real2Sim_ROS_Doosan
Projects/MP/MP.py
MP.py
py
4,500
python
en
code
0
github-code
13
6427574903
#!/bin/env python3 import numpy as np import sys sys.path.insert(0, '../src') # import own modules import complexes import reactions import datareader import evaluator # read experimental data times_exp, map_oligos_exp, c_oligos_exp, c_oligos_exp_err, c_EDC_exp, c_EDC_exp_err = \ datareader.read_experimental_dat...
gerland-group/ChemicallyFueledOligomers
without_template__length-independent_rate_constants/compute_timeevolution.py
compute_timeevolution.py
py
2,147
python
en
code
0
github-code
13
32294897253
""" Task Given two integers a and b, find their least common multiple. Input Format: The two integers 𝑎 and 𝑏 are given in the same line separated by space. Constraints: 1 ≤ a, b ≤ 10**7. Output Format: Output the least common multiple of a and b. """ def simple_numbers__iterator(stop=2): yield 2 remember...
boloninanajulia/challanges
lcm.py
lcm.py
py
1,489
python
en
code
0
github-code
13
4320896031
############################################################################## # Copyright (C) 2018, 2019, 2020 Dominic O'Kane ############################################################################## from .error import FinError from .date import Date from .calendar import (Calendar, CalendarTypes) from ...
domokane/FinancePy
financepy/utils/schedule.py
schedule.py
py
11,970
python
en
code
1,701
github-code
13
1434351263
#3.写一个狗类。产生10条狗(姓名,攻击力(默认5),防御力 #(默认3),血量(默认100))。然后随机从10条狗中选2条狗打架,狗的血量初始值都为100., # 当血量为0的时候,这条狗,死亡,清出狗的队伍。 #.直到最后一条狗,输出获胜狗的编号 import random #写一个狗类,添加属性 姓名 攻击力 防御力 血量 并且赋予默认值 list=[] class Gou(): def __init__(self,name=None,shanghai=0,fangyu=0,HP=100): while True: s=random.randint(1,5) ...
sk0606-sk/python
python1/python3/作业1.py
作业1.py
py
1,396
python
zh
code
0
github-code
13
39352843935
# @Time : 2022/4/6 14:54 # @Author : PEIWEN PAN # @Email : 121106022690@njust.edu.cn # @File : metric.py # @Software: PyCharm import torch import torch.nn as nn import torch.nn.functional as F import numpy as np from skimage import measure class SigmoidMetric(): def __init__(self, score_thresh=0): ...
PANPEIWEN/Infrared-Small-Target-Segmentation-Framework
utils/metric.py
metric.py
py
10,083
python
en
code
20
github-code
13
38787330719
import time import json from flask import Flask, request from pipeline import load_pipeline, HaystackEncoder from haystack.nodes import PromptTemplate application = Flask(__name__) pipe = load_pipeline("data/mcare/") @application.route('/', methods=['GET']) @application.route('/index', methods=['GET']) @application.r...
Lewington-pitsos/oopscover
application.py
application.py
py
1,476
python
en
code
3
github-code
13
74461854097
import datetime from behave import * from selenium.webdriver.common.by import By @then(u'I should see my rides sorted by {parameter} {order}') def step_impl(context, parameter, order): rides = context.driver.find_elements(By.CSS_SELECTOR, "div[class*=css-109v0wb]") rides_params = [] for ride in...
LeviSforza/TraWell
TraWell-tests/features/steps/sorting_my_rides.py
sorting_my_rides.py
py
952
python
en
code
0
github-code
13
17376283683
import numpy as np from Beam import * import matplotlib.pyplot as plt class Warp: def __init__(self,type,par,wn,k, MAXITE): ''' Name Description ------- -------------- nDim Number of Spatial Dimensions ...
Zhengyu-Huang/Warp_and_Weft
Warp.py
Warp.py
py
18,069
python
en
code
1
github-code
13
20758891532
import logging import time import click from odahuflow.cli.utils import click_utils from odahuflow.cli.utils.click_utils import auth_options from odahuflow.cli.utils.client import pass_obj from odahuflow.cli.utils.error_handler import check_id_or_file_params_present, TIMEOUT_ERROR_MESSAGE, \ IGNORE_NOT_FOUND_ERRO...
odahu/odahu-flow
packages/cli/odahuflow/cli/parsers/deployment.py
deployment.py
py
11,525
python
en
code
12
github-code
13
72106304659
def main(): t = int(input()) while(t): num = int(input()) ing = [int(x) for x in input().split()] ans = sum(ing)-(num-1)*1 print(ans) t-=1 if __name__ == '__main__': main()
JARVVVIS/ds-algo-python
long_challenge/feb2019/magicjar.py
magicjar.py
py
225
python
en
code
0
github-code
13
24839328224
""" Created on Sat Feb 24 16:20:17 2022 @author: mike_ """ import pandas as pd import matplotlib.pyplot as plt # load rankings data here: steel_rankings = pd.read_csv('Golden_Ticket_Award_Winners_Steel.csv') wood_rankings = pd.read_csv('Golden_Ticket_Award_Winners_Wood.csv') # print(steel_rankings.head(), wood_rankin...
gobr2005/codecademy
roller_coaster_starting/script.py
script.py
py
6,816
python
en
code
0
github-code
13
12003291233
from Path import Path from Parameters import * from MyFunctions import f def get_curve_name(latex=False, rad_on=True, base_x=base_x, base_y=base_y, base_curve_coeffs=base_curve_coeffs, curls_on=True, curls_x=curls_x, curls_y=curls_y, curls_curve_coeffs=curls_curve_coeffs, radius_...
tkepes/spirograph
Name.py
Name.py
py
9,120
python
en
code
0
github-code
13
10688750103
def date_boundary(filename,week): #Returns True if the date is contained in the week given and False otherwise date = int(filename[filename.find("201808") + 6: filename.find("201808") + 8]) if week == "1": return bool(date <18) if week == "2": return bool(18<date<25) if week...
jt667/Hydralab-Pallet-Comparison
date_checker.py
date_checker.py
py
374
python
en
code
0
github-code
13
20192078946
# -*- coding: utf-8 -*- """ Verification: 验证爬来下的ip是否可用, 取出文本/SSDB/Redis 中的ip进行分布验证, 为1个进程, 6个进行验证的线程, 1个进行取出的线程 _check_proxy: 将传入的proxy值进行验证, 通过bool值返回 verify_ip: 验证方法, 同时启动四个线程来使用, 加快验证的时间 get_txt_ip: 将ip从文本中一个一个拿出来 main: 为该class的主控函数 UsableIP: """ import sys sys.path.append('....
Eason-Chen0452/MyProject
ProxyPackage/VerificationProxy.py
VerificationProxy.py
py
4,528
python
en
code
0
github-code
13
10548098166
""" Contains base classes for Orders etc. """ from .const import GENERIC_PAYLOAD, HEADERS, NEXT_DAY_TIMESTAMP import requests from enum import Enum class Exchange(Enum): NSE = "N" BSE = "B" MCX = "M" class ExchangeSegment(Enum): CASH = "C" DERIVATIVE = "D" CURRENCY = "U" class OrderFor(E...
OpenApi-5p/py5paisa
py5paisa/order.py
order.py
py
4,949
python
en
code
73
github-code
13
4162457612
from netCDF4 import Dataset import numpy as np import xarray as xr def mask_plainnetcdf(): with Dataset(mask_file, 'r') as mask, Dataset(input_file, 'a') as to_mask: for var in to_mask.variables: if len(to_mask[var].shape) == 4: # The dimensions are time,depth,lat,lon for i in ...
GCEL/netcdf-utils
maskvariablenetcdf.py
maskvariablenetcdf.py
py
1,079
python
en
code
0
github-code
13
42582140616
import matplotlib.pyplot as plt import networkx as nx from manim import * #reference: https://github.com/nipunramk/Reducible class GraphNode: def __init__(self, name, position, radius=0.5, font_size=1): #geometric properties self.center = position self.radius = radius self.circle...
martina-battisti/manim-rb-trees
graph_library.py
graph_library.py
py
7,334
python
en
code
0
github-code
13
14951953458
from django import forms from .models import Comment ,Author ,Post class TagForm(forms.Form): name=forms.CharField(max_length=25, min_length=6) class AuthForm(forms.ModelForm): class Meta: model=Author fields=['name'] class PostForm(forms.ModelForm): class Meta: model=Post ...
Voidblocker/First-Blog-Project
my_app/forms.py
forms.py
py
1,219
python
en
code
0
github-code
13
17324057524
from ckeditor.fields import RichTextField from django.db import models from django.utils.translation import gettext as _ from phonenumber_field.modelfields import PhoneNumberField class Direction(models.Model): name = models.CharField(max_length=125, verbose_name=_("Name")) date_create = models.DateTimeField(...
xislam/Zeon
career/models.py
models.py
py
2,585
python
en
code
0
github-code
13
17043947824
#!/usr/bin/env python # -*- coding: utf-8 -*- import json from alipay.aop.api.constant.ParamConstants import * class AlipayOpenIotmbsFacecheckSendModel(object): def __init__(self): self._dev_id = None self._face_id = None self._floor_num = None self._out_request_id = None ...
alipay/alipay-sdk-python-all
alipay/aop/api/domain/AlipayOpenIotmbsFacecheckSendModel.py
AlipayOpenIotmbsFacecheckSendModel.py
py
4,166
python
en
code
241
github-code
13
72554938578
# 1. вывести главное окно по центру # 2. отключить от него resize # 3. после главной кнопки появляется три новые кнопки ( через toplevel) # фейерверк у главного окна по кнопке. кнопка которая отключает # через 15, 30, 45 секунд с обратным отсчетом. # через это время фейерверк заканчивается, форма закрывается f...
yanooomm/lab10-2
lab10.py
lab10.py
py
1,016
python
ru
code
0
github-code
13
42304360539
import random class Point: def __init__(self,x,y): self.x = x self.y = y def __str__(self): return str(self.x) + ' - ' + str(self.y) class EllipticCurveCryptography: def __init__(self,a,b): self.a = a self.b = b def _point_addition(self, P,...
ucadena07/Cryptography
ECC/EllipticCurveCrytography.py
EllipticCurveCrytography.py
py
1,517
python
en
code
0
github-code
13
36205861546
from telegram.ext.callbackcontext import CallbackContext from message_generator import MessageGenerator from image_generator import ImageGenerator import logging import time from database import Database import telegram from telegram.ext import Updater, CommandHandler from settings import * class Bot: def __ini...
Endex761/Vacciniamoci
bot.py
bot.py
py
6,211
python
en
code
0
github-code
13
42865685449
from PyQt5.QtWidgets import QFrame from qfluentwidgets import ComboBox from ..layout.inputLabel import InputLabel class Select(QFrame): def __init__(self, label:str, items: list, parent): inputLabel = InputLabel(label, parent) self.comboBox = ComboBox(inputLabel) self.comboBox.addItems(ite...
raherygino/python-gui-like-windows-11
app/components/input/Select.py
Select.py
py
579
python
en
code
4
github-code
13
25105807793
import matplotlib.pyplot as plt import geopandas as geo #equivalent to import pandas as pd pd = geo.pd EARTH = geo.read_file(geo.datasets.get_path('naturalearth_lowres')) crs={'init':'epsg:4326'} EEZbounds = geo.read_file('World_EEZ_v11_20191118_gpkg/eez_boundaries_v11.gpkg') EEZ = geo.read_file('World_EEZ_v11_201911...
intwhcom/Small-Cetaceans-Gap-Analysis
spacialDataMaps.py
spacialDataMaps.py
py
2,321
python
en
code
0
github-code
13
38258831881
import numpy as np from sklearn.datasets import load_diabetes from sklearn.decomposition import PCA dataset = load_diabetes() x = dataset.data y = dataset.target # print(x.shape,y.shape) (442, 10) (442,) pca = PCA(n_components=8) x2 = pca.fit_transform(x) print(x2) # print(x2.shape) (442, 7) pca_EVR = pca.explained_...
dongjaeseo/study
ml/m29_pca2_1_diabetes.py
m29_pca2_1_diabetes.py
py
676
python
en
code
2
github-code
13
43728242103
import cv2 import numpy as np import os # ================================= Warp Prespective ================================= ''' the perspective transformation is associated with the change in the viewpoint. This type of transformation does not preserve parallelism, length, and angle. But they do preserve colline...
ahmadSoliman94/Computer-Vision
Image Processing/Transformations/Warp_prespective.py
Warp_prespective.py
py
1,373
python
en
code
0
github-code
13
23371381768
from turtle import * speed(-1) def draw_star(x,y,length): for i in range (5): forward(length) right(144) draw_star(1,1,100) input() speed(0) color('blue') for i in range(100): import random x = random.randint(-300, 300) y = random.randint(-300, 300) length = random.randint...
Hailinh146/btvn-hailinh
Session 5/Turtle_circle_3_4.py
Turtle_circle_3_4.py
py
458
python
en
code
0
github-code
13
11073952624
import json import logging import os.path import asyncio import os import subprocess import sys import time from asyncio.subprocess import PIPE import git from git import Repo, InvalidGitRepositoryError from clickhouse import DataType, RepoClickHouseClient from datetime import datetime ON_POSIX = 'posix' in sys.builti...
ClickHouse/clickhub
repo/importer.py
importer.py
py
7,714
python
en
code
12
github-code
13
35623546480
import numpy as np import matplotlib.pyplot as mpl import ga # Equação escolhida # Y = w1x1 + w2x2 + w3x3 + w4x4 + w5x5 # (x1,x2,x3,x4,x5) = (6,-4,5.7,7,-13,-6.9) # A equação possui 5 inputs e 5 pesos # Entradas da equação entradas_eq = [6,-4,5.7,7,-13,-6.9] # Número de pesos pesosQtd = len(entradas_eq) # Nesse caso ...
RafaelCRC/Genetic-Algorithm-maximize-the-output-of-an-equation
main.py
main.py
py
2,380
python
pt
code
0
github-code
13
30227683554
from crispy_forms.helper import FormHelper from django import forms from salesapp.models import Item, Receipt, TrackSetting, ItemStocking class ItemForm(forms.ModelForm): class Meta: model = Item fields = "__all__" def __init__(self, *args, **kwargs): super(ItemForm, self).__init__(*...
brightkan/sales
salesapp/forms.py
forms.py
py
1,121
python
en
code
0
github-code
13
5911549514
class Solution: def eraseOverlapIntervals(self, intervals): def get_second(interval): # helper function for the sort() to return the end time of each interval return interval[1] intervals.sort(key = get_second) # sort the interval using the endtime of each interval as ...
collinsakuma/LeetCode
Problems/435. Non-overlapping intervals/non_overlapping_intervals.py
non_overlapping_intervals.py
py
942
python
en
code
0
github-code
13
3108386496
""" The program displays the FIRST 10 lines of a FILE whose NAME is provided as a COMMAND-LINE ARGUMENT, CATCHING and HANDLING any EXCEPTIONS. """ # The system module must be imported to ACCESS the command-line ARGUMENTS import sys # Declaration of the CONSTANTS NUM_LINES = 10 try: if len(sys.argv) != 2: ...
aleattene/python-workbook
chap_07/exe_149_display_head_file.py
exe_149_display_head_file.py
py
1,108
python
en
code
1
github-code
13
42105980918
import sys from collections import Counter sys.setrecursionlimit(10 ** 8) ini = lambda: int(sys.stdin.readline()) inl = lambda: [int(x) for x in sys.stdin.readline().split()] ins = lambda: sys.stdin.readline().rstrip() debug = lambda *a, **kw: print("\033[33m", *a, "\033[0m", **dict(file=sys.stderr, **kw)) def solve...
keijak/comp-pub
vcon/asa20200818/C/main.py
main.py
py
474
python
en
code
0
github-code
13
40406124291
# Ejercicio 15 # El director de una escuela está organizando un viaje de estudios, # y requiere determinar cuánto debe cobrar a cada alumno y cuánto debe pagar a la compañía de viajes por el servicio. # La forma de cobrar es la siguiente: si son 100 alumnos o más, el costo por cada alumno es de 65 euros; # de 50 a 99 a...
mavb86/ejercicios-python
seccion4/if/ejercicio15.py
ejercicio15.py
py
1,165
python
es
code
0
github-code
13
7895742022
from chat.schatclient import SChatClient import pytest from time import time from lib.settings import COMMAND, ONLINE, TIMESTAMP, USER, ACCOUNT_NAME, ERROR, RESPONSE ONLINE_MESSAGE = { COMMAND: ONLINE, TIMESTAMP: '', USER: { ACCOUNT_NAME: 'guest' } } ONLINE_USER_MESSAGE = { COMMAND: ...
Solda-git/CS
test/test_client.py
test_client.py
py
2,171
python
en
code
0
github-code
13
35114321411
import re def text_to_query(text): sentenceEnders = re.compile('[.!?›«»—]') sentenceList = sentenceEnders.split(text) nbr_word = 23 split_text = [] for sentence in sentenceList: if sentence != "": if len(sentence) >= nbr_word: splited_sebtence = split_by_nbr_wor...
iliassaoufi/Plagiarism-check-algorithm__Python
getQuery.py
getQuery.py
py
1,364
python
fr
code
1
github-code
13
31201129908
from st2common import log as logging from st2common.exceptions.triggers import TriggerDoesNotExistException from st2common.models.api.reactor import (TriggerAPI, TriggerTypeAPI) from st2common.models.system.common import ResourceReference from st2common.persistence.reactor import (Trigger, TriggerType) __all__ = [ ...
gtmanfred/st2
st2common/st2common/services/triggers.py
triggers.py
py
7,035
python
en
code
null
github-code
13
16515911396
file = open("input.txt","r") patterns = file.read().split("\n\n") total1 = 0 total2 = 0 for pattern in patterns: lines = pattern.split("\n") # Horizontal lines for i in range(1,len(lines)): cnt = 0 for j in range(1,min(len(lines)-i,i)+1): for k in range(len(lines[0])): ...
FLL128/AOC_2023
Day13/main.py
main.py
py
854
python
en
code
0
github-code
13
86594509010
#!/usr/bin/python #-*-coding:utf-8-*- import cStringIO import codecs import re from xml.dom import minidom from httplibExt import * import codecs class LivebosObject(): object = None type = None actionType = None objectId = None version=None modifyDate=None #"2011.04.20 14:25:30" createDa...
chyangfather/envadmin
docs/commitassistant/models.py
models.py
py
4,952
python
en
code
0
github-code
13
8932970963
import os, sys, time, glob import numpy as np os.environ['TF_CPP_MIN_LOG_LEVEL']='2' from tensorflow.keras.models import Model, Sequential from tensorflow.keras.layers import Input, Dense, Masking, GRU, TimeDistributed from tensorflow.keras.callbacks import TensorBoard, ModelCheckpoint def get_weights_file(checkpoin...
MzXuan/fetch_plan
baselines/baselines/ppo2/keras_simpleRNN.py
keras_simpleRNN.py
py
4,893
python
en
code
0
github-code
13
35028098760
# 알파벳 찾기 import sys ipt = sys.stdin.readline S=list(ipt().rstrip()) result=[] # 위치 값을 위한 리스트 for i in range(97,123): # 아스키 코드 사용 if chr(i) not in S: # 없으면 -1을 리스트에 추가 result.append(-1) else: result.append(S.index(chr(i))) # 있다면 인덱스 추가 for j in range(len(result)-1): print(resu...
Jehyung-dev/Algorithm
백준/Bronze/10809. 알파벳 찾기/알파벳 찾기.py
알파벳 찾기.py
py
443
python
ko
code
0
github-code
13
38173644774
import os # os.environ["CUDA_VISIBLE_DEVICES"] = "1" import numpy as np import pickle import tensorflow as tf import tensorflow.keras as keras from tensorflow.keras.layers import Conv2D, MaxPooling2D, Flatten, Dropout, Dense def mask_layer_outputs(unit_mask, layer_outputs): unit_mask_tensor = tf.constant(unit_mas...
liyueqiao/feature-entropy
fe/vgg16.py
vgg16.py
py
7,786
python
en
code
0
github-code
13
71648264657
import logging from javalang.tree import MethodInvocation from qark.issue import Issue, Severity from qark.plugins.webview.helpers import webview_default_vulnerable, valid_set_method_bool from qark.scanner.plugin import CoroutinePlugin, ManifestPlugin log = logging.getLogger(__name__) SET_ALLOW_UNIVERSAL_ACCESS_FRO...
linkedin/qark
qark/plugins/webview/set_allow_universal_access_from_file_urls.py
set_allow_universal_access_from_file_urls.py
py
2,499
python
en
code
3,071
github-code
13
5885262730
from __future__ import print_function import json import logging import numpy import os import subprocess import sys from sawtooth.cli.admin_sub.genesis_common import genesis_info_file_name from txnintegration.exceptions import ExitError from txnintegration.matrices import NodeController from txnintegration.matrices ...
gabykyei/GC_BlockChain_T_Rec
validator/txnintegration/validator_network_manager.py
validator_network_manager.py
py
8,556
python
en
code
1
github-code
13
26335124240
def url_suffix(request): """ Calculate any required url suffix to be appended """ ans = "" # Forward 'webid' if hasattr(request, 'webid'): ans += "webid=%s" % request.webid elif 'webid' in request.GET: ans += "webid=%s" % request.GET['webid'] # Return url suffix return ans def context(request, **extra):...
wavesoft/creditpiggy
creditpiggy-server/creditpiggy/frontend/views/__init__.py
__init__.py
py
568
python
en
code
0
github-code
13
11177081844
from flask import Flask import os import redis import json app = Flask(__name__) # Get port from environment variable or choose 8080 as local default port = int(os.getenv('PORT', 8080)) redis_config = dict(host='localhost', port=6379, password='') # Get Redis credentials from CF service if 'VCAP_SERVICES' in os.env...
cloud-gov/aws-redis-example
python/app.py
app.py
py
1,734
python
en
code
8
github-code
13