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
70291081441
from typing import List import numpy def part1(input: List[str]): return bingo(input)[0] def part2(input: List[str]): return bingo(input)[-1] def bingo(input: List[str]): boards = [[]] num = 0 # read numbers numbers = list(map(int, input[0].split(","))) # read boards for line in...
tvollstaedt/aoc2021
_4.py
_4.py
py
1,435
python
en
code
0
github-code
54
15693762675
#!/usr/bin/env python # coding: utf-8 # <h3> Titanic Survival Prediction Algorithm </h3> # This notebook details the underlying hypotheses for survival, builds several machine learning models based on hypotheses, and submits the GradientBoostingClassifier for scoring. # In[ ]: # Modules for data manipulation import...
nischalshrestha/automatic_wat_discovery
Notebooks/py/dougdaly/hypothesis-based-approach-to-surviving-icebergs/hypothesis-based-approach-to-surviving-icebergs.py
hypothesis-based-approach-to-surviving-icebergs.py
py
9,152
python
en
code
2
github-code
54
12889074588
# 1. Парсинг сайта habr.com import requests as req from bs4 import BeautifulSoup import json import tqdm data = { "data":[] } for page in range(1,11): url = f"https://habr.com/ru/search/page{page}/?q=Data%20science&target_type=posts&order=relevance" resp = req.get(url) soup = BeautifulSoup(resp.text,...
Projektestro/DE_Sprint
main.py
main.py
py
1,749
python
en
code
0
github-code
54
1217858611
from __future__ import annotations from typing import Optional from aiohttp import web from dl_api_commons.aiohttp.aiohttp_wrappers import DLRequestBase from dl_api_commons.logging import ( CompositeLoggingContextController, RequestLoggingContextController, ) def get_root_logging_context_controller(request...
datalens-tech/datalens-backend
lib/dl_api_commons/dl_api_commons/aio/middlewares/commons.py
commons.py
py
1,593
python
en
code
99
github-code
54
6875576896
"""update db Revision ID: 25ac49dfe877 Revises: Create Date: 2019-03-16 15:24:25.564355 """ from alembic import op import sqlalchemy as sa # revision identifiers, used by Alembic. revision = '25ac49dfe877' down_revision = None branch_labels = None depends_on = None def upgrade(): # ### commands auto generate...
toufanialfarisi/AiPinter-v2.0
migrations/versions/25ac49dfe877_update_db.py
25ac49dfe877_update_db.py
py
636
python
en
code
13
github-code
54
17317274510
import json from django.http import HttpResponse from django.contrib.auth.decorators import login_required from github import Github from github.NamedUser import NamedUser # from social_django import social_auth_usersocialauth # g = Github('s-surineni', ACCESS_TOKEN) @login_required def index(request): extra...
s-surineni/open-show-off
show_off_github/views.py
views.py
py
1,133
python
en
code
0
github-code
54
11934466091
# Kernel PCA # Importing the libraries import numpy as np import matplotlib.pyplot as plt import pandas as pd from sklearn.decomposition import PCA # Subsetting the dataset Age_dataset3=Age_dataset2[Age_dataset2['position1']==3] #Features features=['goals','assists','blocks', 'carries','carries_attacking_third','car...
vigneshjayanth00/Football
# Kernel PCA Age performance Index.py
# Kernel PCA Age performance Index.py
py
2,868
python
en
code
0
github-code
54
16355822784
import datetime import sys import traceback import smtplib from email.mime.multipart import MIMEMultipart from email.mime.text import MIMEText from customError import EmailError from util import getValueIfExist class EmailClient: def __init__(self, configJson) -> None: self.scriptName = sys.argv[0] # ge...
npopalzay/examples
python/drainage-issue-tracker/emailClient.py
emailClient.py
py
4,086
python
en
code
0
github-code
54
36905475159
"""Simple Reflex Agent""" # Author: Lucas David -- <ld492@drexel.edu> # License: MIT (c) 2016 import logging from . import base logger = logging.getLogger('artificial') class SimpleReflexAgent(base.AgentBase): """Simple Reflex Agent. Basic intelligent agent based on decision rules. """ def __init...
lucasdavid/artificial
artificial/agents/simple_reflex.py
simple_reflex.py
py
904
python
en
code
2
github-code
54
33016211291
#!/usr/bin/env python2 from __future__ import print_function import eeml import pg import pgdb import sys db = pgdb.connect() c = db.cursor() c.execute("SET TIME ZONE 0") c.execute("SELECT key FROM pachube WHERE id=%(feed)s", { "feed": sys.argv[2] }) key = c.fetchone()[0] c.execute("SELECT COUNT(*) FROM dingdong WHER...
nomis/doorbell
pachube.py
pachube.py
py
538
python
en
code
1
github-code
54
73356770401
""" Visualization General Utilities (crikit.ui.visgentuils) ======================================================= roimask : Create a region-of-interest binary mask """ from matplotlib.path import Path as _Path import numpy as _np def roimask(imgx, imgy, xvec, yvec): """ Create a region-of-interest bi...
CCampJr/CRIkit2
crikit/ui/utils/roi.py
roi.py
py
1,750
python
en
code
15
github-code
54
30843162039
import code import sys import threading from kivy.base import runTouchApp from kivy.clock import Clock from kivy.config import Config from kivy.properties import ListProperty, NumericProperty, StringProperty from kivy.uix.boxlayout import BoxLayout from kivy.uix.textinput import TextInput Config.set('kivy', 'exit_on_...
jonhare/slideshow-framework
slideshow/shells/python_shell.py
python_shell.py
py
8,029
python
en
code
0
github-code
54
74229947042
""" Gaussian kernel calculator Adapted from: https://observablehq.com/@jobleonard/gaussian-kernel-calculater """ from __future__ import annotations import math SQRT2 = math.sqrt(2) def erf(x: float): a1 = 0.254829592 a2 = -0.284496736 a3 = 1.421413741 a4 = -1.453152027 a5 = 1.061405429 p = 0...
pythonarcade/arcade
arcade/experimental/gaussian_kernel.py
gaussian_kernel.py
py
1,182
python
en
code
1,537
github-code
54
17758168140
"""first migration Revision ID: 8d26623c329d Revises: Create Date: 2021-09-04 20:55:30.204258 """ from alembic import op import sqlalchemy as sa # revision identifiers, used by Alembic. revision = '8d26623c329d' down_revision = None branch_labels = None depends_on = None def upgrade(): # ### commands auto ge...
mal-mel/kts_homeworks
habr_bot/api/server/alembic/versions/8d26623c329d_first_migration.py
8d26623c329d_first_migration.py
py
1,979
python
en
code
0
github-code
54
29281270098
import cv2 as cv path = r'data/videos/numpy.mp4' capture = cv.VideoCapture(path) window_name = 'Python' while True: isTrue, frame = capture.read() cv.imshow(window_name, frame) if cv.waitKey(20) & 0xFF==ord('d'): # Stops the video if key 'd' is pressed break capture.release() cv.destroyAllW...
KlausPeace95/OpenCV-ImageProcessing
video-reader.py
video-reader.py
py
328
python
en
code
0
github-code
54
32972471891
def rank_sort(team_points: tuple): """This provides the primary, secondary, and tertiary sort keys to sort a dictionary by team RP, TBP1, and TBP2""" rp = team_points[1]["RP"] tbp1 = team_points[1]["TBP1"] tbp2 = team_points[1]["TBP2"] return (rp, tbp1, tbp2) def sort_Rank_Dict(rank_dict: dic...
FIRST-Alberta/FTC_Scoring_Parser
utilities/rank_utilities.py
rank_utilities.py
py
2,336
python
en
code
0
github-code
54
74228909602
from __future__ import print_function, division import unittest from pyscf.nao import mf class KnowValues(unittest.TestCase): def test_water_pp_pb(self): """ This is for initializing with SIESTA radial orbitals """ from numpy import einsum, array import os dname = os.path.dirname(os.path.abspath(__f...
pyscf/nao
pyscf/nao/test/test_0006_water_pp_pb_nao.py
test_0006_water_pp_pb_nao.py
py
1,361
python
en
code
5
github-code
54
29395562878
# -*- coding:utf-8 -*- from api.api import API from pages.ios.common.superPage import SuperPage from pages.ios.ffan.message_settings_page_configs import MessageSettingsPageConfigs from pages.logger import logger class MessageSettingsPage(SuperPage): ''' 作者 宋波 首页=>我的飞凡=>消息中心=>设置 ''' def __init__(s...
liu111xiao111/UItest
pages/ios/ffan/message_settings_page.py
message_settings_page.py
py
1,504
python
en
code
2
github-code
54
17842262925
# -*- coding: utf-8 -*- import scrapy import fileinput def get_url(text): return "http://www.promedmail.org/post/%s" % text class PromedSpider(scrapy.Spider): name = 'promed' allowed_domains = ['http://www.promedmail.org'] def start_requests(self): urls = [ 'http://quotes.toscrap...
unsw-se3011/SENG3011_Neon
PHASE_1/Spider/scraper/spiders/promed.py
promed.py
py
791
python
en
code
1
github-code
54
2734604280
from bs4 import BeautifulSoup as bs from urllib import request from functools import lru_cache from transformers import pipeline import data import requests import unicodedata import re import spacy import copy # Loading spacy nlp = spacy.load("en_core_web_sm") # Class representing a recipe class Recipe: # Class re...
RichardRichter/NLP_Project_2
recipe.py
recipe.py
py
44,565
python
en
code
1
github-code
54
4509735285
from django.db import models from YSE_App.models.base import * from YSE_App.models.enum_models import * from YSE_App.models.telescope_resource_models import * from YSE_App.models.transient_models import * from YSE_App.models.host_models import * class Followup(BaseModel): class Meta: abstract = True ordering = [...
davecoulter/TSST_PZ
YSE_App/models/followup_models.py
followup_models.py
py
2,006
python
en
code
0
github-code
54
40634463515
#!/usr/bin/env python import argparse import json import pandas as pd from pathlib import Path from typing import List from itertools import chain def read_geometries(file_name: Path) -> List[str]: """Read the geometries from ``file_name``.""" with open(file_name, 'r') as f: gs = json.load(f) r...
nlesc-nano/swan
scripts/utils/remove_duplicates.py
remove_duplicates.py
py
1,449
python
en
code
14
github-code
54
212422621
from odoo import models, fields, api, _ from odoo.exceptions import ValidationError class Customer(models.Model): _inherit = 'res.partner' # ke thua tu res.partner # name = fields.Many2one('sale.order', string='Customer') # customer_id = fields.Many2one('sale.order', string='Customer_ID') # name = f...
nhanvu0901/VuTrongNhan_bai_tap_1
models/Customer.py
Customer.py
py
1,616
python
en
code
0
github-code
54
26758009679
from django.conf.urls import url from django.urls import path from mainapp import views #template tagging app_name = 'mainapp' urlpatterns=[ url(r'^LogIn/$',views.user_logIn,name='LogInPage'), url(r'^SignUp/$',views.signUp,name='SignUpPage'), url(r'^welcome/$',views.welcome,name='welcomePage'), url(r'^...
WinstonPais/StockMarkerRates
mainapp/urls.py
urls.py
py
549
python
en
code
0
github-code
54
18584364047
#Prompt user for Loan, Annual income, Current loan, Total savings, Years to pay back loan l = float(input('What is your desired loan amount? ')) a = float(input('What is your annual income? ')) c = float(input('What is the total value of your current loans? ')) s = float(input('What is the ttal of your savings? '))...
Koyonari/NP-Programming
Semester 1/Graded Assessments/Aptitude Test 1 Revision/Revision for PRG Aptitude test 1, Qn 1.py
Revision for PRG Aptitude test 1, Qn 1.py
py
599
python
en
code
0
github-code
54
36017186052
import warnings from time import perf_counter from pathlib import Path from collections import defaultdict from concurrent.futures import ProcessPoolExecutor from sunpy.util.datatype_factory_base import NoMatchError from stixcore.config.config import CONFIG from stixcore.ephemeris.manager import Spice from stixcore.i...
i4Ds/STIXCore
stixcore/processing/L1toL2.py
L1toL2.py
py
5,205
python
en
code
2
github-code
54
30859498411
import numpy as np from scipy.stats import norm def bs(S, K, T, sigma, r, type='call'): d1 = (np.log(S / K) + (r + 0.5 * sigma ** 2) * T) / (sigma * np.sqrt(T)) d2 = d1 - sigma * np.sqrt(T) return (S * norm.cdf(d1) - K * np.exp(-r * T) * norm.cdf(d2)) \ if type == 'call' else (K * np.exp(-r * T) *...
ywang408/MultinomialTree
src/algorithms/binomial.py
binomial.py
py
2,134
python
en
code
0
github-code
54
25135958509
import tkinter.messagebox from datetime import * alert_list = [] alert_count = [0, 0, 0, 0] def print_alert(case): # 부정행위 감지 시 alert now = datetime.now() if case == 1: tkinter.messagebox.showinfo("Alert", "두 명 이상 감지되었습니다.") alert_count[0] += 1 alert_list.append("alert log[2명이상] : %s...
2021-NEXT-LEVEL/StopCheating
alert.py
alert.py
py
1,436
python
ko
code
1
github-code
54
28442716330
#!/usr/bin/python # -*- coding: iso-8859-1 -*- import Tkinter as tk from spreadsheet_reader import * class Hospitality(tk.Tk): def __init__(self,parent): tk.Tk.__init__(self,parent) self.parent = parent self.people = read_people('BB89RT8239.csv') self.hosts = read_hosts('AFSB8ASD8F32.csv') self.initialize(...
brotatotes/hospitality
gui.py
gui.py
py
2,375
python
en
code
0
github-code
54
72348653280
import json from django.http import HttpResponse from django.shortcuts import render, redirect from django.core import serializers from django.db.models import Sum from .models import Answer from .forms import AnswerForm COOKIE_DURATION = 60 * 60 * 24 * 14 # two weeks def own_answers(request): answer_ids = reque...
d70-t/grillplaner
polls/views.py
views.py
py
2,577
python
en
code
0
github-code
54
40597933251
# Recursive algorithm for k-bit Gray code, from # http://cacs.usc.edu/education/phys516/01-4AdvancedMC.pdf def gray(N): k = 1 g=[[0],[1]] while k < N: g = [[0] + gg for gg in g] + [[1] + gg for gg in g[::-1]] k+= 1 return g for gg in gray(4): print (gg)
weka511/smac
lecture_8/gray.py
gray.py
py
303
python
en
code
18
github-code
54
43399810480
from uttInputReader import * from random import randint, choice, choices, sample from string import printable, whitespace #from googletrans import Translator, LANGUAGES #pip install googletrans #from translate import Translator # PIP INSTALL TRANSLATE import inflect from word2number import w2n from yandex.Translater i...
CharmTool/Charm
proyecto/codigo/pythonscripts/testPhrasesGenerator.py
testPhrasesGenerator.py
py
32,154
python
en
code
2
github-code
54
40299900078
#!/usr/bin/env python3 import sys import time def sort(array): # Bubble Sort algorithm for i in range(0, len(array)): is_swapped = False for j in range(1, len(array) - i): cmp = array[j - 1] > array[j] if cmp: array[j - 1], array[j] = array[j], array[j -...
tkl-dbcore/dblecture-projects
sorting/sort.py
sort.py
py
971
python
en
code
0
github-code
54
37624708533
class Solution(object): def maxProfit(self, prices): """ :type prices: List[int] :rtype: int """ n = len(prices) if n == 0: return 0 sell, buy, cool = [0] * n, [0] * n, [0] * n buy[0] = -prices[0] for i in range(1, n): s...
qianlongzju/Leet_Code
Algorithms/py/309.BestTimeToBuyAndSellStockWithCooldown.py
309.BestTimeToBuyAndSellStockWithCooldown.py
py
909
python
en
code
0
github-code
54
27188127232
import os import numpy as np def read_glove_wiki_weighted(d, weight_index, glove_dir = None): if glove_dir is None: glove_dir = "/media/felipe/SAMSUNG/GloVe" supported_dimensions = [50, 100, 200, 300] if d not in supported_dimensions: raise ValueError("argument d must be one of {0}".for...
queirozfcom/auto-tagger
social-tags/src/helpers/embeddings.py
embeddings.py
py
1,298
python
en
code
0
github-code
54
34668081175
'''question 5: Write a program which accepts a sequence of comma separated 4 digit binary numbers as its input and then check whether they are divisible by 5 or not. The numbers that are divisible by 5 are to be printed in a comma separated sequence. Example: 0100,0011,1010,1001 Then the output should be: 1010''' s=[]...
Nidhi4-p/python
python practice/p5.py
p5.py
py
473
python
en
code
0
github-code
54
687681126
'''Program utama yang digunakan untuk menampilkan menu utama yang juga digunakan sebagai tempat dimana user memberikan input ''' import module def main(): '''Fungsi utama untuk menjalankan program ''' while(True): menu() try: '''membuat exception handling apabila...
Alexander-2912/SuperCashier
main.py
main.py
py
5,718
python
id
code
0
github-code
54
29414053806
# -*- coding:utf-8 -*- from bean.model.bean_model import BeanModel from bean.bean_error import BeanValidationError from bean.fields import IntField, StringField, ArrayField, ObjectField class Friend(BeanModel): name = StringField() age = IntField(minimum=1, maximum=100) class Family(BeanModel): father =...
franklucky001/python-bean
main.py
main.py
py
1,235
python
en
code
0
github-code
54
2028269403
from django import forms from .models import post_model,photo_add_model from django.forms import CheckboxSelectMultiple from .fields import ListTextWidget class post_form(forms.ModelForm): class Meta: model=post_model exclude=['user','id','slug','create_at','likes','views'] widgets={ ...
mdruhulamin5347/Django_Ruhul_website
post/forms.py
forms.py
py
883
python
en
code
0
github-code
54
5531128284
from nltk.corpus import stopwords from nltk import word_tokenize stopword_list = stopwords.words("english") filter = {} for w in stopword_list: filter[w] = w punctuations = { "?": "?", ":": ":", "!": "!", ".": ".", ",": ",", ";": ";" } filter.update(punctuations) def filtering(text): i...
CheongWoong/impact_of_cooccurrence
src/utils/common/text_processing.py
text_processing.py
py
628
python
en
code
3
github-code
54
33852037391
""" COMP.CS.100 Ensimmäinen Python-ohjelma. Tekijä: Anna Rumiantseva Opiskelijanumero: 050309159 """ def print_box(width, height, mark): """ohjelma tulostaa hienoja ruutuja""" i = 1 j = 1 while i <= height: while j <= width: if j == width: print(mark) els...
kettu-metsanen/python_course
kierros3/ruutu.py
ruutu.py
py
680
python
en
code
0
github-code
54
7658245780
import os import csv dir_path = os.path.dirname(os.path.realpath(__file__)) csvpath = os.path.join(dir_path,"Budget_Data.csv") output_file=os.path.join(dir_path,"Final_PyBank.txt") date=[] profit_loss=[] net_change=[] prev_row=[] greatest=0 lowest=0 with open(csvpath) as csvfile: csvreader=csv.reader(csvfile,de...
nberman12/python-challenge
PyBank/Main.py
Main.py
py
1,882
python
en
code
0
github-code
54
36459276853
import os import time from fastapi import FastAPI from app.routes.api import router as api_router from app.config import settings os.environ["TZ"] = settings.TIMEZONE time.tzset() def get_application() -> FastAPI: application = FastAPI( title=settings.TITLE, description=settings.DESCRIPTION, ...
AdamStrojek/todo_fastapi
app/main.py
main.py
py
530
python
en
code
0
github-code
54
27345395453
from time import time class Solution: def backspaceCompare(self, s: str, t: str) -> bool: s_list = [] for c in s: if c != "#": s_list.append(c) elif s_list: s_list.pop() t_list = [] for c in t: if c != "#": ...
Sadomtsevvs/Leetcode
844. Backspace String Compare.py
844. Backspace String Compare.py
py
594
python
en
code
0
github-code
54
5292917962
import keras as keras import tensorflow as tf from tensorflow import keras import pandas as pd import numpy as np train_df = pd.read_csv('./data/train.csv') print(train_df.head()) #Da Da die farben Strings sind, müssen diese mithilfe eines Dictionaries gemappt werden color_dict = {'red': 0, 'blue': 1, 'green': 2, 'te...
rafaelbaun/neural-nets
examples/clusters/network.clusters.py
network.clusters.py
py
1,538
python
en
code
0
github-code
54
40154882241
#!/usr/bin/env python3 # -*- coding: utf-8 -*- # # pymc-learn documentation build configuration file, created by # sphinx-quickstart on Thu Jan 18 12:17:12 2018. # # This file is execfile()d with the current directory set to its # containing dir. # # Note that not all possible configuration values are present in this #...
pymc-learn/pymc-learn
docs/conf.py
conf.py
py
8,653
python
en
code
219
github-code
54
15342502415
import random import time def intro(): all_pokemon=["Pikachu"]*20+["Pidgeot"]*60+["Mew"]*5 pokemon=random.choice(all_pokemon) print("You are currently walking through tall grass") time.sleep(1) print("...") time.sleep(1) print("...") time.sleep(1) print("... and you encounter a "+pok...
Timmichi/Tutoring
Students/Jay/Archive/jay_l7.py
jay_l7.py
py
1,705
python
en
code
0
github-code
54
34673781349
from tkinter import * from PIL import ImageTk def move_up(event): canvas.move(myImage_for_canvas, 0, -10) def move_left(event): canvas.move(myImage_for_canvas, -10, 0) def move_down(event): canvas.move(myImage_for_canvas, 0, 10) def move_right(event): canvas.move(myImage_for_canvas, 10, 0) # -...
YuMiao329/Python_Basics
GUI/GUI_move_images_with_keys_(canvas).py
GUI_move_images_with_keys_(canvas).py
py
1,325
python
en
code
0
github-code
54
40777315959
import pyowm from pyowm.utils.config import get_default_config import telebot owm = pyowm.OWM('1f0e262e15c5790f98efecb2573b959c') config_dict = get_default_config() config_dict['language'] = 'ru'\ bot = telebot.TeleBot("5184523501:AAFRWgVHl21MfyLcfIT8V0TtSkvRJG5gSi8") @bot.message_handler(content_types=['text']) def...
AlexeyAly/Python_all
botbot.py
botbot.py
py
1,073
python
ru
code
0
github-code
54
8344206484
import pygame, math from . import maff # https://en.wikipedia.org/wiki/Regular_dodecahedron#Cartesian_coordinates vertices = [ (x, y, z) for x in (-1, 1) for y in (-1, 1) for z in (-1, 1) ] + [ (0, a, b) for a in (-math.phi, math.phi) for b in (-math.Phi, math.Phi) ] + [ (b, 0, a) for a in (-math.phi, math.phi) for...
cosmologicon/pyjam
unmatter/src/cage.py
cage.py
py
2,378
python
en
code
7
github-code
54
2834061588
# # Mars Rover Design Team # approaching_gate.py # # Created on May 19, 2021 # Updated on Aug 21, 2022 # import core import copy from core import constants import interfaces from algorithms import stanley_controller, heading_hold from algorithms.obstacle_avoider import ASTAR import algorithms from core.states import R...
MissouriMRDT/Autonomy_Software_Python
core/states/approaching_gate.py
approaching_gate.py
py
22,178
python
en
code
23
github-code
54
2455836894
WORD = 'father' CORRECT_WORD_ARRAY = list(WORD) ATTEMPTS = 0 board = [ ['_', '_', '_', '_', '_', '_'], ['_', '_', '_', '_', '_', '_'], ['_', '_', '_', '_', '_', '_'], ['_', '_', '_', '_', '_', '_'], ['_', '_', '_', '_', '_', '_'], ['_', '_', '_', '_', '_', '_'], ] # Function to print the boar...
trevenue44/wordle
app.py
app.py
py
1,451
python
en
code
1
github-code
54
33498348127
from PIL import Image Object = Image.open(r'abb.png') # perform a flip of left and right flippedImage = Object.transpose(Image.FLIP_TOP_BOTTOM) # display the original image Object.show() # display the horizontal flipped image flippedImage.show()
vatsalasharma04/python-basics
horiflip.py
horiflip.py
py
266
python
en
code
1
github-code
54
31714708650
# -*- coding: utf-8 -*- """ Created on Fri Nov 20 21:00:05 2020 @author: d """ import torch.nn as nn import torch from models.attention import ChannelAttention,SpatialAttention from torch.nn import functional as F class InputConv(nn.Module): def __init__(self, in_channels, out_channels): super().__init__(...
BruceKai/DSTFNet
models/spatial_branch.py
spatial_branch.py
py
12,062
python
en
code
2
github-code
54
32650836659
# Adds a and b, returns as result def add(a, b): return a+b # Returns the highest value from the three given params def max_of_three(a, b, c): if (a >= b and a > c) or (a > b and a >= c): return a elif (b >= a and b > c) or (b > c and a >= a): return b elif (c >= a and c > b) or (c > b...
greenfox-zerda-lasers/bednayb
week-05/day-01/extend.py
extend.py
py
1,034
python
en
code
0
github-code
54
15082478944
''' MITM Proxy server - a cli tool to catch tcp traffic between target device and a remote server. ''' from argparse import ArgumentParser, RawTextHelpFormatter from scapy.all import IFACES from time import sleep from dns_spoofer.dns_spoofer import DNS_Spoofer from ca.cert_auth import CertificateAuthority from...
polzbit/mitm_proxy_server
src/main.py
main.py
py
5,001
python
en
code
0
github-code
54
18953195389
from decibel import Runbook from decibel.ansible.tasks import define ( apt, command ) = define( "ansible.builtin.apt", "ansible.builtin.command" ) class ConsulAgent(Runbook): def run_do(self): apt( name="consul", state="installed" ) if self.vars.dat...
ArmedGuy/decibel
tests/common/roles/service_agents.py
service_agents.py
py
791
python
en
code
2
github-code
54
16776302125
""" class Student(object): @property def score(self): return self._score @score.setter def score(self,value): if not isinstance(value,int): raise ValueError('score must be an integer') if value<0 or value >100: raise ValueError('score must between 0~100!') self._score=value s=Student() s.score...
hb918902/lgit
python/test7.py
test7.py
py
2,218
python
en
code
0
github-code
54
24502635798
import bisect import hashlib import json import logging import random from pathlib import Path from typing import Union import discord from discord import Member from discord.ext import commands from discord.ext.commands import BadArgument, Cog, clean_content from bot.constants import Roles log = logging.getLogger(_...
mentalvenom/MyAdminBot
bot/exts/valentines/lovecalculator.py
lovecalculator.py
py
3,831
python
en
code
1
github-code
54
37501234840
# -*- coding:utf-8 -*- """ 字节跳动 后台开发 """ line = list(map(int, input().split())) n = line[0] m = line[1] c = line[2] color_index = {} # 记录颜色位置 for i in range(n): line = list(map(int, input().split())) # 如果是无色的,跳过 if line[0] == 0: continue # 如果有颜色,记录颜色位置 for j in range(line[0]): ...
wonderfulmys1314/leetcode
ByteDance_color.py
ByteDance_color.py
py
879
python
en
code
0
github-code
54
21579832315
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ ppscan.py MIT license (c) 2018 Asylum Computer Services LLC """ import re import sys import os import argparse from time import gmtime, strftime # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - # # class Cget # gets a character at a time fro...
wf49670/dpwb
ppscan/ppscan.py
ppscan.py
py
26,290
python
en
code
0
github-code
54
18645682596
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Wed Nov 3 19:29:11 2021 @author: hantswilliams age sex chest pain type (4 values) resting blood pressure serum cholestoral in mg/dl fasting blood sugar > 120 mg/dl resting electrocardiographic results (values 0,1,2) maximum heart rate achieved exercise i...
hantswilliams/AHI_DataSci_507
Classroom_ScratchFiles/class10.py
class10.py
py
3,472
python
en
code
3
github-code
54
36142962376
#!/usr/bin/env python # coding=utf8 """ 安装包工具 """ import os from setuptools import setup, find_packages here = os.path.abspath(os.path.dirname(__file__)) README = open(os.path.join(here, 'README.rst')).read() CHANGES = open(os.path.join(here, 'CHANGES.rst')).read() install_requires = [ 'celer...
listen-lavender/testlab
asynctask/setup.py
setup.py
py
758
python
en
code
1
github-code
54
8641072257
import boto3 from bsm.models import RawDataModel, AggregateModel class Database: def __init__(self, region_name, aws_access_key_id, aws_secret_access_key): self.boto_client = boto3.client('dynamodb', config=boto3.client.Config(region_name=region_name, ...
snbaskarraj/IOT
Documents/IITM_ANSWERS_BASELINETEST/IITMCLASSDOCS/AWSIOT/PROJECT/C04P01-Project-HealthCare-IoT-Cloud/Database.py
Database.py
py
2,935
python
en
code
0
github-code
54
12409565821
"""pycrm URL Configuration The `urlpatterns` list routes URLs to views. For more information please see: https://docs.djangoproject.com/en/1.8/topics/http/urls/ Examples: Function views 1. Add an import: from my_app import views 2. Add a URL to urlpatterns: url(r'^$', views.home, name='home') Class-based...
huaiguoguo/pycrm
config/urls.py
urls.py
py
2,026
python
en
code
1
github-code
54
17101875388
# Consonants pl = '[pPbBtTdDkKgG]' #plosives na = '[mMnNnjNJ]' #nasales tr = '[rRrrRR]' #trills fr = '[fFthTHdhDHcCxXsSzZçÇxhXHshSHzhZHhH]' #fricatives ap = '[jJ]' #approximants la = '[lLllLL]' #laterals bl = '[pPbBmM]' #bilabials ld = '[fFvV]' #labiodentals dt = '[tTdthTHdhDH]' #dentals al = '[nNrRsSzZlLcCxXsSzZrrRRçÇ...
NikolaiS1900/NLP-toolbox-for-Indo-European
NLP scripts for Indo_European/extractor/lang_pack/Albanian.py
Albanian.py
py
1,924
python
en
code
0
github-code
54
2969957830
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Tue Jan 8 03:42:15 2019 @author: nilesh """ #importing libraries import cv2,os,pickle import face_recognition as fr dir_name="/home/nilesh/Desktop/face_recognition/dataset_images" #creating directory try: os.mkdir(dir_name) except: print() c...
nileshbhadana/Facial-Recognition-Using-Dlib
face_recognition_dataset.py
face_recognition_dataset.py
py
1,924
python
en
code
2
github-code
54
3806055557
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 import openpyxl from openpyxl.styles import Alignment from datetime import datetime import os #Path to chrome driver and Xp...
RyanRamthun/seleium_twitter_trending_webscraper
main.py
main.py
py
2,281
python
en
code
0
github-code
54
30003500064
#!/usr/bin/env python # # Mersenne Twister predictor # # Feed this program the output of any 32-bit MT19937 Mersenne Twister and # after seeing 624 values it will correctly predict the rest. # # The values may come from any point in the sequence -- the program does not # need to see the first 624 values, just *any* 624...
SMiles02/CompetitiveProgramming
Codeforces/CF 1800 - 1899/CF1812/CF1812H.py
CF1812H.py
py
4,383
python
en
code
23
github-code
54
32277876231
import csv import requests import json import re ############################################################################################### # Script para agregar un usuario, sus roles y grupo a Keycloak a través de un archivo CSV # ##################################################################################...
maximilianobl/keycloak-user-import-api-rest
import-roles.py
import-roles.py
py
7,398
python
en
code
1
github-code
54
26286950391
import socket import logging class Telegram: def __init__(self, connection): assert(type(connection) is socket.socket) self.connection = connection self.stream_buffer = bytearray() self.connection.setblocking(False) def _fetch_from_socket(self, size): try: ...
agentcoffee/pytanks
server/telegram.py
telegram.py
py
2,201
python
en
code
0
github-code
54
13512054310
import torch def to_tensor(input): """Converts the input into a ``torch.Tensor`` of the default dtype.""" if torch.is_tensor(input): return input.to(torch.Tensor()) else: return torch.tensor(input).to(torch.Tensor()) def stack_trajectory(input): if torch.is_tensor(input): ret...
facebookresearch/fairo
polymetis/polymetis/python/torchcontrol/utils/tensor_utils.py
tensor_utils.py
py
957
python
en
code
826
github-code
54
2313775372
import requests import time from datetime import date from message import Editmessage, Sendmessage, logger def bin_helper(chat_id, combo): status = Sendmessage(chat_id, '<i>Checking....</i>') try: cc = combo except IndexError: return Editmessage(chat_id, 'Enter Valid Combo😡😡...
iamaamirkhan/Denial-bot
Bot/Checks/ass.py
ass.py
py
1,028
python
en
code
0
github-code
54
71860780642
import pygame from pygame import Color from pygame import Surface import sys import random from vectors import * from camera import * from orbiter import * pygame.init() WIDTH, HEIGHT = 1280, 760 GRAV = 0.0000000003 BACK_COLOR = (0, 0, 0) def pointCloud(numPts: int, width: float): cloud = [Orbiter]*numPts f...
tommychobo/Attonaut
main.py
main.py
py
4,184
python
en
code
0
github-code
54
30784229520
""" 04_shutil.py Before running: ch05_std_lib | |__temp (empty) After running: ch05_std_lib | |__temp (with 9 files) ...
markdmyers01/student_files_am
ch05_std_lib/04_shutil.py
04_shutil.py
py
772
python
en
code
0
github-code
54
19131087652
import pandas as pd import numpy as np from pandas.core.frame import DataFrame from sqlalchemy.ext.asyncio import AsyncSession from sqlalchemy import insert, select from src.db.session import ( RoofingMaterial, SeriesOfProjects, WallMaterial, AccidentRate, RoofCleaning, HousingStock, MkdStat...
trueprogr/upkeepai
app/backend/app/src/db_fill/db_filling.py
db_filling.py
py
7,034
python
en
code
1
github-code
54
20107608758
from flask import render_template, Flask, request from forms import SignupForm from models import db, Contact app = Flask(__name__) db.init_app(app) app.secret_key="development-key" app.config['SQLALCHEMY_DATABASE_URI'] = 'postgresql://root:root@localhost/contacts' @app.route("/") def index(): return render_tem...
Sanil2108/Flask-phonebook
routes.py
routes.py
py
840
python
en
code
0
github-code
54
24160438085
import time def calcular_tiempo_y_sumar(funcion): def wrapper(**kwargs): start_time = time.time() resultado = funcion(**kwargs) end_time = time.time() tiempo_ejecucion = end_time - start_time suma = sum(kwargs.values()) print("Resultado de la suma: ", suma) ...
wmendozap/G08-Basico
Prácticas/examen-final/test_03.py
test_03.py
py
854
python
es
code
0
github-code
54
30921163973
# -*- coding: utf-8 -*- """ Created on Sat Oct 12 18:10:42 2019 @author: https://www.cnblogs.com/shouhuxianjian/p/10567201.html """ import argparse import numpy import numpy as np import keras from keras.models import load_model from keras import backend as K from yolo3.model import yolo_body from ker...
OmniXRI/OpenVINO_RealSense_HarvestBot
my_yolo3/yolov3_keras_to_darknet.py
yolov3_keras_to_darknet.py
py
5,765
python
en
code
41
github-code
54
41643148894
from common.linked_list import build_linked_list from common.linked_list import node class Solution(object): def mergeTwoLists(self, l1, l2): """ :type l1: ListNode :type l2: ListNode :rtype: ListNode """ dummy = node(-1) current = dummy while l1 a...
224nth/leetcode
problems/lc_21.py
lc_21.py
py
814
python
en
code
0
github-code
54
2208028647
# Write a function that copies a file to an other # It should take the filenames as parameters # It should return a boolean that shows if the copy was successful def filecop (file1,file2): try: with open(file1, "r") as f1: lines = f1.read() with open(file2, "w") as f2: f2.wri...
green-fox-academy/FulmenMinis
week-03/day-02/copy_file.py
copy_file.py
py
1,052
python
en
code
0
github-code
54
20595997218
from tkinter import * import os import sqlite3 with sqlite3.connect('projectDB.db') as db: c = db.cursor() class main: def __init__(self, master): self.master = master self.username = StringVar() self.username = " " self.password = StringVar() self.widgets() def callback(self): os.system("python R...
s-a-c-h-i-n/Restaurant-Billing-System
alt2.py
alt2.py
py
1,137
python
en
code
0
github-code
54
8651409865
import argparse from autogluon_benchmark.aggregate.results import aggregate_results if __name__ == '__main__': parser = argparse.ArgumentParser(formatter_class=argparse.RawTextHelpFormatter) parser.add_argument('--s3_bucket', type=str, help="Name of S3 bucket that results to aggregate get outputted to", ...
Innixma/autogluon-benchmark
scripts/aggregate_openml_results.py
aggregate_openml_results.py
py
1,214
python
en
code
1
github-code
54
34823974679
import numpy as np import plotly.graph_objects as go from sklearn import datasets from sklearn.model_selection import train_test_split from nn import convert_from_one_hot, convert_to_one_hot TRAIN_COLORS = ['rgb(172,84,84)', 'rgb(84,99,172)', 'rgb(69,118,69)', 'Orange'] VAL_COLORS = ['rgb(177,109,109)', 'rgb(130,139,1...
Vlad-Enia/Neural_Network_Visualiser_V2
drawPlot.py
drawPlot.py
py
17,685
python
en
code
0
github-code
54
36223756597
import hashlib #imports hashlib library to use sha256 # function to perform hash operation def hashGenerator(data): result = hashlib.sha256(data.encode()) return result.hexdigest() class Block: def __init__(self, data, hash, prev_hash): self.data = data self.hash = hash self.prev_h...
Soham13anerjee/WEB3-projects
simple_blockchain_using_py/block.py
block.py
py
937
python
en
code
1
github-code
54
30679922083
import numpy as np import os def reflect(X, minx, maxx): Y = np.copy(X) t = np.nonzero(Y > maxx) Y[t] = 2 * maxx - Y[t] t = np.nonzero(Y < minx) while np.count_nonzero(t) > 0: Y[t] = 2 * minx - Y[t] t = np.nonzero(Y > maxx) if not np.count_nonzero(t) > 0: Y[...
oskarsinger/dtcwt
dtcwt/utils.py
utils.py
py
2,004
python
en
code
0
github-code
54
13267379923
# coding: utf-8 """ gpool里所有 的greenlet执行完毕,是否会删除gpool? 结论 不会 实现思路: gpool里丢2个任务。 join完事以后 再丢1个试试看看会不会继续运行。 运行结果: ***res*** i was sleep 1 sec i was sleep 1 sec 1522371885.5 1522371885.5 ----end---? 0 [当前gpool len] ----in---add---- 6 [下一个任务的输出] ****res**** """ from gevent import monkey; monkey.patch_all() fr...
echoocking/DontForget
关于python的个人疑惑QA/gevent/gpool.py
gpool.py
py
917
python
en
code
0
github-code
54
74422958882
''' Master App, testing for master controller ''' # -*- encoding: utf-8 -*- # file: MasterApp.py from ryu.base import app_manager from ryu.controller import ofp_event from ryu.controller.handler import MAIN_DISPATCHER from ryu.controller.handler import HANDSHAKE_DISPATCHER from ryu.controller.handler import CONFIG_DIS...
igorradichi/sdn-multicontrollers
base/MasterApp.py
MasterApp.py
py
7,630
python
en
code
1
github-code
54
21309675615
import django_filters from app import models class PlatformFilter(django_filters.FilterSet): platforms = django_filters.CharFilter( name='platforms__name', lookup_type='contains', ) class Meta: model = models.WatchList fields = ('title', 'platforms')
rroy11705/Rest_API_With_Django
watchmate_v2.0.1/app/api/custom_filters.py
custom_filters.py
py
298
python
en
code
0
github-code
54
41319773231
from problem import Problem import random from idlelib import tree #from graphics import * class Problem35(Problem): def __init__(self): limit = random.randint(5,10) data = [random.randint(0, 100) for _ in range(1, limit)] data = list(set(data)) statement = '1. Avem urma...
AdminSDA/Lab212
problem35.py
problem35.py
py
7,302
python
ro
code
2
github-code
54
15027812888
import nltk from nltk.stem.wordnet import WordNetLemmatizer from nltk.corpus import sentiwordnet as swn import random ############ if the input is simple and can auto reply #################################################################################################################################################...
yuifuku1118/tobyWebVer
reply.py
reply.py
py
4,182
python
en
code
0
github-code
54
33907467601
import pandas as pd import yfinance as yf import datetime from datetime import date from yahooquery import Ticker from datetime import datetime as d import pmdarima as pm from statsmodels.tsa.arima.model import ARIMA from bokeh.plotting import figure, show, output_notebook import seaborn as sns from Logic.SentimentAnly...
VeredMazor/FinalProjectDeltaPredictBackend
Logic/TechnicalAnalyzerAlgorithms.py
TechnicalAnalyzerAlgorithms.py
py
9,037
python
en
code
5
github-code
54
14359043858
import sys import cv2 import random import warnings import numpy as np from PIL import Image from skimage import feature from scipy.optimize import curve_fit import torchvision.transforms as transforms if not sys.warnoptions: warnings.simplefilter("ignore") def make_power_2(n, base=32.0): return int(round(n /...
oljike/Pix2PixHD
edge_detector.py
edge_detector.py
py
10,002
python
en
code
5
github-code
54
27442251526
# coding=utf-8 # 变量作用域 # 范围: 全局(global):在函数外部定义 局部(local):函数内部 # LEGB原则:L(Local) 局部作用域 E(Enclosing function local) 外部嵌套函数作用域 G(Global modul) 函数定义所在模块作用域 B(buildin) python内置模块的作用域 # a1 = 100 # def fun(): # print(a1) # print('i am in fun') # a2 = 99 # print(a2) # print(a1) # fun() # 提升局部变...
flyingtothe/Python
01-Base/p07-functionScope.py
p07-functionScope.py
py
2,550
python
zh
code
0
github-code
54
28159085424
# coding: utf-8 import argparse import time import math import os, sys import itertools import numpy as np import torch import torch.nn as nn import torch.optim as optim from data_utils import get_lm_corpus from models.trellisnets.deq_trellisnet import DEQTrellisNetLM from modules import radam from utils.exp_utils im...
MultiPath/deq
DEQModel/train_trellisnet.py
train_trellisnet.py
py
15,261
python
en
code
null
github-code
54
6384137981
import re # dico = {'1': 'hello', '2': 'world'} # print(dico[1]) # from django.utils.timezone import datetime # import json # date = datetime.now() # print(datetime.now()) # print(type(datetime.now())) # print('\n') # date = datetime.now().strftime("%Y-%d-%m %H:%M:%S.%f")[:-1] # print(date) # print(type(date)) # p...
Pierre605/DjangoREST_CurrencyConverterService
LengowCodingame/currencyconverter/basic.py
basic.py
py
550
python
en
code
1
github-code
54
24729816934
import sqlite3 conn = sqlite3.connect("food_blog.db") cur = conn.cursor() cur.execute("PRAGMA foreign_keys = ON;") cur.execute("""CREATE TABLE IF NOT EXISTS meals(meal_id INTEGER PRIMARY KEY AUTOINCREMENT, meal_name VARCHAR(20) NOT NULL)""") cur.execute("""CREATE TABLE IF NOT EXISTS ingredie...
dmstyx/JB_projects
JB_recipes_db.py
JB_recipes_db.py
py
4,684
python
en
code
0
github-code
54
26293648432
def primedetect(limit): allnum = [] for i in range(limit): allnum.append(i) allnum.pop[0] allnum.pop[1] p = 2 cross = p+2 while p < limit: allnum.pop[cross] cross += 2 return allnum limit = int(input('Enter the limit:')) print(primedetect(limit))
XavierPlayzTheDueldox/Python_Lvl2
.vscode/Lists/ex127.py
ex127.py
py
303
python
en
code
0
github-code
54
72355817442
import numpy as np from matplotlib import pyplot as plt from PIL import Image class Average: def __init__(self, f: str = "img2-1024/1024_1.bmp") -> None: self.f = f def get_average(self, output) -> None: im = Image.open(self.f) w, h = im.size rgb_data = np.array(im) nd...
Gild-shogi/infod2023-tools
tools/avarage.py
avarage.py
py
1,712
python
en
code
0
github-code
54
3681804390
# Modules and packages # A module is a piece of software with specific functionality. # in a ping pong game, one module would handle drawing the game, and one would handle logic. # Modules have the file extension ".py" # EXCERCISE sort all commands in package "re" alphabetically import re print(sorted(dir(re))) # Yo...
SimonBirgersson/Projects
Learning_Python/tutorial/modules_packages.py
modules_packages.py
py
504
python
en
code
1
github-code
54