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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
34058594289 | import traceback
import logging
import logging.config
import sys
from django.conf import settings
class SysLogger(object):
"""
system logger
"""
INFO_LOGGER = logging.getLogger(settings.PROJECT_INFO_LOG)
ERROR_LOGGER = logging.getLogger(settings.PROJECT_ERROR_LOG)
EXCEPTION_LOGGER = logging.g... | cnbillow/startupadmin-django2-python3-react | startup/libs/djangos/logger/syslogger.py | syslogger.py | py | 2,060 | python | en | code | 0 | github-code | 50 |
26283351078 | import os
import openai
from dotenv import load_dotenv
load_dotenv()
OPENAI_API_KEY = os.environ.get('OPENAI_API_KEY')
class OpenAIFeatures():
def __init__(self):
self.model = "gpt-3.5-turbo-1106"
def test_seed(self, seed: int = None):
# Below context taken from https://www.investopedia.co... | kpister/prompt-linter | data/scraping/repos/rajib76~langchain_examples/examples~how_to_use_seed_in_openai.py | examples~how_to_use_seed_in_openai.py | py | 3,297 | python | en | code | 0 | github-code | 50 |
69969448477 | # Oppgave 1 (oppgave 5)
tempe_fahrenheit = input("Skriv inn en temperatur i fahrenheit: ") # Lagrer input i en variabel
is_number = False
while not is_number: # Ved hjelp av variabelen "is_number", så kjører koden under.
try: # Så lenge det kommer en feilmelding når man prøver å konvertere input, ... | DanielDuy/in1000_host_2022_innleveringer | in1000_oblig2/fahrenheit_celsius.py | fahrenheit_celsius.py | py | 965 | python | no | code | 0 | github-code | 50 |
42093212638 | import gtk
import cairo
import gobject
class HIGToolItem(gtk.HBox):
"""
A HBox that emulate the behaviour of ToolItem
"""
def __init__(self, lbl, image_widg=None, markup=True):
"""
Initialize an instance of HIGToolItem
@param lbl the text for label
@param image_widg th... | umitproject/packet-manipulator | umit/pm/higwidgets/higtoolbars.py | higtoolbars.py | py | 13,081 | python | en | code | 16 | github-code | 50 |
16709923415 | import numpy as np
import cv2
#for gray scale
img=cv2.imread('apple1.jpg',0)
#show image
cv2.namedWindow('image_window',cv2.WINDOW_NORMAL)
cv2.imshow('image_window',img)
k=cv2.waitKey(0)
if k==ord(s):
cv2.imwrite('applegrey.png',img)
cv2.destroyAllWindows()
| himanshushukla254/OPENCV_Python_Codes | key_involve.py | key_involve.py | py | 264 | python | en | code | 0 | github-code | 50 |
10079458197 | import tkinter
import pandas as pd
from tkinter import ttk
from tkcalendar import DateEntry
import time
from tkinter import messagebox
import os.path as path
class InputStudentWindow(tkinter.Frame):
def __init__(self, master=None, path="data/estudiantes.json"):
super().__init__(master)
self.pack(... | ichcanziho/Interfaz_grafica_tablas_python | core/classes/input_student.py | input_student.py | py | 3,666 | python | en | code | 0 | github-code | 50 |
41454300062 | import os
import abbrs
def current_path():
p = os.path.realpath(__file__)
p = os.path.split(p)[0]
p = os.path.split(p)[-1]
return p
PACKAGE_NAME = current_path()
RC_FILENAME = f'{PACKAGE_NAME}.json'
def make_dat(ls):
def is_mp4(x):
s = x.split('.')
return len(s) >= 2 and (s[-1] == 'mp4' or s[... | frankschweitzer/TV_Ad_Scraper | myenv/lib/python3.11/site-packages/filenames_secure/__init__.py | __init__.py | py | 1,256 | python | en | code | 0 | github-code | 50 |
10366567275 | import os
import cgsensor
import mh_z19
import requests
from dotenv import load_dotenv
def get_sensor_info():
result = {}
bme280 = cgsensor.BME280(i2c_addr=0x76)
bme280.forced()
result["temp"] = bme280.temperature
result["humid"] = bme280.humidity
result["pressure"] = bme280.pressure
tsl... | mjun0812/raspi | cron.py | cron.py | py | 691 | python | en | code | 0 | github-code | 50 |
15326574774 | # Vigenere Cipher Frequency Hacker
import itertools
import os
import re
import sys
import use_original.CheckEnglishUseinEight as CE
import use_original.FrequencyFinderUseinSeventeen as FF
import use_original.VigenereCipherUseinSixteen as VC
import use_original.ProcessingBar as PB
LETTERS = "ABCDEFGHIJKLMNOPQRSTUVWXY... | KampfWut/CodeGeneratedDuringLearning | Python Encryption/17_VigenereCipherFrequencyHacker.py | 17_VigenereCipherFrequencyHacker.py | py | 9,047 | python | en | code | 0 | github-code | 50 |
8715663169 | from dash import dash, html
import dash
import dash_bootstrap_components as dbc
# Create Dash App
app = dash.Dash(__name__, use_pages=True, external_stylesheets=[dbc.themes.CYBORG],
meta_tags=[{'name': 'viewport',
'content': 'width=device-width, initial-scale=1.0'}])
#... | marcynn/Fintix | app.py | app.py | py | 1,265 | python | en | code | 1 | github-code | 50 |
14600597575 | from facenet_pytorch import MTCNN, InceptionResnetV1, fixed_image_standardization, training
import torch
from torch.utils.data import DataLoader
from torch import optim
from torch.optim.lr_scheduler import MultiStepLR
from torchvision import datasets, transforms
import os
from pysistant import helpers
from PIL import I... | Ilyushin/facenet-pytorch | train_model_distributed_accelerator.py | train_model_distributed_accelerator.py | py | 6,750 | python | en | code | null | github-code | 50 |
21874214998 | """
Definition of Interval.
class Interval(object):
def __init__(self, start, end):
self.start = start
self.end = end
"""
import heapq
class Solution:
"""
@param intervals: an array of meeting time intervals
@return: the minimum number of conference rooms required
"""
def minM... | sunjianbo945/leetcode | src/amazon/919. Meeting Rooms II.py | 919. Meeting Rooms II.py | py | 674 | python | en | code | 0 | github-code | 50 |
12721264122 | try:
from hdb_ha_dr.client import HADRBase
except ImportError as e:
print("Module HADRBase not found - running outside of SAP HANA? - {0}".format(e))
import os
"""
To use this HA/DR hook provide please:
1) create directory /usr/shared/myHooks, which should be owned by <sid>adm
2) copy this file to /usr/sha... | rsponholtz/NotificationHook | myFirstHook.py | myFirstHook.py | py | 2,533 | python | en | code | 0 | github-code | 50 |
70942433115 | """
Module for instrument class and subclasses.
"""
import glob
import os
import astropy.io.fits as pyfits
import numpy as np
from scipy.ndimage.filters import median_filter
from . import utils as u
class Instrument:
"""
Instantiates an object that implements instrument-specific reduction techniques.
"... | arjunsavel/SImMER | src/simmer/insts.py | insts.py | py | 9,017 | python | en | code | 7 | github-code | 50 |
22923702477 | # !/usr/bin/python3
# coding:utf-8
# author:panli
import pytest
import unittest
import HTMLTestRunner
import time
import os
def allTest():
suite=unittest.TestLoader().discover(
start_dir=os.path.dirname(__file__),
pattern='test_*.py',
top_level_dir=None)
return suite
def getNowTime():
return time.strftim... | 17621606077pl/Test_Api | script/Day11/allTestRun.py | allTestRun.py | py | 665 | python | en | code | 0 | github-code | 50 |
38616349980 | # Системный администратор вспомнил,
# что давно не делал архива пользовательских файлов.
# Однако, объем диска, куда он может поместить архив,
# может быть меньше чем суммарный объем архивируемых файлов.
# Известно, какой объем занимают файлы каждого пользователя.
# Напишите программу, которая по заданной информации о ... | AnnaSmelova/Python_programming_basics_course | week6/05_archive.py | 05_archive.py | py | 1,062 | python | ru | code | 1 | github-code | 50 |
41700012726 | import numpy as np
from numpy.testing import (assert_array_equal, assert_array_almost_equal)
from sklearn.decomposition import PCA, TruncatedSVD
from sklearn.datasets import load_iris
from skutil.decomposition import *
from skutil.testing import assert_fails
from skutil.utils import load_iris_df
from skutil.decompositi... | tgsmith61591/skutil | skutil/decomposition/tests/test_decompose.py | test_decompose.py | py | 3,119 | python | en | code | 29 | github-code | 50 |
6513147544 | import subprocess
import os
folder_path = '/media/usb'
des_path = '/home/sanjana/Braillie_Project/input_files'
def copy_files(source_path, destination_path):
#command to copy files
COPY_COMMAND = ['cp',source_path,destination_path]
#execute the command
try:
subprocess.check_... | VKSANJANA/Braillie_Project | copy.py | copy.py | py | 1,488 | python | en | code | 0 | github-code | 50 |
4031923941 | def clear(a):
for i in range(len(a)):
a[i] = a[i].strip()
return a
def toNumber(a):
for i in range(len(a)):
a[i] = eval(a[i])
return a
def tinhdiem_trungbinh(score,rate):
s=0
for i in range(len(score)):
s += score[i]* rate[i]
return rou... | TrinhNKL/Learning_python_for_data-science | OOP Ass/tinhtoan_diemtongket_OO_rev.py | tinhtoan_diemtongket_OO_rev.py | py | 7,590 | python | en | code | 0 | github-code | 50 |
38302835935 | from flask import Blueprint, render_template
import yfinance as yf
from flask_login import login_required, current_user
from db_manager import db_manager
from datetime import datetime
hist = Blueprint('hist',__name__)
def fetch_stock_history(symbol):
ticker = yf.Ticker(symbol)
end_date = datetime.now().strft... | jkw944/DIS_Project | MyWebApp/stock_hist.py | stock_hist.py | py | 3,078 | python | en | code | 0 | github-code | 50 |
70505940315 | """Module for Member_Payments model"""
from sqlalchemy.sql.functions import now
from models.Member_Payments import Member_Payments
from exceptions.Bad_Request import Bad_Request
from sqlalchemy.exc import IntegrityError
from models.Group_Payments import Group_Payments, db
from dataclasses import dataclass
@dataclass
... | Juli03b/groupypay | db_helpers/Member_Payment.py | Member_Payment.py | py | 3,001 | python | en | code | 0 | github-code | 50 |
73810922075 | import logging
import struct
import numpy as np
import serial
import time
from serial import SerialException
class ArduinoSerial:
"""
Represents an Arduino or ESP32 Serial device
"""
__address = None
__baud_rate = 57600 #19200 # 38400
__byte_size = serial.EIGHTBITS
__timeout = 0.01
... | erickmartinez/relozwall | instruments/position_pot.py | position_pot.py | py | 4,911 | python | en | code | 0 | github-code | 50 |
32103077192 | import firebase_admin
from firebase_admin import db
from datetime import datetime
from dotenv import load_dotenv
import os
import settings
load_dotenv()
DATABASE_URL = os.getenv('DATABASE_URL')
CREDENTIALS = os.getenv('CREDENTIALS')
class User():
def __init__(self, *args, **kwargs):
self.id=kwargs.get('i... | Anele13/voice_notes | firebase.py | firebase.py | py | 2,426 | python | en | code | 0 | github-code | 50 |
25672403537 | import copy
import numpy
def create_augmented_matrix():
array = numpy.empty(12).reshape(3, 4) # matrix (3 rows x 4 columns) (12 values)
array[0] = [1, 0, 2, 1]
array[1] = [2, -1, 3, -1]
array[2] = [4, 1, 8, 2]
return array # returns array
def create_matrix():
array = numpy.empty(9).reshap... | Aemxander/scientific-computing-course | Assignment 2/assignment 2.py | assignment 2.py | py | 8,296 | python | en | code | 0 | github-code | 50 |
21277570393 | '''Descript:
Ugly number is a number that only have factors 2, 3 and 5.
Design an algorithm to find the nth ugly number. The first 10 ugly numbers are 1, 2, 3, 4, 5, 6, 8, 9, 10, 12...
Notice
Note that 1 is typically treated as an ugly number.
'''
import heapq
class Solution:
"""
@param n: An integer
... | dragonforce2010/interview-algothims | none_ladder/4_Ugly_NumberII.py | 4_Ugly_NumberII.py | py | 3,450 | python | zh | code | 19 | github-code | 50 |
31795427348 | from problems.independence import IndependenceProblem
from gui import BaseGUI
import time
def greedy_search(problem: IndependenceProblem, gui: BaseGUI):
"""The BEST-IN-GREEDY algorithm."""
# Step 1: Get elements sorted by costs
element_iterator = problem.get_sorted_elements()
# Step 2: Initialize th... | jonasgrebe/tu-opti-algo-project | algos/greedy.py | greedy.py | py | 913 | python | en | code | 2 | github-code | 50 |
16761913042 | import numpy as np
import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import Axes3D
import seaborn as sns
import scipy.optimize as spc
def OOR2(x, p1):
return p1/(x**2)
def PlotLightCollection(positions, LC_factors, axis=None):
'''For a given axis, plot the light collection as a function of
that ax... | pershint/WATCHSHAPES | lib/Plots.py | Plots.py | py | 4,794 | python | en | code | 0 | github-code | 50 |
38925027559 | #!/usr/bin/env python
# coding: utf-8
# In[ ]:
import numpy as np
from scipy import integrate
class Wire:
'''
Implements an arbitrary shaped wire
'''
#coordz = np.array([])
'''Coordinates of the vertex of the wire in the form [X,Y,Z]'''
#I = 1
'''Complex current carried by the wire'''
... | arnaudbergeron/TokamakTrack | SimulationTokamak/WireShape.py | WireShape.py | py | 4,345 | python | en | code | 1 | github-code | 50 |
34401125439 | import psycopg2
import pandas as pd
def serialize_array(arr):
ret = " ".join(arr)
if not ret:
return "NULL"
return ret
def de_serialize_array(array_str):
return array_str.split(" ")
# connect to PostgreSQL database, get connection
conn = psycopg2.connect(
host="database",
dbname="po... | ECE444-2021Fall/project1-education-pathways-group-11-sigmalab | education_pathways/db_init.py | db_init.py | py | 5,490 | python | en | code | 2 | github-code | 50 |
74769111516 | # RandomForestClassifier.py: 随机森林分类器模块
import os, sys, time
import numpy as np
import math
from mpi4py import MPI
from DecisionTreeCartContinue import DecisionTreeCartContinue
from DecisionTreeCartDiscrete import DecisionTreeCartDiscrete
class RandomForestClassifier:
'''
: RandomForestClassifier... | Happyxianyueveryday/mpi-random-forest | RandomForestClassifier/RandomForestClassifier.py | RandomForestClassifier.py | py | 10,609 | python | zh | code | 1 | github-code | 50 |
7008365857 | from django.db import models
from django.contrib.auth.models import AbstractUser
# Create your models here.
class User(AbstractUser):
"""
Esta tabla reemplaza al User de django auth
"""
last_module_id = models.CharField(max_length=60, null=True, blank=True)
class Meta:
verbose_name = "Us... | LP2-20162/DinningCashier-S.A.C_copia | dinning_Cashier_service/caja/usuario/models.py | models.py | py | 362 | python | en | code | 0 | github-code | 50 |
20345531155 | import numpy as np
from src.bbox import get_bbox
from src.util import get_radius
class ClusterInfo():
"""
cluster info
"""
def __init__(self, in_a, in_b) -> None:
## indices array of points inside the cluster
self.in_a = in_a
self.in_b = in_b
self.n_pts_a = len(in_a)
self.n_pts_b = len(in_b)
self.n_p... | ZukSkyWalker/sniper_cuda | src/cluster_info.py | cluster_info.py | py | 4,583 | python | en | code | 0 | github-code | 50 |
11075605514 | from __future__ import annotations
import contextlib
import inspect
import logging
import os
import re
from asyncio import iscoroutinefunction
from datetime import timedelta
from fnmatch import fnmatch
from importlib import import_module
from typing import Any, Callable, Sequence
from asgiref.sync import async_to_syn... | reactive-python/reactpy-django | src/reactpy_django/utils.py | utils.py | py | 13,946 | python | en | code | 248 | github-code | 50 |
40779293015 | # CoApyright (c) 2018 The CommerceBlock Developers
# Distributed under the MIT software license, see the accompanying
# file LICENSE or http://www.opensource.org/licenses/mit-license.php.
from __future__ imp... | commerceblock/cb_idcheck | cb_idcheck/idcheck.py | idcheck.py | py | 20,179 | python | en | code | 1 | github-code | 50 |
31100584211 | """Unit tests for the job_offers_optimal_buckets module."""
import typing
from typing import Iterable
import unittest
import pandas
from bob_emploi.data_analysis.modeling import job_offers_optimal_buckets
class _TestCase(typing.NamedTuple):
name: str
offers: Iterable[int]
expected: Iterable[str]
clas... | bayesimpact/bob-emploi | data_analysis/modeling/test/job_offers_optimal_bucket_test.py | job_offers_optimal_bucket_test.py | py | 2,032 | python | en | code | 139 | github-code | 50 |
35864071104 | from __future__ import print_function, division
import psycopg2
from psycopg2.extras import Json
from psycopg2.extensions import TransactionRollbackError
import code
# {{{ database setup
SCHEMA = ["""
CREATE TYPE job_state AS ENUM (
'waiting',
'running',
'error',
'complete');
""",
"""
CREATE TABLE ... | inducer/disttune | disttune/__init__.py | __init__.py | py | 20,589 | python | en | code | 0 | github-code | 50 |
40807516385 | import math
import matplotlib.pyplot as plt
import numpy
lamb_1 = 0.4211 #
lamb_2 = 0.7371 #
M_0 = 15 #
sigma_Sqr_0 = 3 #
alfa_0 = 0.15 #
epsilon = 0.004 #
A1 = 1.68 # 1.7
A2 = .32 # 0.32
Ns = 15 #
lamb_3 = 0
S = 6 # 5 или 6
N = 200
def rand(l1, l2):
l3 = (l1 * l2 * 1e8) // 100
l3 = l3 % 10000
... | XYphrodite/MandMADD | 6.py | 6.py | py | 2,628 | python | en | code | 0 | github-code | 50 |
11043979180 | from odoo.addons.point_of_sale.tests.test_frontend import TestPointOfSaleHttpCommon
from odoo.tests import Form, tagged
@tagged("post_install", "-at_install")
class TestUi(TestPointOfSaleHttpCommon):
def setUp(self):
super().setUp()
self.promo_programs = self.env["coupon.program"]
# code... | anhjean/beanbakery_v15 | addons/pos_coupon/tests/test_frontend.py | test_frontend.py | py | 6,664 | python | en | code | 5 | github-code | 50 |
74434592795 | # -*- coding: utf-8 -*-
"""
Created on Sun Sep 18 16:07:23 2022
@author: Yu Jen
"""
import pandas_datareader as DR
import pandas as pd
import dateutil.parser as psr
from pandas_datareader._utils import RemoteDataError
import matplotlib.pyplot as plt
import sys
plt.rcParams['font.sans-serif']=['Arial Unicode MS']
plt... | yjchen0228/python_project | 台灣股票市場線圖製作/台灣股市線圖製作.py | 台灣股市線圖製作.py | py | 1,759 | python | en | code | 0 | github-code | 50 |
11013272830 | from odoo import models, fields, api
class PackageType(models.Model):
_inherit = 'stock.package.type'
shipper_package_code = fields.Char('Carrier Code')
package_carrier_type = fields.Selection([('none', 'No carrier integration')], string='Carrier', default='none')
@api.onchange('package_carrier_type... | anhjean/beanbakery_v15 | addons/delivery/models/stock_package_type.py | stock_package_type.py | py | 649 | python | en | code | 5 | github-code | 50 |
31178623803 | from django.shortcuts import render
from products.models import Product
from .models import Cart, CartDetail, Order, OrderDetail
# Create your views here.
def add_to_cart(request):
if request.method == "POST" :
product_id = request.POST['product_id']
quantity = request.POST['quantity']
... | pythone-developer/Ecomerce-Website | orders/views.py | views.py | py | 746 | python | en | code | 1 | github-code | 50 |
26636042324 | # 获取自带数据集
from sklearn.datasets import load_iris,load_boston,fetch_20newsgroups
# 特征工程
from sklearn.feature_extraction.text import TfidfVectorizer
from sklearn.feature_extraction import DictVectorizer
from sklearn.preprocessing import StandardScaler
# 分割数据集
from sklearn.model_selection import train_test_split
# 网格搜索... | PeterZhangxing/codewars | AI/machine_learning/knn_nby_class.py | knn_nby_class.py | py | 11,224 | python | en | code | 0 | github-code | 50 |
12485265076 | import time
import random
leoeaten = 0
daddyeaten = 0
mummyeaten = 0
minutes = random.randint(0,5)
if minutes != 0:
if minutes > 1:
print("They have just over", minutes, "minutes!")
else:
print("They have just over", minutes, "minute!")
for x in range(minutes):
if minutes != 0:
def... | tjrobinson/LeoPython | pygamezero/food.py | food.py | py | 920 | python | en | code | 1 | github-code | 50 |
31519995563 | import os
import re
from string import punctuation
class Data():
'''
Import and parse data for training word-prediction
Arguments:
filepath: path to file
Raises:
FileNotFoundError if filepath not found
'''
def __init__(self, filepath):
self.filepath... | Coopss/word-prediction | data.py | data.py | py | 8,289 | python | en | code | 1 | github-code | 50 |
72538868634 | from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import datetime
import logging
import os
from typing import Text
from tfx.components import CsvExampleGen
from tfx.orchestration import metadata
from tfx.orchestration import pipeline
from tfx.components impo... | guravtanvi/Big-Data-Systems-and-Int-Analytics-INFO-7245 | Labs/Lab8-Airflow_tfx/dags/taxi_pipeline.py | taxi_pipeline.py | py | 6,540 | python | en | code | 6 | github-code | 50 |
38622676937 | #!/usr/bin/env python
# coding: utf-8
import numpy as np
from itertools import repeat
from matplotlib import pyplot as plt
from skimage.io import imread
import networkx as nx
import os
from tqdm import tqdm
from skimage.transform import resize
from Melanoma_cellgraph_globalfeats_functions import getGraphFeats
def pl... | TheNamor/masters | UNet/generate_feats.py | generate_feats.py | py | 3,614 | python | en | code | 0 | github-code | 50 |
22419658231 | import hashlib
import sys
from pyspark import SparkConf
from pyspark.sql import SparkSession
from pyspark.sql import functions as f
from pyspark.sql import types as types
def create_tables():
spark.sql(
"""create table airbnb_dv.sat_hosts(
sat_id string,
sk_host ... | tmspacechimp/Data-Engineering | Final Project/AirflowEnv/jobs/create_sats.py | create_sats.py | py | 6,818 | python | en | code | 0 | github-code | 50 |
6317452733 | import demistomock as demisto # noqa: F401
from CommonServerPython import * # noqa: F401
''' COMMAND FUNCTION '''
def get_additonal_info() -> List[Dict]:
alerts = demisto.context().get('Core', {}).get('OriginalAlert')[0]
if not alerts:
raise DemistoException('Original Alert is not configured in co... | demisto/content | Packs/CloudIncidentResponse/Scripts/XCloudIdentitiesWidget/XCloudIdentitiesWidget.py | XCloudIdentitiesWidget.py | py | 1,561 | python | en | code | 1,023 | github-code | 50 |
16034967559 | user = int(input('''till which number you want to print fibonacci number: '''))
def fib(inp):
"""print fibonacci series till nth fibo number (n-user input)"""
a, b = 0, 1
count = 0
while count <= inp:
print(a, end=' ')
a, b = b, a + b
count += 1
def fib_2(inp):
"""Prints ... | divya-raichura/Dr-Python | CODES/functions/functions_1/_10_fibo.py | _10_fibo.py | py | 506 | python | en | code | 0 | github-code | 50 |
40774354058 | import mt_tkinter as tk
class InfoUI:
@staticmethod
def is_num(string):
try:
value = float(string)
return True
except:
return False
def __init__(self, main_ui):
self.main_ui = main_ui
self.pop_up_box(main_ui.root)
def input_number(s... | hongyu19930808/Emotional-Equalizer | source/ui_info.py | ui_info.py | py | 2,359 | python | en | code | 6 | github-code | 50 |
1223945914 | from django import template
from django.template.defaultfilters import stringfilter
register = template.Library()
@register.filter(name="addclass")
def add_class(field, css):
old_css = field.field.widget.attrs.get("class", None)
if old_css:
css = old_css + css
return field.as_widget(attrs={"class... | thomasherzog/DeltaX | core/templatetags/task_filters.py | task_filters.py | py | 443 | python | en | code | 0 | github-code | 50 |
24598195082 | from django.conf import settings
from django.contrib.auth.decorators import login_required
from django.urls import reverse, reverse_lazy
from django.db.models import Q, Count
from django.views.generic import (
ListView,
CreateView,
DetailView,
UpdateView,
DeleteView,
)
from pathlib import Path
impor... | Lalkeen/massive_homework | showcase_app/views.py | views.py | py | 3,843 | python | en | code | 0 | github-code | 50 |
24769604688 | from brushes.brush import Brush
class StrokeBrush(Brush):
def __init__(self):
super().__init__(False)
def use(self, canvas_view, mouse_state, current_color):
# Keep it here in case we want to add extra functionality to base class
super().use(canvas_view, mouse_state, current_color)
... | lycayan18/magicapixel | brushes/stroke_brush.py | stroke_brush.py | py | 704 | python | en | code | 0 | github-code | 50 |
12790437394 | #!/usr/bin/env python
# coding=utf-8
"""Variant on standard library's cmd with extra features.
To use, simply import cmd2.Cmd instead of cmd.Cmd; use precisely as though you
were using the standard library's cmd, while enjoying the extra features.
Searchable command history (commands: "history")
Load commands from fi... | michaelhenkel/contrail-tripleo-docu | .tox/docs/lib/python2.7/site-packages/cmd2.py | cmd2.py | py | 197,211 | python | en | code | 2 | github-code | 50 |
17027919186 | #!/usr/bin/env python3
"""Script to send Icinga2 notifications to Discord channel via webhook"""
import sys
import argparse
import urllib.parse
import requests
parser = argparse.ArgumentParser(
prog = 'Icinga2 Discord Notification',
description = 'Script to send Icinga2 notifications to Discord channel via we... | Dennis14e/monitoring-discord-webhook | notification.py | notification.py | py | 5,258 | python | en | code | 1 | github-code | 50 |
18854870234 | import requests
from typing import Self
import xmltodict
import urllib.parse
import base64
import jinja2
PLAYREADY_SYSID = "9A04F07998404286AB92E65BE0885F95"
WIDEVINE_SYSID = "EDEF8BA979D64ACEA3C827DCD51D21ED"
#only works for 1 audio 1 video
DRM_TEMPLATE= """<?xml version="1.0" encoding="UTF-8" ?>
<GPACDRM type="CENC... | RodolpheFouquet/drm_scripts | ezdrm.py | ezdrm.py | py | 3,626 | python | en | code | 0 | github-code | 50 |
17784782852 | #!/usr/bin/python3
# go to 'targeturl' looking for 'searchterm' and return all of the values within
# 'delim' immediately following the beginning of 'searchterm'
import urllib.request
import os
# Crawl url, look for searchTerm, grab thing within delim, put it in txtFile
def crawl(url, pageBegin, pageEnd, searchTerm... | PumpkinPai/lslvimazing-builder | spidey.py | spidey.py | py | 4,506 | python | en | code | 0 | github-code | 50 |
28395539037 | import os
import pickle
from multiprocessing import Pool, Manager
from pathlib import Path
from typing import Optional, List, Tuple, Union, Any
import numpy as np
from PIL import Image
from detectron2.structures import BoxMode
from lofarnn.data.cutouts import convert_to_valid_color, augment_image_and_bboxes
from lofa... | jacobbieker/lofarnn | lofarnn/utils/coco.py | coco.py | py | 17,530 | python | en | code | 1 | github-code | 50 |
5050699532 | while True:
n = input()
if n == '0':
break
check_list1 = ""
check_list2 = ""
n_len = len(n)
part_point = n_len // 2
if n_len % 2 == 1:
n = n[:part_point] + n[part_point+1:] #12321 => 1221
#애는 point에서 0까지 거꾸로 분할
for i in range(part_point -1, -1, -1):
check_... | jihunhan98/Baekjoon | 1259.py | 1259.py | py | 559 | python | ko | code | 0 | github-code | 50 |
24634017890 | # 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:
# iterative
def isSymmetric(self, root: TreeNode) -> bool:
stack = [(root.left, root.right)]
... | toh995/leetcode-practice | medium/0101_symmetric_tree.py | 0101_symmetric_tree.py | py | 1,129 | python | en | code | 0 | github-code | 50 |
71268256475 | import pandas as pd
from sklearn.ensemble import RandomForestClassifier
#Get data
train = pd.read_csv('/home/bhanuchander/course/Learn_MachineLearning/data/csv/titanic/train.csv')
test = pd.read_csv('/home/bhanuchander/course/Learn_MachineLearning/data/csv/titanic/test.csv')
train.drop(["Name", "Ticket", "Cabin"], a... | Bhanuchander210/Learn_MachineLearning | Problems/titanic_prediction/mytest.py | mytest.py | py | 1,243 | python | en | code | 1 | github-code | 50 |
29810645821 | # getaddrinfo() takes several arguments to filter the result list.
# The host and port values given in the example are required arguments.
# The optional arguments are family, socktype, proto, and flags. The family, socktype,
# and proto values should be 0 or one of the constants defined by socket.
import socket
... | profjuarezbarbosajr/python-networking | addressing_protocols_socket_types/server_address_lookup_optional_args.py | server_address_lookup_optional_args.py | py | 1,365 | python | en | code | 0 | github-code | 50 |
3913206133 | """A vectorized code to compute multiple trajectories at simultaneously"""
from jax import partial,jvp,vmap,jit
import jax.numpy as jnp
import numpy as np
from ode_solvers import rk4_solver as solver
from testbed_models import L96
import os
import json
forcing=8.0
# these parameters now give you the mode, which is o... | Mr-Markovian/Covariant_lyapunov_Vectors | codes/assimilation/L96/multiple_trajectories.py | multiple_trajectories.py | py | 2,053 | python | en | code | 1 | github-code | 50 |
17781918084 | # %%
import copy
import einops
import numpy as np
# import streamlit as st
import torch as t
from funcs import (
cal_score_read_my,
cal_score_weight_probe,
cal_score_write_unemb,
load_board_seq,
load_model,
neuron_and_blank_my_emb,
one_hot,
plot_probe_outputs,
relu,
state_stac... | yeutong/ARENA_Othello | explore.py | explore.py | py | 16,533 | python | en | code | 0 | github-code | 50 |
23673085326 | # 백준 11722: 가장 긴 감소하는 부분 수열(실버 II), https://www.acmicpc.net/problem/11722
import sys
input = sys.stdin.readline
N = int(input())
A = list(map(int, input().split()))
dp = [1] * N
for i in range(N-1):
for j in range(i+1, N):
if A[i] <= A[j]: continue
dp[j] = max(dp[j], dp[i] + 1)
print(max(dp))
| mukhoplus/BOJ | 2_python/11722.py | 11722.py | py | 347 | python | ko | code | 0 | github-code | 50 |
40261696633 | from flask_wtf import FlaskForm
from wtforms import StringField, BooleanField, IntegerField, TextAreaField, SelectField
from wtforms.validators import InputRequired, Optional, NumberRange, URL, Length
class AddPetForm(FlaskForm):
"""Form for adding a pet"""
name = StringField("Pet name",
... | ShaheenKhan99/flask-adoption-agency | forms.py | forms.py | py | 1,069 | python | en | code | 0 | github-code | 50 |
40540326751 | import numpy as np
import matplotlib.pyplot as plt
if __name__ == '__main__':
serial_output = """icostri: 45.4164: linf_verts = 2.42561, linf_faces = 1.49743
cubedsphere: 82.9186: linf_verts = 0.2566, linf_faces = 0
icostri: 22.7082: linf_verts = 0.175552, linf_faces = 0.446258
cubedsphere: 41.4593: l... | pbosler/lpm | scripts/poissonOutput.py | poissonOutput.py | py | 4,069 | python | en | code | 5 | github-code | 50 |
33798140343 | """
Initialise the shop! Users can spend gold to purchase items.
TODO: It is currently a bad bad system that keeps everything in JSON and loops through the inventory to find things.
I will move this to an indexed format at some point but as a poc this works for now.
"""
import discord
from discord.ext import com... | jkswin/glicko_goblins | glicko_bot/cogs/shop.py | shop.py | py | 8,395 | python | en | code | 0 | github-code | 50 |
24933452472 | import inspect
import os
import re
import traceback
import types
import sys
#
from gub.syntax import printf, function_class
from gub import octal
from gub import misc
def subst_method (func):
'''Decorator to match Context.get_substitution_dict ()'''
func.substitute_me = True
return func
NAME = 0
OBJECT = ... | EddyPronk/gub | gub/context.py | context.py | py | 9,845 | python | en | code | 2 | github-code | 50 |
32187295828 | idioma = input("Introduce las palabras en español e inglés separadas por dos puntos (:) y cada par separado por comas.")
idiomas = {}
duplas = idioma.split(",")
for dupla in duplas:
palabra = dupla.split(":")
español = palabra[0].strip()
ingles = palabra[1].strip()
idiomas[español] = ingles
traducir =... | SyZeck/Ejercicios-de-Programacion-con-Python | Diccionarios/Ejercicio 8/solucion.py | solucion.py | py | 575 | python | es | code | 0 | github-code | 50 |
16092127365 | """
Map out allocated memory regions in a specificed binary.
Not a standalone python file -- needs to run under GDB.
Called by harvest_heap_data.py
"""
import gdb #won't work unless script is being run under a GDB process
import re
import os
import struct
import sys
# GDB's python interpreter needs this to locate the... | jproney/MemoryCartography | cartography_gdb.py | cartography_gdb.py | py | 4,172 | python | en | code | 4 | github-code | 50 |
12195818389 | import RPi.GPIO as GPIO
import time
buz = 18
GPIO.setmode(GPIO.BCM)
GPIO.setup(buz,GPIO.OUT)
GPIO.setwarnings(False)
pwm = GPIO.PWM(buz,262)
pwm.start(50.0)
time.sleep(1)
pwm.stop()
GPIO.cleanup() | embededdrive/embedded | Raspberry Pi/day01/buzzer.py | buzzer.py | py | 199 | python | en | code | 0 | github-code | 50 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.