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
25505977572
import six import tensorflow_hub as hub import pandas as pd from functions import get_logger, execute, to_sep_space, get_sim_index, show_sim_faq from config import LOGDIR, JA_NNLM_MODEL, MUSCLE_QA def main(): logger = get_logger(LOGDIR) logger.info('start') logger.info('load faq data') qa_df = pd.rea...
trtd56/MuscleQA
src/muscle_qa_nnlm.py
muscle_qa_nnlm.py
py
1,036
python
en
code
0
github-code
13
12228729380
# -*- coding:utf-8 -*- from django.conf.urls import url from django.contrib import admin from .views import ( StationListAPIView, CommunityListAPIView, SecondWaterListAPIView, DMAListAPIView, dmabaseinfo, getDmaSelect, ) app_name='devm-api' urlpatterns = [ # url(r'^user/oranizationtree/$',...
apengok/bsc2000
dmam/api/urls.py
urls.py
py
1,157
python
en
code
1
github-code
13
20032171796
"""upvote3 Migration Revision ID: 528c1a134c57 Revises: 73e42c60678a Create Date: 2021-04-28 12:39:38.258102 """ from alembic import op import sqlalchemy as sa # revision identifiers, used by Alembic. revision = '528c1a134c57' down_revision = '73e42c60678a' branch_labels = None depends_on = None def upgrade(): ...
kagus-code/Pitch-Piper
migrations/versions/528c1a134c57_upvote3_migration.py
528c1a134c57_upvote3_migration.py
py
1,181
python
en
code
0
github-code
13
16773949833
# dfs__BOJ_21609_상어중학교 # NxN grid # block : {black(-1), rainbow(0), ordinary(M)} # === input === EDGE, NUM_OF_COLOR = map(int, input().split()) EMPTY = -2 BLACK, RAINBOW = -1, 0 board = [list(map(int, input().split())) for _ in range(EDGE)] # === algorithm === def rotate_counterclockwise(arr: list) -> ...
1092soobin2/Algorithm-Study
bfs,dfs/(1.5) dfs-stack__BOJ_21609_상어중학교.py
(1.5) dfs-stack__BOJ_21609_상어중학교.py
py
3,626
python
en
code
1
github-code
13
8658469917
VERSION = "Cam_display v0.10" import sys, time, threading, cv2 import numpy as np from flirpy.camera.lepton import Lepton from tifffile import imsave import helperFunctions.skin_detector import time import h5py from helperFunctions.spo2Functions import face_detect_and_thresh,spartialAverage,MeanRGB,SPooEsitmate,pr...
TheBluePhoenix10/multiparaOS
src/test.py
test.py
py
12,695
python
en
code
0
github-code
13
27165492465
with open('input.txt', 'r') as file: inp = file.read().strip() sections = inp.split('\n') total = 0 total_part2 = 0 for sec in sections: var1, var2 = sec.split(',') var1_start, var1_end = map(int, var1.split('-')) var2_start, var2_end = map(int, var2.split('-')) if(var1_start...
LaCroix0/Code-of-Advent-2022
day_4/day_4.py
day_4.py
py
697
python
en
code
0
github-code
13
31318752744
"""Module 7 - Lab 2 We're going to practice installing, importing and using external python modules while learning out how to scrape web pages. """ # Import libraries import requests from bs4 import BeautifulSoup # Scraping the web # Set up our url as a string url = "https://wiki.python.org/moin/IntroductoryBooks" # ...
dtingg/IntroToPython
Module 7/mod7_lab2.py
mod7_lab2.py
py
1,348
python
en
code
0
github-code
13
19304981596
# Write a program to accept a number from 1 to 7 and display the name of the day like 1 # for Sunday , 2 for Monday and so on. dict = {1:"Sunday", 2: "Monday", 3: "Tuesday", 4:"Wednesday", 5:"Thursday", 6:"Friday", 7:"Sturday"} num = int(input("Input the number of the day you will like to see. Note(between 1-7): ")) ...
olaoyeisrael/Input_and_output_in_py
Answer7.py
Answer7.py
py
437
python
en
code
0
github-code
13
71540701457
from random import randint nb1 = randint(0, 100) nb_input = int(input("Entrez un nombre: ")) while nb_input != nb1: if nb_input < nb1: print("trop petit") else: print("trop grand") nb_input = int(input("Entrez un nombre: ")) print(f"Vous avez trouvé le nombre caché était donc bien: {nb1...
Fixer38/University-Notes
semester-1/progra-ex/manip2/ex12-random.py
ex12-random.py
py
327
python
fr
code
0
github-code
13
71082097937
import numpy as np from activation import sigmoid_derivative, sigmoid_function class MLP: def __init__( self, input_size, hidden_size, output_size, activation, derivative_activation, ) -> None: """ This is a three layer neural network with: ...
wayneotemah/ML-from-scratch
perceptron/multilayerpercepton.py
multilayerpercepton.py
py
2,788
python
en
code
0
github-code
13
1486440233
import random import time import os from pprint import pprint class Pokemon: def __init__(self, name, hp, attack, defense, speed, attaks) -> None: self.name = name self.hp = hp self.attack = attack self.defense = defense self.speed = speed self.attacks = attaks ...
AdrianVillamayor/Python_First_Try
pokemon_fight.py
pokemon_fight.py
py
5,959
python
en
code
0
github-code
13
5792350135
from threading import Thread from queue import Queue from message import Message, MessageType import socket import select class Connection: def __init__(self, _logger, socket, address="unknown", fileroot='/tmp'): self._logger = _logger self.socket = socket self.address = address # ...
FallingSnow/simplified-ftp
src/simplified_ftp/server.py
server.py
py
9,440
python
en
code
0
github-code
13
72137408017
from math import sqrt from matplotlib import pyplot import numpy as np from pandas import read_csv from sklearn.metrics import mean_squared_error from sklearn.metrics import mean_absolute_error from sklearn.metrics import mean_absolute_percentage_error count=1 count1=1 dataset_name="USDCNY" for i in range(30): ori...
xhuph66/GNSNP
compute.py
compute.py
py
1,749
python
en
code
0
github-code
13
14326520580
import sys from PyQt5.QtCore import * from PyQt5.QtGui import * from PyQt5.Qt import Qt from PyQt5.QtWidgets import * class KeyboardWidget(QDialog): def __init__(self, parent=None): super(KeyboardWidget, self).__init__(parent) self.currentTextBox = None self.signalMapper = QSignalMapper(s...
eurosa/DigilineSystem-new
virtual_keyboard_qtextedit.py
virtual_keyboard_qtextedit.py
py
8,578
python
en
code
0
github-code
13
25055574735
import pandas as pd from matplotlib import pyplot as plt import numpy as np # read the csv file into a dataframe df = pd.read_csv('rotten_tomatoes_movies.csv', engine='python') print(df.head()) # fitler out movies wihout a numeric rating df.dropna(subset=['tomatometer_rating', 'audience_rating', 'actors'], inplace=T...
tinuh/applied-statistics
U2 Data Project.py
U2 Data Project.py
py
4,267
python
en
code
0
github-code
13
41713625591
import requests import json class sudoku(): def __init__(self, matrix): matrix[0][0] = 1 def main(): print("Ciao!") response = requests.get("https://sugoku.herokuapp.com/board?difficulty=easy") """ sudoku = sudoku(response) """ print(response.status_code) """ 200 means --> success...
DanieleCoppola/ProgettoSUDOKU
murgo_code.py
murgo_code.py
py
704
python
en
code
0
github-code
13
15032884806
#!/usr/bin/env python # -*- coding: utf-8 -*- import os import smtplib import requests from dotenv import load_dotenv from flask import Flask, request from email import message_from_string from email.mime.text import MIMEText from email.mime.multipart import MIMEMultipart from email.utils import parseaddr, make_msgid ...
mishushakov/dialogflow-sendgrid
inbox.py
inbox.py
py
5,624
python
en
code
34
github-code
13
74324875537
import sevseg import sys, time def format_digit(digit_str): return f'\033[1;34m{digit_str}\033[0m' def format_separator(): return '\033[1;31m:\033[0m' try: while True: print('\n' * 60) current_time = time.localtime() hours = str(current_time.tm_hour % 12) if hours == '0': ...
KradThed/python_projects
digital_clock.py
digital_clock.py
py
1,582
python
en
code
1
github-code
13
6234852632
from django.http import HttpRequest # Create your views here. from common import error from lib.http import render_json from lib.sms import send_verify_code, check_verify_code from user.logic import save_avatar_to_location, save_avatar_to_remote from user.models import User from user.models import UserForm def get...
wei6740714/tantan
user/api.py
api.py
py
1,873
python
en
code
0
github-code
13
19019123171
from django.contrib.auth.decorators import login_required from annoying.decorators import render_to from forms import ImportForm from share.decorator import no_share from import_class import PreviewImport, DatabaseImport, BaseImport from handle_uploads import save_php, save_upload, get_last from backupfromphp import...
priestc/flightloggin2
manage/views.py
views.py
py
3,259
python
en
code
18
github-code
13
1942747725
from flask import Flask, request, jsonify class NetManager: def __init__(self): self.app = Flask(__name__) self.ip = "0.0.0.0" self.port = 8000 self.setup_routes() def run(self): self.app.run(host = self.ip, port = self.port) def setup_routes(self): self...
PeiXinHuang/MiniGamePro
Server/NetManager.py
NetManager.py
py
738
python
en
code
0
github-code
13
70612985937
class Solution(object): def reverseVowels(self, s): """ :type s: str :rtype: str """ length = len(s) sCopy = list(s) data = ['a','e','i','o','u','A','E','I','O','U'] left = [] right = [] for i in range(length//2): i...
yoonhoohwang/Algorithm
LeetCode/345. Reverse Vowels of a String.py
345. Reverse Vowels of a String.py
py
887
python
en
code
2
github-code
13
32465295299
def binarySearch(nums, target): start = 0 end = len(nums) - 1 while start <= end: middle = start + (end-start)//2 if nums[middle] == target: return middle elif nums[middle] < target: start = middle + 1 else: end = middle - 1 return -1 # Pattern: # Two pointers. Look at the middle of the array, the...
dbasso98/LeetCode-Grind
python/binary_search.py
binary_search.py
py
406
python
en
code
0
github-code
13
8965442042
import routeros_api import pandas as pd def connect(host, username, password): connection = routeros_api.RouterOsApiPool(host, username=username, password=password, port=8740, ...
edopore/api-graphic
api.py
api.py
py
1,745
python
en
code
0
github-code
13
22248105122
import speech_recognition as sr from DataTrain import DataTrain import pyttsx3 import time class VoiceRecognisation: def speech(self, string): engine = pyttsx3.init() query = string r = sr.Recognizer() with sr.Microphone() as source: rate = engine.getProperty('rate')...
bornwinner54/HelloQuery
HelloQuery/VoiceRecognisation.py
VoiceRecognisation.py
py
1,135
python
en
code
0
github-code
13
14551993603
def p_function(word): word_len = len(word) p_values = [0 for _ in range(word_len)] for i in range(1, word_len): k = p_values[i - 1] while k > 0 and word[i] != word[k]: k = p_values[k - 1] if word[i] == word[k]: k += 1 p_values[i] = k return p_value...
StepDan23/MADE_algorithms
hw_14/c.py
c.py
py
665
python
en
code
0
github-code
13
71084000979
courses = {} while True: command = input() if command == 'end': break data = command.split(' : ') course_name = data[0] student_name = data[1] if course_name not in courses.keys(): courses[course_name]=[] courses[course_name].append(student_name) for course in courses.keys(...
bobsan42/SoftUni-Learning-42
ProgrammingFunadamentals/a25DictionariesExrecises/courses.py
courses.py
py
437
python
en
code
0
github-code
13
70838594579
import os import logging import gin import typing import cv2 import numpy as np import pandas as pd import torch import matplotlib.pyplot as plt from soccer_robot_perception.utils.metrics import ( calculate_metrics, get_confusion_matrix, calculate_iou, calculate_det_metrics, iou_metrics_preprocess,...
DeepanChakravarthiPadmanabhan/Soccer_Robot_Perception
soccer_robot_perception/evaluate/evaluate_model_concatenated_dataset.py
evaluate_model_concatenated_dataset.py
py
17,452
python
en
code
1
github-code
13
7383216239
from aws_cdk import ( Duration, Stack, aws_s3 as s3, aws_cloudfront as cloudfront, aws_cloudfront_origins as origins, aws_certificatemanager as acm, aws_route53 as rt53, aws_route53_targets as targets, aws_codestarconnections as codestar, aws_codepipeline as codepipeline, aws...
cleanslate-technology-group/indyaws-cdk-python-jekyll-blog
infrastructure/infrastructure/infrastructure_stack.py
infrastructure_stack.py
py
11,422
python
en
code
0
github-code
13
37879076422
from agentes import othello import timeit black=othello.minimax_searcher(3, othello.score) white=othello.alphabeta_searcher(3, othello.score) startt = timeit.default_timer() # black, white = get_players() board, score = othello.play(black, white) elapsed = timeit.default_timer() - startt # en segundos cl = elapse...
Unnamed10110/AI
ia-t2-master/agentes/sub/othello/tests.py
tests.py
py
429
python
en
code
0
github-code
13
9856577085
# Задание 5** # Создайте новый столбец в датафрейме authors_price под названием cover, в нем будут располагаться данные о том, # какая обложка у данной книги - твердая или мягкая. В этот столбец поместите данные из следующего списка: # ['твердая', 'мягкая', 'мягкая', 'твердая', 'твердая', 'мягкая', 'мягкая']. # Просмот...
ZV8/GB-Python-libraries-for-DS
Lesson_2/Working with data in Pandas/5.py
5.py
py
2,682
python
ru
code
0
github-code
13
2625060935
# -*- coding: utf-8 -*- import pytz import datetime import json from pyramid.view import view_config from stalker import db, Project, Status, Entity, Invoice, Budget, Client, Payment from stalker.db.session import DBSession import transaction from webob import Response import stalker_pyramid import logging #logger...
eoyilmaz/stalker_pyramid
stalker_pyramid/views/invoice.py
invoice.py
py
14,596
python
en
code
6
github-code
13
7315471364
# 交换a与b def swap(a,b): temp=a a=b b=temp return a,b # +:0, -:1, *:2, /:3 # in:two number # out:a tuple with result and its operator def f(a,b): # 让a>=b if(a<b): a,b=swap(a,b) res=[] res.append((a*b,'*')) res.append((a+b,'+')) res.append((a-b,'-')) if(b!=0): ...
marcusadrian666/24-
24.py
24.py
py
2,021
python
zh
code
1
github-code
13
20919783216
#!/usr/bin/python3 import aocd from icecream import ic import itertools import math import operator TEST_INPUT = """199 200 208 210 200 207 240 269 260 263 """ def test(): depths = [int(d) for d in TEST_INPUT.splitlines()] ### PART A ### depths2 = list(zip(depths, depths[1:])) increases = len(list(filter(lambda...
colematt/advent-code
2021/p1.py
p1.py
py
1,158
python
en
code
0
github-code
13
29712193280
from django.conf import settings import types def log(method, **kwargs): assert isinstance(method, types.FunctionType) is True or isinstance( method, types.MethodType), "method == type : function or method" if settings.DEBUG is True: comment = "" for key, value in kwargs.items(): ...
yseiren87/jellicleSpace
server/utils/log.py
log.py
py
586
python
en
code
0
github-code
13
15112705280
# -*- coding: utf-8 -*- """ """ # -*- coding: utf-8 -*- import numpy as np import matplotlib.pyplot as plt import pandas as pd import lightgbm as lgb from sklearn import metrics # Importing the dataset dataset = pd.read_csv('C:/Users//Ravi Keerthi//Desktop//Disserattion//Cleaned_KIVA_Data.csv') datas...
Ravikeerthi2401/Kickstarter_Campaign
k flod.py
k flod.py
py
2,749
python
en
code
0
github-code
13
1586731608
import datetime import threading from django.core.cache.backends.locmem import LocMemCache from django.utils import timezone class LocMemCacheBackend(LocMemCache): """LocMemCache Backend""" def _set_value( self, key, value_class, value_kwargs=None, timeout=60 * 60, ...
lee-lou2/lee-lou2
src/conf/caches.py
caches.py
py
2,316
python
ko
code
1
github-code
13
13194754109
import csv from numpy.linalg import norm from scipy import * import os from pylab import plot, show, legend,xlim,ylim,savefig,title,xlabel,ylabel,clf, loglog from Hamil import * from numpy import tanh,arctanh def makevar(sx,ex,dx,st,et,dt): x = arange(sx, ex, dx) t = arange(st, et, dt) return x,t ...
jordanpitt3141/collectedworks
postprocessing/makeup/HamiltonainCheck/Energies.py
Energies.py
py
9,742
python
en
code
0
github-code
13
19933233597
# 实现 int sqrt(int x) 函数。 # 计算并返回 x 的平方根,其中 x 是非负整数。 # 由于返回类型是整数,结果只保留整数的部分,小数部分将被舍去。 # 示例 1: # 输入: 4 # 输出: 2 # 示例 2: # 输入: 8 # 输出: 2 # 说明: 8 的平方根是 2.82842...,由于返回类型是整数,小数部分将被舍去。 ### Solution:采用二分法思想,先指数扩张,再二分查找 ### 平方根整数解,要满足 result^2 <= x < (result+1)^2 class Solution: def mySqrt(self, x: int) -> int: ...
Vivhchj/LeeeCode_Notes
69.x的平方根_easy.py
69.x的平方根_easy.py
py
1,234
python
zh
code
0
github-code
13
16641389235
# ---------------------------------------------------------------+ # # Albert Negura # 2-Dimensional Particle Swarm Optimization (PSO) with Python # February, 2021 # # ---------------------------------------------------------------+ # --- IMPORT DEPENDENCIES----------------------------------------+ # mathematics ...
AlbertNegura/ParticleSwarmOptimization
particle_swarm_optimization.py
particle_swarm_optimization.py
py
20,236
python
en
code
1
github-code
13
21774380069
# -*- coding: utf-8 -*- """ XMS Client module """ from __future__ import absolute_import, division, print_function try: from urllib.parse import quote_plus, urlencode except ImportError: from urllib import quote_plus, urlencode import logging import requests import clx.xms.__about__ from clx.xms import des...
clxcommunications/sdk-xms-python
clx/xms/client.py
client.py
py
24,270
python
en
code
3
github-code
13
44178297742
from selenium import webdriver #from selenium.webdriver.common.keys import Keys #from selenium.webdriver.support import expected_conditions as EC import re import re import os import time import subprocess import io from PIL import Image import base64 user_history = [] id_history = [] proxy='127.0.0.1:7890' env = o...
Vermillion-de/spider
src/youtube.py
youtube.py
py
4,287
python
en
code
1
github-code
13
24601642704
import random from locust import HttpUser, task, between from aueb_api.aueb_api.settings import STRESS_TEST_TOKEN class AuebApiUser(HttpUser): """ A user querying the AUEB API. """ wait_time = between(1, 5) # Wait for 1 to 5 seconds header = { 'Authorization': 'Token {}'.format(STRESS_TEST_TOKEN...
KonstantinosVasilopoulos/aueb_api
stress_test/locustfile.py
locustfile.py
py
837
python
en
code
3
github-code
13
36331589455
# -*- coding: utf -*- # Create your views here. from django.shortcuts import render_to_response, redirect from django.template import RequestContext from osto.models import Barcode from tilit.models import Account, AccountCode def maybe_get_price(barcode): try: return barcode.product.current_price exce...
HelsinkiHacklab/limu
limuweb/osto/views.py
views.py
py
2,412
python
en
code
4
github-code
13
13748428820
#!/usr/bin/env python3 import socket, struct, time, os, netifaces, netaddr, nmap, pprint, re, subprocess, logging, argparse, resource from netaddr import * from portscan import scan_ports from pwd import getpwnam import getpass logging.getLogger("scapy.runtime").setLevel(logging.ERROR) global addr, netmask, cidr, all...
nixgeekk-zz/netscan
netscan.py
netscan.py
py
7,158
python
en
code
0
github-code
13
36031646192
from selenium import webdriver from selenium.webdriver.common.by import By import time url='https://www.youtube.com/@fifa/videos' driver = webdriver.Chrome() driver.get(url) videos = driver.find_elements(By.CLASS_NAME,"style-scope ytd-rich-grid-media") for vid in videos: title = vid.find_elements(By.XPATH,'//*[@id=...
itsazogdbbk/Internship
Selenium_Python/selenium_scrape.py
selenium_scrape.py
py
514
python
en
code
0
github-code
13
12543623470
#from collections import deque import random import numpy as np #from utilities import transpose_list from collections import namedtuple, deque import torch device = torch.device("cuda" if torch.cuda.is_available() else "cpu") BUFFER_SIZE = int(1e6) # replay buffer size BATCH_SIZE = 1024 # minibatch size clas...
CristyanGil/Project3-DRL-Udacity
buffer.py
buffer.py
py
4,309
python
en
code
0
github-code
13
33400538462
import glob import os.path import torch from torchvision import transforms from PIL import Image from torch.utils.data import Dataset PICTURE_SIZE = 96 LABEL_MAPPING = { 'cat': 0, 'dog': 1, } transform = transforms.Compose([ transforms.CenterCrop(PICTURE_SIZE), transforms.Resize(PICTURE_SIZE), t...
twolights/pytorch-practice
practices/dogs_and_cats/datasets/preprocess.py
preprocess.py
py
1,669
python
en
code
0
github-code
13
7236810384
import cv2 import numpy as np import warnings from skimage.feature import peak_local_max from astropy.io import fits from astropy.convolution import convolve, Gaussian2DKernel from astropy.stats import sigma_clipped_stats, gaussian_fwhm_to_sigma from photutils.background import MedianBackground, Background2D # from ...
Yash-10/galmask
galmask/galmask.py
galmask.py
py
6,178
python
en
code
6
github-code
13
12323877451
import random import time from selenium import webdriver from selenium.webdriver.common.by import By driver = webdriver.Chrome() driver.execute_cdp_cmd("Page.addScriptToEvaluateOnNewDocument", { "source": """ Object.defineProperty(navigator, 'webdriver', { get: () => undefined }) """ ...
lll13508510371/Scrapping
11 多进程与多线程/01 上课代码/第10次作业讲解/0315-10-00000002-山禾-selenium问卷星.py
0315-10-00000002-山禾-selenium问卷星.py
py
1,350
python
en
code
0
github-code
13
72485782738
from random import randint def main(): """Main function to call sub-functions""" # get and validate initial pencil input pencils = pencil_valid() # get and validate player choice player = player_check() while pencils > 0: printer(pencils, player) if player == "John": ...
jdstrongpdx/JetBrains-last_pencil
Last Pencil/task/game.py
game.py
py
4,286
python
en
code
0
github-code
13
71110521299
from pathlib import Path import pytest from pycromanager import start_headless from pycromanager.acq_util import cleanup from pymmcore_plus import find_micromanager from pycro_plus_bridge import pycroCorePlus @pytest.fixture(scope="session") def core(): mm_app_path = Path(find_micromanager()) start_headless...
ianhi/pycro-plus-bridge
tests/test_pycro_plus_bridge.py
test_pycro_plus_bridge.py
py
804
python
en
code
0
github-code
13
17043364094
#!/usr/bin/env python # -*- coding: utf-8 -*- import json from alipay.aop.api.constant.ParamConstants import * class AlipayOfflineProviderEquipmentAuthRemoveModel(object): def __init__(self): self._device_id = None self._device_type = None self._ext_info = None self._merchant_pid...
alipay/alipay-sdk-python-all
alipay/aop/api/domain/AlipayOfflineProviderEquipmentAuthRemoveModel.py
AlipayOfflineProviderEquipmentAuthRemoveModel.py
py
3,427
python
en
code
241
github-code
13
36178162426
from flask import Flask,Response,request,json from flask_pymongo import MongoClient import logging as log from bson.json_util import dumps app = Flask(__name__) class MongoAPI: def __init__(self,data): log.basicConfig(level=log.DEBUG, format='%(asctime)s %(levelname)s:\n%(message)s\n') #...
prao02/flask_app
test.py
test.py
py
2,457
python
en
code
0
github-code
13
10967114087
import networkx as nx import matplotlib.pyplot as plt from homework2.task_defaults import DATA_ROOT, RESULTS_ROOT class Task3: prefix = 'task3' def run(self): for i in range(1, 4): graph = self.read_txt(DATA_ROOT / f'sample3.{i}.txt') fig, ax = plt.subplots(1, 1, figsize=(16,...
Sumrak1337/modern_computer_technologies
homework2/tasks/task3.py
task3.py
py
2,279
python
en
code
0
github-code
13
9570546696
from tkinter import * def find_gcd(): num1 = e1.get() num2 = e2.get() e1.delete(0, END) e2.delete(0, END) if num1.isdigit() and num2.isdigit(): num1 = int(num1) num2 = int(num2) if num2 > num1: num1, num2 = num2, num1 # swap in python r = num1 % num2 ...
hozan66/College-Practical-Code
Python (Cryptography)/pythonProject(GUI)/GUI3(find GCD using function).py
GUI3(find GCD using function).py
py
1,294
python
en
code
1
github-code
13
28364344675
from aws_cdk import ( Aws, aws_iam as iam, aws_secretsmanager as secretsmanager, CfnOutput ) from constructs import Construct class IAMSetup(Construct): def __init__(self, scope: Construct, construct_id: str, props: dict, **kwargs) -> None: super().__init__(scope, construct_...
velez94/cdkv2_prog_user_deploy
src/constructs/iam_role.py
iam_role.py
py
4,239
python
en
code
1
github-code
13
71270823697
import sys from math import ceil from collections import defaultdict from collections import OrderedDict class Reaction: def __init__(self, string): out, inp = self.parse_reaction(string) self.out_quantity = out[0] self.out_chemical = out[1] self.inp_chemicals = {} for in...
Lammatian/AdventOfCode
2019/14/sol.py
sol.py
py
2,847
python
en
code
1
github-code
13
48472110814
# -*- coding: utf-8 -*- """ Created on Sat May 28 12:35:50 2022 @author: Vijaya """ import math import matplotlib.pyplot as plt import pandas as pd import pickle with open ('locus_pos_list.pickle', 'rb') as f: locus_pos = pickle.load(f) standardRoom_mic_locs2 = [ [1.5,3.5, 0.9], [5.5,...
vnraomitnala/Device_Handover
plotMicrophoneTransition_basedOn_Distance_locus1_multiple.py
plotMicrophoneTransition_basedOn_Distance_locus1_multiple.py
py
1,495
python
en
code
0
github-code
13
24257212328
""" App's entrypoint """ from fastapi import FastAPI from fastapi.middleware.cors import CORSMiddleware from src.schema.prediction import Prediction from src.model.model import predict # App object app = FastAPI( title="DASS model deployment", version=1.0 ) # CORS app.add_middleware( CORSMiddleware, a...
ggonzr/mind-safeguard-api
src/api.py
api.py
py
594
python
en
code
0
github-code
13
40061024094
import cv2 import numpy as np #Delation avalia em cada pixel os pixels brancos na vizinhança. Caso ao menos um seja 1 (brancos) então o pixel #é transformado para branco. Caso contrário, ele permanece 0 (preto). image = cv2.imread('j.png', 0) kernel = np.ones((5, 5), np.uint8) dilation = cv2.dilate(image, ker...
wshusheng/Python-OpenCV
dilation.py
dilation.py
py
449
python
pt
code
0
github-code
13
27809793104
l=[] num=int(input("ENTER TOTAL NUMBER OF ELEMENT NEEDED : ")) for i in range(0,num): value=int(input("ENTER NUMBER : ")) l.append(value) t=tuple(l) max=t[0] for i in range(0,len(t)): if(t[i]>max): max=t[i] print("MAXIMUN ELEMENT IS : ",max)
chetanbhatt10/WEEK--DAY5
a22.py
a22.py
py
271
python
en
code
0
github-code
13
14523043830
from typing import List import pandas as pd from Warehouse.Attribute import Attribute, ForeignKey, SCDAttribute class Dimension: def __init__(self, name, metadata, dimensions, language="POSTGRES"): self.name = name self.attributes = [] self.dimensions = dimensions self.metadata = ...
becutandavid/Generating-SQL-code-for-ETL
Warehouse/Dimension.py
Dimension.py
py
14,010
python
en
code
0
github-code
13
7179962530
""" Script used to group each selected object in it's own seperate group """ # Standard library imports # Third party imports from maya import cmds # Local application imports def GroupEachSeperately(): sel = cmds.ls(selection=1) for object in sel: cmds.select(object) cmds.group(name='GR...
CatAndDogSoup/Maya_Tools
scripts/macros_utils/GroupEachSeperately.py
GroupEachSeperately.py
py
384
python
en
code
9
github-code
13
23795242571
import os import os.path as osp import sys import torch import torch.utils.data import cv2 import numpy as np import json from PIL import Image import matplotlib.pyplot as plt import matplotlib.image as mpimg from torchvision import transforms RGBD_HOME = 'C:\\Users\\Admin\\Desktop\\ssdRGBD\\data\\RGBD\\' dict_scenes...
FabioBer/RGBDexperiments
rgbd.py
rgbd.py
py
9,777
python
en
code
0
github-code
13
24204878460
import asyncio from playwright.async_api import async_playwright urls = [ "http://whatsmyuseragent.org/", "https://whatismyipaddress.com/", "https://mylocation.org/" ] async def scrape(url): async with async_playwright() as p: for browser_type in [p.chromium, p.firefox, p.webkit]: ...
psisysinsight/playwright_sync_python_getting_started
async_example.py
async_example.py
py
791
python
en
code
0
github-code
13
27364579272
import os import pytest import torch import torch.distributed as dist from torch import nn from torch.nn import functional as F import slapo from slapo import set_random_seed def test_dropout(init_dist): def verify(model, data, rank, local_rank, world_size, all_close): out = model(data) outs = ...
awslabs/slapo
tests/test_fork_rng.py
test_fork_rng.py
py
1,814
python
en
code
120
github-code
13
1775545396
# 提示用户输入一个整数 try: num = int(input("输入一个整数")) result = 8/num print(result) except ZeroDivisionError: print("除0错误") except ValueError: print("数值类型不匹配")
LBJ-Max/basepython
面向对象/异常2.py
异常2.py
py
226
python
zh
code
2
github-code
13
19997328329
import torch from torch import nn import numpy as np def flatten_trajectories(data): # merge batch and trajectory dimensions in data dictionary for key in data.keys(): if torch.is_tensor(data[key]): if data[key].ndim > 2: shape = [*data[key].shape] data[key]...
SAITPublic/SinGRAF
models/model_utils.py
model_utils.py
py
2,028
python
en
code
7
github-code
13
72564202258
import cv2 import skimage.exposure import numpy as np from numpy.random import default_rng # define random seed to change the pattern seedval = 55 rng = default_rng(seed=seedval) def create_segmentation_map(image): height, width = image.shape height -= 10 width -= 10 noise = rng.integers(0, 255, (heig...
AayushAgrawal2003/Deep-Blur
data/utilts.py
utilts.py
py
1,300
python
en
code
0
github-code
13
74436065618
import argparse import builtins import re from github import Github def run(github_file): print("About to blindly run {url}.\nType yes if you think that's a good idea.\nHint: it's not.".format( url=github_file.html_url )) if input().strip().lower() != "yes": print("Ok, not running it.") ...
jaksi/advent-of-other-peoples-code
advent.py
advent.py
py
2,040
python
en
code
77
github-code
13
26640162275
import math import pandas as pd import numpy as np import matplotlib.pyplot as plt import mlflow import seaborn as sns def save_results(results, fit_times, output_dir, options): save_csv(results, output_dir, options) plot_result(results, output_dir, options) save_time_csv(fit_times, output_dir, options) ...
raijin0704/TrDART
process/postprocess/save_results.py
save_results.py
py
3,914
python
en
code
0
github-code
13
17427442098
""" Serialize Binary Tree Problem Description Given the root node of a Binary Tree denoted by A. You have to Serialize the given Binary Tree in the described format. Serialize means encode it into a integer array denoting the Level Order Traversal of the given Binary Tree. NOTE: In the array, the NULL/None child is ...
vigneshSr91/MyProjects
Excercise76-SerializeBinaryTree.py
Excercise76-SerializeBinaryTree.py
py
3,020
python
en
code
0
github-code
13
41136459194
from platform_app.models import * from auth_app.models import * from django.shortcuts import get_object_or_404 from django.utils import timezone import copy __all__ = ("TaskService",) class TaskService: def info_match_check(self, user_pk: int, user_team: str) -> bool: query = User.objects.filter(id=user...
basicgrammer/simple-project4
backend/platform_app/Services/TaskService.py
TaskService.py
py
7,780
python
ko
code
0
github-code
13
10620997074
import numpy as np import tensorflow as tf from keras import backend as K __author__ = 'ignacio' class WMDDistance(object): #Implementation of Word Mover's Distance #Reference # From Word Embeddings To Document Distances # http://www.jmlr.org/proceedings/papers/v37/kusnerb15.pdf def __init_...
lizarraldeignacio/smartweb
isistan/smartweb/algorithm/WMDDistance.py
WMDDistance.py
py
3,258
python
en
code
0
github-code
13
2580455355
from django.urls import path from . import views from django.contrib.auth import views as auth_views app_name = "users" urlpatterns = [ path('register/', views.RegisterView.as_view(), name='RegisterView'), path('profile/', views.ProfilePageView.as_view(), name='ProfilePageView'), path('profile-edit/', vie...
AbdurRahman111/basic_ecommerce
users/urls.py
urls.py
py
576
python
en
code
0
github-code
13
11407937832
#!/usr/bin/env python # -*- coding: utf-8 -*- import json import multiprocessing as mp import os import socket import time import argparse from terminable_thread import Thread, threading from api.server import start_api_server from config import (docker_configuration, network_configuration, user_...
OWASP/Python-Honeypot
core/load.py
load.py
py
30,410
python
en
code
383
github-code
13
25539376617
# Definition for a binary tree node. class TreeNode(object): def __init__(self, x): self.val = x self.left = None self.right = None class Solution(object): def buildTree(self, preorder, inorder): """ :type preorder: List[int] :type inorder: List[int] :rt...
luppx/leetcode
jianzhioffer/firstround/jianzhi_07.py
jianzhi_07.py
py
1,378
python
en
code
0
github-code
13
36945460709
from collections import Counter def poly(s): res = '' dd = dict() sin = '' for k, v in Counter(s).most_common(): if v > 1: dd[k] = v elif v == 1 and (sin == '' or k < sin): sin = k for c in sorted(dd.keys()): res += c * (dd[c] // 2) if d...
iaramer/algorithms
python/mipt/mipt_contest/contest/C/problem_c.py
problem_c.py
py
751
python
en
code
0
github-code
13
73006149138
import os import numpy as np import glob from PIL import Image from jittor.dataset.dataset import Dataset import jittor.transform as transform import matplotlib.pyplot as plt import mxnet as mx def get_dataset(path, resolution, batch_size): root_path = os.path.join(path, str(resolution)) return FolderDataset(...
fengshikun/JittorStylegan
dataloader.py
dataloader.py
py
2,932
python
en
code
0
github-code
13
24111091423
import math from django.shortcuts import render from django.http import HttpResponse from django.views.decorators.csrf import csrf_exempt from rest_framework.decorators import api_view from django.http import JsonResponse from binance.client import Client, AsyncClient from binance.exceptions import BinanceAPIException...
707Plushka707/TradingClone
python_backend/api/views.py
views.py
py
16,196
python
en
code
0
github-code
13
8429922224
import bitcoin.base58 import bitcoin.core import colorcore.addresses import unittest import unittest.mock class Base58AddressTests(unittest.TestCase): def setUp(self): bitcoin.SelectParams('mainnet') def test_from_string_no_namespace(self): address = colorcore.addresses.Base58Address.from_s...
martexcoin/colorcore
tests/test_addresses.py
test_addresses.py
py
2,496
python
en
code
2
github-code
13
16131561693
from pprint import pp import graphene class Gender(graphene.Enum): MALE = "MALE Person" FEMALE = "FEMALE Person" OTHER = "OTHER Type Person" class Person(graphene.ObjectType): name = graphene.String() age = graphene.Int() gender = graphene.Field(Gender) class Query(graphene.ObjectType): ...
udhayprakash/PythonMaterial
python3/16_Web_Services/e_GraphQL/creating/a_graphene/b5_Enum_types.py
b5_Enum_types.py
py
661
python
en
code
7
github-code
13
8829825690
import pandas as pd users_info=pd.read_csv("./files/users-info.csv",index_col=0) users_score=pd.read_csv("./files/users-score-uname.csv",index_col=0) print(users_info.join(users_score.groupby(['username']).sum(),how='inner',on='username')) #groupy sum
Johnson-xie/jtthink_python_math
courseware/pandas/06/课件/class6.py
class6.py
py
259
python
en
code
0
github-code
13
13614760030
class Rlist(object): class EmptyList(object): def __len__(self): return 0 empty = EmptyList() def __init__(self, first, rest=empty): self.first = first self.rest = rest def rlist_to_list(rlist): """Take an RLIST and returns a Python list with the same elements. ...
clovery410/mycode
python/chapter-2/lab8-rlist-1.py
lab8-rlist-1.py
py
856
python
en
code
1
github-code
13
1531145341
"""A set of simple utility functions for array math.""" import numpy as np import scipy.signal as sps def reduce_by_midpoint(array): """Subtract off and divide by middle array element. Sorts the array before picking mid-point, but returned array is not sorted.""" midpoint = sorted(array)[int(np.round...
FaustinCarter/scraps
scraps/fitsS21/utils.py
utils.py
py
1,806
python
en
code
13
github-code
13
33149687979
import discord import praw from discord.ext import commands, tasks import random import requests import os from itertools import cycle filehandle = open("commands.md") filehandle = filehandle.read() bot = commands.Bot(command_prefix='$', case_insensitive=True) reddit = praw.Reddit(client_id=os.environ.get("praw_client_...
MuhammadAlzamily/fpath
discord_bot.py
discord_bot.py
py
3,549
python
en
code
0
github-code
13
543719080
import subprocess performance = ['sudo', 'sh', '-c', 'echo performance > /sys/devices/system/cpu/cpufreq/policy0/scaling_governor'] powersave = ['sudo', 'sh', '-c', 'echo powersave > /sys/devices/system/cpu/cpufreq/policy0/scaling_governor'] subprocess.check_call(performance) import tensorflow as tf import tensorflo...
RoboTuan/ML4IOT_HMW
HMW3/little_client.py
little_client.py
py
7,562
python
en
code
0
github-code
13
17700665509
from rest_framework import serializers from .models import Article, TaggedArticle, ArticleTag from django.contrib.auth.models import User from taggit_serializer.serializers import TaggitSerializer, TagListSerializerField from comments.fields import CommentArticleRelatedField class UserSerializer(serializers.ModelSeri...
oshevelo/jul_py_barbershop
barbershop/blog/serializers.py
serializers.py
py
1,184
python
en
code
0
github-code
13
71004553297
import os import shutil import torch import torch.nn as nn import torch.utils.data as data_utils from matplotlib import pyplot as plt from tqdm import tqdm from transformers import HerbertTokenizer, RobertaModel from config import Config from datasets.massive import IntentDataset from models.intent_classifier import ...
Kacprate/Intent-classification-Polish-language
train.py
train.py
py
6,189
python
en
code
0
github-code
13
3035417553
import matplotlib.pyplot as plt from matplotlib import rc import numpy as np # Set the global font and size rc('font',**{'family':'sans-serif','sans-serif':['DejaVu Sans'],'size':25}) # Set the font used for math rc('mathtext',**{'default':'regular'}) def stylize_axes(ax, size=25, legend=True, xlabel=None, ylabel=N...
cmoyacal/DAE-PINNs
src/utils/plots.py
plots.py
py
9,757
python
en
code
2
github-code
13
24186110246
import os import matplotlib.image as mpimg import csv import numpy as np import cv2 import matplotlib.pyplot as plt import math #cd /home/workspace/CarND-Behavioral-Cloning-P3 samples = [] #process data from csv data_path = './Drive_Data/' csv_path_filename = data_path + 'driving_log.csv' images_path = data_path + '...
JSachdev92/BehaviouralCloning
model.py
model.py
py
4,878
python
en
code
0
github-code
13
1652840945
# 开始一直提示AttributeError: 'NoneType' object has no attribute 'left',原来是要先判断节点存在。 # 虽然是自己写的,但是还是有点不理解后面两个if和最后return的关系,根据这个例子看来递归前面不一定要加return,只要递归函数内部有return即可。 # 同时,是先return再运算if里的递归的函数的,很奇怪,先标*吧 # Definition for a binary tree node. # class TreeNode(object): # def __init__(self, x): # self.val = x # ...
fire717/Algorithms
LeetCode/python/_226.InvertBinaryTree.py
_226.InvertBinaryTree.py
py
1,040
python
zh
code
6
github-code
13
35596982649
import numpy as np import cp2110 if __name__ == '__main__': # This will raise an exception if a device is not found. try: d = cp2110.CP2110Device(vid=0x10c4, pid=0xea80) except: raise IOError("Device not found") # You can also find a device by path. #cp2110.CP2110Device(path='/dev...
djorlando24/pyLabDataLogger
tests/test_cp2110.py
test_cp2110.py
py
2,977
python
en
code
11
github-code
13
73667101459
from rest_framework.viewsets import ViewSet from rest_framework.response import Response from rest_framework.request import Request from rest_framework import status from django.template.defaultfilters import slugify from .models import Campaign, Subscriber from .serializers import CampaignSerializer, SubscriberSerial...
DevJoshi030/Next-Demo-API
api/views.py
views.py
py
2,957
python
en
code
0
github-code
13
10396425009
from flask import Flask, request, render_template import data_utils import model_nn import sqlite3 import argparse import database as db app = Flask(__name__) @app.route("/", methods=["GET"]) def home(): return "This is a default landing page!" @app.route("/db/userdata", methods=["GET"]) def view_data(): conn...
slinakm/neuro_stress
backend/server.py
server.py
py
1,480
python
en
code
0
github-code
13
28571097975
class Person(): def __init__(self, nom, prenom) : self.nom = nom self.prenom = prenom def SePresenter(self): return "je suis " + self.nom + self.prenom p=Person("pelagie " , "AINTANGAR") j=Person("emmanuel ", "AINTANGAR") e=Person("eliakim ", "AINTANGAR") print(p.SePresenter()) print(j.S...
PELAGIE-AINTANGAR/runtrack-python-poo
runtrack_poo_jour1/job4.py
job4.py
py
356
python
en
code
0
github-code
13
12508828312
#!/usr/bin/env python3 import time import RPi.GPIO as GPIO build_in_trigger = \ ['rising', 'falling', 'both'] ''' func: trigger() ''' def trigger(channel_list, _name, params): edge_type = {'rising': GPIO.RISING, 'falling': GPIO.FALLING, 'both': GPIO.BOTH} for channel in channel_list: GPIO.a...
lwj786/RPi_GPIO_scheme
build_in_input.py
build_in_input.py
py
655
python
en
code
0
github-code
13
70864088658
# -*- coding: utf-8 -*- # emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: nil -*- # vi: set ft=python sts=4 ts=4 sw=4 et: """ Unit tests for elementary surfplot-based visualisations """ import pytest import nibabel as nb import numpy as np import pandas as pd import pyvista as pv from hyve_examples im...
hypercoil/hyve
tests/test_uniplot.py
test_uniplot.py
py
6,336
python
en
code
0
github-code
13
10465611815
def ler_fasta(arquivo): sequencia = '' dna = [] with open(arquivo, 'r') as fasta: sequencia = '' for linha in fasta: if not linha.startswith('>'): sequencia += linha else: kd = linha dna.append(sequen...
luchiago/bioinformatica
kdMer_old.py
kdMer_old.py
py
1,589
python
en
code
1
github-code
13