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
72322916513
# -*- coding:utf-8 -*- from __future__ import print_function import numpy import theano.tensor as T import cv2 import cPickle numpy.random.seed(1337) # for reproducibility from PIL import Image from keras.models import Sequential from keras.layers import Input, Dense, Dropout, LSTM from keras.layers.convolutional i...
jsxxj/RBF_DCNN
MCNN/LSTM.py
LSTM.py
py
3,202
python
en
code
0
github-code
1
28653936566
""" uniquePath1 A robot is located at the top-left corner of a m x n grid (marked 'Start' in the diagram below). The robot can only move either down or right at any point in time. The robot is trying to reach the bottom-right corner of the grid (marked 'Finish' in the diagram below). How many possible unique paths ar...
drmenghan/PyS
LeetCode/Unique Paths.py
Unique Paths.py
py
4,076
python
en
code
1
github-code
1
74692201954
#!/usr/bin/env python3 # # CLIMPORN # # Prepare 2D maps (monthly) that will later become a movie! # NEMO output and observations needed # # L. Brodeau, January 2019 # import sys import glob #import argparse as ap import numpy as nmp from PIL import Image # # ClimPorn: from climporn.utils import chck4f import...
brodeau/climporn
python/scripts/mk_image_montage_agrif.py
mk_image_montage_agrif.py
py
3,867
python
en
code
6
github-code
1
30767921487
# -*- coding: utf-8 -*- from django.template import RequestContext from django.http import HttpResponseRedirect from django.contrib.auth import logout from django.http import HttpResponse, Http404 #from django.template import Context #from django.template.loader import get_template from django.contrib.auth.models impo...
meoooh/Bookmarks
bookmarks/views.py
views.py
py
9,930
python
en
code
0
github-code
1
31129070227
#!/usr/bin/env python """dec05-1.py: Solution to Advent of Code December 5th, part 1 """ def read_input(filename: str) -> list: input_list = list() try: with open(filename) as f: for line in f.readlines(): input_list.append(line) except FileNotFoundError: print...
kyleburnette/adventofcode2020
solutions/dec05/dec05-1.py
dec05-1.py
py
1,131
python
en
code
0
github-code
1
18323604988
import aiohttp import urllib.parse as urlparse from typing import Optional from middleware.config import Settings from middleware.exception import MiddlewareException from middleware.external.base.application import Application as BaseApplication class Application(BaseApplication): @staticmethod async def _g...
chyaoyuan/data-sync-cdc
middleware/external/schema/application.py
application.py
py
1,365
python
en
code
0
github-code
1
72263561954
"""create auth tables Revision ID: 6e0daa4be1f8 Revises: cb42b1c187d9 Create Date: 2019-09-26 09:17:12.642904 """ from alembic import op import sqlalchemy as sa # revision identifiers, used by Alembic. revision = '6e0daa4be1f8' down_revision = 'cb42b1c187d9' branch_labels = None depends_on = None def upgrade(): ...
best-doctor/its_on
db/migrations/versions/6e0daa4be1f8_create_auth_tables.py
6e0daa4be1f8_create_auth_tables.py
py
1,439
python
en
code
14
github-code
1
20146515848
# Definition for singly-linked list. # class ListNode: # def __init__(self, x): # self.val = x # self.next = None # Definition for a binary tree node. # class TreeNode: # def __init__(self, x): # self.val = x # self.left = None # self.right = None class Solution: # ...
henrylu518/LeetCode
Convert Sorted List to Binary Search Tree.py
Convert Sorted List to Binary Search Tree.py
py
964
python
en
code
0
github-code
1
42169327955
#! /usr/bin/env python3 import os import requests #List all the files in /supplier-data/descriptions for root, dirs, files in os.walk("./supplier-data/descriptions"): #Loop through the list of description files of fruits for file_name in files: with open(os.path.join(root,file_name)) as file: ...
peterncs/fruit
run.py
run.py
py
927
python
en
code
0
github-code
1
10565279224
import pandas as pd import numpy as np import tensorflow as tf from datetime import datetime import statistics # connect to db import pymysql import sqlalchemy from sqlalchemy import create_engine # misc import random as rn from sklearn.model_selection import train_test_split #pipeline from sklearn.preprocessing impor...
HBNU-SWUNIV/COME-CAPSTONE22-dashboard
003 Code/autoEncoder/AE.py
AE.py
py
7,821
python
en
code
0
github-code
1
6484667503
""" @Time : 2021/1/28 10:41 @Author : Steven Chen @File : main.py @Software: PyCharm """ # 目标: # 方法: # 1、导入managerSystem模块 from manageSystem import * # 2.启动学员管理系统 if __name__ == '__main__': student_manager = StudentManager() student_manager.run()
PandaCoding2020/pythonProject
Python_OOP/7案例:面向对象版学习系统/StudentManageSystem/main.py
main.py
py
296
python
zh
code
0
github-code
1
7460166493
import sys sys.stdin = open("algo2_sample_in.txt") def get_box_sum(m): if N < 3: box_sum = [0] return box_sum else: center_lst = [] for i in range(2, N): for j in range(2, N): center_lst.append([i, j]) box_sum = 0 box_sum_lst = [] ...
coolihans/TIL
Algorithms/과목평가1/Algo2_서울_5반_안현모.py
Algo2_서울_5반_안현모.py
py
1,474
python
en
code
0
github-code
1
42615496732
"""Class to define the properties of a climate zone""" from .const import ADVANCED, MODE_AUTO, MODE_MANUAL class Zone(): """Class to define the properties of a climate zone""" # pylint: disable=too-many-instance-attributes def __init__(self, name: str) -> None: self.name = name self.tem...
funtastix/pyrinnaitouch
pyrinnaitouch/zone.py
zone.py
py
1,435
python
en
code
4
github-code
1
30951274678
"""Main module.""" import os from datetime import datetime import numpy as np from scipy.optimize import least_squares import click import matplotlib.pyplot as plt from geometric_calibration.reader import ( read_img_label_file, read_projection_hnc, read_projection_raw, ) from geometric_calibration.utils ...
mrossi93/geometric_calibration
geometric_calibration/geometric_calibration.py
geometric_calibration.py
py
18,359
python
en
code
4
github-code
1
37897987245
from flask import Flask from flask import request import urllib.request import re from requests_html import HTMLSession app = Flask(__name__) #Makes all responses plaintext @app.after_request def treat_as_plain_text(response): response.headers["content-type"] = "text/plain" return response @app.route('/') de...
ThatOneCamel/boxdScrape
_oldVersion/app.py
app.py
py
1,380
python
en
code
1
github-code
1
15578279834
# ================================================================================ # This script instantiates the llm object with the relevant parameters # ================================================================================ from langchain.llms import CTransformers # Local CTransformers wrapper for Llama-2...
DeveshParagiri/sage
llm.py
llm.py
py
521
python
en
code
1
github-code
1
32394088452
import csv from face import Face data = csv.DictReader(open("fer2013/fer2013.csv")) faces_train = [] faces_val = [] faces_test = [] for row in data: if row.get("Usage") == "Training": faces_train += [Face(row)] elif row.get("Usage") == "PublicTest": faces_val += [Face(row)] elif row.get("U...
eshawang/Facial-Expression-Analysis
format_data.py
format_data.py
py
439
python
en
code
1
github-code
1
74429573154
#!/usr/bin/env python import os, argparse, time import utils from keras.models import Sequential from keras.layers import Dense, Activation, Dropout from keras.layers import LSTM from keras.callbacks import ModelCheckpoint, ReduceLROnPlateau, TensorBoard from keras.optimizers import SGD, RMSprop, Adagrad, Adadelta, Ada...
brannondorsey/midi-rnn
train.py
train.py
py
10,546
python
en
code
154
github-code
1
72307539555
from sklearn.preprocessing import normalize from sklearn.neighbors import NearestNeighbors from tqdm import tqdm import os import pickle from datetime import datetime if not os.path.exists("saves/crude_embeddings.pkl"): raise ValueError("Please run --process first to generate embeddings") else: with open("save...
finned-tech/MEIP
model/train.py
train.py
py
1,936
python
en
code
0
github-code
1
31920261178
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Tue Aug 4 14:59:16 2020 @author: Eric Chen, Graduate Center, City University of New York @contact: eric.clyang521@gmail.com """ import os os.chdir("/Users/eric/Desktop/paper_figure/solvation_free_energy/Tip3p_bulk") import numpy as np from gridData im...
EricChen521/small_mol_project_script
bulk_TSsix.py
bulk_TSsix.py
py
1,109
python
en
code
0
github-code
1
37798492039
import pathlib import numpy as np import pytest import meshio from . import helpers @pytest.mark.parametrize( "mesh", [ helpers.empty_mesh, helpers.tet_mesh, helpers.hex_mesh, helpers.tet_mesh, helpers.add_cell_sets(helpers.tet_mesh), ], ) @pytest.mark.parametriz...
nschloe/meshio
tests/test_flac3d.py
test_flac3d.py
py
1,540
python
en
code
1,691
github-code
1
29001110749
import pygame class playerProjectiles(pygame.sprite.Sprite): def __init__(self, x): super().__init__() self.entity = pygame.image.load("../assets/playerbullet.png").convert_alpha() self.rect = self.entity.get_rect() self.rect = self.rect.move(x.rect.left+29, x.rect.top-50) s...
wiltley/SpaceInvadersPyGame
scripts/bullet.py
bullet.py
py
1,196
python
en
code
0
github-code
1
20782775994
import os import numpy as np import torch import torch.nn as nn import torch.nn.functional as F from .utils import download_file_from_gdrive # mapping network ################# def pixel_norm(x, epsilon=1e-8): return x * torch.rsqrt(torch.mean(torch.pow(x, 2), dim=1, keepdim=True) + epsilon) class MappingNetwo...
tanelp/neural-obfuscator
neural_obfuscator/stylegan.py
stylegan.py
py
12,295
python
en
code
2
github-code
1
71223092515
# coding=utf-8 # 字典合并 l_p = {"python": 'py', 'c++':'cpp'} l_j = {'java': 'java', 'golang': 'go'} l_t = l_p | l_j # print(l_t) # 解包合并 t = {**l_p, **l_j} # print(t) # 字典生成式 m_keys = ['py', 'c', 'go'] m_values = ['python', 'c', 'golang'] d = {key: value for key, value in zip(m_keys, m_values)} # print(d) # k,v互换 d...
FYPYTHON/PathOfStudy
python/笔记/字典操作.py
字典操作.py
py
625
python
en
code
0
github-code
1
29920536522
from PyQt5.QtCore import Qt from PyQt5.QtWidgets import QApplication, QMainWindow, QPushButton, QStackedWidget, QToolButton, QComboBox, \ QTableWidget, QTableWidgetItem, QLabel from PyQt5.uic import loadUi from fileDirectory import FileDirectory class Ui(QMainWindow): def __init__(self): supe...
lalocho/software2
src/PICK.py
PICK.py
py
9,213
python
en
code
0
github-code
1
74227210594
import uos as os import lcd160cr import lcd160cr_test import pyb import utime as time import widgets from colors import * from utils import restore_framebuffer try: lcd = lcd160cr.LCD160CR('XY') except OSError: # I might have plugged in into the other side lcd = lcd160cr.LCD160CR('YX') lcd.set_pen(WHITE, ...
fragmuffin/howto-micropython
examples/lcd-demo/main.py
main.py
py
3,425
python
en
code
2
github-code
1
6993276560
import numpy as np import matplotlib.pyplot as plt from scipy.integrate import odeint T = 200 h = 1e-2 t = np.arange(start=0, stop=T + h, step=h) bet, gam = 0.15, 1 / 50 # todo: zmienic poziej na randoma # S_pocz = np.random.uniform(0.7, 1) S_start = 0.8 I_start = 1 - S_start R_start = 0 N = S_start + I_start + R_sta...
Ukasz09/Machine-learning
SIR_Model_Spread_of_Disease/SIR.py
SIR.py
py
4,130
python
en
code
1
github-code
1
30826854011
from http import HTTPStatus from typing import Dict from aiohttp import web from aiohttp.web import Request, Response, json_response from botbuilder.core import ( BotFrameworkAdapterSettings, ConversationState, MemoryStorage, UserState, ) from botbuilder.core.integration import aiohttp_error_middleware...
Sako74/p10
P10_03_chatbot/webapp/app.py
app.py
py
4,282
python
en
code
0
github-code
1
26777282377
import math import torch import numpy as np from torch import autograd, optim from torch.distributions.multivariate_normal import MultivariateNormal import scipy.optimize from tqdm import tqdm def get_schedule(num, rad=4): if num == 1: return np.array([0.0, 1.0]) t = np.linspace(-rad, rad, num) s ...
Lucas-Florin/dais_np
src/neural_process/dais.py
dais.py
py
4,698
python
en
code
0
github-code
1
28921295761
import pandas as pd import random as rd import numpy as np import matplotlib.pyplot as plt import seaborn as sns import matplotlib.cm as cm import pickle import random import math class neuron: def __init__(self,weights): self.weights = weights self.outputneuron=None self.s=...
MeryemEssalmi/Adaptive-Neural-Network-from-scrach
Neural Network code.py
Neural Network code.py
py
11,523
python
en
code
0
github-code
1
23574390738
#CRIANDO FUNÇÕES def decorar(): print(15*'-') print('MENU') print(15*'-') def enfeitarNome(texto): print(15*'-') print(texto) print(15*'-') def teste(): return 'meu erro' def calcularIMC(altura, peso): imc = peso/(altura**2) return imc print(enfeitarNome(calcularIMC(2,99))) som...
renegadelhaedu/alg20231
code41.py
code41.py
py
543
python
pt
code
1
github-code
1
1538771716
import logging import numpy as np from src.MiniProjects.Maze.Maze import Maze __author__ = 'frank.ma' logger = logging.getLogger(__name__) class MazeSolver(object): MOVES = dict(N=(-1, 0), W=(0, 1), S=(1, 0), E=(0, -1)) found_solution = False def __init__(self, maze: Maze): s...
frankma/Finance
src/MiniProjects/Maze/MazeSolver.py
MazeSolver.py
py
1,299
python
en
code
0
github-code
1
27400999130
from __future__ import annotations import itertools from abc import ABC, abstractmethod from collections import defaultdict from collections.abc import Iterable, Iterator from dataclasses import dataclass, field from typing import cast from cognite.client.data_classes import data_modeling as dm from cognite.client.da...
cognitedata/pygen
cognite/pygen/_core/data_classes.py
data_classes.py
py
31,015
python
en
code
2
github-code
1
22448311010
import dash_core_components as dcc import dash_html_components as html from dash.dependencies import Input, Output from app import app from apps import app_individual, app_aggregate app.layout = html.Div([ dcc.Location(id='url', refresh=False), html.Div(id='page-content') ]) index_page = html.Div([ dcc....
saeed349/Microservices-Based-Algorithmic-Trading-System-V-2.0
Storage/dash/index.py
index.py
py
901
python
en
code
38
github-code
1
4247894925
from datetime import timedelta from airflow import DAG from airflow.models import Param from airflow.operators.dummy_operator import DummyOperator from common.operators.gce import ( StartGCEOperator, StopGCEOperator, CloneRepositoryGCEOperator, SSHGCEOperator, ) from common.utils import get_airflow_sch...
pass-culture/data-gcp
orchestration/dags/jobs/ml/algo_training_qpi.py
algo_training_qpi.py
py
9,855
python
en
code
2
github-code
1
10821283659
import argparse import torch import torch.nn as nn from torch.utils import data import numpy as np from torch.autograd import Variable import torch.optim as optim import torch.backends.cudnn as cudnn import os import os.path as osp from multiframe3_CoAttentionSTN import FtoFAttentionModel import scipy.io as sio from Po...
sa867/CoAttentionSTN
train_CoAttentionSTN_temporal.py
train_CoAttentionSTN_temporal.py
py
17,381
python
en
code
1
github-code
1
892004178
import sqlite3 import csv get_sql = """ DELETE FROM 'table_fees' WHERE truck_number = ? AND timestamp = ? """ def delete_wrong_fees(cursor: sqlite3.Cursor, wrong_fees_file: str) -> None: with open(f'../{wrong_fees_file}') as csvfile: spamreader = csv.reader(csvfile, delimiter=',') for ...
BogdanNos/PythonNosinovskiy
mod13/task2/task2.py
task2.py
py
553
python
en
code
0
github-code
1
6377740088
#!/usr/bin/env python # -*- coding: utf-8 -*- # *************************************************************************** # Copyright (c) 2018 西安交通大学 # All rights reserved # # 文件名称:Mayavi_test.py # # 摘 要:数据可视化mayavi库测试文件 # # 创 建 者:上官栋栋 # # 创建日期:2018年11月9日 # # 修改记录 # 日期 修改者 版本 修改内容 # --...
sgdd66/Optimization-under-Constraint
Mayavi_test.py
Mayavi_test.py
py
18,371
python
en
code
0
github-code
1
30407259914
from fastapi import FastAPI from controllers.routes import router from services.services import download_and_load_data, download_and_load, clear_db_data from apscheduler.schedulers.background import BackgroundScheduler def poll_and_load_datasets_again(): clear_db_data() download_and_load_data() app = FastAP...
A-G-U-P-T-A/LoopApi
main.py
main.py
py
684
python
en
code
0
github-code
1
74579624992
"""empty message Revision ID: 88f77742bc2d Revises: Create Date: 2017-07-03 13:15:12.714598 """ from alembic import op import sqlalchemy as sa # revision identifiers, used by Alembic. revision = '88f77742bc2d' down_revision = None branch_labels = None depends_on = None def upgrade(): # ### commands auto gene...
cokifigue/validateMe
migrations/versions/88f77742bc2d_.py
88f77742bc2d_.py
py
852
python
en
code
3
github-code
1
40091316327
import torchvision from torchvision import transforms from torch.utils import data def load_data_fashion_mnist(batch_size, resize=None, workers=4): """ 自动下载FashionMNIST数据集,并返回数据加载器 """ trans = [transforms.ToTensor()] if resize: trans.insert(0, transforms.Resize(resize)) trans = tran...
huangluyao/simple_network
simple_network/dataset/load_data.py
load_data.py
py
1,177
python
en
code
0
github-code
1
11737051293
from flask import jsonify, render_template from app.device import bp, device from app.models import DeviceModel, Project @bp.route('/devices', methods=['GET', 'POST']) def devices(): connected = device.get_devices() registered = DeviceModel.query.all() return render_template('device/devices.html', title='...
johndoe-dev/Ecodroid
app/device/routes.py
routes.py
py
660
python
en
code
0
github-code
1
19719572491
#!/usr/bin/env python3 import sys sys.path.append('../../python') from deviceManager import * import unittest class TestGetDevice(unittest.TestCase): #====== process_device ======== def test_parse_happy_case(self): test_input = ["13021FDD4005XC device", "emulator-5554 offline"] expected = [{'...
qbalsdon/talos
python/tests/deviceManager_Test.py
deviceManager_Test.py
py
5,422
python
en
code
4
github-code
1
37182985066
from utilities import * all_subdirs = os.listdir() for subdir_name in all_subdirs: if not os.path.isdir(subdir_name) or "Vehicle" not in subdir_name: continue all_files = os.listdir(subdir_name + "/cleaned_csv/") bad_rides_filenames = set() if os.path.isfile(subdir_name + "/bad_ride...
LucijaZuzic/OtoTrak-Data-Test
time_gap.py
time_gap.py
py
1,480
python
en
code
0
github-code
1
9430911528
t=int(input()) while t != 0: nums = list(map(int, input().split(" "))) l = min(nums) r = max(nums) for i in nums: if i not in (l,r): print(i) t-=1
NicholasTing/Competitive_Programming
CodeForces_830-835/CodeForces_835/a.py
a.py
py
209
python
en
code
1
github-code
1
23048697587
import torch from torchvision import transforms as T from torch.optim.lr_scheduler import ExponentialLR from PIL import Image import os from tqdm import tqdm from dalle2_pytorch import DALLE2, DiffusionPriorNetwork, DiffusionPrior, Unet, Decoder, OpenAIClipAdapter, DiffusionPriorTrainer, DecoderTrainer from dall...
goldiusleonard/Dalle2_pytorch_project
train_dalle2_from_csv.py
train_dalle2_from_csv.py
py
7,138
python
en
code
4
github-code
1
70483337633
import random from zope import lifecycleevent, event from zope.component import getUtility from Products.CMFCore.utils import getToolByName from Products.Five import BrowserView from kss.core import force_unicode from plone.app.kss.plonekssview import PloneKSSView from archetypes.kss.fields import FieldsView from ...
austgl/everydo-project
zopen.plone.chat/src/zopen/plone/chat/browser/kssview.py
kssview.py
py
1,830
python
en
code
0
github-code
1
21155338475
import numpy as np import pandas as pd from preprocess import data_preprocessed as dt year_data=[dt.loc[dt.YEAR==i,:] for i in range(1979,2016)] max_table=pd.DataFrame(index=list(range(1979,2016)),columns=['max','max^2']) for i in range(37): max_table.iloc[i,0]=year_data[i].max()['HS'] max_table.iloc[i,1]=max...
WaicongTam/Graduation-Thesis
source code/prediction.py
prediction.py
py
644
python
en
code
0
github-code
1
27090158967
import heapq N, K = map(int, input().split()) A, B = [0]*N, [0]*N timesUsed = [0 for _ in range(N)] for i in range(N): a, b = map(int, input().split()) A[i], B[i] = a, b priorityQueue = [(A[i], i) for i in range(N)] heapq.heapify(priorityQueue) # print(priorityQueue) ans = 0 for i in range(K): machineN...
Intel-out-side/AtCoder
practice/CodeThanksFestival2017_d.py
CodeThanksFestival2017_d.py
py
569
python
en
code
0
github-code
1
35913592991
# Manasa and Stones # Calculate the possible values of the last stone where consecutive values on the stones differ by a value 'a' or a value 'b'. # # https://www.hackerrank.com/challenges/manasa-and-stones/problem # def stones(n, a, b): # si a==b une seule valeur possible if a == b: return [(n - 1) * ...
rene-d/hackerrank
algorithms/implementation/manasa-and-stones.py
manasa-and-stones.py
py
752
python
en
code
72
github-code
1
25191930876
from pytablewriter import MarkdownTableWriter def readCustomVCF(fname, keep_cols): data = [] with open(fname, 'r') as vcf: for line in vcf: # skip the header specification part if line.startswith('##'): continue # get the header line but only keep the...
W-L/ProblematicSites_SARS-CoV2
src/vcf2markdown.py
vcf2markdown.py
py
2,381
python
en
code
45
github-code
1
6421783280
import datetime from flask import jsonify, request, Blueprint from flask_jwt import jwt_required, current_identity from flasgger.utils import swag_from from app.utils.utils import serialize, get_flag_by_id from app.utils.validate_redflag import Validate_redflag from app.models.redflag import Redflag from database.inci...
PatrickMugayaJoel/IReporter-Api
app/views/redflags.py
redflags.py
py
8,161
python
en
code
0
github-code
1
17555510361
'''Functions for reading ERA5 parameter table info saved in csv format. Author: guangzhi XU (xugzhi1987@gmail.com) Update time: 2021-04-09 11:13:20. ''' from __future__ import print_function import os import glob import csv TABLE_FOLDER=os.path.abspath(os.path.join(os.path.abspath(__file__), '../tables/')) def rea...
Xunius/era5-dl
era5dl/util_read_param_table.py
util_read_param_table.py
py
3,880
python
en
code
2
github-code
1
14147831907
#!/usr/bin/python3 # #####素数的方法一 ''' 方法一使用传统的while循环来实现素数的查找 ''' def showMaxFactor(num): count=num//2 while count>1: if num % count==0: print('%d的最大约数是%d' % (num,count)) break count -=1 else: print('%d是素数!' % num) num=int(input('请输入一个数:')) showMaxFactor(num) ...
jackiesir/test
1.py
1.py
py
625
python
zh
code
0
github-code
1
3495862385
import random from core.dice import Dice from math import sqrt class Board: @staticmethod def create_from_dice(dice: Dice): dice_list = dice.value shuffled_dice = random.sample(dice_list, len(dice_list)) letters = [] for die_faces in shuffled_dice: let...
cpurules/alphabet-soup
alphabet-soup/core/board.py
board.py
py
5,170
python
en
code
0
github-code
1
1706775488
from tkinter import * from enum import Enum ## WFrame 창의 처음 위치를 나타내는 열거형 class StartPosition(Enum): default = 0 centerScreen = 1 centerParent = 2 manual = 3 ## Windows Forms를 토대로 작성한 Frame # # http://effbot.org/tkinterbook/ class WFrame(Frame): ## 제목 표시줄에 표시할 제목 # @var string t...
sunghwan2789/EnglishTypingPractice
wframe.py
wframe.py
py
3,692
python
ko
code
1
github-code
1
26275998182
import json from http.server import HTTPServer, BaseHTTPRequestHandler from multiprocessing import active_children, Process ''' 大致原理,程序启动后,会在本地开启一个http服务。Tkinter布局助手上,点击预览后,将拖拽界面的布局转为python代码, 通过网络请求,发送到本服务,服务端接收到代码,使用exec函数执行代码。 因为exec函数,有一定危险性,如果你使用的是fork的项目,请自行检查代码后再执行。官方下载地址如下。 官方地址:https://www.pytk.net/tkinter-...
iamxcd/tkinter-helper
preview/preview-1.0.0.py
preview-1.0.0.py
py
1,855
python
en
code
408
github-code
1
20486209047
guests = ["Peter", "Cathy", "Leon"] for guest in guests: print(f"Hello, {guest}! You are invited to a dinner party.") print(f"We have room for more guests at the dinner party.") # Add guest to beginning of list guests.insert(0, "Ella") # Add guest to middle of list using floor divide // to get an int index mid...
pnvnd/python-courses
Python Crash Course 2e/03/3-6_more-guests.py
3-6_more-guests.py
py
512
python
en
code
0
github-code
1
71975828513
#!/usr/bin/env python3 import time from pyftdi.spi import SpiController from pycrc.algorithms import Crc # --------------------------------------------------------------------------- # DSI utilities # --------------------------------------------------------------------------- EOTP = [ 0x08, 0x0f, 0x0f, 0x01 ] DSI...
esden/icebreaker-temp
nano-pmod-up5k/control.py
control.py
py
4,883
python
en
code
3
github-code
1
22452873346
import matplotlib.pyplot as plt import numpy as np import pandas as pd from sklearn import tree, ensemble from sklearn.model_selection import cross_val_score from sklearn.datasets import load_breast_cancer from sklearn.model_selection import KFold from sklearn.tree import plot_tree from sklearn.model_selection import t...
ken-100/edX
MachineLearning/HW01_DecisionTree_Cross-Validation.py
HW01_DecisionTree_Cross-Validation.py
py
6,116
python
en
code
0
github-code
1
17736076609
# given a list of integers return the minimum # integer missing from the list def solution(a): # you could use the original list # my reasoning for creating set out # of the original list was to make the # search for the elements faster as a # set does not contain duplicates # for example give...
E-G-C/challeges
min_integer_in_array.py
min_integer_in_array.py
py
946
python
en
code
0
github-code
1
38918987427
from django.shortcuts import render , redirect from django.contrib.auth import login from django.contrib.auth.forms import UserCreationForm def register(request): #регаем нового юзверя if request.method != 'POST': #вывод пустой формы реги form=UserCreationForm() else: #Обр...
Master-sniffer/Learning-PYTHON-
Book_1/Django/Scripts/users/views.py
views.py
py
973
python
ru
code
1
github-code
1
31929396338
# Standalone 1.5D distributed SpMM implementation # Largely borrowed from CAGNET import argparse import math import os import time import torch import torch.distributed as dist import torch.multiprocessing as mp from sparse_coo_tensor_cpp import spmm_gpu comp_time = dict() comm_time = dict() bcast_comm_time = dict(...
alokpathy/spmm
nccl_ex.py
nccl_ex.py
py
9,877
python
en
code
1
github-code
1
26390497940
from django.db import models from django.utils.translation import gettext_lazy as _ class QuestionType(models.TextChoices): NUMERIC = 'NUMERIC', _('Numeric') TEXT = 'TEXT', _('Text') DROPDOWN = 'DROPDOWN', _('Dropdown') CHECKBOX = 'CHECKBOX', _('Checkbox') RADIO_BUTTON = 'RADIO_BUTTON', _('RadioBut...
mehedi-shafi/simple-survey
api/survey/enums.py
enums.py
py
495
python
en
code
0
github-code
1
35253854263
import pymongo import yfinance as yf from pymongo import collection from .stock_price import get_stock_price import os CLIENT = pymongo.MongoClient("mongodb+srv://App:ZU5u0b56vYc7xY15@stockopositions.r5bip.mongodb.net/StockoPositions?retryWrites=true&w=majority") DB = CLIENT.test USER_COLLECTION = DB.get_collection('d...
Asetka/Stocko
backend_api/backend_processing/db_wrapper.py
db_wrapper.py
py
6,000
python
en
code
0
github-code
1
27516911233
# -*- coding:UTF-8 -*- def get_auth_url(): weibo_auth_url = 'https://api.weibo.com/oauth2/authorize' redirect_url = 'http://127.0.0.1:8000/complete/weibo/' auth_url = weibo_auth_url+'?client_id={client_id}&redirect_uri={re_url}'.format(client_id=2113796513,re_url=redirect_url) print(auth_url) def ge...
yuansuixin/Django
apps/utils/weibo_login.py
weibo_login.py
py
1,282
python
en
code
1
github-code
1
32174735176
import os import io import base64 import os.path from zipfile import ZipFile from odoo import api, fields, models from odoo.tools.safe_eval import safe_eval class ExportNfe(models.TransientModel): _name = 'wizard.export.nfe' _description = "Exporta NF-e" start_date = fields.Date(string="Data Inicial", re...
Trust-Code/odoo-brasil
l10n_br_eletronic_document/wizard/export_nfe.py
export_nfe.py
py
4,275
python
en
code
178
github-code
1
38914409041
# python dictonary file from difflib import get_close_matches from json import load #import tkinter as tk from tkinter import * # loading dictionary to memory file = open('data.json', 'r') data = load(file) file.close() # fuction declaration def translate(): output.delete(0, END) w = entry_key.get() w ...
rinkeshsante/ExperimentsBackup
Python Project Dictionary/app_GUI.py
app_GUI.py
py
1,797
python
en
code
0
github-code
1
409246010
from __future__ import absolute_import from .pybcp47 import Bcp47LanguageParser from transitfeed import problems as problems_class from transitfeed import util parser = Bcp47LanguageParser() def IsValidLanguageCode(lang): """ Checks the validity of a language code value: - checks whether the code, as lower ca...
google/transitfeed
extensions/googletransit/extension_util.py
extension_util.py
py
1,697
python
en
code
670
github-code
1
18815073444
N = 14 hats = [0, 1, 2, 2, 3, 4, 5, 6, 6, 6, 6, 6, 6, 6] #Replace the above code with your test cases liar=0 for i in range(2,N-1): if(hats[0]!=0): liar=1 elif(hats[1]!=1): liar=2 else: if(hats[i]+1!=hats[i+1] and hats[i]!=hats[i+1]): liar=i+1 if(liar==0): for x in range(len...
LumpBloom7/MCC-2017-Answers
MCC2017Q5/main.py
main.py
py
403
python
en
code
0
github-code
1
20192619756
import pprint from urllib import request import requests import pandas as pd from _kluce import * movie_id = 551 api_version = 3 api_base_url = f"https://api.themoviedb.org/{api_version}" endpoint_path = f"/search/movie" search_query = "Matrix" endpoint = f"{api_base_url}{endpoint_path}?api_key={api_key}&query={sear...
eavf/30-days
Day132/connect.py
connect.py
py
1,293
python
en
code
0
github-code
1
19444944835
"""The core module of this code base. Includes the agent, environment, and experiment APIs. """ import logging import sys import time from abc import ABCMeta, abstractmethod import numpy as np LOGGER = logging.getLogger('experiment') LOGGER.setLevel(logging.DEBUG) class Agent(metaclass=ABCMeta): """An abstr...
christopher-wolff-zz/lab-old
lab/core.py
core.py
py
9,902
python
en
code
0
github-code
1
17847187153
# -*- test-case-name: xquotient.test.historic.test_composer5to6 -*- """ Create stub database for upgrade of L{xquotient.compose.Composer} from version 5 to version 6. """ from axiom.test.historic.stubloader import saveStub from axiom.dependency import installOn from axiom.userbase import LoginMethod from xquotient.c...
rcarmo/divmod.org
Quotient/xquotient/test/historic/stub_composer5to6.py
stub_composer5to6.py
py
711
python
en
code
10
github-code
1
29674277875
import json from astar.astar import Astar from roblib.map import Map import numpy as np from roblib.datastructures import MoveCommand from roblib.datastructures import Coordinate from filetransfer import Filetransfer # Path JSON _PATH_LOCAL = "./path.json" _PATH_REMOTE = "/home/nao/.local/share/PackageManager/apps/Flo...
tschibu/hslu-roblab-floorguide
planner.py
planner.py
py
4,098
python
en
code
0
github-code
1
5579649281
import keyboard from time import time from communication.bt_server import BT_Server from communication.KEYBOARD_CONFIG import KEYBOARD_CONFIG_DICT, DEBOUNCE_INTERVAL from communication.BT_CONFIG import BT_CONTROLLER_DICT def graceful_exit(func): def wrapper(*args, **kw_args): try: return func...
ankitasharma1/swarmbots
raft/controller.py
controller.py
py
3,093
python
en
code
0
github-code
1
73206785314
"""Support for HomeSeer light-type devices.""" import asyncio import logging from typing import Any from homeassistant.components.light import ( ToggleEntity, LightEntity ) from homeassistant.const import ( CONF_NAME, STATE_ON, STATE_OFF ) from .command import (turn_off, turn_light_up) _LOGGER = logging.getL...
ettingshausen/hass-micoe-bath-heater
custom_components/micoe_bath_light/light.py
light.py
py
1,252
python
en
code
0
github-code
1
27101007733
# -*- coding: utf-8 -*- from PyQt4 import QtGui as qg import PyQt4 import sys class Example( qg.QWidget ): def __init__( self ): super(Example,self).__init__() PyQt4.QtCore.QTextCodec.setCodecForTr(PyQt4.QtCore.QTextCodec.codecForName('GB18030')) self.init() def init( self ): q...
TAKSIM/news
monitor/gui_test.py
gui_test.py
py
771
python
en
code
0
github-code
1
2360324537
# word = "you " # # first_letter = word[0] # # end_word = word[1:-1] # first_letter = "" # end_word = "" # for char in word: # if char == word[0:1]: # first_letter += char # elif char in word[1:-1:]: # end_word += char # # print('x') # # print(first_letter) # # print(end_word) # # p...
SamuelMiller413/Python-101-
11_conditionals-and-loops/Order_function_loop.py
Order_function_loop.py
py
2,399
python
en
code
0
github-code
1
19078811720
from django.shortcuts import render from django.http import HttpResponseRedirect from django.db.models import Q from django.urls import reverse_lazy from django.views.generic import ListView from applications.Producto.models import ProductoServicio from applications.PaginaVenta.models import Suscripciones from applicat...
jhonny212/portalventas
applications/Compra/views.py
views.py
py
3,549
python
es
code
0
github-code
1
27168642483
# Databricks notebook source # MAGIC %pip install git+https://github.com/rafa-arana/fire.git # COMMAND ---------- # MAGIC %md # MAGIC --- # MAGIC + <a href="$./00.DLT-SAN-Setup">STAGE 0</a>: Setup # MAGIC + <a href="$./00.DLT-SAN-File Ingestion with Autoloader">STAGE 0 bis</a>: File Ingestion with Autoloader # MAGIC ...
rafa-arana/dlt-regulatory-reporting
01.DLT-SAN-Autoloader-template.py
01.DLT-SAN-Autoloader-template.py
py
5,618
python
en
code
0
github-code
1
26514033503
from multiprocessing import Process, Value, RLock import time start = time.time() numa = Value('i', 0) numb = Value('i', 0) rlock = RLock() def do_sth(): """ """ """ rlock.acquire() try: adda() addb() finally: rlock.release() """ with rlock: for i in rang...
hemuke/python
17_process_thread/31_1_multiprocess_rlock.py
31_1_multiprocess_rlock.py
py
1,027
python
en
code
0
github-code
1
38940929836
import functools import io import json import logging import mimetypes import os.path import re import shutil import urllib.parse from typing import Dict, Type, TextIO import yaml from swagger_ui_bundle import swagger_ui_3_path # type: ignore[import] from werkzeug import Response from werkzeug.exceptions import HTTPE...
superbjorn09/checkmk
cmk/gui/wsgi/applications/rest_api.py
rest_api.py
py
9,052
python
en
code
null
github-code
1
21372179198
from selenium import webdriver from selenium.webdriver.common.by import By from selenium.webdriver.support.ui import WebDriverWait from selenium.webdriver.support import expected_conditions as EC from webdriver_manager.chrome import ChromeDriverManager from selenium.webdriver.chrome.options import Options ...
pdatlab/urology_journal_retriever
JournalGrabber.py
JournalGrabber.py
py
5,308
python
en
code
0
github-code
1
26055383293
import json import torch import yaml from torch.utils.data import DataLoader from torchvision.transforms import transforms from tqdm import tqdm from src.data.tooth_dataset import ToothDataset from src.model.vgg.vgg import Vgg from src.utils.transforms import SquarePad if __name__ == "__main__": with open("./src...
tudordascalu/2d-teeth-detection-challenge
src/model/vgg/scripts/predict.py
predict.py
py
2,508
python
en
code
2
github-code
1
39674393133
import logging import csv import re from . import Indicator from ..interfaces import CountryPolyInterface class WebsiteIndicator(Indicator): """ Indicator which detects the TLD of the website in the users profile and maps it to an area. Note: domains such as .com, .net and .org are ignored, and only coun...
Humpheh/twied
src/twied/multiind/indicators/websiteindicator.py
websiteindicator.py
py
1,626
python
en
code
11
github-code
1
31851582700
import pprint import re # noqa: F401 import six from asposeslidescloud.models.math_element import MathElement class BorderBoxElement(MathElement): """ Attributes: swagger_types (dict): The key is attribute name and the value is attribute type. attribute_map (dict): ...
aspose-slides-cloud/aspose-slides-cloud-python
asposeslidescloud/models/border_box_element.py
border_box_element.py
py
10,885
python
en
code
0
github-code
1
358883832
from apmiiib.abstract.geom.Point import Point from apmiiib.abstract.represent.microbot.AbstractMicrobotLineup import AbstractMicrobotLineup from apmiiib.abstract.represent.microbot.MicrobotSpikeParametrics import MicrobotSpikeParametrics from math import pi, floor, pow pi2 = pi*2 class AbstractMicrobotBasicSpike: "...
apmiiib/takachihosecretfiles-reverseengineering-blendermicrobotsimulation
src/apmiiib/abstract/represent/microbot/AbstractMicrobotBasicSpike.py
AbstractMicrobotBasicSpike.py
py
9,387
python
en
code
0
github-code
1
74229119712
from typing import List class Solution: def eraseOverlapIntervals(self, intervals: List[List[int]]) -> int: intervals.sort() res = 0 prevEnd = intervals[0][1] for start, end in intervals[1:]: if start >= prevEnd: prevEnd = end else: ...
TimHung000/leetcode
0435_nonOverlappingIntervals/main.py
main.py
py
450
python
en
code
0
github-code
1
35507782361
import random RandomNumber = random.randint(1,30) print(RandomNumber) print('Wylosowałem liczbę z zakresu 1-30. Odganij ją\n') while 1: Guess = int(input()) if Guess == RandomNumber: break print('Brawo wygrałeś!')
dlaciak/Python
8/2_3.py
2_3.py
py
238
python
pl
code
0
github-code
1
183727253
import cv2 import numpy as np import os import svgwrite # load image, change color spaces, and smoothing img = cv2.imread(os.path.dirname(os.path.abspath(__file__))+"/INIAD_logo.png") im=cv2.resize(img,(10000,10000)) im_gray = cv2.cvtColor(im, cv2.COLOR_BGR2GRAY) retval, im_bw = cv2.threshold(im_gray, 0, 255, cv2.THR...
s1F101900723/CG
CG_python/11/11-5_4.py
11-5_4.py
py
2,421
python
en
code
0
github-code
1
22852644906
from django.shortcuts import render, HttpResponse, redirect from django.db.models import Max, Min, Count from attendance.models import extemployeeatt, holiday, classlist, classes, classsolt, timesolt, checkinout from hr.models import employee from . import msslqdb import datetime import time import threading from xm...
linuxsjun/assect
attendance/views.py
views.py
py
16,883
python
en
code
0
github-code
1
42595708920
from typing import Any, Dict from django.contrib.auth.mixins import PermissionRequiredMixin from .exceptions import UnfoldException class UnfoldModelAdminViewMixin(PermissionRequiredMixin): """ Prepares views to be displayed in admin """ def get_context_data(self, **kwargs) -> Dict[str, Any]: ...
unfoldadmin/django-unfold
src/unfold/views.py
views.py
py
708
python
en
code
506
github-code
1
34855303951
#!/usr/bin/env python3 import time rot = [] for i in (1,-1): for j in (1,-1): for k in (1,-1): rot.append((i,j,k)) shuffle = [[0,1,2], [0,2,1], [1,0,2], [1,2,0], [2,0,1], [2,1,0]] flag = False class Scanner: def __init__(self, measures): self.data = measures self.num_data...
vanjo9800/AdventOfCode2021
19/scanners.py
scanners.py
py
4,251
python
en
code
1
github-code
1
19825679464
from menu import resources, MENU order = input("What would you like? (espresso/latte/cappuccino):") def calculate_amount(): t_quarter = float(input("how many quarters?:")) t_dime = float(input("how many dimes?:")) t_nickel = float(input("how many nickels?:")) t_penny = float(input("how many pennies?:...
ArghyaAD/Python
coffe_machine/code.py
code.py
py
1,078
python
en
code
0
github-code
1
42500434502
from django.urls import path from . import views app_name = 'polls' urlpatterns = [ # polls的首页 path('', views.IndexView.as_view(), name='index'), # 显示第三个问题的内容,例如: /polls/2/ path('<int:pk>/', views.DetailView.as_view(), name='detail'), # 显示第三个问题的内容回答,例如:: /polls/2/results/ path('<int:p...
cybercampus/mysite-polls
polls/urls.py
urls.py
py
571
python
zh
code
0
github-code
1
10048169764
""" Binary Search Trees (BST) - tree structure that follow the search property, ie, for every node, all the nodes in the left subtree are smaller than the current node and all the nodes in the right subtree are larger than the current node. rank(n) => the rank of a node in a tree is the sum of the number of nodes that ...
okaysidd/Interview_material
Extras/Binary search trees (BST).py
Binary search trees (BST).py
py
2,777
python
en
code
0
github-code
1
31317534219
from typing import List from scripts.faceswaplab_ui.faceswaplab_inpainting_ui import face_inpainting_ui from scripts.faceswaplab_swapping.face_checkpoints import get_face_checkpoints import gradio as gr from modules import shared from scripts.faceswaplab_utils.sd_utils import get_sd_option def faceswap_unit_advanced_...
Navezjt/sd-webui-faceswaplab
scripts/faceswaplab_ui/faceswaplab_unit_ui.py
faceswaplab_unit_ui.py
py
11,583
python
en
code
0
github-code
1
7521355922
# factorial 알고리즘 (2가지 방법) # (1) 1~n까지 연속한 정수의 곱을 구하기 def facto(n): s = 1 for i in range(1, n+1): s = i * s return s print(facto(10)) # (2) 재귀호출을 통한 구현 def facto2(n): if n <= 1: return 1 return n * facto2(n-1) print(facto2(10)) # 활용1. 1~n까지 연속된 숫자 합을 재귀 함수로 구하기 # firtst trial def sum_num(n): ...
kyueunQ/Python
algorithms/day04.py
day04.py
py
896
python
ko
code
0
github-code
1
32495999011
# You are welcome to write and include any other Python files you want or need # however your game must be started by calling the main function in this file. from character import Character from random import * # Creates the character objects def getCharacters(): hero = Character("Daltor", 200, 20) sendor = C...
coreymyster/adventure-game
adventure_game.py
adventure_game.py
py
4,370
python
en
code
0
github-code
1
30332025823
from pathlib import Path import shutil CURRENT = Path(__file__).resolve().parent ConfPath = CURRENT / ".vscode" if ConfPath.exists(): shutil.rmtree(ConfPath) ConfPath.mkdir() tasks_conf = ConfPath / "tasks.json" if False: tasks_conf.write_text( """ { "version": "2.0.0", "tasks": [ { ...
soda92/external_sorting
generate_vscode_files.py
generate_vscode_files.py
py
2,338
python
en
code
0
github-code
1