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
19085165501
import math n = int (input()) N = int (math.sqrt(n) + 1) s = set() for j in range (2, 35): for i in range (2, N): if i ** j > n: break if i ** j <= n: s.add(i ** j) print (n - len (s))
RocketMirror/AtCoder_Practice
unex.py
unex.py
py
247
python
en
code
0
github-code
1
279625670
from PIL import Image, ImageDraw from .hilbert import HilbertContext, hilbert_sequence COLOR_WHITE = (255, 255, 255) COLOR_BLACK = (0, 0, 0) COLOR_RED = (255, 0, 0) COLOR_GREEN = (0, 255, 0) COLOR_BLUE = (0, 0, 255) def draw_grid(image_draw, grid_size, square_size): for x in range(0, grid_size, square_size): ...
jtremesay/hilbert
hilbert/drawing.py
drawing.py
py
1,497
python
en
code
0
github-code
1
18152152452
import torch.nn as nn class YOLO_V1_Model(nn.Module): def __init__(self,params): self.dropout_prob= params["dropout"] self.num_classes= params["num_class"] super(YOLO_V1_Model,self).__init__() # LAYER 1 self.layer1 = nn.Sequential( nn.Conv2d(3, 64, kernel_size=...
Alibhji/python_training
4_YOLO_1/YOLO_V1_A/package_1/YOLO_V1_Model.py
YOLO_V1_Model.py
py
9,382
python
en
code
0
github-code
1
10048511394
""" Perfect Squares Given a positive integer n, find the least number of perfect square numbers (for example, 1, 4, 9, 16, ...) which sum to n. Example 1: Input: n = 12 Output: 3 Explanation: 12 = 4 + 4 + 4. Example 2: Input: n = 13 Output: 2 Explanation: 13 = 4 + 9. # NOTE: IMPORTANT! """ import math class Solution...
okaysidd/Interview_material
June_challenge/Perfect Squares.py
Perfect Squares.py
py
2,076
python
en
code
0
github-code
1
73263358115
import firebase_admin from firebase_admin import credentials from firebase_admin import db cred = credentials.Certificate("serviceAccountKey.json") firebase_admin.initialize_app(cred,{ "databaseURL" :"https://face-recognition-attenda-5a0b4-default-rtdb.firebaseio.com/" } ) ref = db.r...
pingDiablo/attendance-system
AddDataToDataBase.py
AddDataToDataBase.py
py
2,139
python
en
code
0
github-code
1
39998758804
import unittest import math import copy import heppy.framework.context as context if context.name != 'bare': from heppy.particles.isolation import * from heppy.particles.tlv.particle import Particle from ROOT import TLorentzVector @unittest.skipIf(context.name=='bare', 'ROOT not available') class TestIso...
cbernet/heppy
heppy/particles/test_isolation.py
test_isolation.py
py
1,758
python
en
code
9
github-code
1
1541036519
# -*- coding: utf-8 -*- """ Grabs 5 second chunks of voltage data being sampled at 100 Hz """ import serial import time import matplotlib.pyplot as plt import numpy as np from datetime import datetime import os from scipy import fftpack from scipy import signal ser = serial.Serial('COM3', 9600) time.s...
MCKersting12/EEG_DIY
python/grab_voltage_chunk.py
grab_voltage_chunk.py
py
1,842
python
en
code
1
github-code
1
15153206033
#%% number = "6" print(number) # %% int(number) # %% name = "Arie" list(name) # %% my_list = [] # %% my_list.append(4) # %% names_list = ["Arie", "James", "James", "James"] # %% names_list.remove("James") # %% 4 + 4 # %% "Arie" + "Twigt" # %% names_list + names_list # %% "Arie" + 4 # %% 4 + "Arie" # %% names_list #%...
ArieTwigt/python_training_10_07_2023
exp_3.py
exp_3.py
py
753
python
en
code
0
github-code
1
11807230528
import threading import time from functools import partial from queue import Empty import msgpack import zmq import infupy.backends.fresenius as fresenius zmqhost = '127.0.0.1' zmqport = 4201 freseniusport = 'COM6' def stateWorker(stopevent): context = zmq.Context() zmqsocket = context.socket(zmq.PUB) z...
jaj42/phystream
python/FresStream.py
FresStream.py
py
2,719
python
en
code
0
github-code
1
40363479768
__author__ = 'M_Nour' import numpy as np from scipy import stats from sklearn.semi_supervised import label_propagation from sklearn.metrics import classification_report, confusion_matrix,accuracy_score, f1_score, recall_score from collections import Counter # import marjan_dataset import dataset from imblearn...
marjan-nourollahi/PALS
My_Active_Learning.py
My_Active_Learning.py
py
10,383
python
en
code
0
github-code
1
21334524678
import tweepy from tweepy import OAuthHandler from tweepy import Stream import sys consumer_key= 'hi' # Don't have these in the final consumer_secret= 'hi'# Don't have these in the final access_token= 'hi'# Don't have these in the final access_token_secret= 'hi' authorization = tweepy.OAuthHandler(consumer_key, consu...
amcurley/ContentGen-heroku
gpt/src/cursor.py
cursor.py
py
837
python
en
code
2
github-code
1
72430038754
"""Index view.""" from django.conf import settings from django.contrib.auth.decorators import login_required from django.core.paginator import Paginator from django.shortcuts import redirect, render from later42.models.article import Article from later42.models.urls import URL def get(request): """Index view."""...
dntsk/later42
later42/views/index.py
index.py
py
1,503
python
en
code
0
github-code
1
13741501932
import cv2 import os import os import sys import time import pickle import random import numpy as np os.environ["CUDA_VISIBLE_DEVICES"] = "0" # 读取数据集 总共8类 32, 64, 128 , 256尺寸 # os opencv 训练数据集 image_size = 32 def readImage(dir): totalImage = [] totalFlag = [] totalImageTemp = [] totalFlagTemp = [] ...
tchennech/graduateDesign
preperData.py
preperData.py
py
3,197
python
en
code
0
github-code
1
42370577435
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Wed Nov 8 00:38:09 2023 @author: guangdafei """ import tushare as ts import pandas as pd import numpy as np import matplotlib.pyplot as plt plt.rcParams['font.sans-serif'] = ['SimHei'] token = "13bb0841c8a377221b39d9142f42bae2e2e9a897b9f692c75dd90d65" ...
akaGD-13/trove_bt2
main.py
main.py
py
1,493
python
en
code
0
github-code
1
27723210016
from django.shortcuts import render, redirect from .models import * from .forms import UsuarioForm, PescadoForm, PescariaForm, CriarUsuarioForm from .filters import OrderFilter, UsuarioFilter, PescariaFilter from django.contrib.auth.forms import UserCreationForm from django.contrib import messages from django.contrib.a...
sergioroberto15/Pescaria_Django
accounts/views.py
views.py
py
7,022
python
en
code
0
github-code
1
36909495555
from django.shortcuts import render from django.http import HttpResponse, JsonResponse from django.template import loader from appprueba.forms import ContactoForm from datetime import datetime from django.contrib import messages from django.core.mail import send_mail from django.conf import settings # Create your ...
nicofe88/DjangoB
appprueba/views.py
views.py
py
6,053
python
es
code
1
github-code
1
3207045152
# -*- coding: ascii -*- import sys, os parent_path = os.path.split(os.path.abspath("."))[0] if parent_path not in sys.path: sys.path.insert(0, parent_path) from pyspec import * from pyspec.embedded.dbc import * from pyspec.mockobject import * class Behavior_DesignByContract_PrePost(object): class Counter(DbCo...
shibu/pyspec
spec/behavior_pyspec_dbc.py
behavior_pyspec_dbc.py
py
3,243
python
en
code
6
github-code
1
2628218849
import os import json import csv import datetime import requests from util import download_file def main(): #愛媛県のopendata url="https://www.pref.ehime.jp/opendata-catalog/dataset/2174/resource/7072/380008_ehime_covid19_patients.csv" file_name=download_file(url) #日付とその日の陽性者数をセットしていく d...
tamitami5c/corona-ehime-data
main.py
main.py
py
1,909
python
ja
code
0
github-code
1
12111496524
#!/usr/bin/env python 3.8 # -*- coding: UTF-8 -*- # @date: 2022.01.14 下午 11:46 # @name: demo2 # @author:Ads-Ryen # @webside:www.prlrr.com # @software: PyCharm import requests import re url_1 = "https://www.demo.net/XiuRen/485_4.html" response = requests.get(url=url_1) try: htmls = response.text.encode('ISO-8859-1...
Adsryen/ImageCrawlingManage
python/main/demo2.py
demo2.py
py
1,797
python
en
code
0
github-code
1
42830860654
import speech_recognition as sr import pyttsx3 def recognize_speech_from_mic(recognizer, microphone): if not isinstance(recognizer, sr.Recognizer): raise TypeError("`recognizer` must be `Recognizer` instance") if not isinstance(microphone, sr.Microphone): raise TypeError("`microphone` must be...
Elysian01/AI-Chatbot
aichatbot/speech2text.py
speech2text.py
py
1,373
python
en
code
7
github-code
1
892953746
#! /usr/bin/env python import os from flask_script import Manager from api import myApp, db # NAME_APP : your app name # default : config default in your app api = myApp(os.getenv('NAME_APP', 'default')) manager = Manager(api) @manager.shell def migration_db(): return dict(app=api, db=db) if __name__ == '__main...
notme1001/Flask_boilerplate
server.py
server.py
py
342
python
en
code
1
github-code
1
40715490552
import re with open(r"D:\Advent of Code\2015\day5_input.txt", "r") as file: # read the contents of the file into a string strings = file.readlines() # Got the below code from ChatGPT def is_nice(string:str)->bool: # matches any string that contains at least 3 vowels return bool(re.search(r'(.*[...
avinashbasutkar/advent_of_code
2015/day5.py
day5.py
py
782
python
en
code
0
github-code
1
35013610536
""" guitar_string.py Models a guitar string. """ import math import random import ring_buffer import stdarray import stdio import sys # Sampling rate. SPS = 44100 def create(frequency): """ Create and return a guitar string of the given frequency, using a sampling rate given by SPS. A guitar string is...
amandakwong898/cs110-project3
23444902/guitar_string.py
guitar_string.py
py
2,237
python
en
code
0
github-code
1
7084636942
import pygame import socket from effects import * import json from random import randint import sys pygame.init() s = socket.socket() port = 5555 s.bind(('',port)) s.listen(5) def main(): number_client = "" while type(number_client) != int: try: number_client = int(input("Combien de joueur...
Alexander7474/Sky_Shooter_Online
server.py
server.py
py
3,349
python
en
code
1
github-code
1
74692226594
import os import django os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'calendar_base.settings') django.setup() import unittest from calendarapp import models from calendarapp.models import Year, Month, Day class CalendarTest(unittest.TestCase): def year_tester(self, year_object, year, start_day, start_day_str, d...
broden-wanner/colmanegancalendar
calendar_validation_tests.py
calendar_validation_tests.py
py
5,515
python
en
code
0
github-code
1
7731011757
''' Created on Aug 16, 2018 @author: I335484 ''' import threading import time class Mythread(threading.Thread): def __init__(self, name, n1 , n2 , oper): threading.Thread.__init__(self) self.name = name self.n1 = n1; self.n2 = n2; self.oper = oper def run(...
murali-kotakonda/PythonProgs
PythonBasics1/threadings/MyThreadGroups.py
MyThreadGroups.py
py
1,044
python
en
code
0
github-code
1
72494269475
# coding:utf8 """ 插入排序和冒泡排序的区别在于: 插入排序的前提是:左边是有序的数列 而冒泡排序:相邻的值进行交换,一共进行n次交换 """ def insertion_sort(nums): for i in range(1, len(nums)): while i: if nums[i] < nums[i-1]: nums[i], nums[i-1] = nums[i-1], nums[i] i -= 1 return nums if __name__ == "__main__": nu...
apachecn/Interview
src/py3.x/DataStructure/InsertionSort.py
InsertionSort.py
py
513
python
en
code
8,365
github-code
1
29695897405
import scrapy from imdbtutorial.items import MovieItem, CastItem class ImdbSpider(scrapy.Spider): name = "imdb" allowed_domains = ["imdb.com"] base_url = "https://imdb.com" start_urls = ['https://www.imdb.com/chart/top' ,] def parse(self, response): # table coloums of all the movies ...
SIDDHANT9281/ImdbsCraper
imdbtutorial/imdbtutorial/spiders/imdb_spider.py
imdb_spider.py
py
2,013
python
en
code
0
github-code
1
38126545610
import mediapipe as mp import numpy as np import cv2 from draw_landmarks import draw_landmarks_on_image model_path = 'pose_landmarker_full.task' BaseOptions = mp.tasks.BaseOptions PoseLandmarker = mp.tasks.vision.PoseLandmarker PoseLandmarkerOptions = mp.tasks.vision.PoseLandmarkerOptions PoseLandmarkerResult = mp.ta...
napongps/Muay-Thai-pose-similarity
Detector_video.py
Detector_video.py
py
2,023
python
en
code
0
github-code
1
14458303716
n = int(input()) s = set(map(int, input().split())) N = int(input()) for i in range(N): x = input().split(' ') command = x[0] if command == "pop": s.pop() elif command == "discard": s.discard(int(x[1])) elif command == "remove": s.remove(int(x[1])) total = sum(s) print(total...
maruf1847/problem-solving-python
HackerRank/set_pop_discard_remove.py
set_pop_discard_remove.py
py
322
python
en
code
0
github-code
1
26481879926
from osgeo import ogr import warnings from typing import Union from gdalhelpers.checks import layer_checks, values_checks from gdalhelpers.classes.DEM import DEM import losanalyst.functions.los_field_names as field_names from losanalyst.functions import helpers def check_los_layer(layer: ogr.Layer) -> None: """ ...
JanCaha/los_analyst
losanalyst/functions/checks.py
checks.py
py
7,122
python
en
code
0
github-code
1
71747047394
import urllib.request from django.http import response from django.http.response import HttpResponse from django.shortcuts import render from accounts.models import Order, Customer from humanitary_gift_shop.utils import checkout_session, random_string_generator, cookieCart from django.views.decorators.csrf import csrf_...
Code-Institute-Submissions/humanitary
checkout/views.py
views.py
py
2,101
python
en
code
0
github-code
1
21973052666
import collections def TransformToArray(data, reverse): keys = list(data.keys()) for key in keys: data[key] = collections.OrderedDict(sorted(data[key].items(),reverse=reverse)) auxData = list(data.values()) data = [] for index in range(len(auxData)): data.append({'na...
augusto-roct/ExportModel
src/app/utils/documentToArray.py
documentToArray.py
py
683
python
en
code
0
github-code
1
43749328961
import os cwd = os.getcwd() # for each directory in the cwd for name in os.listdir(cwd): if os.path.isdir(name) and name != '.git': # for each file in this directory for filename in os.listdir(name): # open the file with open(cwd + '/' + name + '/' + filename, 'r+') as file...
tristan-morrison/airspace-fixes
cleanup.py
cleanup.py
py
618
python
en
code
0
github-code
1
9233188360
''' Module for user ''' import json from src.data_store import data_store from src.helper_functions import auth_id_to_user, check_token_valid, decode_jwt, get_email, check_valid_u_id from src.error import InputError, AccessError import re def user_profile_setemail_v1(token, email): ''' <Update the authorised us...
mannarora5/UNSW-Seams-Backend-Project
user.py
user.py
py
5,044
python
en
code
0
github-code
1
22769144792
import pandas as pd import numpy as np Database= "/home/ubun/Desktop/UTRApp/UTR.xlsx" Event = "/home/ubun/Desktop/UTRApp/ML.xlsx" eventName = "Event1" mergeOn='Name' totalFrom='E1' xl_fileDB = pd.ExcelFile(Database) DB = {sheet_name: xl_fileDB.parse(sheet_name) for sheet_name in xl_fileDB.sheet_names}...
itchybumDev/UTRAPP
utr.py
utr.py
py
1,916
python
en
code
0
github-code
1
1632399775
from aocd.models import Puzzle from aocd import lines puzzle = Puzzle(year=2020, day=7) rules = dict() for line in lines: line = line.replace(' bags', '').replace(' bag', '').replace('.', '') parts = line.split(' contain ') if parts[0] not in rules: rules[parts[0]] = list() inside_b...
dumoulinj/aoc
aoc/2020/day7.py
day7.py
py
1,053
python
en
code
0
github-code
1
12380996944
import pandas as pd data = pd.read_csv('C:/Users/Rakesh/Desktop/DataScience/Lohith code/Naive Bayes/spam.csv', encoding='latin-1') data.head() # Drop column and name change data = data.drop(["V3", "Unnamed: 3", "Unnamed: 4"], axis=1) #data2 = data.drop([3,4],axis=0) #print(data2) data = data.rename(columns={"v1": "l...
gswathinair/SwathiWS
Naive Bayes/naive_bayes_spam_or_not.py
naive_bayes_spam_or_not.py
py
2,342
python
en
code
0
github-code
1
18364519880
#!/usr/bin/env python """These tests only test the aspects of the `fseq.SeqReader` that does not involve running the the encoding as that behaviour is a complex behaviour involving all aspects of `fseq` those tests are performed by `test_fseq`. Those are: SeqReader.run() for res in SeqReader ... ...
local-minimum/fseq
fseq/tests/test_seq_reader.py
test_seq_reader.py
py
6,334
python
en
code
0
github-code
1
2909345465
import cv2 import requests import sys import os from PIL import Image import json import numpy as np from . import error_score from . import face_pp URL = 'https://api-us.faceplusplus.com/facepp/v1/face/thousandlandmark' API_KEY = ['-D9lXEJg0Z0MMuSHKtmKxetMLqYkZp2c', 'eORdjUCXMFgW-RahCeWAzZM-huNDakIi', '5Ak...
cubalys/tmp
faceshape_carrick/shape.py
shape.py
py
9,358
python
en
code
0
github-code
1
71793787233
import re from lib.core.settings import WAF_ATTACK_VECTORS __product__ = "KONA Security Solutions (Akamai Technologies)" def detect(get_page): retval = False for vector in WAF_ATTACK_VECTORS: page, headers, code = get_page(get=vector) retval = code == 501 and re.search(r"Reference #[0-9A-Fa-...
pwnieexpress/raspberry_pwn
src/pentest/sqlmap/waf/kona.py
kona.py
py
407
python
en
code
1,000
github-code
1
10995743705
""" 给定一个整数数组 nums ,找出一个序列中乘积最大的连续子序列(该序列至少包含一个数)。 示例 1: 输入: [2,3,-2,4] 输出: 6 解释: 子数组 [2,3] 有最大乘积 6。 示例 2: 输入: [-2,0,-1] 输出: 0 解释: 结果不能为 2, 因为 [-2,-1] 不是子数组。 """ class Solution(object): def maxProduct(self, nums): dpMax = [0] * len(nums) dpMin = [0] * len(nums) dp = [0] * len(nums) ...
bendanwwww/myleetcode
code/lc152.py
lc152.py
py
884
python
zh
code
1
github-code
1
6561066196
from django.http import HttpResponse from django.shortcuts import render import datetime def hello(request): try: ua = request.META['REMOTE_ADDR'] except KeyError: ua = 'unknown' return HttpResponse("Hello world, you are visiting %s, %s" % (request.path, ua )) def meta_data(request): ...
RobertFloor/mysite
mysite/views.py
views.py
py
860
python
en
code
0
github-code
1
28010986220
''' Using a dictionary in a Restaurant menu ''' def restaurant (): ''' Take orders from user ''' MENU = {'pizza' : 3.14, 'espresso' : 1.00, 'water' : 0.50} print("Available items:") for key, value in MENU.items(): print(f"{key:10s}{value:.2f}") done = False tot = 0. while...
bgppa/python_workout
ch4_dicts_and_sets/ex14.py
ex14.py
py
870
python
en
code
0
github-code
1
10124597966
import json import requests if __name__ == '__main__': url='https://oapi.dingtalk.com/robot/send?access_token=e88a5dfb80118f073ddae0534d9daa4ea0d5049917d7768b12753e2e9ef649c3' headers = {'Content-Type': 'application/json;charset=utf-8'} # data={ # "msgtype": "text", # "text": { # ...
WilliamFWG/Warehouse
python/PycharmProjects/py03/day01/dingtalk.py
dingtalk.py
py
2,054
python
en
code
0
github-code
1
30467351646
# Route Between Nodes # Given a directed graph, design an algorithm to find out whether there is a # route between two nodes. from mygraph import Graph import unittest def is_route(G: Graph, root: int, goal: int) -> bool: """Returns true iff there is a route between root and goal in graph G""" # Validate inp...
kchenx/cracking-coding-interview
chapter4/1_route_between_nodes.py
1_route_between_nodes.py
py
1,472
python
en
code
0
github-code
1
72373797155
# -*- coding: utf-8 -*- import tensorflow as tf import numpy as np import torch import torchvision as tv from torchvision import transforms, datasets import torch.nn as nn import torch.nn.functional as F import torch.optim as optim import matplotlib.pyplot as plt print(tf.__version__) # 3 models to implement various...
hruday48/CPSC-8430
1a.py
1a.py
py
8,092
python
en
code
1
github-code
1
35632485387
import math rad = math.radians(60) cos = math.cos(rad) sin = math.sin(rad) class point(): def __init__(self, x, y): self.x = x self.y = y def koch_curve(a, b, n): if n == 0: return s = point((2*a.x + b.x)/3, (2*a.y + b.y)/3) t = point((a.x + 2*b.x)/3, (a.y + 2*b.y)/3) u = point((t.x - s....
YujinMiyoshi/0202
divide_and_conquer_method/koch_curve.py
koch_curve.py
py
749
python
en
code
0
github-code
1
4516356754
import PIL.ImageDraw as ImageDraw import PIL.Image as Image import numpy as np import random WIDTH = 800 HEIGHT = int(3 * WIDTH / 4) image = Image.new("RGB", (WIDTH, HEIGHT)) draw = ImageDraw.Draw(image) # Attempt to use 2nd image to draw just the boundary by following orbit of boundary point image_2 =...
stschaef/LoG_M
Cones.py
Cones.py
py
4,617
python
en
code
1
github-code
1
11396217458
number = int(input('Введите глубину ямы: ')) print() depth = number - 1 while depth >= 0: for pit in range(-number, number + 1): if abs(pit) > depth: print(abs(pit), end='') elif pit == 0: print(end='') else: print('.', end='') depth -= 1 print()
GlebSmor/skillbox
Python_Basics_part_1/module-10/work-10_m10.py
work-10_m10.py
py
335
python
en
code
0
github-code
1
28276419372
import os import re import ast import pandas as pd import numpy as np import datetime from typing import List, Union, Any, Tuple import httplib2 import apiclient.discovery from oauth2client.service_account import ServiceAccountCredentials CREDENTIALS_FILE = os.getenv("CREDENTIALS_FILE") gsheetId = os.getenv("gsheetId"...
pchlq/plaid_to_gsheets
df_to_sheet.py
df_to_sheet.py
py
9,717
python
en
code
0
github-code
1
43788559826
import colour from IPython.display import Video from datetime import datetime class ishow_config(): def __init__(self, # file_writer_config write_to_movie=True, break_into_partial_movies=False, save_last_frame=False, save_pngs=Fa...
Kexin-Zhang-UCAS/imanim
imanim/__init__.py
__init__.py
py
4,527
python
en
code
0
github-code
1
6130964866
from heapq import heappush, heappop def solution(jobs): answer = 0 cur = 0 n = len(jobs) jobs.sort() for i in range(len(jobs)): jobs[i][0], jobs[i][1] = jobs[i][1], jobs[i][0] q = [] heappush(q, jobs.pop(0)) while q: cost, at = heappop(q) if cur < at: ...
2020-ASW/kwoneyng-Park
12월 3주차/디스크 컨트롤러.py
디스크 컨트롤러.py
py
707
python
en
code
0
github-code
1
25258282499
from __future__ import absolute_import, division, unicode_literals import logging import uuid from flask_restful.reqparse import RequestParser from sqlalchemy.orm import subqueryload_all from changes.utils.diff_parser import DiffParser from werkzeug.datastructures import FileStorage from changes.api.base import APIV...
harrisonfeng/changes
changes/api/phabricator_notify_diff.py
phabricator_notify_diff.py
py
6,390
python
en
code
null
github-code
1
15848455280
import pyautogui, time amount = input("How many comments to do you want to make?") amount = int(amount) comment = input("What do you want to comment?") print("The program is starting in 5 seconds.") time.sleep(5) pyautogui.scroll(100) pyautogui.scroll(-7) time.sleep(2) for i in range(amount): pyautogui.moveTo...
IAMACAR10/yt-spam
yt-spam.py
yt-spam.py
py
455
python
en
code
0
github-code
1
20412505556
import game_functions # Main class used give attributes to all characters class Creature: def __init__(self): self.name = "" self.initiative = 0 self.initiative_dice_sum = 0 self.resistance = 0 self.attack = 0 self.agility = 0 self.is_alive = True def ...
SakariJawo/DungeonMaster
classes.py
classes.py
py
3,687
python
en
code
0
github-code
1
38701721413
''' A simple python calculation question generator usg: python calculator.py -d "+,-" -c 3 -l 200 -t 30 usg: python calculator.py --op_type="+,-" --op_count=3 --limit=20 --total=30 ''' import sys, getopt, random, json def auto_cal_generator(limit=100, op_count=1, op_type=["+"], total=100): res = {} if limit>99...
jessychen1984/MiniProj
src/api/miniproj/calculator.py
calculator.py
py
1,634
python
en
code
0
github-code
1
70735149474
import os import warnings from setuptools import setup, find_packages def read(fname): with open(os.path.join(os.path.dirname(__file__), fname), "rb") as f: reqs = f.read().decode("utf-8") return reqs from pkg_resources import require, DistributionNotFound, parse_version def check_provided(distributi...
bouralab/Prop3D
setup.py
setup.py
py
3,734
python
en
code
16
github-code
1
2852118483
from django.urls import path from django.contrib.auth import views as auth_views from . import views urlpatterns = [ path('', views.index, name='index'), # path('login/', auth_views.LoginView.as_view(template_name='pybo/login.html'), name='login'), path('logout/', auth_views.LogoutView.as_view(), name='log...
ischar/pillMe2
pybo/urls.py
urls.py
py
782
python
en
code
0
github-code
1
20165679405
#encoding: UTF-8 # Autor: Daniel Sahuer # Calcula el valor total de boletos para asientos con costos diferentes con respecto a su clase def calcularPago(asientosA,asientosB, asientosC): #Calcula el pago total sumando el precio de cada asiento A = asientosA * 400 B = asientosB * 250 C = asientosC * 135 ...
sahuer/Tarea_03
asientos.py
asientos.py
py
727
python
es
code
null
github-code
1
71483143075
from django.utils.translation import gettext_lazy try: from pretix.base.plugins import PluginConfig except ImportError: raise RuntimeError("Please use pretix 2.7 or above to run this plugin!") __version__ = "1.0.1" class PluginApp(PluginConfig): name = "pretix_batch_emailer" verbose_name = "Batch Em...
bockstaller/pretix-batch-emailer
pretix_batch_emailer/__init__.py
__init__.py
py
789
python
en
code
0
github-code
1
32874388032
""" Link: https://www.spoj.com/problems/CSTREET/ Time complexity: O(M * Log(N)) Space complexity: O(M + N) Author: Nguyen Duc Hieu """ import heapq INF = int(1e10) def prim(graph, N): dist = [INF] * N visited = [False] * N dist[0] = 0 min_heap = [(0, 0)] while min_heap: weight, source = h...
hieuducnguyen/BigOCourse
15_minimun_spanning_tree/3_Cobbled_streets.py
3_Cobbled_streets.py
py
1,055
python
en
code
2
github-code
1
43195269741
def is_chinese(uchar): if u'\u4e00' <= uchar <= u'\u9fa5': return True else: return False def format_str(raw_str): content_str = '' for i in raw_str: if is_chinese(i): content_str = content_str + i return content_str def get_processed_text(content): chine...
ggjyp/yw_text_claasification
utils/preprocess.py
preprocess.py
py
431
python
en
code
2
github-code
1
12934808687
from typing import Callable, Tuple, Union from scipy.integrate import quad # type: ignore from .context import Context from .tree import BaseValue, Resolveable from .utils import aslist quad: Callable[..., Tuple[float, float]] class Integral(Resolveable): def __init__( self, integrand: Callabl...
Telofy/SquigglyPy
squigglypy/resolvers.py
resolvers.py
py
986
python
en
code
2
github-code
1
73868708515
datain = open("bendin.txt" , "r") dataout = open("bendout.txt" , "w") #Read and convert line with multiple numbers to integer type using list comprehension x1, y1, x2, y2 = [int(x) for x in datain.readline().split()] x3, y3, x4, y4 = [int(x) for x in datain.readline().split()] if x1 < x3: hoverlap = max(x2-x3, 0)...
Deanang/AIOTrainingHub
AIOPastYearQuestions/2021/bend.py
bend.py
py
640
python
en
code
1
github-code
1
5195633034
import os with open('phi/version.txt', 'r') as f: version = f.read() with open('phi/README-template.md', 'r') as f: readme = f.read().format(version) with open('README.md', 'w') as f: f.write(readme)
cgarciae/phi
tasks/create_readme.py
create_readme.py
py
218
python
en
code
130
github-code
1
24328709873
"""Read NestedSamples from MultiNest chains.""" import os import numpy as np from anesthetic.read.getdist import read_paramnames from anesthetic.samples import NestedSamples def read_multinest(root, *args, **kwargs): """Read MultiNest chain files. Parameters ---------- root : str root name fo...
handley-lab/anesthetic
anesthetic/read/multinest.py
multinest.py
py
2,142
python
en
code
51
github-code
1
71492290593
import os import requests import csv import tqdm def download_img(url, name): if not os.path.exists("./images/"): os.mkdir("./images/") name = name.replace("/", "_").replace('"', '“') if os.path.exists("./images/" + name + '.jpg'): return req = requests.get(url=url) try: wi...
xucong053/arsenal_spider
img_download.py
img_download.py
py
747
python
en
code
0
github-code
1
2037403562
# -*- coding: UTF-8 -*- import tensorflow as tf import re def fc_layer(bottom, neurons,name,activation=None,reTrain=False): with tf.variable_scope(name): shape = bottom.get_shape().as_list() dim = 1 for d in shape[1:]: dim *= d x = tf.reshape(bottom, [-1, dim]) ...
yeahydq/DYDL
tutorials/custom_estimator/trainer/tfutil.py
tfutil.py
py
1,392
python
en
code
0
github-code
1
29914946798
from pico2d import * open_canvas() grass = load_image('grass.png') character = load_image('run_animation.png') x = 0 frame = 0 # 여기를 채우세요. while (x < 800): clear_canvas() grass.draw(400, 30) character.clip_draw(frame * 100, 0, 100, 100, x, 90) update_canvas() frame = (frame + 1) % 8 x += 5 ...
TaeRimUm/2021184020_2DGP_DRILL
Lecture05_Animation/character_runs.py
character_runs.py
py
381
python
en
code
1
github-code
1
10722851178
import sys from flask import Flask, render_template, request, flash, url_for, redirect from config import SQLITE_DATABASE_NAME from model import db, db_init, Post app = Flask(__name__) app.config['SQLALCHEMY_DATABASE_URI'] = 'sqlite:///' + SQLITE_DATABASE_NAME app.config['SQLALCHEMY_TRACK_MODIFICATIONS'] ...
Tozarin/Personal-site
main.py
main.py
py
1,878
python
en
code
0
github-code
1
8997009046
from flask import request, Flask, jsonify from search.Searchengine import Searchengine from flask_cors import * app = Flask(__name__) CORS(app, supports_credentials=True) searchengine = Searchengine() @app.route("/") def main(): return "hello world" @app.route("/search", methods=["GET","POST"]) def search():...
wp931120/Seach_engine
web/app.py
app.py
py
595
python
en
code
6
github-code
1
4444628072
from rasa.core.policies import KerasPolicy, MemoizationPolicy, FallbackPolicy, FormPolicy, MappingPolicy from rasa.core.agent import Agent import asyncio async def main(): # there is a threshold for the NLU predictions as well as the action predictions agent = Agent('domain.yml', policies=[KerasPolicy(epochs=...
jupiterbak/RASA
DialogEngineService/train_core.py
train_core.py
py
1,017
python
en
code
2
github-code
1
41035339624
import importlib import itertools import random from sqlalchemy import and_ from sqlalchemy import Boolean from sqlalchemy import case from sqlalchemy import cast from sqlalchemy import Column from sqlalchemy import column from sqlalchemy import dialects from sqlalchemy import exists from sqlalchemy import extract fro...
sqlalchemy/sqlalchemy
test/sql/test_compare.py
test_compare.py
py
66,864
python
en
code
8,024
github-code
1
40365150163
""" created by qiushye on 2018.10.23 python version >= 3 """ import time import numpy as np from .imputation import imputation from sktensor.dtensor import dtensor class HaLRTC(imputation): def __init__(self, miss_data, W, alpha, lou, threshold, max_iter=100): if len(alpha) != 3: raise Runtim...
qiushye/ITS_217
impute/compt/halrtc.py
halrtc.py
py
1,815
python
en
code
0
github-code
1
2554886757
from flask import Flask app = Flask(__name__) @app.route("/") def home(): name = 'Lisa' city_names = ['Paris', 'London', 'Rome', 'Tahiti'] city = "" for i in city_names: city += f'<li>{i}</li>' return f''' <html> <body> <h1>Welcome {name}!</h...
AroraPranav/Hw3_flask
home.py
home.py
py
526
python
en
code
0
github-code
1
11296103632
from rest_framework import generics, status from rest_framework.response import Response from rest_framework.permissions import IsAuthenticated from API.serializers import ( ContainerSerializer, ContainerCreateOnlySerializer ) from API.models import Container, Device from django.db.models import Q class Conta...
AmbientELab-Group/Medbox-server
app/API/views/container.py
container.py
py
6,622
python
en
code
0
github-code
1
18771955258
import csv import timeit class Item: pay_rate = 0.2 # pay rate after 20% discount all_items = [] # class attributes def __init__(self, name: str, price: int or float, qty=0): # validation to the received arguments assert price > 0, f'Price {price} is not valid' assert qty >=...
MyodsOnline/python_files
JimShapedCoding/main.py
main.py
py
2,350
python
en
code
0
github-code
1
37615405353
def solution(id_list, report, k): answer = [0] * len(id_list) reportedDict = {id:[] for id in id_list} report = list(set(report)) for i in report: reporting, reported = i.split() reportedDict[reported].append(reporting) for key, value in reportedDict.items(): if len(value) >...
H2-won/Programmers
src/LEVEL1/신고 결과 받기.py
신고 결과 받기.py
py
425
python
en
code
0
github-code
1
29144802486
from customer import Customer def organize_customer_data(customer_file_path): """Read customer file and return list of customer objects. Read file at customer_file_path and create a customer object containing customer information. """ #create an empty list called customers customers = []...
Geeksten/melon_raffle
customer_info.py
customer_info.py
py
964
python
en
code
0
github-code
1
31223384313
'''Crie um pg que leia a idade de 7 pessoas. no final mostre quantas pessoas são maiores de idade e quantas são menores.''' from datetime import date maior = 0 menor = 0 ano = date.today().year for lista in range(1,8): nasc = int(input('Digite seu ano de nascimento da {}ª pessoa: '.format(lista))) if ano - nasc...
FrancisPaull/CursoemvideoPython
exercicios/ex054 repetição for grupo da maioridade.py
ex054 repetição for grupo da maioridade.py
py
459
python
pt
code
0
github-code
1
35414759397
from image_quality_assessment import MSE, PSNR, SSIM, LPIPS_Score import os import csv from PIL import Image from utils import build_iqa_model import torchvision.transforms as T def save_metrics(hr, sr, psnr_model, ssim_model, lpips_model, device): hr_tensor = T.ToTensor()(hr) sr_tensor = T.ToTensor()(sr) ...
kimjy-st/AdaptiveSRGAN
github/save_metrics.py
save_metrics.py
py
3,030
python
en
code
0
github-code
1
2144088888
import numpy as np import matplotlib.pyplot as plt from helpers import * def svm_train_brute(training_data): # convert data to np array just in case training_data = np.asarray(training_data) positive = training_data[training_data[:, 2] == 1] negative = training_data[training_data[:, 2] == -...
quanghuy2002/huyyeutrang
svm2.py
svm2.py
py
6,074
python
en
code
1
github-code
1
39539040497
# coding: utf-8 # fabric code deploy tool from fabric.api import * from fabric.colors import * import time env.user = 'root' env.hosts = ['192.168.103.155','192.168.103.156'] # 密码略去 env.password = '' env.project_name = 'Server' env.project_code_source = '/Users/suboyang/Documents/repository/fengji/Server/' env.proj...
kivensu/learnpython3
SmartTools/deploycode.py
deploycode.py
py
3,082
python
en
code
0
github-code
1
15780180474
def fact(num): result = 1 for i in range(1, num+1): result = result*i return result def main(): number = 5 print(f"{number}!은 {fact(number)}입니다.") if __name__ == "__main__": main()
pinkocto/AS2023
hw2/lec05_factorial.py
lec05_factorial.py
py
224
python
en
code
0
github-code
1
12297714547
import json import csv import os import boto3 import gspread from oauth2client.service_account import ServiceAccountCredentials def create_keyfile_dict(): variables_keys = { "type": os.environ.get("TYPE"), "project_id": os.environ.get("PROJECT_ID"), "private_key_id": os.environ.get("PRIVATE_KEY_ID")...
tbarringer/Google-Sheets-to-Redshift
GoogleSheets-to-S3_Lambda/lambda_function.py
lambda_function.py
py
1,566
python
en
code
1
github-code
1
25562295539
import csv import random from os import path from zipfile import ZipFile from lxml import etree ZIPS_DIR = path.join(path.realpath('.'), 'race-zips') zips_num = 50 xmls_per_zip = 100 def test_csv1(): total_ids_expected = zips_num * xmls_per_zip csv1_realpath = path.join(ZIPS_DIR, 'csv1.csv') ids = set()...
jackalissimo/multicore
race_csv/tests/test_race_csv.py
test_race_csv.py
py
1,893
python
en
code
0
github-code
1
9213758492
import numpy as np import pandas as pd from imblearn.base import SamplerMixin from imblearn.pipeline import make_pipeline import collections import copy import random # parent submodules import os, sys sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) from preprocessors import IndicatorTr...
mazmazz/SkepticSystem
python/skepticsys/preprocessors/multi_sampler.py
multi_sampler.py
py
7,860
python
en
code
1
github-code
1
16708399772
from django.contrib import admin from django.urls import path from . import views urlpatterns = [ path('' , views.register), path('show', views.show), path('send', views.send), path('delete', views.delete), path('edit', views.edit), path('RecordEdited', views.RecordEdited) ]
priyanka51195/student-management
management/urls.py
urls.py
py
300
python
en
code
0
github-code
1
43708317307
from hello_world import app as hello_world_app import hello_world import pytest @pytest.fixture def client(): with hello_world_app.test_client() as client: yield client def test_service_reply_to_root_path(client): response = client.get("/") assert 'world' in response.data.decode(response.charset...
JustM57/MADE_python_hw
test_flask.py
test_flask.py
py
2,146
python
en
code
0
github-code
1
71988756194
# -*- coding: utf-8 -*- """ Created on Wed Oct 10 13:13:23 2018 @author: EdvanSoares """ import csv import random import math from sklearn.model_selection import KFold from numpy import array from random import randrange def loadCsv(filename): lines = csv.reader(open(filename, "rt")) dataset = list(lines)...
ajffdelgado/projeto1_AM
nb.py
nb.py
py
4,053
python
en
code
0
github-code
1
40379496020
import re def matchList( ilist: list, data: str ): """ :param ilist: :param data: :return: """ for item in ilist: if re.match( item, data, re.IGNORECASE ) is not None: return True return False
pe2mbs/m3u_serializer
m3u_serializer/util.py
util.py
py
245
python
en
code
0
github-code
1
34504054424
from unittest import mock from fastapi.responses import Response from fastapi.testclient import TestClient from apps.main import app client = TestClient(app) def test_read_main_success(): response = client.get("/") assert response.status_code == 200 def test_read_main_template_not_found(): with mock....
Alexvjunior/challenge
tests/test_translator_view.py
test_translator_view.py
py
2,950
python
en
code
0
github-code
1
72930184995
import numpy as np import torch import random from typing import Optional, Tuple def fourier_shift(u: torch.Tensor, eps: float=0., dim: int=-1, order: int=0) -> torch.Tensor: """ Shift in Fourier space. Args: u (torch.Tensor): input tensor, usually of shape [batch, t, x] eps (float): shift...
brandstetter-johannes/LPSDA
common/augmentation.py
augmentation.py
py
11,079
python
en
code
35
github-code
1
15219280424
import webbrowser import re import requests from bs4 import BeautifulSoup from urllib import request def list_url(sorted_url): urls = [] for a in sorted_url: if a.has_attr('href'): urls.append(a['href']) return urls def main(): plugin = input("Podaj nazwę wtyczki: ") headers ...
JobbyJabber/WordPress-scraper
wp_scraper_v0.2.py
wp_scraper_v0.2.py
py
1,337
python
en
code
0
github-code
1
4620091398
from flask import Blueprint, render_template, session, redirect, request from app.db import mysql from app.Main import allevent_len import requests from serpapi import GoogleSearch user = Blueprint("User", __name__, url_prefix="/user", template_folder="templates") @user.route('/') def home(): if...
Rbcoder1/EMS_WEB
app/User/views.py
views.py
py
3,436
python
en
code
2
github-code
1
25735628289
def find_set(x): while x != group[x]: x = group[x] return x def union(n1, n2): root1 = find_set(n1) root2 = find_set(n2) group[root2] = root1 for tc in range(1, int(input())+1): N, M = map(int, input().split()) # N: 마을 사람 수 / M: 관계 수 group = [num for num in range(N+1)] f...
KSoonYo/SW_Expert_Arcademy_problem
7465_무리개수/s1.py
s1.py
py
685
python
ko
code
0
github-code
1
3408655101
import requests from datetime import datetime import smtplib import time MY_EMAIL = "XXXXXXXXXXX@gmail.com" MY_PASSWORD = "XXXXXXXXXXXXX" MY_LAT = 38.548330 MY_LONG = -90.326280 def is_iss_overhead(): response = requests.get(url="http://api.open-notify.org/iss-now.json") response.raise_for_status() data = respons...
christinichka/iss_overhead
main.py
main.py
py
1,805
python
en
code
0
github-code
1
71968485153
#!/usr/bin/env python3 """ Li battery discharge rate logger -------------------------------- This project discharges a Li battery through a resistive load and logs the voltage and current at a set interval to a CSV file. You can set the battery voltage which the test ends at. Start with the battery full...
Footleg/power-monitoring
li-cell_logger.py
li-cell_logger.py
py
4,339
python
en
code
0
github-code
1
41874767490
import tensorflow as tf print(f"tensorflow: {tf.__version__}") print("configurando gpu") gpus = tf.config.experimental.list_physical_devices('GPU') #for gpu in gpus: # tf.config.experimental.set_memory_growth(gpu, True) #tf.config.experimental.set_virtual_device_configuration(gpus[0], [tf.config.experimental.Virtua...
rob-nn/dlp
ch02/mnist.py
mnist.py
py
1,300
python
en
code
0
github-code
1