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
17669251690
#Trick is to first cyclic sort without caring for anything outside 1 to n. Then start adding missing values in result #and while doing this keep track of all ignored values since k might not be over till len(nums) so the ignored values might #be those nums. Then add additional values outside len till len(reult) not les...
SharmaManjul/DS-Algo
LeetCode/Hard/grok_findKthMissingPositiveNum.py
grok_findKthMissingPositiveNum.py
py
1,284
python
en
code
0
github-code
13
27282657908
import pygame import sys from pygame.locals import * pygame.init() size = width, height = 640, 480 bg = (255, 255, 255) clock = pygame.time.Clock() screen = pygame.display.set_mode(size) pygame.display.set_caption("FishC Demo") oturtle = pygame.image.load("turtle.png") turtle = pygame.transform.chop(o...
DodgeV/learning-programming
books/python/零基础入门学习Python(小甲鱼)全套源码课件/082Pygame:提高游戏的颜值2(源代码)/课堂演示/py_1.py
py_1.py
py
722
python
en
code
3
github-code
13
321264235
import matplotlib.pyplot as plt import pandas as pd import pylab as pl import numpy as np # read data df = pd.read_csv("winequality-red.csv") print(df.head(9)) cdf = df[['fixed_acidity','volatile_acidity','citric_acid','residual_sugar','chlorides','density','pH','alcohol','quality']] print(cdf.he...
spider2510/Regression
Regression/polynomial.py
polynomial.py
py
4,750
python
en
code
0
github-code
13
10273634689
# Importamos las clases y funciones del archivo protocolo.py from protocolo import * # Función del emisor def sender(socketio,____error,___secuencia): ___buffer = from_network_layer() # Obtener algo para enviar desde la capa de red s = Frame() # Crear un objeto frame s.info = ___buffer # Copiamos el paq...
johanec/Proyecto1-Redes
backend/utopia.py
utopia.py
py
924
python
es
code
0
github-code
13
4956513333
from http import HTTPStatus class CityNotFoundError(Exception): def __init__( self, expected_type: dict = {}, received_type: dict = {}, message: str = "", status_code: int = HTTPStatus.NOT_FOUND, *args, **kwargs ): super().__init__(args, kwargs) ...
penguinuux/rain-forecast-risk-alert-api
app/exceptions/city_exc.py
city_exc.py
py
2,186
python
en
code
3
github-code
13
86362336422
import numpy as np import tensorflow as tf import nrrd import os import matplotlib.pyplot as plt input_data_path = os.path.join('test_data', 'test_output_data.nrrd') # Load the volume input_data, input_data_header = nrrd.read(input_data_path) # XYZ # Normalize the data -> Values between 0 and 1 scaled_data = (input...
ChrisE087/3D_cell_counting
00-playground/scaling_target_data.py
scaling_target_data.py
py
1,040
python
en
code
0
github-code
13
37154810064
from __future__ import print_function, absolute_import, division import pytest from distutils.version import LooseVersion from astropy import units as u from astropy import wcs import numpy as np from . import path from .helpers import assert_allclose, assert_array_equal from .test_spectral_cube import cube_and_raw ...
mevtorres/astrotools
spectral_cube/tests/test_subcubes.py
test_subcubes.py
py
5,901
python
en
code
0
github-code
13
6990882425
from setuptools import setup, find_packages from aminoed import __version__ with open("README.md", "r") as stream: long_description = stream.read() setup( name="Amino.ed", version=__version__, url="https://github.com/Alert-Aigul/Amino.ed", download_url="https://github.com/Alert-Aigul/Amino.ed/arch...
Zetsu00167373/Amino.ed
setup.py
setup.py
py
1,339
python
en
code
0
github-code
13
25451219828
# coding:utf-8 # from celery import Celery,platforms import time from core.Subdomain_Baidu import Baidu from core.Subdomain_Brute import Brute from core.Subdomain_Crawl import Crawl from core.Subdomain_Api import Api from core.Url_Info import Get_Url_Info from core.Host_Info import Get_Ip_Info,Get_Alive_Url from core....
Mespoding/LangSrcCurise
core/main.py
main.py
py
25,972
python
en
code
null
github-code
13
73755550097
import tornado.web import traceback class BaseHandler(tornado.web.RequestHandler): async def prepare(self): user_id = self.get_secure_cookie("fyssionmediaserver_user") if user_id: self.current_user = await self.db.get_user(int(user_id)) if self.current_user: ...
Fyssion/FyssionMediaServer
server/handlers/base.py
base.py
py
906
python
en
code
0
github-code
13
25392857596
""" Provides date conversion functions, HistDate, and date scales. """ # ========== For conversion between calendars and Julian day numbers. ========== # Algorithms were obtained from: # https://en.wikipedia.org/wiki/Julian_day#Converting_Gregorian_calendar_date_to_Julian_Day_Number. def gregorianToJdn(year: int, mo...
terry06890/chrona
backend/hist_data/cal.py
cal.py
py
4,976
python
en
code
1
github-code
13
72966079699
from datetime import datetime, timedelta from logging import getLogger import pytz import time from random import Random from threading import Condition, Event, Thread from crab import CrabError, CrabEvent, CrabStatus from crab.service import CrabMinutely from crab.util.schedule import CrabSchedule HISTORY_COUNT = 10...
grahambell/crab
lib/crab/service/monitor.py
monitor.py
py
16,297
python
en
code
61
github-code
13
11707907717
import torch # import numpy as np # import cv2 from torch.utils.data import Dataset from pathlib import Path # from pycocotools.coco import COCO # from pycocotools import mask as cocomask import cv2 import numpy as np import skimage.io as io # import matplotlib.pyplot as plt # import pylab # import random # import prep...
Justdjent/kaggle_salt
dataset.py
dataset.py
py
8,191
python
en
code
0
github-code
13
72555580818
import random import time from email_build import buildEmail from confirmation_email import buildKeyEmail from lsts import giver_list, key_master giver = giver_list receiver = [name for name in giver] # this function randomly chooses a int within the range of the list provided an removes it from the list def pop_ran...
bparker12/xmasNameRandomizer
random_generator.py
random_generator.py
py
1,887
python
en
code
0
github-code
13
37473491574
startSequence = [] substitutions = {} READ_SEQUENCE=0 READ_SUBSTITUTIONS=1 inputMode = READ_SEQUENCE with open("input.txt") as FILE: for line in FILE.readlines(): line = line.strip() if inputMode == READ_SEQUENCE: if len(line)==0: inputMode = READ_SUBSTITUTIONS ...
Chromega/adventofcode
2021/Day14/day14.py
day14.py
py
1,873
python
en
code
0
github-code
13
30651904435
day = 0 age = 0 #Taking input age = int(input("Enter Age = ")) day = int(input("Enter Day of Week 1-7 :")) if (day==1) : print("The museum is closed.") if((day == 2) or (day == 4)): print("You get half price discount!") if(((age>=13) and (age<=20)) and (day == 3)) : print("Yo...
Umair-Manzoor-47/Semester-2
week 1/Meuseum.py
Meuseum.py
py
395
python
en
code
0
github-code
13
23240766238
import cozmo import time from iudrl_agent import IUDRL_Agent as Agent from torchvision.transforms.functional import * straight_drive = lambda robot: robot.drive_straight(cozmo.util.Distance(100), cozmo.util.Speed(100)) straight_drive_backwards = lambda robot: robot.drive_straight(cozmo.util.Distance(-100), cozmo.util....
reeshogue/Cozminimum
test.py
test.py
py
2,001
python
en
code
0
github-code
13
4849863092
from PyQt5.QtCore import * from PyQt5.QtGui import * from PyQt5.QtWidgets import * class InputPanel(QDialog): def __init__(self, parent, label, defaulttext): super(InputPanel, self).__init__(parent=parent) self.setWindowFlags(Qt.FramelessWindowHint) self._text = '' self.setObjectN...
renerocksai/sublimeless_zk
src/inputpanel.py
inputpanel.py
py
1,626
python
en
code
185
github-code
13
38921860304
# avg O(Log(n)) where n is the number of nodes. It's log of n because you eliminate half of the tree | O(n) def closest_value_in_bst_recursive(tree, target): return findClosestValueInBstHelper(tree, target, float("inf")) # Average: O(log(n)) time | O(log(n) space # worst: O(n) time | O(n) space def findClosestVal...
RysanekRivera/DataStructuresAndAlgorithmsPractice
src/problems/closestvalueinbst/ClosestValueInBST.py
ClosestValueInBST.py
py
1,357
python
en
code
0
github-code
13
16393503047
import logging import os import re import sys import traceback import yaml from datetime import datetime, timedelta, timezone from nexus_helper.nexus_helper import NexusHelper from zmpe import raise_error, zabbix_sender # Program settings settings = {} # Program logger logger = logging.getLogger() def main(): m...
MinistrBob/MyPythonTools
Nexus/nexus_repo_cleaner.py
nexus_repo_cleaner.py
py
8,032
python
en
code
0
github-code
13
1702506415
import requests from bs4 import BeautifulSoup class Movie: def __init__(self, link): headers = {"Accept-Language": "en-US,en;q=0.5", 'User-Agent': 'Mozilla/5.0'} response = requests.get(link, headers=headers) self.soup = BeautifulSoup(response.text, 'html.parser') d...
alexrotaru15/actors-crawler
classes.py
classes.py
py
1,168
python
en
code
0
github-code
13
37882360920
from copy import deepcopy readline = lambda: list(map(int, input().split())) N, M = readline() cloud_cord = [[N, 1], [N, 2], [N - 1, 1], [N - 1, 2]] basket = [] visited = [] move = [] DIRECTION = { 1: (0, -1), 2: (-1, -1), 3: (-1, 0), 4: (-1, 1), 5: (0, 1), 6: (1, 1), 7: (1, 0), 8: (1, ...
kod4284/kod-algo-note
백준/21610-마법사-상어와-비바라기/answer.py
answer.py
py
2,297
python
en
code
0
github-code
13
35654688522
file = open('abc.txt', 'w+') file.write('Linha 1\n') file.write('Linha 2\n') file.seek(0, 0) print('Lendo linhas: ', file.read()) print('########') file.seek(0, 0) for linha in file.readlines(): print(linha, end='') file.seek(0, 0) file.close() ############################################# try: file = ...
JonasFiechter/UDEMY-Python
aula_89_arquivos/aula_89.py
aula_89.py
py
1,198
python
en
code
0
github-code
13
73291335376
from hamcrest import * import cloudant import streaming.util def test_red_view(): db = streaming.util.create_streaming_db() v = db.view("foo", "bam") assert_that(v.rows, has_length(streaming.util.NUM_RED_ROWS[0])) assert_that(v.rows[0], has_entry("value", 1000)) def test_red_view_group_true(): ...
cloudant/quimby
streaming/1002-reduce-views-test.py
1002-reduce-views-test.py
py
1,157
python
en
code
0
github-code
13
26079235305
from math import pi def circle_area(radius): if type(radius) not in [int, float]: raise TypeError("Radius must be real non-negative number") if radius < 0: raise ValueError("Radius must be non-negative") return pi * radius ** 2 check_list = [1, 20, 37, -5, 2+3j, [1, 2,], True, 'string'] f...
PaulusCereus/unittests
testing_circle_area/circle.py
circle.py
py
441
python
en
code
0
github-code
13
70549207059
f = open("input") nums = [[int(c) for c in l] for l in f.read().splitlines()] width = len(nums[0]) height = len(nums) padding = 10 border = [padding] * (width + 2) nums = [border, *([padding, *l, padding] for l in nums), border] def get(x, y): return nums[y + 1][x + 1] def is_low(x, y): h = get(x, y) return (h < ...
Leowbattle/aoc2021
day09/day9a.py
day9a.py
py
512
python
en
code
0
github-code
13
31181390583
import os import re from collections import namedtuple import numpy as np from nltk.corpus import stopwords as sw from gensim.utils import simple_preprocess # Helper functions punctuations = '!"#$%&()\*\+,-\./:;<=>?@[\\]^_`{|}~' re_punc = re.compile(r"["+punctuations+r"]+") re_space = re.compile(r" +") stopwords...
zhewei-sun/slanggen
Code/util.py
util.py
py
3,244
python
en
code
5
github-code
13
13081561491
from shop.sales import Sales # Config what to buy: unavailable_black_totle = { 'name': 'black tote', 'url': 'https://www.hermes.com/us/en/product/herbag-zip-cabine-bag-H082835CKAC/' } available_hand_bag = { 'name': 'white hand bag', 'url': 'https://www.hermes.com/us/en/product/herbag-zip-cabine-bag-H0...
carerley/hermes
main.py
main.py
py
863
python
en
code
0
github-code
13
74166694417
import threading import time def thread_job(): # print("this is add_thread,number is %s"% threading.current_thread()) print("T1 start\n") for i in range(10): time.sleep(0.1) print("T1 finish\n") def T2_job(): print("T2 start\n") print("T2 finish\n") def main(): add_thread=threading.Thread(target=thread_job,n...
levinyi/scripts
crawler/thread_day1.py
thread_day1.py
py
620
python
en
code
8
github-code
13
9889031834
import cv2 import numpy as np import os import argparse import logging log_format = '%(created)f:%(levelname)s:%(message)s' logging.basicConfig(level=logging.DEBUG, format=log_format) # log to file filename='example.log', TAG = "edge-detector-full:" def detectEdges(img): height, width, depth = img.shape # ...
christhompson/recognizers-arch
apps/darkly/downsampling_edge_detector/edges.py
edges.py
py
2,153
python
en
code
1
github-code
13
8183857073
import Extract import Transform import Load import psutil import datetime def pipeline(url): start = datetime.datetime.now() print("pipeline started ...") print( f"extractData ended, CPU : {psutil.cpu_percent()}, Memory: {psutil.virtual_memory().percent}" ) extractedData = Extract.extract...
3zHrb/DataEngineering-UberProject
uber_project/uber_project_pipeline/pipeline.py
pipeline.py
py
814
python
en
code
0
github-code
13
39099868450
__author__ = 'Hakan Uyumaz' import json from django.shortcuts import get_object_or_404 from django.http import HttpResponse from ..models import User, FriendshipRequest from ..views import file responseJSON = {} def is_POST(request): if request.method != "POST": fail_response() responseJSON["m...
OEA/LetsEat
web/api/views/friendship_views.py
friendship_views.py
py
8,531
python
en
code
6
github-code
13
14502215246
input = open("../input/day02/input.txt", "r").readlines() horizontal = 0 depth = 0 aim = 0 for line in input: (command, x) = line.split(" ") x = int(x) if command == "forward": horizontal += x depth += aim * x elif command == "up": # depth -= x aim -= x elif command ...
verysamuel/advent-of-code-2021
python/day02.py
day02.py
py
395
python
en
code
1
github-code
13
73685126417
#To create SSL keys use: # # openssl genrsa -out webhook_pkey.pem 2048 # openssl req -new -x509 -days 3650 -key webhook_pkey.pem -out weebhook_cert.pem # # in "Common Name write the same value as in WEBHOOK_HOST" import telebot, json, requests, time, ssl, logging import ToPng from io import BytesIO from aiohttp impo...
Graftiger/Lab4_XLA
ImageToSticker_converter/src/main.py
main.py
py
4,560
python
en
code
0
github-code
13
31917665206
class Rekins(): def __init__(self,klients,veltijums,izmers,materials): self.klients = klients self.veltijums = veltijums self.izmers = izmers.split(",") self.materials = float (materials) sad_izm = self.izmers.split(",") print(sad_izm) self.aprekins(...
malinovskiss/2022-2023.g
13.09.2022.py
13.09.2022.py
py
1,215
python
lv
code
0
github-code
13
37451261520
import numpy as np import kcorrect as kc import astropy.table kc.load_templates() kc.load_filters(f='myfilter.dat') catalogues={} #======================================================================= balogh_data2 = astropy.table.Table.read('/home/dannyluo/cosmosdata/balogh_data2bands.csv', format='ascii.csv...
PiercingDan/cosmos-analysis
kcorrectscript.py
kcorrectscript.py
py
4,459
python
en
code
0
github-code
13
7579618412
#!/usr/bin/python3 '''Module for: function that divides all elements of a matrix''' def matrix_divided(matrix, div): ''' Divides all elements of a matrix. Args: matrix (list): A list of lists of integers or floats. div (int or float): A number to divide all elements of the matrix. Ret...
janymuong/alx-higher_level_programming
0x07-python-test_driven_development/2-matrix_divided.py
2-matrix_divided.py
py
1,445
python
en
code
0
github-code
13
14606304607
from param import * from sensors import GPS import Adafruit_BBIO.GPIO as GPIO import time import csv import math import traceback # GPS sample time sample_time = 1.0/gps_dataUpdateRate # Create GPS object gps = GPS() # Setup CSV file file_name = raw_input('Input the name of the file where the path will be recorded: ...
Hannnes1/autobike
Python_backup_20220402/record_path_latlon_old.py
record_path_latlon_old.py
py
3,139
python
en
code
0
github-code
13
43357078507
from collections import deque def solution(n, computers): def bfs(i): queue = deque() queue.append(i) while queue: i = queue.popleft() visited[i] = True for j in range(n): if computers[i][j] and not visited[j]: queue.a...
tr0up2r/coding-test
website/programmers/level3/113_network.py
113_network.py
py
480
python
en
code
0
github-code
13
11888689164
import numpy as np import tensorflow as tf class FeaturesLoss: def __init__(self, templates_images, model): self.templates_features = self.build_templates(templates_images, model) def build_templates(self, templates_images, model): templates = [] for i in range(templates_images.shape[...
LotanLevy/affordance_visualization
losses.py
losses.py
py
1,028
python
en
code
0
github-code
13
10591600758
from tqdm.notebook import tqdm import matplotlib.pyplot as plt import wandb import os import torch from torch.utils.data import DataLoader from torchvision import datasets from torchvision import transforms from torchvision.utils import save_image from torchvision.utils import make_grid import torch.nn as nn import to...
harshraj172/Compression-GAN
W-Gan/gan.py
gan.py
py
9,594
python
en
code
0
github-code
13
5870241881
class Solution: def nt(self, s): lst = (0, s[0]) res = list() i = 0 for i in range(len(s)): if s[i] != lst[1]: res.append(str(i-lst[0])) res.append(lst[1]) lst = (i, s[i]) res.append(str(i-lst[0]+1)) res.appe...
eric6356/LeetCode
countAndSay.py
countAndSay.py
py
522
python
en
code
0
github-code
13
15219581756
from multiprocessing import Process, Queue from robot_controller import Controller from text_parser import Parser import pyaudio import librosa import pickle import sounddevice as sd import numpy as np import threading from array import array import wave mapping = ['tien', 'lui', 'len', 'xuong', 'trai', 'phai', 'quay'...
ductm104/project_speech_processing
src/main.py
main.py
py
3,553
python
en
code
0
github-code
13
39349849965
def quicksorting(array): if len(array) < 2: return array else: pivot = array[0] less =[ i for i in array[1:] if i < pivot] greater =[ i for i in array[1:] if i > pivot] return quicksorting(less) + [pivot] + quicksorting(greater) print (quicksorting([10, 5, 2, 3, 6, 7, 6]...
Not-user-1984/My_Stady_lvl_0
Training_task/quick_sorting.py
quick_sorting.py
py
322
python
en
code
0
github-code
13
873276257
from termcolor import colored from pyfiglet import figlet_format from random import choice import colorama import requests colorama.init() txt = "DAD JOKE BY GOURAV" text= figlet_format(txt) print(colored(text,color="green")) topic = input("Let me tell you a joke! Give me a topic : ") url = "https://icanh...
gouravt38/Dad-Jokes
Dad_Joke.py
Dad_Joke.py
py
820
python
en
code
0
github-code
13
70361154898
import pymysql from app import app from db_config import mysql from flask import jsonify from flask import flash, request from util.lastId import get_last_id from util.sendGetResponse import send_get_response from LoginSignUp.util.required2 import token_required def update_days(cursor,data,res_id): # try: ...
garganshul108/BookMyTable
BackEnd/API/Restaurant/update.py
update.py
py
4,451
python
en
code
0
github-code
13
15912902356
from __future__ import absolute_import import functools import time from mom import codec __author__ = "yesudeep@google.com (Yesudeep Mangalapilly)" __all__ = [ "cert_time_to_seconds", "der_to_pem", "der_to_pem_certificate", "der_to_pem_private_key", "der_to_pem_private_rsa_key", "der_to_pe...
gorakhargosh/mom
mom/security/codec/pem/__init__.py
__init__.py
py
4,490
python
en
code
37
github-code
13
18157680264
"""Day03 - puzzle solutions for day 03.""" def load_data(path: str) -> list[str]: """Load and split data from file.""" rows = [] with open(path, encoding="ascii") as file: for row in file: rows.append(row.rstrip()) return rows def part1(input): sumOfItemPriorities = 0 for l...
Sfera-IT/adventofcode2022
maramazza/3/3.py
3.py
py
1,412
python
en
code
2
github-code
13
13670822233
DOCUMENTATION = r""" --- module: iam_server_certificate_info version_added: 1.0.0 short_description: Retrieve the information of a server certificate description: - Retrieve the attributes of a server certificate. author: - "Allen Sanabria (@linuxdynasty)" options: name: description: - The name of the s...
ansible-collections/community.aws
plugins/modules/iam_server_certificate_info.py
iam_server_certificate_info.py
py
4,833
python
en
code
174
github-code
13
5210242311
""" Given a string s, return the longest palindromic substring in s. Example 1: Input: s = "babad" Output: "bab" Note: "aba" is also a valid answer. Example 2: Input: s = "cbbd" Output: "bb" Example 3: Input: s = "a" Output: "a" Example 4: Input: s = "ac" Output: "a" Constraints: 1 <= s.length <= 1000 ...
1like2learn/code-puzzle-solutions
Puzzles/longest-palindromic-substring.py
longest-palindromic-substring.py
py
2,940
python
en
code
0
github-code
13
30182526521
from proton.reactor import Reactor from datawire import Agent, Container, Linker, Tether, Processor import common class BizLogic(object): def __init__(self, args): self.host = args.host self.port = args.port self.tether = Tether(None, "//%s/bizlogic" % self.host, None, ...
datawire/datawire-common
barker/bizlogic.py
bizlogic.py
py
1,873
python
en
code
2
github-code
13
17351740316
import torch, glob, os def checkpoint_restore(model,exp_name,name2,use_cuda=True,epoch=0): if use_cuda: model.cpu() if epoch>0: f=exp_name+'-%09d-'%epoch+name2+'.pth' assert os.path.isfile(f) print('Restore from ' + f) model.load_state_dict(torch.load(f)) else: ...
Benzlxs/spconv_scannet
spconv/util.py
util.py
py
1,112
python
en
code
2
github-code
13
73606120016
# %% import pandas as pd import requests as rq import time import os import hashlib import hmac from apikey_bitmex import API_KEY, API_SECRET BASE_URL = 'https://www.bitmex.com' DATE_FROM = pd.Timestamp('2022-01-30') DATE_TILL = pd.Timestamp('2022-08-04') SYMBOLS = ['XBTUSD', 'ETHUSD'] PATH = os.path.abspath(os.path.d...
bellerofonte/skillfactory-dst-50
final/src/history/hst-bitmex.py
hst-bitmex.py
py
2,999
python
en
code
0
github-code
13
34131806897
import pandas as pd import numpy as np from sklearn.linear_model import Lasso, LassoCV from sklearn.model_selection import train_test_split from scipy.stats import pearsonr from collections import Counter from tqdm import tqdm import utils import gnk_model """ Code for running LASSO experiments on empirical fitness f...
dhbrookes/FitnessSparsity
src/empirical_lasso.py
empirical_lasso.py
py
2,494
python
en
code
6
github-code
13
73645040019
class Fuctura(): def __init__(self, nome, matricula, telefone, email): self.nome = nome self.matricula = matricula self.telefone = telefone self.email = email aluno1 = Fuctura('André', '123', '987648036', 'andregabriel_lima@hotmail.com.br') print(aluno1.nome) aluno2 = Fuctu...
AndreGabrielLima/aulasDePython1
class2.py
class2.py
py
398
python
pt
code
1
github-code
13
998041337
from django.contrib import admin from django.urls import path from . import views from .views import detalhe from django.conf.urls.static import static from django.conf import settings urlpatterns = [ path('admin/', admin.site.urls), path('', views.home, name='home'), path('links', views.links, name='links'),...
CleverssonHames/intranetgav
urls.py
urls.py
py
1,024
python
es
code
0
github-code
13
7125320647
import openslide from PIL import Image from math import ceil import os from os import listdir from os.path import isfile, join, isdir import glob def get_image_paths(folder): image_paths = [join(folder, f) for f in listdir(folder) if isfile(join(folder, f))] if join(folder, '.DS_Store') in image_paths: ...
GeNeHetX/Histology_ResNet50_Features
svs_conversion/convert_svs.py
convert_svs.py
py
4,241
python
en
code
0
github-code
13
41766793632
# Definition for a binary tree node. # class TreeNode: # def __init__(self, val=0, left=None, right=None): # self.val = val # self.left = left # self.right = right class Solution: def findPairs(self, d1, d2): for d_i in d1: for d_j in d2: if a...
ritwik-deshpande/LeetCode
1530-number-of-good-leaf-nodes-pairs/1530-number-of-good-leaf-nodes-pairs.py
1530-number-of-good-leaf-nodes-pairs.py
py
1,041
python
en
code
0
github-code
13
17050089094
#!/usr/bin/env python # -*- coding: utf-8 -*- import json from alipay.aop.api.constant.ParamConstants import * class CodeResult(object): def __init__(self): self._code = None self._code_token = None self._code_url = None @property def code(self): return self._code @...
alipay/alipay-sdk-python-all
alipay/aop/api/domain/CodeResult.py
CodeResult.py
py
1,755
python
en
code
241
github-code
13
24376457332
from reboot.common.dbutils import MySQLHelper CNT = 1 CPU_PERCENT = 0.2 RAM_PERCENT = 50 db = MySQLHelper() def has_alarm(ip): # CPU&RAM 大于80% _sql = 'select cpu,ram from performs where ip=%s order by time desc limit %s' _args = (ip, CNT) count, rt_list = db.fetch_all(sql=_sql, args=_args) cpu =...
chenjinhui520/Python
reboot/common/monitor.py
monitor.py
py
922
python
en
code
0
github-code
13
10609925127
# coding:utf-8 """ Filename : api.py Role : api with pipelines hosting @author : Sunwaee """ import os import time import fasttext from fastapi import FastAPI def ready_api_content(): """ Puts models in buffers and prepare API for requesting. """ # Changing os dir dir_buffer = os.getcwd() ...
DvdNss/sunwaee-mt5-api
api.py
api.py
py
1,859
python
en
code
1
github-code
13
26436456730
"""Test delete_flashcards_row application use case for Flashcards entity""" from logogram.tests.base_test import BaseTestCase from logogram.common.execute.execute_command_fetch_data import ( ExecuteCommandFetchData) from logogram.users.insert_rows.insert_rows import insert_user_row from logogram.flashcards.insert_r...
WinstonKamau/DatabasePlayBook
src/database_playbook/logogram/tests/flashcards/test_delete_row.py
test_delete_row.py
py
1,826
python
en
code
0
github-code
13
19527920532
import queue from flask import Flask, jsonify,request,Blueprint import pymongo from bson.objectid import ObjectId from datetime import date, datetime, timedelta ### integration from Database.Database import Database as mydb from flask_cors import cross_origin from functools import wraps import jwt # myclient = pymongo...
OmarNashat01/Back-End-Twitter-Clone
Routes/notifications/get_by_notification_id.py
get_by_notification_id.py
py
2,498
python
en
code
2
github-code
13
23793192606
from flask import Flask, render_template, abort, request, jsonify from models import * from controllers import * from db import create_db import subprocess # ----- # index # ----- @app.route('/') def index(): return render_template('index.html') # -------- # about # -------- @app.route('/about/') def about(): ...
RobinsonNguyen/cs373-idb
main.py
main.py
py
6,254
python
en
code
0
github-code
13
38433681797
import win32event, time mutex = win32event.CreateMutex(None, True, "WEBLAUNCHASSIST_MUTEX") # try to acquire the mutex result = win32event.WaitForSingleObject(mutex, 0) if result == win32event.WAIT_OBJECT_0: print("Acquired the mutex, going to sleep for a minute") time.sleep(60) win32event.ReleaseMutex...
MocanuAlexandru/LabWork
Reverse Engineering/Laboratory 1/Solutions/taskbonus_vaccine.py
taskbonus_vaccine.py
py
459
python
en
code
0
github-code
13
72436173777
import json import uuid from tornado.web import RequestHandler from tornado.web import Application from tornado.ioloop import IOLoop from tornado.options import options, define, parse_command_line class LoginHandler(RequestHandler): users = [{ 'id': 1, 'name': 'disen', 'pwd': '123', ...
yixialei0215/microServer
other/api_server.py
api_server.py
py
5,288
python
en
code
0
github-code
13
5991246147
import pandas as pd import numpy as np import os import sys import time import logging from logging.handlers import RotatingFileHandler import matplotlib.pyplot as plt from sklearn.model_selection import train_test_split from config import Config class Dataset: def __init__(self, config): self.config = co...
moujin/soothsayer
dataset_stock.py
dataset_stock.py
py
4,244
python
en
code
0
github-code
13
12256054290
class DetectPPE: def __init__(self, client, imgfilename): self.dict = [] with open(imgfilename, 'rb') as imgfile: self.imgbytes = imgfile.read() self.response = client.detect_protective_equipment(Image={'Bytes': self.imgbytes}, SummarizationAttributes={'MinConfidence'...
welly50704/AWS-API-MODULE
AWS-API-MODULE/Recognition.py
Recognition.py
py
8,203
python
en
code
1
github-code
13
1619799670
import httplib import traceback import os,sys def webscale_errorhook(excType, excValue, traceback): api = os.environ.get('ERROR_API', "api.error.technology") params = os.environ.get("ERROR_API_PARAMS", "") conn = httplib.HTTPConnection(api) conn.request("GET", "/?lang=python&full=true"+ params) res...
euank/error.technology
pythonlib/errortech.py
errortech.py
py
423
python
en
code
1
github-code
13
15495575751
from setuptools import setup, find_packages with open('README.md') as f: readme = f.read() setup( name='nglutils', version='0.1.1', description='NGL utils for trajectory visualization', long_description=readme, author='Simon Grosse-Holz', url='https://github.com/mirnylab/nglutils', packa...
mirnylab/nglutils
setup.py
setup.py
py
706
python
en
code
2
github-code
13
9484972317
#!/usr/bin/env python # -*- coding=utf-8 -*- __author__ = "柯博文老師 Powen Ko, www.powenko.com" from sklearn import datasets from sklearn.model_selection import train_test_split import tensorflow as tf import numpy as np iris = datasets.load_iris() category=3 dim=4 x_train , x_test , y_train , y_test = train_test_split...
jtlai0921/sampleCode
ch29/01-Iris-MLP_show.py
01-Iris-MLP_show.py
py
1,711
python
en
code
0
github-code
13
72947644819
# python standard # JSON support to load the database info from typing import Dict, Union from datetime import datetime, timedelta # components of the factory from .object import Material, Producer, Obj_Initial from .object.tool_data import SQL from graphviz import Digraph # pytorch import torch # load database info...
RuihanRZhao/Efficiency_RL
src/game/factory/environment.py
environment.py
py
10,368
python
en
code
2
github-code
13
26943696493
import os import server import unittest import tempfile class FlaskrTestCase(unittest.TestCase): def setUp(self): self.db_fd, server.app.config['DATABASE'] = tempfile.mkstemp() server.app.config['TESTING'] = True self.app = server.app.test_client() #server.init_db() def tearDo...
bds-orsk/1CMonitorService
ObmenMonitor_test.py
ObmenMonitor_test.py
py
814
python
en
code
1
github-code
13
70865475537
import torch import math import random AUG_TYPE = {0: 'resize_padding', 1: 'translation', 2: 'rotation', 3: 'gaussian_noise', 4: 'horizontal_flip', 5: 'vertical_flip', 6: 'scaling', 7: 'invert', 8: 'solarize'} def augmentation(img_tensor, op_type, magnitude): ''' augmentation that capable...
HaojieYuan/autoAdv
aug_search.py
aug_search.py
py
5,664
python
en
code
1
github-code
13
31494146312
# Faça um Programa que verifique se uma letra digitada é "F" ou "M". # Conforme a letra escrever: F - Feminino, M - Masculino, Sexo Inválido. a = input('Digite (M) para masculino \n Digite (F) para feminino') a = a.upper() a = a.strip() if a == 'M': print('Sexo Masculino selecionado.') elif a == 'F': ...
GuilhermeMastelini/Exercicios_documentacao_Python
Estrutura de Decisão/Lição 3.py
Lição 3.py
py
401
python
pt
code
0
github-code
13
74852657616
from __future__ import unicode_literals import logging import sys import json import click try: from importlib import metadata except ImportError: # for Python<3.8 import importlib_metadata as metadata from colorama import init from .api import get_threads, get_posts from .threads import ( parse_threads...
davegallant/rfd
rfd/cli.py
cli.py
py
4,859
python
en
code
9
github-code
13
7494436973
from tkinter import * from tkinter import filedialog class FileDir: def __init__(self, root, GUIManagerWidgetsList): self.path = None # Global variable to store path from user self.readSettings() row = Frame(root) # File Path Button lab = Label(row, width=20, text="Excel ...
DavidCastillo2/GrouponScraper
tKinter/fileDir.py
fileDir.py
py
1,709
python
en
code
0
github-code
13
3356302380
# print("Hello World!") # print("Day 1 - Python Print Function") # print("The function is declared like this:") # print("print('what to print')") # \n makes a new line # print("Hello World\nHello World\nHello World") # print("Hello" + " Sean") #Fix the code below # print("Day 1 - String Manipulation") # print("Str...
SeanUnland/Python
Python Day 1/main.py
main.py
py
1,065
python
en
code
0
github-code
13
36815579547
from CoolProp.CoolProp import PropsSI as prop from CoolProp.CoolProp import PhaseSI as fase from matplotlib import pyplot as plot from tabulate import tabulate t1 = 300 t3 = 300 p1 = 0.1 * (10**6) p4 = 1.2 * (10**6) s1 = prop('S', 'T', t1, 'P', p1, 'air') s2 = s1 for i in range(100): p2 = (i/100000000000 + .34657...
fttaunton/Tarea-3-Conversi-n-de-Energ-a
Codigo/T3P42.py
T3P42.py
py
723
python
en
code
0
github-code
13
40640501305
# exact data from orca output import re import os import sys import numpy as np from tqdm import tqdm from energy_calc import calculate_energy_xtb # file path re_coor = re.compile(r'\s*(\d{0,3}[A-Z][a-z]?)\s+(\S+)\s+(\S+)\s+(\S+)\s*') re_double_end_line = re.compile(r'\n\s*\n') atom_index_table = { '...
MWFudan/MolStruFitting
XTB_sort/xtb_sort.py
xtb_sort.py
py
1,896
python
en
code
0
github-code
13
38035526825
# -*- coding: utf-8 -*- """ Created on Fri Feb 19 12:36:44 2021 @author: Maxi """ #Decimal to binary num = 11 if num < 0: isNeg = True num = abs(num) else: isNeg = False result = '' if num == 0: result = '0' while num > 0: result = str(num%2) + result num = num//2 if is...
Maxdelsur/Introduction-to-Computer-Science-and-Programming-Using-Python
Unit two/lect 3/Lect 3 - Floats and Fractions.py
Lect 3 - Floats and Fractions.py
py
1,209
python
en
code
0
github-code
13
71139106259
from __future__ import print_function from option import * from model import * from load_data import * import torch opt = Option()() model = create_model(opt) batch_size = opt.batch_size is_small = opt.is_small if 'EFG' in opt.model: if 'CYC' in opt.model: transformed_dataset = EFGDataset(mode='training',...
klory/s2f2e
train.py
train.py
py
3,010
python
en
code
1
github-code
13
29008104720
from typing import Tuple, List, Dict, Union import numpy as np from dataloaders.batchdatagenerator import BatchDataGenerator class NetworkCheckerBase(object): def __init__(self, size_image: Union[Tuple[int, int, int], Tuple[int, int]]) -> None: self._size_image = size_image def get_network_layers_...
antonioguj/bronchinet
src/models/networkchecker.py
networkchecker.py
py
2,355
python
en
code
42
github-code
13
6727542080
import talib import configargparse import datetime as dt import numpy as np import pandas as pd from .base import Base import core.common as common from .enums import TradeState from core.bots.enums import BuySellMode from core.tradeaction import TradeAction from lib.indicators.stoploss import StopLoss from sklearn imp...
OlzhasAldabergenov/trading_bot_huobi
strategies/emasuperprediction.py
emasuperprediction.py
py
13,415
python
en
code
1
github-code
13
42125658463
import os.path import pandas as pd import skbio import qiime2 from ._utilities import (_get_group_pairs, _extract_distance_distribution, _visualize, _validate_metadata_is_superset, _get_pairwise_differences, _stats_and_visuals, _add_metric_to_...
gregcaporaso/q2-longitudinal
q2_longitudinal/_longitudinal.py
_longitudinal.py
py
10,952
python
en
code
null
github-code
13
13555146753
import os import sys try: from setuptools import setup, find_packages from setuptools.command.install_lib import install_lib as InstallLib except ImportError: print("cmlxztp now needs setuptools in order to build. Install it using" " your package manager (usually python-setuptools) or via pip (pi...
Mellanox/cmlx_ztp
setup.py
setup.py
py
2,477
python
en
code
0
github-code
13
27152236144
from unicodedata import name from xml.etree.ElementTree import Comment from django.shortcuts import render from django.contrib.auth.decorators import login_required from django.http import HttpResponse from django.template import loader from django.shortcuts import render, get_object_or_404, redirect from user.models i...
marijamilanovic/UksGitHub
Uks/repository/views.py
views.py
py
23,726
python
en
code
0
github-code
13
30584729752
# Definition for a Node. class Node: def __init__(self, val=None, children=None): self.val = val self.children = children class Solution: def maxDepth(self, root: 'Node') -> int: if not root: return 0 # will contain [Node, depth] stack = [[root, 1]] ...
dark-shade/CompetitiveCoding
LeetCode/332/559.py
559.py
py
648
python
en
code
0
github-code
13
34315934793
from sklearn.datasets import load_iris from sklearn.model_selection import train_test_split from sklearn.neighbors import KNeighborsClassifier data = load_iris() x_train, x_test, y_train, y_test = train_test_split(data['data'], data['target'], test_size=0.1) classifier = KNeighborsClassifier(n_neighbors=5) classifier...
fauwara/aiml
p8/test.py
test.py
py
408
python
en
code
0
github-code
13
22483786873
import os import requests # get environment variables APIFY_USER_ID = os.getenv('APIFY_USER_ID', '') APIFY_CRAWLER_ID = os.getenv('APIFY_CRAWLER_ID', '') APIFY_TOKEN = os.getenv('APIFY_TOKEN', '') # start crawler execution run r = requests.post(f'https://api.apify.com/v1/{APIFY_USER_ID}/crawlers/{APIFY_CRAWLER_ID}/ex...
stacybrock/pollenwatch
pollenwatch.py
pollenwatch.py
py
1,316
python
en
code
0
github-code
13
42418244385
import pandas from matplotlib import pyplot as plt from sklearn.feature_selection import RFECV from sklearn.preprocessing import StandardScaler from sklearn.svm import LinearSVC from sklearn.svm import SVC cv = 4 input_filename = 'dataset.csv' print('==> Reading file (' + input_filename + ')') data_frame = pandas.rea...
festeban26/data_mining_usfq_projects
[4] Normalización y reducción/src/main.py
main.py
py
4,377
python
en
code
0
github-code
13
28351354753
class Solution: def wiggleMaxLength(self, nums: List[int]) -> int: ###dp # n=len(nums) # dp=[[1]*2 for i in range(n)] # maxi=1 # for i in range(1,n): # po=ne=0 # for j in range(i-1,-1,-1): # if nums[j]>nums[i]: # ...
saurabhjain17/leetcode-coding-questions
376-wiggle-subsequence/376-wiggle-subsequence.py
376-wiggle-subsequence.py
py
935
python
en
code
1
github-code
13
40451873025
import graphviz from bs4 import BeautifulSoup import threading import os from fiber import fiber filePathName = "test-output/round-table.gv" filePublic = "test-output" mode = "svg" eventMap = {} eventList = ["click"] def pushData(initList,viewData,childName): # print(viewData,childName) initList.append({ ...
cailuan/graphvizView
main.py
main.py
py
5,857
python
en
code
0
github-code
13
8249689442
#!/usr/bin/python3 import i3 # retrieve only active outputs outputs = list(filter(lambda output: output['active'], i3.get_outputs())) current_ws = i3.filter(i3.get_workspaces(), focused=True)[0]['name'] for output in outputs: # set current workspace to the one active on that output i3.workspace(output['current_w...
JonaLoeffler/dotfiles
.config/i3/swap_workspaces.py
swap_workspaces.py
py
510
python
en
code
0
github-code
13
17189724214
import random import structlog from locust import FastHttpUser, constant, task from .gql.mutations import dasri_create, form_create, form_update from .gql.queries import (base_bsdas_query, base_bsffs_query, base_dasri_query, base_form_query, base_forms_query, base_vhus_query, ...
MTES-MCT/td-load-testing
src/locustfiles/scenario_more_queries.py
scenario_more_queries.py
py
10,029
python
en
code
0
github-code
13
12548976459
import csv, requests, re from httplib2 import Response # repo: expected as user/repository or company/repository repo = '' # token: have a look here https://github.com/settings/tokens token = '' out_path = "." # first (there is a link pagination) github url. # in this case I'll download all issues # more filters av...
gigadr3w/github-issues-to-csv
github-issues-to-csv.py
github-issues-to-csv.py
py
2,250
python
en
code
1
github-code
13
11236608855
import os import random from pytorch_lightning import Trainer, seed_everything from pytorch_lightning.callbacks import EarlyStopping, ModelCheckpoint, RichModelSummary, RichProgressBar from pytorch_lightning.loggers import TensorBoardLogger from rindti.data import DTIDataModule from rindti.models import Classificatio...
ilsenatorov/rindti
train.py
train.py
py
2,765
python
en
code
8
github-code
13
74165325136
#!/usr/bin/python3 from __future__ import print_function import sys if len(sys.argv) > 1: entries = [] with open(sys.argv[1], "r") as f: for i in f: entries.append( (i[0],) + tuple(i[1:].rstrip().split("\t"))) print(str(entries).replace("), ", "),\n\t")) else: print("Usage:\n\tdir2python <filename>")
felixp7/gophersnake
dir2python.py
dir2python.py
py
318
python
en
code
15
github-code
13
30584286008
# coding=utf-8 """ Utilities for ETL part """ import collections from datetime import datetime from dateutil.parser import parse from requests.exceptions import ConnectionError ERROR_MSG_DATEIFY_INVALID_DATE = ( 'dateify: ' + 'Invalid date without null values allowed') # Requests error management def connecti...
dbenlopers/SANDBOX
misc/data_quality_is/ge.ibis.etl/ge/ibis/etl/utilities.py
utilities.py
py
4,204
python
en
code
0
github-code
13
26755603622
import numpy as np import pandas as pd import matplotlib.pyplot as plt debug=False # flag to debug lamb_=3 # for regularization term in loss function (given in question) lr=0.2 #learning rate (given in question) iter_num=500 #given number of iterations for batch gradient input_features = pd.read_csv('./data/...
ialrazi/CSCE-5063-Machine-Learning-
Assignment_3_Solution/assignment_3_solution_010850660.py
assignment_3_solution_010850660.py
py
6,079
python
en
code
0
github-code
13