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
42641515679
# -*- coding: utf-8 -*- # @Time : 2020/12/13 11:04 # @Author : Joker # @Site : # @File : draw.py # @Software: PyCharm import numpy as np import matplotlib.pyplot as plt m = 20 # 行 n = 2 # 列 c = 5 # 分类数量 test_point = [2, 6] # 测试点数据 if __name__ == '__main__': # 文件地址 path = "C:/Users/99259/source...
Chimaeras/Data_Mining_ex
src/category_draw.py
category_draw.py
py
3,852
python
en
code
0
github-code
6
2856090188
import unittest from conans.test.tools import TestClient from conans.util.files import load import os import platform class ConanEnvTest(unittest.TestCase): def conan_env_deps_test(self): client = TestClient() conanfile = ''' from conans import ConanFile class HelloConan(ConanFile): name = "...
AversivePlusPlus/AversivePlusPlus
tools/conan/conans/test/integration/conan_env_test.py
conan_env_test.py
py
2,180
python
en
code
31
github-code
6
40796544139
import pydantic from pydantic import validator import typing from uuid import UUID, uuid4 class SchemaCustomer(pydantic.BaseModel): id: str name: str last_name: str email: pydantic.EmailStr age: pydantic.PositiveInt @validator('id', pre=True, always=True) def convert_id_to_str(cls, v): ...
edmon1024/workshop-api-ejemplo-fastapi
app/schemas.py
schemas.py
py
708
python
en
code
0
github-code
6
26671808814
#Diccionario para los datos clientes={45471:["Luis Perez",45,"BJX", True], 8944411:["FernandaGarcia",25,"JAL", True], 5223:["Alejandra Ortiz",33,"JDL", True]} #se crean una funcion para agregar clientes def Agregar(): #Bucle para evitar errores con el input del INE while True: ...
JoseCarlosLugo/Ejercicio-retadores-6-7-8
Ejercicio_8_func.py
Ejercicio_8_func.py
py
6,125
python
es
code
0
github-code
6
11670856973
# See subject at https://www.ilemaths.net/sujet-suite-864999.html """ La suite de Conway """ from itertools import groupby, islice def gen_conway(germe): """Génère la suite de Conway à partir du germe""" while True: yield germe germe = ''.join(f"{len(tuple(g))}{c}" for c, g in groupby(germe...
bdaene/ilemaths
suite-864999.py
suite-864999.py
py
667
python
fr
code
0
github-code
6
32094902662
''' 1251번 단어 나누기 문제 알파벳 소문자로 이루어진 단어 단어를 길이가 1 이상인 세 개의 더 작은 단어로 나누는 나눈 세 개의 작은 단어들을 앞뒤를 뒤집고, 이를 다시 원래의 순서대로 합친다. 단어 : arrested 세 단어로 나누기 : ar / rest / ed 각각 뒤집기 : ra / tser / de 합치기 : ratserde 단어가 주어지면, 이렇게 만들 수 있는 단어 중에서 사전순으로 가장 앞서는 단어를 출력하는 프로그램을 작성하시오. 입력 첫째 줄에 영어 소문자로 된 단어가 주어진다. 길이는 3 이상 50 이하이다. 출력 첫째 줄에 구하고...
doll2gom/TIL
KDT/week6/02.03/4_1251.py
4_1251.py
py
2,583
python
ko
code
2
github-code
6
74537456828
import numpy as np, cv2 def draw_histo(hist, shape=(200, 256)): hist_img = np.full(shape, 255, np.uint8) # 흰색이 배경이 되도록 초기화 cv2.normalize(hist, hist, 0, shape[0], cv2.NORM_MINMAX) # 최솟값이 0, 최대값이 그래프의 높이 값을 갖도록 빈도값을 조정 gap = hist_img.shape[1]/hist.shape[0] for i, h in enumerate(hist): x =...
binlee52/OpenCV-python
Common/histogram.py
histogram.py
py
539
python
en
code
1
github-code
6
10699282838
import tensorflow as tf import os from xdnlp.utils import default_logger as logging def load_data_from_directory(_path: str, batch_size, validation_split=0.1, seed=123, label_mode='categorical', train=True): """train_dir: the train data dir test_dir: the test data dir Just...
mikuh/xdnlp
xdnlp/classify/utils.py
utils.py
py
2,972
python
en
code
1
github-code
6
71484039228
class Cube: def __init__(self, x, y, z, s): self.x, self.y, self.z = x, y, z self.s = s def is_in_cube(self, x, y, z): return self.x <= x <= self.x + self.s and self.y <= y <= self.y + self.s and self.z <= z <= self.z + self.s def intersect(self, C): dxyz = [(0, 0, 0), ...
knuu/competitive-programming
aoj/16/aoj1612.py
aoj1612.py
py
2,362
python
en
code
1
github-code
6
70416778427
from config import config import random import requests import chardet from db.db_select import sqlhelper import threading lock = threading.Lock() class Downloader(object): @staticmethod def download(url): try: r = requests.get(url=url, headers=config.get_header(), timeout=config.TIMEOUT)...
queenswang/IpProxyPool
spider/HtmlDownloader.py
HtmlDownloader.py
py
1,469
python
en
code
0
github-code
6
6460673982
import logging from pprint import pprint # noqa from olefile import isOleFile, OleFileIO from ingestors.support.timestamp import TimestampSupport from ingestors.support.encoding import EncodingSupport log = logging.getLogger(__name__) class OLESupport(TimestampSupport, EncodingSupport): """Provides helpers for...
alephdata/ingest-file
ingestors/support/ole.py
ole.py
py
2,390
python
en
code
45
github-code
6
19993528742
""" This script crawls data about Malaysian stock indices and stores the output in a csv file. """ import requests from bs4 import BeautifulSoup import time #Website to get the indices base_url = 'https://www.investing.com/indices/malaysia-indices?' print('Scraping: ' + base_url) headers = {'User-Agent':...
ammar1y/Data-Mining-Assignment
Web crawlers/Malaysian stock indices crawler.py
Malaysian stock indices crawler.py
py
3,548
python
en
code
0
github-code
6
20972621530
import sys import random import math from tools.model import io import torch import torch.nn as nn import torch.nn.functional as F from torch.autograd import Variable from detection import box, anchors, display, evaluate, loss import argparse from detection.models import models from tools.image import cv def ran...
oliver-batchelor/detection
models/test.py
test.py
py
2,957
python
en
code
0
github-code
6
6905516706
""" Python Tutorial: https://docs.python.org/3/tutorial/errors.html Errors & Exceptions """ def myf(x, y): x/y try: # raise ZeroDivisionError("text of an exc...") myf(4, 0) # except BaseException as err: # print(f"Base! {err}") except ZeroDivisionError as err: print(f"zero! {err}") except TypeErro...
hqpiotr/learning-python
0. Python Tutorial - docs/exceptions.py
exceptions.py
py
454
python
en
code
0
github-code
6
1498361105
n = int(input("Enter an integer: ")) a = 0 b = 1 count = 0 sum1 = 0 lst = list() listfib = list() listeven = list() sum2 = 0 while count <= n: lst.append(sum1) count += 1 a = b b = sum1 sum1 = a + b for j in lst: if j <= n: listfib.append(j) for k in listfib: if k % 2 == 0: l...
BRAVO68WEB/codetantra-py-labs
Lab4b.py
Lab4b.py
py
463
python
en
code
0
github-code
6
74471362747
from faculty import Faculty from student import Student class University: """A class representing a university. Attributes: faculties (list[Faculty]): A list of faculties in the university. """ def __init__( self, uni_dict_data: dict = None, ): """Initializes a ne...
pyramixofficial/OOP
second_lab/university.py
university.py
py
3,390
python
en
code
0
github-code
6
37379394096
try: import Image import ImageDraw except: from PIL import Image from PIL import ImageDraw import glob import numpy as np import os import sys def image_clip(img_path, size): # 转换为数组进行分割操作,计算能完整分割的行数、列数 imarray = np.array(Image.open(img_path)) imshape = imarray.shape image_col = int(i...
faye0078/RS-ImgShp2Dataset
train_example/model/Fast_NAS/data/slip_img.py
slip_img.py
py
1,752
python
zh
code
1
github-code
6
14896890650
"""empty message Revision ID: 97dd2d43d5f4 Revises: d5e28ae20d48 Create Date: 2018-05-30 00:51:39.536518 """ # revision identifiers, used by Alembic. revision = '97dd2d43d5f4' down_revision = 'd5e28ae20d48' from alembic import op import sqlalchemy as sa def upgrade(): # ### commands auto generated by Alembic ...
duvholt/memorizer
migrations/versions/97dd2d43d5f4_.py
97dd2d43d5f4_.py
py
828
python
en
code
16
github-code
6
25069435045
from typing import List, Any, Tuple from ups_lib.av_request import AddressValidationRequest from purplship.core.utils import ( XP, DP, request as http, exec_parrallel, Serializable, Deserializable, Envelope, Pipeline, Job, ) from purplship.api.proxy import Proxy as BaseProxy from pur...
danh91/purplship
sdk/extensions/ups/purplship/mappers/ups/proxy.py
proxy.py
py
3,654
python
en
code
null
github-code
6
15512949000
#This is for the introduction and Asking user info #Asking user their name and checking if it is correct def name(): name_1=input("What is your name?") right_name=input("Your name is {}. Is this correct? press [y/n]".format(name_1)) if right_name == 'y': print("Hi {}. Welcome to my Car theft prevent...
karthik-create/Car_theft-
intro.py
intro.py
py
513
python
en
code
0
github-code
6
70211001788
from django.conf.urls import patterns, include, url from django.conf import settings from cer_manager.views import * # Uncomment the next two lines to enable the admin: # from django.contrib import admin # admin.autodiscover() urlpatterns = patterns('', # Examples: # url(r'^$', 'cer_manager.views.ho...
colive/cer_manager
urls.py
urls.py
py
1,030
python
en
code
0
github-code
6
19583758283
""" This file is used to perform a random hyperparameter search on the Coco dataset using the baseline image captioner. For more info on the ImageCaptionerBaseline class, please check out the docstrings in the image_captioning.py file. """ # Package loading import argparse import os import sys sys.path.append('..') ...
milenakapralova/socraticmodels
scripts/coco_caption_base_hp_tune.py
coco_caption_base_hp_tune.py
py
3,103
python
en
code
0
github-code
6
34131870149
import time import numpy as np def num_with_sqr_lt_n(n): while not np.sqrt(n).is_integer(): n-=1 return int(np.sqrt(n)) def process(n, state): num = state[0] sub = state[1] den = n - sub**2 if den%num==0: den = den/num sub = -1*sub num = np.sqrt(n)+sub #print('\n',den,sub,num,'\n') a = ...
sadimanna/project_euler
p64.py
p64.py
py
1,386
python
en
code
0
github-code
6
10173968880
from configparser import ConfigParser # get the configparser object config_object = ConfigParser() # set config config_object["SERVERCONFIG_BROWSER"] = { "host": "127.0.0.1", "port": "8888", "web_directory": "www/" } config_object["SERVERCONFIG"] = { "host": "127.0.0.1", "port": "8080", } # Writ...
kaumnen/diy-http-server
config/config.py
config.py
py
428
python
en
code
0
github-code
6
17287700821
import yaml import argparse from jinja2 import Environment, FileSystemLoader, Template def get_args(): parser = argparse.ArgumentParser() parser.add_argument('--jobs', required=True) parser.add_argument('--job_config', required=True) return parser.parse_...
Chappers1992/Variability
run.py
run.py
py
759
python
en
code
0
github-code
6
13155871471
import serial import time # pass in upper and lower 8 bit values # returns the 16 bit value as an int # def PrintContcatBytes(valueOne, valueTwo): # print bin(valueOne)[2:].rjust(8,'0') class ReturnValue(object): def __init__(self, valid, pm10, pm25, pm100, num3, num5, num10, num25, num50, num100): self....
learnlafayette/sensors
sensors/sensors/test/samples/pm_sample.py
pm_sample.py
py
2,794
python
en
code
0
github-code
6
32412548511
### Spine by Chris Alexander # Standard imports # Custom imports import DataFormat import Interface # Interface Input class class Input(Interface.I, DataFormat.Format): # The max number of bytes to receive from the socket maxBytesReceive = 2048 # Initialise the Input Interface def __...
arnie-robot/Spine
src/Interface/input.py
input.py
py
1,072
python
en
code
0
github-code
6
21340780197
import sqlite3 from recipe import Recipe, Quantity, stringsToQuantities class Database: def __init__(self,database): self.connection = sqlite3.connect(database) self.c = self.connection.cursor() # self.c.execute("""DROP TABLE IF EXISTS ingredients""") # self.c.execute("""DROP T...
fcopp/RecipeApplication
backend/backend.py
backend.py
py
7,842
python
en
code
0
github-code
6
1480464469
from jinja2 import DebugUndefined from app.models import db, Order from datetime import datetime def seed_orders(): christian = Order( userId=1, gigId=2, gigImage='https://nerdrr.s3.amazonaws.com/fruits-basket.jpg', deliveryInstructions='Please mail directly to me.', placed=datetime(2022, 6, 5, 8...
Amlovern/nerdrr
app/seeds/orders.py
orders.py
py
1,402
python
en
code
0
github-code
6
41791316904
import pytessy as pt from PIL import ImageFilter, Image if __name__ == "__main__": # Create pytessy instance ocrReader = pt.PyTessy() files = ["cell_pic.jpg"] for file in files: # Load Image img = Image.open(file) # Scale up image w, h = img.size img = img.resize((2 * w, 2 * h)) # Sharpen imag...
TheNova22/OurVision
legacy1/testtessy.py
testtessy.py
py
628
python
en
code
null
github-code
6
24117960481
import gym import torch import torch.nn as nn import torch.nn.functional as F import torch.optim as optim from torch.distributions import Categorical import numpy as np from skimage.transform import resize # hyper params gamma = 0.98 class Policy(nn.Module): def __init__(self): super(Policy, sel...
sachinumrao/pytorch_tutorials
cnn_breakout_rl.py
cnn_breakout_rl.py
py
4,757
python
en
code
0
github-code
6
14150647036
import json import re from requests_toolbelt import MultipartEncoder from todayLoginService import TodayLoginService from liteTools import * class AutoSign: # 初始化签到类 def __init__(self, todayLoginService: TodayLoginService, userInfo): self.session = todayLoginService.session self.host = today...
zuiqiangdexianyu/ruoli-sign-optimization
actions/autoSign.py
autoSign.py
py
16,038
python
en
code
null
github-code
6
9837240055
from urllib.parse import urljoin import requests import json from fake_useragent import UserAgent from lxml import html import re from pymongo import MongoClient ua = UserAgent() movie_records = [] first = True base_url = "https://www.imdb.com/" url = "https://www.imdb.com/search/title/?genres=drama&groups=top_250&sor...
shreyashettyk/DE
Imdb_data_extraction/imdb.py
imdb.py
py
2,184
python
en
code
0
github-code
6
1369504657
# -*- coding: utf-8 -*- import RPi.GPIO as GPIO import time, datetime from lcd import * from Email import * import server lcd_init () GPIO.setmode(GPIO.BOARD) print('System start/restart - ' + str(datetime.datetime.now())) #Switch for Bin 1 to be connected to pin 18 and 3.3v pin #Switch for Bin 2 to be connected to...
CraigHissett/TM_Timber
BinSensor/BinSensor.py
BinSensor.py
py
1,875
python
en
code
0
github-code
6
11900486194
import dash from dash import html from matplotlib import container from navbar import create_navbar import dash_bootstrap_components as dbc from dash import Dash, html, dcc, Input, Output import plotly.express as px import pandas as pd f_sb2021 = pd.read_csv("f_sb2021.csv", on_bad_lines='skip', sep=';') f_sb2022 = pd....
jeanpierec/ljpiere_projects
DataScience_projects/Proyecto5_DS4ABucaramanga/home.py
home.py
py
4,956
python
en
code
1
github-code
6
18100941624
""" 739. Daily Temperatures https://leetcode.com/problems/daily-temperatures/ """ from typing import List from unittest import TestCase, main class Solution: def dailyTemperatures(self, temperatures: List[int]) -> List[int]: stack: List[int] = [] # List of indexes, not temperatures answer ...
hirotake111/leetcode_diary
leetcode/739/solution.py
solution.py
py
1,081
python
en
code
0
github-code
6
8271520226
##problem 16 import random rolls = 10 success = 0 failure = 0 for i in range(rolls): coinchoice = random.randint(1,3) if (coinchoice == 1): ##heads in both faces failure = failure+1 elif (coinchoice == 2): ##heads and tails success = success+1 elif (coinchoice == 3): ##tails on both f...
jkiyak/CS355-Probability-and-Statistics-in-Computer-Science-
SP2019 CS 355_555-2E Probability/homework2.py
homework2.py
py
604
python
en
code
0
github-code
6
20893678055
# I don't understand the question, so this answer was not mine, it was from reddit. recipes = '084601' score = '37' elf1 = 0 elf2 = 1 while recipes not in score[-7:]: score += str(int(score[elf1]) + int(score[elf2])) elf1 = (elf1 + int(score[elf1]) + 1) % len(score) elf2 = (elf2 + int(score[elf2]) + 1) % l...
EricKim987/adventOfCode2018
day14/day14.py
day14.py
py
423
python
en
code
0
github-code
6
14175319666
import numpy as np __author__ = 'punki' class LinearRegresion: def __init__(self, reg_lambda, transofrmation): self.transofrmation = transofrmation self.reg_lambda = reg_lambda self.w = [] def fit(self, training_data_set): x = np.array([self.transofrmation(z[0],z[1]) for z in...
tomasz-pankowski/LinearRegresion
common/LinearRegresion.py
LinearRegresion.py
py
835
python
en
code
0
github-code
6
72729319867
# External dependencies import openai import io import os import tempfile from datetime import datetime from flask import render_template, request, url_for, redirect, flash, Response, session, send_file, Markup from flask_login import login_user, login_required, logout_user, current_user from flask_mail import Message ...
joaomorossini/Clever-Letter-Generator
routes.py
routes.py
py
10,934
python
en
code
1
github-code
6
28800521491
"""Function to calculate the enrichment score for a given similarity matrix.""" import numpy as np import pandas as pd from typing import List, Union import scipy from cytominer_eval.utils.operation_utils import assign_replicates def enrichment( similarity_melted_df: pd.DataFrame, replicate_groups: List[str]...
cytomining/cytominer-eval
cytominer_eval/operations/enrichment.py
enrichment.py
py
2,845
python
en
code
7
github-code
6
25571472390
import logging # fmt = "%(name)s----->%(message)s----->%(asctime)s" # logging.basicConfig(level="DEBUG",format=fmt) # logging.debug("这是debug信息") # logging.info('这是info信息') # logging.warning('这是警告信息') # logging.error('这是错误信息') # logging.critical('这是cri信息') logger = logging.getLogger('heihei') #默认的打印级别是WARNING,所以当跟控制台...
lishuangbo0123/basic
history_study/test.py
test.py
py
1,059
python
zh
code
0
github-code
6
21490193625
# # PyBank # Ryan Eccleston-Murdock # 28 November 2020 # # Purpose: Analyze .csv financial data # # Sources: import os import csv in_path = 'Resources' in_file_name = 'budget_data.csv' in_csvpath = os.path.join(in_path, in_file_name) out_path = 'analysis' out_file_name = 'financial_summary.csv' out_csvpath = o...
reccleston/python-challenge
PyBank/main.py
main.py
py
2,272
python
en
code
0
github-code
6
43371065244
from selenium import webdriver from selenium.webdriver.common.keys import Keys class Spider: try: page = webdriver.Chrome() url = "https://music.163.com/#/song?id=31654747" page.get(url) search = page.find_element_by_id("srch") search.send_keys("aaa") search.send_ke...
frebudd/python
autoinput.py
autoinput.py
py
382
python
en
code
2
github-code
6
25097408304
# -*- coding: utf-8 -*- """ Created on Fri Jul 15 09:34:07 2022 @author: maria """ import numpy as np import pandas as pd from numpy import zeros, newaxis import matplotlib.pyplot as plt import scipy as sp from scipy.signal import butter,filtfilt,medfilt import csv import re #getting the F traces which are classi...
mariacozan/Analysis_and_Processing
functions/functions2022_07_15.py
functions2022_07_15.py
py
26,567
python
en
code
0
github-code
6
19239185532
# stack ! 과제는 끝나지 않아! # 효율 고려 X, 하나 넣고 하나 빼기 import sys from collections import deque input = sys.stdin.readline N = int(input()) S = deque() # 과제 넣어두는 스택 tot = 0 # 총 점수 for _ in range(N): W = list(map(int, input().split())) if W[0]: # 새 과제가 있다면 if W[2] == 1: # 지금 바로 끝낼 수 있으면 점수 바로 더해주기 ...
sdh98429/dj2_alg_study
BAEKJOON/stack/b17952.py
b17952.py
py
878
python
ko
code
0
github-code
6
22933846621
from cryptopals.set1.common import recover_xor_key def test(hex_strings, expected): english_score = { score: text for key, score, text in [ recover_xor_key(hex_string.decode('hex')) for hex_string in hex_strings ] } best_score = min(english_score) return engli...
ericnorris/cryptopals-solutions
cryptopals/set1/challenge_04.py
challenge_04.py
py
341
python
en
code
0
github-code
6
17441173344
import pandas as pd import seaborn as sns import matplotlib.pyplot as plt import streamlit as st import ptitprince as pt def scatter_plot(df,fig): hobbies = [] for col in df.columns: hobbies.append(col) print(col) st.title(" Scatter Plot") hobby = st.selectbox("X-axis: ", hobbies) #...
imsanjoykb/Data-Analytics-Tool-Development
apps/graphs.py
graphs.py
py
4,249
python
en
code
3
github-code
6
10159507438
# 0 1 2 3 4 # 5 6 7 8 9 # 0 1 2 3 4 # 5 6 7 8 9 def rosy(): counter=0 for rows in range(1,3): for col in range(0, 5): print(counter,end=' ') counter += 1 print() rosy() rosy()
suchishree/django_assignment1
python/looping/assignment 3/no6.py
no6.py
py
228
python
en
code
0
github-code
6
32470859712
#숫자 카드 2 from bisect import bisect_left, bisect_right def binary(x): start = bisect_left(data_n, x) end = bisect_right(data_n, x) return end - start n = int(input()) data_n = sorted(list(map(int, input().split()))) m = int(input()) data_m = list(map(int, input().split())) for x in data_m: print(bina...
JinDDung2/python-pratice
BOJ/binary/10816.py
10816.py
py
345
python
en
code
0
github-code
6
38701948852
#coding=utf8 import config import json import sys, time py3k = sys.version_info.major > 2 import os.path import urllib if py3k: from urllib import parse as urlparse else: import urlparse def get_one(): return config.dbconn().fetch_rows('http', condition={'checked': 0}, order="id asc", limit="1", fetchone=True) de...
5alt/ZeroExploit
parser.py
parser.py
py
2,452
python
en
code
4
github-code
6
26829773618
####################################### # This file computes several characteristics of the portage graph ####################################### import math import sys import core_data import hyportage_constraint_ast import hyportage_data import utils import graphs import host.scripts.utils from host.scripts impor...
HyVar/gentoo_to_mspl
host/statistics/statistics.py
statistics.py
py
14,279
python
en
code
10
github-code
6
32646505991
#!/usr/bin/python class NodeVisitor(object): def visit(self, node): method = 'visit_' + node.__class__.__name__ visitor = getattr(self, method, self.generic_visit) return visitor(node) def generic_visit(self, node): # Called if no explicit visitor function exists for a node. ...
Andrzej97/kompilatory
TypeChecker_v3.py
TypeChecker_v3.py
py
6,834
python
en
code
0
github-code
6
33680275570
import numpy as np from numpy import dtype, uint8 class lena(object): def __init__(self, pallete): self.pallete = pallete # Open the file for reading def read_file(self, my_file): stream = open(my_file, 'rb') img = np.fromfile(stream, dtype=(uint8, 3)) return img # Cre...
ortizub41/lena
lena/lena.py
lena.py
py
4,071
python
en
code
1
github-code
6
33846054954
from jwst.stpipe import Step from jwst import datamodels from ..datamodels import TMTDarkModel from . import dark_sub from ..utils.subarray import get_subarray_model __all__ = ["DarkCurrentStep"] class DarkCurrentStep(Step): """ DarkCurrentStep: Performs dark current correction by subtracting dark curr...
oirlab/iris_pipeline
iris_pipeline/dark_current/dark_current_step.py
dark_current_step.py
py
1,857
python
en
code
0
github-code
6
35116816269
# Import the libraries import cv2 import numpy as np import math as m from matplotlib import pyplot as plt #-- PRE-PROCESSING -- # Read the image nimg = 'image1' # Change 'image1' for the name of your image image = cv2.imread(nimg + '.jpg') # Extract the RGB layers of the image rgB = np.matrix(image[:,:,0]) # Blue rGb...
selenebpradop/basic_exercises-computer_vision
contours_of_an_image_v2.py
contours_of_an_image_v2.py
py
2,461
python
en
code
0
github-code
6
34965304781
""" 递归动态规划 """ class Solution(object): def canJump(self,nums): if len(nums) == 1: return True for i in range(1,nums[0]+1): if i <= len(nums): if self.canJump(nums[i:]): return True else: return True retur...
qingyuannk/phoenix
dp/jumpgame.py
jumpgame.py
py
2,117
python
en
code
0
github-code
6
9200799444
from fastapi import status, HTTPException, Depends from fastapi.security import OAuth2PasswordBearer from jose import JWTError, jwt from datetime import datetime, timedelta from sqlalchemy.orm import Session from .schema import TokenData from app import database, models from .config import env SECRET_KEYS = env.SECR...
Ichi-1/FastAPI-example-api
app/oauth2.py
oauth2.py
py
1,581
python
en
code
0
github-code
6
25575181895
from typing import List class Solution: def rotate(self, nums: List[int], k: int) -> None: new_array = [1]*len(nums) for i in range(len(nums)): new_p = (i - k)%len(nums) new_array[i] = nums[new_p] return new_array s = Solution() l = [1,2,3,4,5,6,7] x = s.rotate(l,...
ThadeuFerreira/python_code_challengers
rotate_array.py
rotate_array.py
py
331
python
en
code
0
github-code
6
72332661307
#!/usr/bin/env python3 import os import configparser from mongoengine.connection import connect from .data_model import Post from .render_template import render from .mailgun_emailer import send_email def email_last_scraped_date(): ## mongodb params (using configparser) config = configparser.ConfigParser() ...
alysivji/reddit-top-posts-scrapy
top_post_emailer/__init__.py
__init__.py
py
917
python
en
code
14
github-code
6
26239060381
#!/usr/bin/env python3 ''' This script will incement the major version number of the specified products. It is assumed that the version number in the label itself is correct, and the version just needs to be added on to the filename. Usage: versioning.py <label_file>... ''' import re import os import sys from bs4 im...
sbn-psi/data-tools
orex/pds4-tools/versioning.py
versioning.py
py
5,949
python
en
code
0
github-code
6
35484692669
import os import string def file_check(filepath, mode): if os.path.exists(filepath): if os.path.isfile(filepath): f = open("%s" % filepath, "%s" % mode) return f else: return "Incorrect file" else: return "Incorrect file" print(file_check("kivy_tes...
TaffetaEarth/homework_python
os_work.py
os_work.py
py
1,849
python
en
code
0
github-code
6
4143416632
'''A module for demo-ing exceptions''' import sys from math import log def convert_to_int(s): x = -1 try: return int(s) print("Conversion succeeded! x =", x) except (ValueError,TypeError) as e: print("Conversion error: {}".format(str(e)), file=sys.stderr) return -1 def string_log(s): v = convert_to_int(s)...
gitsana/Python_Tutorial
M6-Exception Handling/exceptional2.py
exceptional2.py
py
764
python
en
code
0
github-code
6
74750166267
from src.components import summarizer from celery import Celery from celery.utils.log import get_task_logger from EmailSender import send_email logger = get_task_logger(__name__) celery = Celery( __name__, backend="redis://127.0.0.1:6379", broker="redis://127.0.0.1:6379" ) @celery.task(name="summarizer") def Gma...
SVijayB/Gist
scripts/flask_celery.py
flask_celery.py
py
816
python
en
code
4
github-code
6
21025178712
#!/usr/bin/env python3 import logging import sys from ev3dev2.motor import OUTPUT_A, OUTPUT_B, OUTPUT_C, MediumMotor from ev3dev2.control.rc_tank import RemoteControlledTank log = logging.getLogger(__name__) class TRACK3R(RemoteControlledTank): """ Base class for all TRACK3R variations. The only difference ...
ev3dev/ev3dev-lang-python-demo
robots/TRACK3R/TRACK3R.py
TRACK3R.py
py
2,002
python
en
code
59
github-code
6
25293805211
import unittest from task import fix_encoding expected_content = """Roses are räd. Violets aren't blüe. It's literally in the name. They're called violets. """ filename = "example.txt" output = "output.txt" class TestCase(unittest.TestCase): def setUp(self) -> None: with open(filename, "w") as f: ...
DoctorManhattan123/edotools-python-course
Strings, inputs and files/file encoding/tests/test_task.py
test_task.py
py
604
python
en
code
0
github-code
6
71344821309
#Inicio do While opcao = -1 #Variaveis do Saque, máximo do saque 500 por saque e até 3x por dia limiteSaque = 500 saqueDia = 3 valorSacado = 0 #Variaveis do Saldo saldo = float(0) #Variaveis Deposito deposito = float(0) while opcao != 0: opcao = int(input(" [1] Para sacar \n [2] Para depositar \n ...
Dnx0/trilha-python-dio
sistemaBancario.py
sistemaBancario.py
py
1,631
python
pt
code
1
github-code
6
30969861276
import matplotlib.pyplot as plt import time import numpy as np from PIL import Image class graphic_display(): def __init__(self): self.um_per_pixel = 0.5 self.cm_hot = plt.get_cmap('hot') self.cm_jet = plt.get_cmap('jet') self.cm_vir = plt.get_cmap('virid...
peterlionelnewman/flow_lithographic_printer
Graphic_display.py
Graphic_display.py
py
6,222
python
en
code
1
github-code
6
33800125828
import sys sys.setrecursionlimit(10000) def dfs(d, v, visited): visited[v]= True for i in d[v]: if not visited[i]: dfs(d, i, visited) n,m = map(int, input().split()) d = [[] for _ in range(n+1)] visited = [False]*(n+1) result = 0 for _ in range(m): u,v = map(int, input().split()) ...
devAon/Algorithm
BOJ-Python/boj-11724_연결요소의개수.py
boj-11724_연결요소의개수.py
py
459
python
en
code
0
github-code
6
14594327515
import tensorflow as tf import json from model_provider import get_model from utils.create_gan_tfrecords import TFRecordsGAN from utils.augment_images import augment_autoencoder import os import tensorflow.keras as K import datetime import string from losses import get_loss, gradient_penalty import argparse physical_d...
AhmedBadar512/Badr_AI_Repo
cycle_gan_train.py
cycle_gan_train.py
py
18,298
python
en
code
2
github-code
6
43005467228
""" Utility functions """ import torch import matplotlib as mpl import numpy as np import math mpl.use('Agg') from matplotlib import pyplot as plt def sin_data(n_train, n_test, noise_std, sort=False): """Create 1D sine function regression dataset :n_train: Number of training samples. :n_test: Number of t...
weiyadi/dlm_sgp
conjugate/utils.py
utils.py
py
4,966
python
en
code
2
github-code
6
24603935810
with open("inputs/day14.txt", 'r') as fh: lines = fh.readlines() schedules = {} for line in lines: parts = line.split() name = parts[0] speed = int(parts[3]) duration = int(parts[6]) rest = int(parts[13]) schedule = [] while len(schedule) < 2503: schedule += [speed, ] * duratio...
neilo40/adventofcode2015
day14.py
day14.py
py
1,111
python
en
code
0
github-code
6
20186345178
# Import pakages import torch import torch.nn as nn import gym import os import torch.nn.functional as F import torch.multiprocessing as mp import numpy as np # Import python files from utils import v_wrap, set_init, push_and_pull, record from shared_adam import SharedAdam os.environ["OMP_NUM_THREADS"] = "1" os.enviro...
smfelixchoi/MATH-DRL-study
6.A3C/discrete_A3C.py
discrete_A3C.py
py
4,973
python
en
code
1
github-code
6
3129533999
import numpy as np data = [[]] with open("data.txt","r") as fichier: for line in fichier.read().splitlines(): if line: data[-1].append(line) else: data.append([]) nb_stacks = int(data[0][-1][-2]) stacks = [[]] pile_max = len(data[0])-1 for i in range(nb_stacks): stacks....
Schtroumpfissime/AdventOfCode2022
5/main.py
main.py
py
1,276
python
en
code
0
github-code
6
42742926031
from models.models import VatsimPilot from data_reader import reader def main(): print("VATSIM LIB") json_data = reader.init() vgs = reader.get_vatsim_general(json_data) # print(vgs) pilots = reader.get_vatsim_pilots(json_data) print(f"number of pilots this update: {len(pilots)}") fligh...
ahuimanu/vatsimlib
run.py
run.py
py
472
python
en
code
1
github-code
6
2654980341
from Tkinter import * root = Tk() frame = Frame(root, bd=2, relief=SUNKEN) frame.grid_rowconfigure(0, weight=1) frame.grid_columnconfigure(0, weight=1) xscrollbar = Scrollbar(frame, orient=HORIZONTAL) xscrollbar.grid(row=1, column=0, sticky=E+W) yscrollbar = Scrollbar(frame) yscrollbar.grid(row=0, column=1, sticky=N...
sbobovyc/DCS
legacy/DCS2_py/examples/canvas_scrollbox.py
canvas_scrollbox.py
py
600
python
en
code
1
github-code
6
71470012027
from lxml import etree from xml.etree import ElementTree def get_text_from_file(xml_file): tree = etree.parse(xml_file) root = tree.getroot() for element in root.iterfind('.//para'): for ele in element.findall('.//display'): parent = ele.getparent() parent.remove(ele) ...
ayandeephazra/Natural_Language_Processing_Research
PaperDownload/papers/process_xml.py
process_xml.py
py
349
python
en
code
2
github-code
6
13461686812
""" Given an array of words and a length L, format the text such that each line has exactly L characters and is fully (left and right) justified. You should pack your words in a greedy approach; that is, pack as many words as you can in each line. Pad extra spaces ' ' when necessary so that each line has exactly L cha...
szhongren/leetcode
68/main.py
main.py
py
3,017
python
en
code
0
github-code
6
23704854533
#!/usr/bin/env python3 import json import os import requests import datetime base_url="https://raw.githubusercontent.com/threatstop/crl-ocsp-whitelist/master/" uri_list=['crl-hostnames.txt','crl-ipv4.txt','crl-ipv6.txt','ocsp-hostnames.txt','ocsp-ipv4.txt','ocsp-ipv6.txt'] dict=dict() dict['list']=list() def source_r...
007Alice/misp-warninglists
tools/generate-crl-ip-list.py
generate-crl-ip-list.py
py
943
python
en
code
null
github-code
6
16704497954
import pickle import numpy as np import scipy.io as sio from library.error_handler import Error_Handler class Data_Loader: def load_data_from_pkl(self, filepath_x, filepath_y, ordering="True"): with open(filepath_x, "rb") as file_x: x_data = pickle.load(file_x) with o...
tzee/EKDAA-Release
library/data_loader.py
data_loader.py
py
2,380
python
en
code
2
github-code
6
70602414269
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Thu Mar 19 11:06:45 2020 @author: xchen """ ## required packages # system imports import os import sys from termcolor import colored from colorama import init # data manipulation and data clean from nltk.corpus import stopwords # sklearn from sklearn imp...
linnvel/text-classifier-master
ML.py
ML.py
py
5,072
python
en
code
0
github-code
6
21379925078
from bogos import ScrapeBogos import configparser import twitter def lambda_handler(event, context): config = configparser.ConfigParser() config.read('config.ini'); keywords = '' keywordMultiWord = False url = '' prefixText = '' postfixText = '' noBogoText = '' print('Config values:') if 'BOGO' n...
DFieldFL/publix-bogo-notification
BogoMain.py
BogoMain.py
py
2,732
python
en
code
2
github-code
6
41236509775
from django.urls import path from rest_framework.routers import DefaultRouter from . import views urlpatterns = [ ] router = DefaultRouter() router.register("porcelain", viewset=views.PorcelainView, basename="porcelain") router.register("dynasty", viewset=views.DynastyView, basename="dynasty") router.register("Empe...
beishangongzi/porcelain-backend
predict_model/urls.py
urls.py
py
412
python
en
code
0
github-code
6
36064906771
''' Created on 2017-1-13 @author: xuls ''' from PIL import Image import os PATH2=os.path.dirname(os.getcwd()) def classfiy_histogram(image1,image2,size = (256,256)): image1 = image1.resize(size).convert("RGB") g = image1.histogram() image2 = image2.resize(size).convert("RGB") s = ima...
xulishuang/qichebaojiadaquan
src/script/sameas.py
sameas.py
py
1,917
python
en
code
0
github-code
6
162022841
import time from selenium import webdriver from django.contrib.staticfiles.testing import StaticLiveServerTestCase from .pages.login import LoginPage class ManageUserTestCase(StaticLiveServerTestCase): def setUp(self): self.browser = webdriver.Firefox() self.browser.implicitly_wait(20) s...
pophils/TaskManagement
yasanaproject/tests/functional/test_manage_user.py
test_manage_user.py
py
2,447
python
en
code
1
github-code
6
34838799506
import csv import pandas as pd cerealFile = open('cereal.csv') cerealReader = csv.reader(cerealFile) cerealList = list(cerealReader) df = pd.read_csv('cereal.csv') for row in cerealList: print(row[0]) #print(df.info()) print(df['calories'].dtypes)
kamiltrzcinski/python
zad7.py
zad7.py
py
257
python
en
code
0
github-code
6
1175929683
#!/usr/bin/env python3 """ T9 Spelling problem for Google Code Jam Africa 2010 Qualification Link to problem description: http://code.google.com/codejam/contest/351101/dashboard#s=p2 author: Chris Nitsas (nitsas) language: Python 3.2.1 date: April, 2012 usage: $ python3 runme.py sample.in or $ runme.py sample.in ...
nitsas/codejamsolutions
T9 Spelling/runme.py
runme.py
py
2,291
python
en
code
1
github-code
6
20832937788
import re def open_fasta_file(file_address): file = open(file_address, 'r') text = file.read() file.close() return text def record_counter(file_address): txt = open_fasta_file(file_address) counter = txt.count('>') return counter def dna_dict_creator(file_address): txt = open_fasta...
saeedrafieyan/bioinformatics
final.py
final.py
py
6,224
python
en
code
0
github-code
6
34608371364
import os.path import json import os def readDIPfile(parent_path): edges = {} index = 0 xmlfilepath = os.path.join(parent_path, r'data\Hsapi20170205CR.txt') f = open(xmlfilepath) lines = f.readlines() for line in lines: line_list = line.strip("\n").split("\t") if line_list[9] ==...
LittleBird120/DiseaseGenePredicition
DiseaseGenePredicition/Human_COVID_node2vec20210315/data_processing/readHumanProtein.py
readHumanProtein.py
py
919
python
en
code
0
github-code
6
1435864274
import math import numpy as np import cv2 from matplotlib import pyplot as plt def Euclidean_Distance(pointA, pointB): ans = ((pointA[0] - pointB[0])**2+(pointA[1] - pointB[1])**2)**0.5 return ans def Flat_Kernel(distance, bandwidth, point_number): inRange = [] weight = np.zeros((point_numb...
laitathei/algorithm_implemention
machine_learning/Mean_Shift/utils.py
utils.py
py
1,331
python
en
code
0
github-code
6
474990887
""" *Author : Revanth Sai Nandamuri *GitHUB : https://github.com/RevanthNandamuri1341b0 *Date of update : 25 August 2021 *Project name : Finding missing number *Domain : PYTHON *Description : You are given an array of positive numbers from 1 to n, such that all numbers from 1 to n are pr...
RevanthNandamuri1341b0/PYTHON-COMPY
amazon_interview_question1.py
amazon_interview_question1.py
py
791
python
en
code
0
github-code
6
73900222588
# coding: utf-8 import unittest import os from django.conf import settings from studitemps_storage.path import guarded_join from studitemps_storage.path import guarded_safe_join from studitemps_storage.path import guarded_join_or_create from studitemps_storage.path import FileSystemNotAvailable ABSPATH = os.path.a...
STUDITEMPS/studitools_storages
studitemps_storage/tests/suites/path.py
path.py
py
3,073
python
en
code
0
github-code
6
21114723474
import os from dotenv import load_dotenv, dotenv_values # FOR LOG import logging from logging.handlers import RotatingFileHandler import datetime import math import json # Load environmental variable config = dotenv_values(".env") # --------------------------------------------------- LOGGING ---------------...
Splroak/add_member_telegram
src/test_BatchProcessor.py
test_BatchProcessor.py
py
2,365
python
en
code
0
github-code
6
13489533801
import json import requests resource = requests.post('http://216.10.245.166/Library/DeleteBook.php', json = {"ID" : "ashish123227"}, headers={'Content-Type' : 'application/json' } ) assert resource.status_code == 200 , f'the api failed with an error messages as : {resource.text}' response...
bhagatashish/APT_Testing
delete_book.py
delete_book.py
py
462
python
en
code
0
github-code
6
73795089468
import json import os from flask import current_app, redirect, request, Response from . import blueprint @blueprint.route("/routes") def routes(): data = { "name": current_app.config["name"], "version": current_app.config["version"], "routes": { "api": [ "/api/...
cumbof/igv-flask
igv/routes/basics.py
basics.py
py
1,385
python
en
code
0
github-code
6
1066446639
""" This module defines the interface for communicating with the sound module. .. autoclass:: _Sound :members: :undoc-members: :show-inheritance: """ import glob import os import platform import subprocess from functools import partial from opsoro.console_msg import * from opsoro.sound.tts import TTS from o...
OPSORO/OS
src/opsoro/sound/__init__.py
__init__.py
py
4,683
python
en
code
9
github-code
6
25754911493
import os from multiprocessing import freeze_support,set_start_method import multiprocessing from Optimization import Optimization from GA import RCGA from PSO import PSO if __name__=='__main__': from datetime import datetime start = datetime.now() print('start:', start.strftime("%m.%d.%H.%M")) multipr...
zhengjunhao11/model-updating-framework
program_framework/Input.py
Input.py
py
1,002
python
en
code
1
github-code
6
6830398340
#!/usr/bin/env python #!/usr/bin/python from tkinter import * root = Tk() # creates a blank window named root top_frame = Frame(root) top_frame.pack() bottom_frame = Frame(root) bottom_frame.pack(side=BOTTOM) # since the bottom frame is specified to be, at the bottom the top is at the top butto...
judas79/TKinter-git-theNewBoston
Tkinter - 02 - Organizing your Layout/Tkinter - 02 - Organizing your Layout.py
Tkinter - 02 - Organizing your Layout.py
py
2,170
python
en
code
0
github-code
6
73416700989
class Verity: def input_boolean(): print("X", "Y", "Z", "Rezult" ) print("*"*15) for X in range(2): for Y in range(2): for Z in range(2): rezult=not(X or Y or Z)== ((not X)and (not Y) and (not Z)) print(f"{X} {Y} {Z} - {...
DenisBaicurov/PracticaPython
exercise2.py
exercise2.py
py
410
python
en
code
0
github-code
6
38938434821
#!/usr/bin/env python from sys import argv fin = open("include/hiponodes.h") fout0 = open("include/node_declaration.h","w") fout1 = open("src/node_assignment.cxx","w") fout1.write("//// File automatically produced by format_hiponodes.py do not make changes here!!\n") fout1.write('#include "TIdentificatorCLAS12.h"\n') f...
orsosa/Clas12Ana
format_hiponodes.py
format_hiponodes.py
py
707
python
en
code
0
github-code
6