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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
19842137677 | import sys
input = sys.stdin.readline
N, M = list(map(int, input().split()))
arr = []
for _ in range(N):
arr.append(str(input()))
checkArr = []
for _ in range(M):
checkArr.append(str(input()))
cnt = 0
for i in checkArr:
if i in arr:
cnt += 1
print(cnt)
| eundeok9/algorithm-study | 백준/Silver/14425. 문자열 집합/문자열 집합.py | 문자열 집합.py | py | 299 | python | en | code | 0 | github-code | 36 |
3045680840 | # Import Pin definition for esp8266
from machine import Pin
# Import time and machine libraries
import time
import machine
# ESP Pin for the relay
Rpin_main = Pin(1, Pin.OUT, value=0) # Relay Pin
Rpin_entry = Pin(2, Pin.OUT, value=0) # Relay Pin
Rpin_patio = Pin(3, Pin.OUT, value=0) # Relay Pin
# Define di timeout... | bspb74/spb_auto | relays/RelayCtrl.py | RelayCtrl.py | py | 1,559 | python | en | code | 0 | github-code | 36 |
23951701787 |
import os
from sendgrid import SendGridAPIClient
from sendgrid.helpers.mail import Mail
from twilio.rest import Client
from sendsms import api
from django.conf import settings
from .models import Host, Clients
from .forms import HostLogin, HostSignUp, ClientRegistration, Checkout
from django.utils import timezone
fr... | nightwarriorftw/Zeus | zeus/god/views.py | views.py | py | 8,226 | python | en | code | 0 | github-code | 36 |
15643367692 | from aurora import aurora
import os
import json
from flask import Flask, flash, request, redirect, url_for, render_template, Response
from werkzeug.utils import secure_filename
from db import db
UPLOAD_FOLDER = './sessions'
ALLOWED_EXTENSIONS = set(['zip','csv', 'txt', 'json'])
app = Flask(__name__)
app.config['UPLOAD... | johnnydev543/aurora-dreamband | run.py | run.py | py | 1,659 | python | en | code | 0 | github-code | 36 |
14841863301 | class CRM_loggin:
def loggin(self,username,pwd):
##CRM系系统打开url及登录
from selenium import webdriver
import time
driver = webdriver.Chrome()
driver.maximize_window()
self.driver = driver
self.driver.get('http://localhost:8080/crm/')
self.driver.find_elemen... | crushrmsl/crush | crmTestSuite2/public/crmlogin.py | crmlogin.py | py | 713 | python | en | code | 0 | github-code | 36 |
506845300 | """
Compile some information from a table
"""
import xlrd
import xlwt
import os
def frequencies_by_place(xls, entities_sheet, entities_id, entities_place,
data_sheet, output, null=None, out_cols_basename=None,
entities_filter=None, cols_exclusion=Non... | jasp382/glass | glass/tbl/xls/anls.py | anls.py | py | 18,189 | python | en | code | 2 | github-code | 36 |
71778088424 | import psycopg2
import pandas as pd
from sqlalchemy import create_engine
from Services.ConfigParser import ConfigParser
class Postgres:
def __init__(self):
config = ConfigParser()
db_config = config.DbConfigSettings()
self.connection_string = "postgresql://" + db_config["username"] + ":" +... | rohitdureja80/youtube-analytics | Database/Postgres.py | Postgres.py | py | 1,120 | python | en | code | 0 | github-code | 36 |
16810687814 | '''Using recurssion'''
def dec_to_bin(n):
if n>1:
dec_to_bin(n//2)
print(n%2,end=' ')
if __name__=='__main__':
dec_to_bin(16)
# n = int(input("Enter a decimal number: "))
# n1 = []
# while n!=0:
# rem = n % 2
# n1.append(rem)
# n//=2
# n2 = n1.reverse()
# for i in n1:
... | Onkar202/Python_Programs | 41_decimal_to_binary.py | 41_decimal_to_binary.py | py | 346 | python | en | code | 0 | github-code | 36 |
9366664262 | #coding=utf-8
import json
import queue
import random
import re
import time
import traceback
import urllib
import urllib.request
import uuid
import requests
import wipe_off_html_tag
from bs4 import BeautifulSoup
import data_storager
class ParentChild(object):
def __init__(self):
self.... | ChandlerBang/Movie-QA-System | jw/spider.py | spider.py | py | 17,068 | python | en | code | 58 | github-code | 36 |
74236535463 | from flask import Flask, request, jsonify
from flask_sqlalchemy import SQLAlchemy
app = Flask(__name__)
# Replace 'your-connection-string' with your actual connection string
app.config['SQLALCHEMY_DATABASE_URI'] = 'mysql+pymysql://john1:Lucban2101@35.239.116.222/john1'
db = SQLAlchemy(app)
class Item(db.Model):
... | JohnLRanola/lab5 | main.py | main.py | py | 1,775 | python | en | code | 0 | github-code | 36 |
73380047464 | import numpy as np
from random import random, choice
class Agent:
def __init__(self, alpha, gamma, eps, env):
self.alpha = alpha
self.gamma = gamma
self.eps = eps
self.env = env
self.qtable = np.zeros((env.observation_space.n, env.action_space.n))
def update_qtable(sel... | kucjan/wsi22Z-kuc | lab6/src/agent.py | agent.py | py | 1,193 | python | en | code | 0 | github-code | 36 |
2940036472 | from __future__ import annotations
from datetime import datetime
from typing import Any
from gym_utilities import in_week, create_offering_dict
# The additional pay per hour that instructors receive for each certificate they
# hold.
BONUS_RATE = 1.50
class WorkoutClass:
"""A workout class that can be offered at... | Heian0/148 | 148/assignments/a0/a0/gym.py | gym.py | py | 28,439 | python | en | code | 0 | github-code | 36 |
40122929996 | """Module for the cli argument parser."""
import sys
from typing import List
from configargparse import ArgumentParser, HelpFormatter
from .globals import (
CONFIG_PATHS,
ALLOWED_SHOW_VALUES,
EXT_LOG_DEFAULT,
EXT_OUT_DEFAULT,
EXT_ERR_DEFAULT,
TOLERATED_USAGE,
BAD_USAGE,
ARGUMENT_ERROR
)
... | psyinfra/HTCAnalyze | htcanalyze/cli_argument_parser.py | cli_argument_parser.py | py | 5,847 | python | en | code | 0 | github-code | 36 |
6798072131 | import logging
import json
from django.core.management.base import BaseCommand
from ...models import Category, Tag
logger = logging.getLogger('library')
INDUSTRIES_CATEGORY = 'Industries'
EXO_ATTRIBUTES_CATEGORY = 'ExO Attributes'
TECH_CATEGORY = 'Technologies'
INDUSTRIES_LIST = [
'Accommodations', 'Accounting... | tomasgarzon/exo-services | service-exo-medialibrary/resource/management/commands/import_tags_and_categories.py | import_tags_and_categories.py | py | 3,548 | python | en | code | 0 | github-code | 36 |
33083676036 | def fibonacci(sequencia=None):
# Se sequencia=None -> sequencia = [0, 1]
sequencia = sequencia or [0, 1]
sequencia.append(sequencia[-1] + sequencia[-2])
return sequencia
if __name__ == "__main__":
inicio = fibonacci()
print(inicio, id(inicio))
print(fibonacci(inicio))
restart = fibona... | sarandrade/Python-Courses | Python 3 - Curso Completo do Básico ao Avançado/Seção 11 - Funções/128. Correção Param. Padrão Mutável.py | 128. Correção Param. Padrão Mutável.py | py | 489 | python | pt | code | 0 | github-code | 36 |
25756344684 | # while True:
# import random
# # # def freaken_game():
# num1 = random.randrange(100)
# num2 = random.randrange(100)
# sum2 = random.randrange(100)
# sum1 = num1 + num2
# print(num1,"+",num2,"=",sum2)
# userinput = input("Answer the question : ")
# point=0
# if userinput == sum1:
# num1 = random.randrange(100)
# ... | Supporter09/C4T-B05 | python/section7/Mini-hack-Part5/rannum.py | rannum.py | py | 2,357 | python | en | code | 1 | github-code | 36 |
5667997586 | from setuptools import setup
PACKAGES = [
'ladder_network',
'ladder_network.ops',
]
def setup_package():
setup(
name="LadderNetwork",
version='0.1.0',
description="TensorFlow implementation of Rasmus et. al's Ladder Network",
author='Joshua D. Loyal',
url='https://... | joshloyal/LadderNetwork | setup.py | setup.py | py | 512 | python | en | code | 0 | github-code | 36 |
9901411991 | import requests
import json
import urllib
from requests.exceptions import HTTPError
def getContact(email, apikey):
contact = {}
try:
#print("- Downloading Contact from Hubspot API...")
url= 'https://api.hubapi.com/contacts/v1/contact/email/' + email + '/profile?hapikey=' + apikey
respon... | zlibert/plib-emailcampaign | main.py | main.py | py | 5,094 | python | en | code | 0 | github-code | 36 |
25444280568 | import torch
import torch.nn as nn
import torch.optim as optim
import os
from omegaconf import OmegaConf, DictConfig
def save_model(model, path=None):
if path:
new_path = os.path.join(model.save_path,path)
model_file_path = os.path.join(
new_path,
model.name)
... | mjadiaz/distributed-ddpg | src/networks.py | networks.py | py | 5,615 | python | en | code | 0 | github-code | 36 |
41946408273 | #!/usr/bin/env python
# coding: utf-8
import cv2
import numpy as np
import glob
import os
rows = 6
cols = 9
objp = np.zeros((rows * cols, 3), np.float32)
objp[:, :2] = np.mgrid[0:rows, 0:cols].T.reshape(-1, 2)
# define the path
path = os.getcwd() + '/images/task_1/'
output_path = os.getcwd() + '/output/task_1/'
# 3... | YB-Joe/Perception_in_Robotics | project_2a/code/task_1/task_1.py | task_1.py | py | 3,567 | python | en | code | 0 | github-code | 36 |
74912810023 | import struct
import socket
from prettytable import PrettyTable
class IPv4(object):
def __init__(self):
self.version = None # 4bit version
self.headerlen = None #4bit header length
self.tos = None # 8bit type of service
self.totalLen = None # 16bit total length
... | fishmingyu/tcpStatis | IPv4Decode.py | IPv4Decode.py | py | 2,338 | python | en | code | 0 | github-code | 36 |
6981217998 | import os
import sys
import json
from applnlayer.ApplnMessageTypes import ResponseMessage
def serialization(rm):
json_buf={
"code":rm.code,
"contents":rm.contents
}
return json.dumps(json_buf)
def deserialization (buf):
json_buf = json.loads(buf)
rm=ResponseMessage(0,None)... | mandali8686/PA3manda | response_serialization.py | response_serialization.py | py | 413 | python | en | code | 0 | github-code | 36 |
5795982413 | from selenium import webdriver
import csv
def Skill():
driver = webdriver.Chrome()
driver.maximize_window()
driver.implicitly_wait(120)
url="https://www.jobs.af/"
driver.get(url)
href=[]
skill_description=[]
elm=driver.find_elements_by_xpath('//div[@class="item-header"]//h2//a')
for... | musAhmadi/mustafa.ahmadi | dynamic_scripting/skill_description.py | skill_description.py | py | 1,005 | python | en | code | 0 | github-code | 36 |
35748710144 | from flask import Flask, request
import sqlite3
import pickle
import numpy as np
app = Flask(__name__)
app.config["Debug"] = True
@app.route("/", methods = ["GET"])
def entrada():
return("¡Bienvenido a la página web de Antonio!")
@app.route("/predict", methods=['GET'])
def prediction():
tv = request.args.get... | Toni2Morales/EjerPyAnywhere | pagina.py | pagina.py | py | 1,757 | python | en | code | 0 | github-code | 36 |
34442117963 | from socket import *
import sys
import select
import os
host= "192.168.0.76"
port = 9999
s = socket(AF_INET, SOCK_DGRAM)
s.bind((host,port))
addr = (host,port)
buf = 1024
count=0
data,addr = s.recvfrom(buf)
#how much recv -> buf
print ("file recv start from",host)
file_name = data.decode()
print("File Name : ", fi... | cnu-cse-datacom/8-week-socketprogramming-YoonJu826 | DC02_08_201502091_leeyunju_receiver.py | DC02_08_201502091_leeyunju_receiver.py | py | 809 | python | en | code | 0 | github-code | 36 |
31522303288 | import os
import openai
from flask import Flask, redirect, render_template, request, url_for, jsonify
app = Flask(__name__)
openai.api_key = os.getenv("OPENAI_API_KEY")
@app.route("/", methods=("GET", "POST"))
def index():
if request.method == "GET":
query_parameters = request.args
if query_para... | fujiwen/chatgpt-api-flask | app.py | app.py | py | 746 | python | en | code | 0 | github-code | 36 |
21702089669 | """
返回与给定先序遍历 preorder 相匹配的二叉搜索树(binary search tree)的根结点。
"""
from leetcode.utils import *
from typing import *
class Solution:
def bstFromPreorder(self, preorder: List[int]) -> TreeNode:
if len(preorder) == 0:
return None
root = TreeNode(preorder[0])
for num in preorder[1:]:
... | linglaiyao1314/touch-fish-expert | leetcode/🌴/bstFromPreorder.py | bstFromPreorder.py | py | 842 | python | en | code | 1 | github-code | 36 |
37985348396 | # Description: This short script exchanges lines for a "standard_b.lib" file
# necessary for Curves+ input. It exchanges (using python list indexing), from
# 10 lines, 2 <--> 3, and then 2 <--> 9. But it needs to this for all sets of 10
# lines.
# Author: Angel-Emilio Villegas Sanchez
#Last Updated: 07/05/21
import sy... | nerffan1/AngelsCompBioNanoScripts | G4 Project/Process_xyz.py | Process_xyz.py | py | 780 | python | en | code | 0 | github-code | 36 |
30370835243 | import sys
sys.stdin = open('input.txt')
def pre_order(node):
if node != 0:
left1, right1 = tree[node][1], tree[node][2]
print(chr(node+64), end='')
pre_order(left1)
pre_order(right1)
def in_order(node):
if node != 0:
left1, right1 = tree[node][1], tree[node][2]
... | pugcute/TIL | algorithm/1991_트리순회/1991.py | 1991.py | py | 1,022 | python | en | code | 0 | github-code | 36 |
19848857135 | def End(result: list):
Ending(result[0], result[1])
return
# Method use for taking the initial config
def Ending(config: dir, wave: str):
if(config["visible"] or config["save"]):
if(config["orientation"] == "1"):
for i in range(len(wave)):
wave[i] = wave[i][::-1]
... | DemonDonny3/Python | Exercises and Training/Exercises/Wave/End.py | End.py | py | 1,288 | python | en | code | 0 | github-code | 36 |
14302631347 | '''Smoothing/Blurring is done when an img has a lot of noise such as camera sensors,lighting issues,etc'''
import cv2 as cv
import numpy as np
img = cv.imread('Resources/Photos/cats.jpg')
cv.imshow('Original', img)
# 1.) Averaging - Each pixel is replaced by the average value of all pixels in the kernel window i.e.... | ajinkeya17/OpenCV-Course | Codebase/smoothing.py | smoothing.py | py | 1,723 | python | en | code | 0 | github-code | 36 |
23528325219 | #!/usr/bin/python3
import os
import tempfile
import argparse
def query_db(row):
if not row:
row = 'FirstName'
sql = f".open /home/jared/chinook.db\nSELECT {row} FROM employees;"
os.system(f'echo "{sql}" | /usr/bin/sqlite3')
print("Done!")
if __name__ == '__main__':
parser = argpars... | zeyu2001/My-CTF-Challenges | STANDCON-2021/pwn/space-university-of-interior-design/service/src/query_db.py | query_db.py | py | 448 | python | en | code | 36 | github-code | 36 |
23100209026 | """Contains example scripts presenting various activation functions characteristics."""
import os
import matplotlib.pyplot as plt
import matplotlib.patches as mpatches
import numpy as np
import inspect
from typing import Dict, Type
import NaiveNeurals.MLP.activation_functions as functions_module
def plot_character... | p-sto/NaiveNeurals | scripts/activation_functions_example.py | activation_functions_example.py | py | 1,562 | python | en | code | 2 | github-code | 36 |
1789822 | def read_graph(vertex_number, edge_number):
graph = [[] for i in range(vertex_number)]
for i in range(edge_number):
v1, v2, w = map(int, input().split())
graph[v1].append((v2, w))
graph[v2].append((v1, w))
return graph
def prim(graph):
spanning_vertexes = {0}
tre... | andrewsonin/4sem_fin_test | -04_prim.py | -04_prim.py | py | 881 | python | en | code | 0 | github-code | 36 |
28239548341 | from toxi.geom import Vec3D
W = H = 500
FPS = 30.0
DURATION = 2
N_FRAMES = DURATION * FPS
N_SAMPLES = 4
BG_COLOR = color(72,45,87)
MAIN_COLOR = color(0)
RECORD = True
COLOR1 = color(234,236,198)
COLOR2 = color(53,31,57)
COLOR3 = color(199,211,182)
COLOR4 = color(165,187,163)
PALETTE = [COLOR1, COLOR2, COLOR3, COLOR... | letsgetcooking/Sketches | processing/2016/calm.py | calm.py | py | 6,499 | python | en | code | 0 | github-code | 36 |
73818483305 | import cv2
import numpy as np
from PIL import Image
import os
path = 'dataset'
recogniser = cv2.face.LBPHFaceRecognizer_create()
detector = cv2.CascadeClassifier("haarcascade_frontalface_default.xml")
def getImagesAndLabels(path):
imagePaths = [os.path.join(path, f) for f in os.listdir(path)]
#it should be ... | Ujj013/Face_detector_recogniser | training.py | training.py | py | 2,160 | python | en | code | 0 | github-code | 36 |
30845959188 | __author__ = 'xuxiaoye'
from django.conf.urls import url
from . import views
urlpatterns = [
# Json APIs
url(r'^jsonResult$', views.jsonResult, name='jsonResult'),
url(r'^api\/login$', views.apiLogin, name='apiLogin'),
url(r'^rs$', views.rs, name='rs'),
# End of Json APIs
# Wechat backend
u... | xiaoyexu/mysite | xiaoye/urls.py | urls.py | py | 926 | python | en | code | 0 | github-code | 36 |
31594578113 | import torch
import torchvision
import torch.nn as nn
def get_vgg16():
vgg16 = torchvision.models.vgg16(pretrained=False)
weight = vgg16.features[0].weight.clone()
vgg16.features[0] = nn.Conv2d(1, 64, kernel_size=(3, 3), stride=(1, 1), padding=1)
with torch.no_grad():
vgg16.features[0].weight[:... | hariharan98m/distinctive-filter-learning-covid19 | std_arch.py | std_arch.py | py | 2,094 | python | en | code | 1 | github-code | 36 |
44001366617 | """
return square submatrix that sums to the higest value
this solution is O(l^3) where l is the length of one side of the matrix
*technically O(longer_side * shorter_side ^ 2)
first we use DP to build a way to get sums of squares in constant time (O(l^2))
then we go through each element and try all valid squares s... | y4le/practice | python/max_submatrix.py | max_submatrix.py | py | 3,411 | python | en | code | 0 | github-code | 36 |
37405911478 | import numpy as mypy
import threading
import time
import random
import socket as mysoc
#import client
def reverseString(strz):
if strz == "\n" or strz == "":
client.globalBoolVar = False
return
#remove '\n'
if strz[len(strz)-1] == '\n':
str1 = strz[0:len(strz)-1]
chars = list(str1)
for i i... | SatitaVitt/CS352 | HW1/server.py | server.py | py | 1,818 | python | en | code | 0 | github-code | 36 |
17978424885 | # 导入操作系统库
import os
# 更改工作目录
os.chdir(r"D:\softwares\applied statistics\pythoncodelearning\chap1\sourcecode")
# 导入基础计算库
import numpy as np
# 导入绘图库
import matplotlib.pyplot as plt
# 导入Lasso模型
from sklearn.linear_model import MultiTaskLasso, Lasso
# 导入绘图库中的字体管理包
from matplotlib import font_manager
# 实现中文字符正常显示
font = fon... | AndyLiu-art/MLPythonCode | chap1/sourcecode/Python11.py | Python11.py | py | 2,671 | python | en | code | 0 | github-code | 36 |
709574459 | import numpy as np
import matplotlib.pyplot as plt
import os
import pandas as pd
import csv
### NOTE: Need to make filepaths for the laptop now ###
def lagrange(X):
'''
Function for creating Lagrange basis functions.
Inputs
------
X: array-like. The elements nodal x-locations.
Returns
---... | mattwilliams06/IntroToFEM | Chapter4/HeatTransfer/ProgramScripts/main.py | main.py | py | 10,569 | python | en | code | 0 | github-code | 36 |
25755779784 | # Definition for singly-linked list.
class ListNode:
def __init__(self, val=0, next=None):
self.val = val
self.next = next
def reverseList(head):
arr = []
while head:
a = head.val
res.insert(0, a)
head = head.next
print(arr)
res = ListNode()
for el in arr... | Supporter09/LeetcodeProblemSolving | 206.Reverse_Linked_List.py | 206.Reverse_Linked_List.py | py | 379 | python | en | code | 0 | github-code | 36 |
3314836701 | # -*- coding: utf-8 -*-
"""
===============================================================================
Script 'fig-pupil-voc'
===============================================================================
This script plots pupil size & significance tests for the vocoder experiment.
"""
# @author: Dan McCloy (drm... | LABSN-pubs/2017-JASA-pupil-attn-switch | figures/fig-pupil-voc.py | fig-pupil-voc.py | py | 14,529 | python | en | code | 0 | github-code | 36 |
13112139662 | from django.shortcuts import render, redirect, reverse
from django.contrib.auth.forms import AuthenticationForm
from django.contrib.auth import login as auth_login, logout as auth_logout
from django.contrib import messages
from django.utils.translation import ugettext as _
from .forms import RegistrationForm
def log... | roccolangeweg-old/infdev016b | account/views.py | views.py | py | 1,546 | python | en | code | 0 | github-code | 36 |
28509575757 | # Opus/UrbanSim urban simulation software.
# Copyright (C) 2010-2011 University of California, Berkeley, 2005-2009 University of Washington
# See opus_core/LICENSE
from opus_core.resources import merge_resources_if_not_None, merge_resources_with_defaults
from urbansim.models.household_location_choice_model impor... | psrc/urbansim | inprocess/lmwang/price/household_location_choice_model_with_price_adj.py | household_location_choice_model_with_price_adj.py | py | 9,729 | python | en | code | 4 | github-code | 36 |
22783528778 | #
# @lc app=leetcode id=9 lang=python3
#
# [9] Palindrome Number
#
# https://leetcode.com/problems/palindrome-number/description/
#
# algorithms
# Easy (49.55%)
# Likes: 3196
# Dislikes: 1722
# Total Accepted: 1.2M
# Total Submissions: 2.4M
# Testcase Example: '121'
#
# Given an integer x, return true if x is pa... | Zhenye-Na/leetcode | python/9.palindrome-number.py | 9.palindrome-number.py | py | 1,991 | python | en | code | 17 | github-code | 36 |
477387110 | """A setuptools based setup module.
See:
https://packaging.python.org/en/latest/distributing.html
https://github.com/pypa/sampleproject
"""
# Always prefer setuptools over distutils
from setuptools import setup, find_packages
# To use a consistent encoding
from codecs import open
from os import path
here = path.abspa... | cmancone/mygrations | setup.py | setup.py | py | 1,605 | python | en | code | 10 | github-code | 36 |
32366750618 | n=input("insertar la secuencia a ser identificada : ")
m=int(input("insertar la cantidad de secuencias candidatas"))
l=[]
l1=[]
#ACtg
def hamming(n,l1,m):
for i in range (0,m):
x=input("insertar el fragmento de la especie candidata numero " + str( i+1 ) + " : " )
for t in x:
l1... | masteronprime/python-codigos-diversos | tarea progra.py | tarea progra.py | py | 653 | python | es | code | 2 | github-code | 36 |
41702191179 | import os
import pytest
import textwrap
@pytest.fixture()
def sample_test(testdir):
testdir.makefile(
".feature",
scenario=textwrap.dedent(
"""\
Feature: Testing
Scenario: Test scenario
Given I have a scenario
When I ... | mattiamonti/pytest-bdd-report | tests/test_html_information/test_html_information.py | test_html_information.py | py | 2,631 | python | en | code | 1 | github-code | 36 |
71514466985 | import numpy as np
import matplotlib.pyplot as plt
x = np.loadtxt('test_accuracies')
plt.figure(figsize=(5.2, 3.1))
plt.errorbar(x[:, 0], x[:, 1:].mean(axis=1), yerr=np.std(x[:, 1:], axis=1, ddof=1), capsize=3, label='SVM accuracy on SNN output')
plt.axhline(y=95, color='orange', linestyle='--', label='SVM accuracy ... | colinshane/stdp-conv-speech | figures/accuracy.py | accuracy.py | py | 475 | python | en | code | 0 | github-code | 36 |
10341840472 | import matplotlib
import numpy as np
import skfuzzy as fuzz
from skfuzzy import control as ctrl
# ------------------------- définition de fonction d'appartenance ----------------------
temperarute = ctrl.Antecedent(np.arange(14, 27, 0.1), "temperarute")
temperarute['faible'] = fuzz.trapmf(temperarute.universe, [14, 1... | HajoubWalid2000/Logique-floue-fuzzy-logic- | logique floue.py | logique floue.py | py | 1,909 | python | fr | code | 2 | github-code | 36 |
15041797614 | import pandas as pd
# df = pd.read_excel("C:/Users/callM/Downloads/Parsed_FE Interviews_Cleaned.xlsx")
df = pd.read_excel(r"C:\Users\callM\Downloads\Parsed_FE Interviews_Cleaned.xlsx")
# Initialize an empty list to store project data
project_data = []
# Iterate through the rows of the DataFrame and convert data
for ... | ROOPCHAND315/SHL_Assesment_project | data.py | data.py | py | 820 | python | en | code | 0 | github-code | 36 |
3784981613 | from datetime import date
from app import app
from models import db, Plant
class TestPlant:
'''Plant model in models.py'''
def test_can_instantiate(self):
'''can be instantiated with a name.'''
p = Plant(name="Douglas Fir")
assert(p)
def test_can_be_created(self):
'''... | learn-co-curriculum/python-p4-flask-restful-cr-lab | server/testing/models_test.py | models_test.py | py | 1,286 | python | en | code | 1 | github-code | 36 |
32001354631 | class Solution:
def rangeSumBST(self, root: TreeNode, low: int, high: int) -> int:
stack = [root]
ans = 0
while(stack):
node = stack.pop()
if node:
if low <= node.val <= high:
ans += node.val
if low < node.val:
... | plan-bug/LeetCode-Challenge | microcephalus7/categories/Tree/938.py | 938.py | py | 459 | python | en | code | 2 | github-code | 36 |
19622908061 | # https://programmers.co.kr/learn/courses/30/lessons/68644
def solution(numbers):
answer = []
# 인덱스 하나씩 구해옴
for i in range(len(numbers)):
for ii in range(len(numbers)):
result = numbers[i]+numbers[ii]
# 같은 인덱스의 값끼리는 더하지 않고, 같은 값이 포함되지 않을 때 answer에 추가
if i != ii... | monegit/algorithm-study | Training-Site/Programmers/Level1/두 개 뽑아서 더하기/source.py | source.py | py | 652 | python | en | code | 0 | github-code | 36 |
74050394344 | from parlai.core.teachers import DialogTeacher
from .build import build
import json
import os
import glob
def _path(opt):
build(opt)
print('opt is', opt['datatype'])
dt = opt['datatype'].split(':')[0]
if dt == 'valid':
dt = 'dev'
elif dt != 'train' and dt != 'test':
raise Runtime... | facebookresearch/ParlAI | parlai/tasks/nlvr/agents.py | agents.py | py | 1,680 | python | en | code | 10,365 | github-code | 36 |
17245832907 | import datetime
import inspect
import json
import boto3
from util import create_ec2_client, create_ec2_resource, print_response
def create_elastic_ip(ec2_client):
# https://boto3.readthedocs.io/en/latest/reference/services/ec2.html#EC2.Client.allocate_address
# DomainのvpcはVPC、standardはEC2-Classic向け
respon... | thinkAmi-sandbox/syakyo-aws-network-server-revised-edition-book | boto3_ansible/ch7.py | ch7.py | py | 3,976 | python | en | code | 0 | github-code | 36 |
15990910311 | from collections import deque
# For debugging
import time
#-----
# Define Node class
#-----
class Node:
def __init__(self, val, left=None, right=None):
self.val = val
self.left = left
self.right = right
def __repr__(self):
return str(self.val)
#-----
# DFT - recursive
#-----
... | tylerbittner/interviewkickstart | trees/basic_tree_ops.py | basic_tree_ops.py | py | 5,850 | python | en | code | 7 | github-code | 36 |
18026113140 | # coding: utf-8
## Author: Jiayi Chen
## Time-stamp: 11/26/2018
import argparse
import time
import math
import os
import torch
import torch.nn as nn
import torch.onnx
parser = argparse.ArgumentParser(description='PyTorch Wikitext-2 RNN/LSTM Language Model')
parser.add_argument('--data', type=str, default='trn-wiki.... | jia-yi-chen/Natural-Language-Processing-all | language_modeling/main-minibatch-rnnlm.py | main-minibatch-rnnlm.py | py | 12,033 | python | en | code | 1 | github-code | 36 |
42778530183 | from unittest.mock import Mock, patch
import pytest
from redshift_connector.error import InterfaceError, OperationalError, ProgrammingError
from toucan_connectors.pagination import (
KnownSizeDatasetPaginationInfo,
OffsetLimitInfo,
PaginationInfo,
)
from toucan_connectors.redshift.redshift_database_connec... | ToucanToco/toucan-connectors | tests/redshift/test_redshift.py | test_redshift.py | py | 20,723 | python | en | code | 16 | github-code | 36 |
3022490255 | #!/usr/bin/python3
import sys
import gzip
import re
def Usage (name):
print ("Usage: %s <Sources.gz>" % sys.argv[0])
exit (1)
# check usage
if (1 >= len(sys.argv)):
Usage (sys.argv[0])
# setup text filters
f_maintainer = re.compile ("^Maintainer:*")
f_uploaders = re.compile ("^Uploaders:*")
f_mailaddr = re.com... | cdluminate/MyNotes | lang/sh/debarchive/stat.py | stat.py | py | 1,230 | python | en | code | 0 | github-code | 36 |
41676958983 | import time
import asyncio
import logging
from config import CONFIG
from proxy import get_proxy
from errors import (
BadStatusLine, BadResponseError, ErrorOnStream,
NoProxyError, ProxyRecvError, ProxyTimeoutError)
from utils import parse_headers, parse_status_line
logger = logging.getLogger(__name__)
request_l... | ScraperX/proxy-load-balancer | server.py | server.py | py | 9,751 | python | en | code | 0 | github-code | 36 |
43195907824 | from tifffile import TiffFile
import collections
from xml.etree import cElementTree as etree
import traceback
#Class for error handling
class PythImageError(Exception):
def __init__(self, message, errors):
super(PythImageError, self).__init__(message)
self.traceback=str(tra... | KatonaLab/Build3D | src/app/modules/packages/a3dc/external/PythImage/utils.py | utils.py | py | 6,381 | python | en | code | 0 | github-code | 36 |
42492324946 | import sys
# from collections import deque
N, M = map(int, sys.stdin.readline().split())
arr = list(map(int, sys.stdin.readline().split()))
arr.sort()
a = 0
b = N-1
answer = 0
while a < b :
if arr[a] + arr[b] >= M : #조건 만족시 팀 결성
answer += 1
a += 1
b -= 1
else : #팀 결성하기에 능력치가 모자라면
... | Mugamta/Boostcamp_AITech5_CV11 | 6.08/이채원_백준_26091_현대모비스_소프트웨어_아카데미.py | 이채원_백준_26091_현대모비스_소프트웨어_아카데미.py | py | 390 | python | ko | code | 0 | github-code | 36 |
72517026344 | from setuptools import find_packages, setup
from typing import List
import io
import os
def parse_requirements(filename: str) -> List[str]:
required_packages = []
with open(os.path.join(os.path.dirname(__file__), filename)) as req_file:
for line in req_file:
required_packages.append(line.s... | FilipCvetko/ml_pet | setup.py | setup.py | py | 818 | python | en | code | 0 | github-code | 36 |
40803709725 | import argparse
import datetime
from analyzer.AntiPatterns import find_anti_patterns
from analyzer.config import PROVIDERS, ANTI_PATTERNS
from analyzer.CIDetector import detect_ci_tools
from analyzer.BuildCollector import collect_builds
from analyzer.Output import create_json, create_text_files, create_images
from ana... | FreekDS/CIAN | analyzer/__init__.py | __init__.py | py | 5,131 | python | en | code | 1 | github-code | 36 |
29775116008 | from orders import get_model
from flask import Blueprint, redirect, render_template, request, url_for
giftcards_crud = Blueprint('giftcards_crud', __name__)
builtin_list = list
# [START list]
@giftcards_crud.route("/")
def list():
token = request.args.get('page_token', None)
if token:
token = toke... | rajathithan/flask | orders/giftcards_crud.py | giftcards_crud.py | py | 1,559 | python | en | code | 0 | github-code | 36 |
30395658662 | from rest_framework import status
from rest_framework.decorators import api_view
from rest_framework.response import Response
from django.http import HttpResponse
from rest_framework.generics import ListAPIView
from django.db.models import Q
from posts.models import Post, PostCategory, PostOwner
from memberships.model... | siklerdaniiii/astral | posts/api/views.py | views.py | py | 5,074 | python | en | code | 0 | github-code | 36 |
4675931038 | from django.contrib import admin
from django.urls import path
from Bank import views
urlpatterns = [
path("", views.homepage, name='homepage_bank'),
path("feedback", views.feedback, name='feedback'),
path("SignUp", views.SignUp, name='SignUp'),
path("LogIn", views.LogIn, name='LogIn'),
pat... | paandrei/Django_Project | Bank/urls.py | urls.py | py | 655 | python | en | code | 0 | github-code | 36 |
12538131223 | from flask import (
Flask,
render_template,
request
)
from bs4 import BeautifulSoup
import requests
from urllib.request import Request, urlopen
from flask_cors import CORS
from textblob import TextBlob
# Create the application instance
app = Flask(__name__, template_folder="templates")
CORS(ap... | marynashapoval/text_analysis_bachelor_work | tryScript.py | tryScript.py | py | 831 | python | en | code | 0 | github-code | 36 |
75264403945 | import socket
import pygame
# noinspection PyUnresolvedReferences,PyProtectedMember
from pygame._sdl2 import Window
from typing import Any
from _thread import start_new_thread
import winsound
from time import sleep
from json import loads, dumps, load
from pymsgbox import alert
class LimboKeysClient:
def __init__(... | quasar098/limbos32 | main.py | main.py | py | 4,638 | python | en | code | 10 | github-code | 36 |
16618551872 | import pygame, random, sys
class Ball:
def __init__(self):
self.x = 380.0
self.y = 280.0
self.radius = 20
self.velocityX = 0.0
self.velocityY = 0.0
self.speed = 150.0
def draw(self, window):
pygame.draw.circle(window, (255, 255, 255), (int(self.x), int(se... | mbedded-mike/Pong | ball.py | ball.py | py | 1,522 | python | en | code | 0 | github-code | 36 |
10839092257 | import numpy as np
import math
pi = 4*math.atan(1)
def overlap(basis):
size = len(basis)
S = []
for i in range(size):
element = []
for j in range(size):
result = (pi/(basis[i][0]+basis[j][0]))**1.5
element.append(result)
S.append(element)
return S
def ... | gravitybang/AtomicWavefunction | HF.py | HF.py | py | 3,322 | python | en | code | 1 | github-code | 36 |
36896264239 | import sys
from distutils.core import setup
version = '1.9.3'
kwargs = {
'name' : 'dnspython',
'version' : version,
'description' : 'DNS toolkit',
'long_description' : \
"""dnspython is a DNS toolkit for Python. It supports almost all
record types. It can be used for queries, zone transfers, and d... | RMerl/asuswrt-merlin | release/src/router/samba-3.6.x/lib/dnspython/setup.py | setup.py | py | 1,697 | python | en | code | 6,715 | github-code | 36 |
19270176336 | #!C:\Users\Bhavya Mulpuri\AppData\Local\Programs\Python\Python36-32\python.exe
import requests
from bs4 import BeautifulSoup
import cgi, cgitb
import csv
from mpl_toolkits.mplot3d import Axes3D
import matplotlib.pyplot as plt
import numpy as np
print("Content-Type:text/html\r\n\r\n")
cgitb.enable();
form = ... | bhavyamulpuri/DADV | Scrapping.py | Scrapping.py | py | 1,956 | python | en | code | 0 | github-code | 36 |
12485870000 | money_guest_player = int(input())
command = None
total = 0
people = 0
while not(command == "The restaurant is full"):
command = input()
if command == "The restaurant is full":
break
group = int(command)
if group < 5:
total += 100 * group
else:
total += 70 * ... | SimeonTsvetanov/Coding-Lessons | SoftUni Lessons/Python Development/Python Basics April 2019/Past Exams and Problems/3 - 3 and 4 November 2018/04. Bachelor Party.py | 04. Bachelor Party.py | py | 559 | python | en | code | 9 | github-code | 36 |
6663058248 | import os
from datetime import datetime
from univention.lib.i18n import Translation
from univention.management.console.config import ucr
from univention.management.console.modules import Base, UMC_OptionTypeError, UMC_OptionMissing, UMC_CommandError
from univention.management.console.log import MODULE
from univention... | m-narayan/smart | ucs/virtualization/univention-virtual-machine-manager-daemon/umc/python/uvmm/snapshots.py | snapshots.py | py | 3,398 | python | en | code | 9 | github-code | 36 |
36569687322 | import datetime
from flask import Flask, render_template, request, json
application = Flask("News")
def getNews():
resultStr = ''
with open("news.json", "r", encoding="UTF-8") as file:
newsList = file.read()
newsList = json.loads(newsList)
for news in newsList:
resultStr +=... | Gubochka/NG_2022_Kirill_Bezdolny | Lesson_5/task3/task3.py | task3.py | py | 1,475 | python | en | code | 0 | github-code | 36 |
36815991792 | from decouple import config
from django.contrib import messages
from django.http import HttpResponse, HttpResponseRedirect, Http404
from django.shortcuts import redirect, render, get_object_or_404
from zeep import Client
from extensions.utils import send_message_api
from home.models import Setting
from order.models im... | amirmovafagh/ecommerce-project-django | payment/views.py | views.py | py | 5,014 | python | fa | code | 0 | github-code | 36 |
29757066016 | # Definition for singly-linked list.
# class ListNode:
# def __init__(self, x):
# self.val = x
# self.next = None
class Solution:
def removeNthFromEnd(self, head, n):
"""
:type head: ListNode
:type n: int
:rtype: ListNode
"""
output = head
... | hrithikguy/leetcode | 19_remove_nth_node_from_end_of_list.py | 19_remove_nth_node_from_end_of_list.py | py | 689 | python | en | code | 0 | github-code | 36 |
18507806058 | """This module store everything connected to a sigular mesh"""
import struct
from typing import BinaryIO
from .offsetstable import OffsetsTable
from .filehelper import FileHelper
class Mesh: # 1_83:
"""A singular mesh"""
# pylint: disable=too-many-instance-attributes,too-many-arguments,too-many-locals
... | stuntkit/stunt_gp_blender | io_scene_pmd/stunt_gp_model/mesh.py | mesh.py | py | 4,722 | python | en | code | 0 | github-code | 36 |
39268599358 | from heapq import *
class Solution:
# @param {string[]} words a list of string
# @param {int} k an integer
# @return {string[]} a list of string
def topKFrequentWords(self, words, k):
if k == 0:
return []
dict = {}
temp = []
sizeOfHeap = 0
f... | JessCL/LintCode | 471_top-k-frequent-words/top-k-frequent-words.py | top-k-frequent-words.py | py | 781 | python | en | code | 0 | github-code | 36 |
624223444 | from pymongo import MongoClient
from dotenv import dotenv_values
import urllib.parse
config = dotenv_values(".env")
mongodb_client = MongoClient(config["ATLAS_URI"])
mongo_database = mongodb_client[config["DB_NAME"]]
print(f">>>> Connected to the {config['DB_NAME']} database!")
items_collection = mongo_database[co... | ahmeds26/Evas-Task | server/database.py | database.py | py | 1,628 | python | en | code | 0 | github-code | 36 |
37747156972 | from lxml import etree
import numpy as np
import re
class BhpDocumentParser:
isCPTRegistrationRequest = False
nsMap = {}
metadata = {}
cptMatrix = None
dissipationMatrices = None
def __init__(self, xmlTree):
self.xmlTree = xmlTree
self.generateNsMap()
self.generateMatr... | ZBoukich/brofiles | scripts/bhpdocumentparser.py | bhpdocumentparser.py | py | 6,683 | python | en | code | 0 | github-code | 36 |
71534618024 | #!/usr/bin/python3
# -*- coding: utf-8 -*-
import matplotlib.pyplot as plt
from random import *
import math
def get_random_coordinates():
return random(), random()
def draw_circle():
center = (0, 0)
radius = 1
circle = plt.Circle(center, radius, fill=False, ec='b')
a = plt.axes(xlim=(-1.2, 1.... | Dry8r3aD/monteCarloSimulation | run.py | run.py | py | 912 | python | en | code | 0 | github-code | 36 |
1774970479 | from WoG.GuessGame import play as guess_play
from WoG.MemoryGame import play as memory_play
from WoG.Utils import ERROR_MESSAGE as error_message
def welcome(name):
return 'Hello ' + name + ' and welcome to the World of Games (WoG).\nHere you can find many cool games to play.'
def load_game():
print("P... | oshrishaul/wog | Live.py | Live.py | py | 974 | python | en | code | 0 | github-code | 36 |
30723510381 | def getDivisors(number):
if(number == 1) : return 1
divisors = set()
count = 0
for i in range(1, int(number ** 0.5)+1):
if(number % i == 0):
divisors.add(i)
tmp_divisors = divisors.copy()
for i in tmp_divisors:
divisors.add(number//i)
return l... | Hoony0321/Algorithm | 프로그래머스/unrated/136798. 기사단원의 무기/기사단원의 무기.py | 기사단원의 무기.py | py | 753 | python | en | code | 0 | github-code | 36 |
22773409160 | # -*- coding:utf-8 -*-
"""
Pour éviter de surcharger de commandes le drone.
"""
from vector import Vector
class Queue (object):
"""
Permet de moduler le flux de commandes à donner au drone, en moyennant les vecteurs déplacement successifs sur plusieurs frames.
"""
def __init__(self, drone, cmd_max):... | micronoyau/NSA-Drone | queue.py | queue.py | py | 1,609 | python | fr | code | 0 | github-code | 36 |
19593309895 | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('carga', '0001_initial'),
]
operations = [
migrations.AlterField(
model_name='carga',
name='id_carga'... | wellicfaria/cargobr | carga/migrations/0002_auto_20150922_1258.py | 0002_auto_20150922_1258.py | py | 389 | python | en | code | 0 | github-code | 36 |
5054290299 | import os
import papermill as pm
def train_ct(dataset_name, hampel_window_len, num_sigmas):
input = "constant-threshold.ipynb"
output = "out/constant-threshold-" + dataset_name + ".ipynb"
pm.execute_notebook(input, output, parameters = dict(
dataset_name = dataset_name,
hampel_window_len = ... | williewheeler/time-series-demos | papermill/train-all.py | train-all.py | py | 744 | python | en | code | 18 | github-code | 36 |
34846400693 | from django.shortcuts import render, redirect
from django.contrib.auth.decorators import login_required
from django.db.models import CharField, Value, Q
from itertools import chain
from authentication.models import User
from website.models import Review, UserFollows, Ticket
from website import forms
@login_required... | TMee3/DA-PYTHON-9 | website/views.py | views.py | py | 8,215 | python | en | code | 0 | github-code | 36 |
39587111591 | import os
import unittest
import dateutil.parser
from dropmunch import munch_data, munch_spec
iso8601_timestamp1 = '2007-10-01T13:47:12.345Z'
valid_datafile_name = 'DATAspecvalid_{0}.txt'.format(iso8601_timestamp1)
class DataFileProcessing(unittest.TestCase):
def setUp(self):
self.working_directory = os.... | zharben/dropmunch | dropmunch/test/test_munch_data.py | test_munch_data.py | py | 5,174 | python | en | code | 0 | github-code | 36 |
27068411013 | from fastapi import APIRouter, Body
from models.model import User, UserLogin
from auth.jwt_handler import signJWT
router = APIRouter(
tags = ["User Routes"]
)
users = []
@router.get("/")
def get():
return {"Hello": "Wob"}
@router.post("/user/signup")
def user_signup(user: User = Body(defaul... | Namikaze007/TodoFastapi | routes/users.py | users.py | py | 802 | python | en | code | 0 | github-code | 36 |
39205903455 | import pytest
import yaml
import os
import json
def load_configuration(filename):
prod_config_file = filename
with open(prod_config_file) as input_file:
config_parameters = yaml.load(input_file, Loader=yaml.FullLoader)
return config_parameters
def load_model_performance(filename):
with open(fi... | jacordero/ESA-audio-sentiment-analysis | tests/test_cases/Threshold_test_cases/test_TTC_1a-Accuracy.py | test_TTC_1a-Accuracy.py | py | 812 | python | en | code | 0 | github-code | 36 |
39274582010 | from fastapi import APIRouter, Depends, HTTPException
from pyairtable.api.table import Table
from pyairtable.formulas import match
from sentry_sdk import capture_message
from app.auth.auth_bearer import JWTBearer
from app.routers.attendees import update_attendee
from ..dependencies import get_mobile_table, get_registr... | LosAltosHacks/api | app/routers/verify.py | verify.py | py | 3,095 | python | en | code | 0 | github-code | 36 |
31213617621 | # set FLASK_APP=app
# set FLASK_ENV=development
# flask run
from flask import Flask, render_template, request
import semsim_funcs
import semtag_funcs
import semnull_funcs
import semcluster_funcs
import textCoder_funcs
app = Flask(__name__)
@app.route('/')
def home():
return render_template('index.... | thomasgladwin/webapps | app.py | app.py | py | 6,804 | python | en | code | 0 | github-code | 36 |
75111308265 | from django.db import models
from mptt.models import MPTTModel, TreeForeignKey
from accounts.models import User
class Category(MPTTModel):
name = models.CharField(max_length=100, verbose_name='Имя категории')
slug = models.SlugField(max_length=100, verbose_name='Ссылка')
parent = TreeForeignKey('self',
... | Maksat-developer/ProjectDjangoShool | cook/blog/models.py | models.py | py | 6,738 | python | en | code | 0 | github-code | 36 |
2177238548 | import pandas as pd
xls = pd.ExcelFile('/Users/scott/Downloads/AAPL5yr.xlsx')
df1 = pd.read_excel(xls)
#200/50 are used for Golden Cross/Death Cross
df1['50dayMA'] = df1['Close/Last'].rolling(50).mean()
df1['200dayMA'] = df1['Close/Last'].rolling(200).mean()
#Bollinger Bands use 20 day moving average of the 'typical... | messinawilliam/algorithms-final-project | algorithms-final-project/Algorithms Project/excelreader.py | excelreader.py | py | 1,067 | python | en | code | 0 | github-code | 36 |
41499034466 | from abc import ABC, abstractmethod
import logging
from sqlalchemy import create_engine
from sqlalchemy.orm import sessionmaker
from sqlalchemy.orm.session import Session
from sqlalchemy.pool import NullPool
from os import getenv
from dotenv import load_dotenv
from models import BaseTable
class Collector(ABC):
... | shivanrbn/BAG-Visualizer | src/bag_extractor/handler_base.py | handler_base.py | py | 1,286 | python | en | code | 0 | github-code | 36 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.