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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
19447382035 | # -*- coding: utf-8 -*-
from CGRtools.files import SDFwrite
from pickle import load
global_result = set()
pairs = set()
molecules = {}
NUMBER = set()
SIG = set()
train = set()
test = set()
validation = set()
def get_set(path, number):
for num in range(number):
tuples = load(open('{}/{}.pickle'.format(pa... | Pandylandy/Practice | NN_score/prepare.py | prepare.py | py | 1,197 | python | en | code | 0 | github-code | 13 |
16129955763 | """
Purpose: Adding Logging configuration
%(asctime)s : displays the date and time of the log, in local time
%(levelname)s: the logging level of the message
%(message)s : the message
"""
import logging
logging.basicConfig(
format="%(asctime)-15s %(client_ip)s %(name)9s %(user)-8s %(message)s"
)
d =... | udhayprakash/PythonMaterial | python3/12_Logging/a_builtin_logging/06_custom_logging_configuration.py | 06_custom_logging_configuration.py | py | 1,084 | python | en | code | 7 | github-code | 13 |
16755238195 | """Tests for diamond_norm."""
import numpy as np
from toqito.channel_metrics import diamond_norm
from toqito.channels import dephasing, depolarizing
def test_diamond_norm_same_channel():
"""The diamond norm of identical channels should yield 0."""
choi_1 = dephasing(2)
choi_2 = dephasing(2)
np.testin... | vprusso/toqito | toqito/channel_metrics/tests/test_diamond_norm.py | test_diamond_norm.py | py | 1,164 | python | en | code | 118 | github-code | 13 |
75082233936 | #we're gonna take a 10 x 10 grid of squares
#obstacles are black squares
#objects defined by shape, size, color
#each square gets an x, y coordinate
#return list of occupied grids using computer vision
#find minimimum path between starting object and matching object using a star search
#openCV was created by Intel, ... | llSourcell/path_planning_demo_live | process_image.py | process_image.py | py | 5,615 | python | en | code | 65 | github-code | 13 |
9483920526 | #!/usr/bin/env python
# -*- encoding:utf-8 -*-
import sys
from PyQt5 import QtWidgets, QtGui
def main():
app = QtWidgets.QApplication(sys.argv)
font_db = QtGui.QFontDatabase()
print('Font Families'.center(80, '='))
for family in font_db.families():
print(family)
print('=' * 80)
print... | liuyug/code_example | pyqt/fonts.py | fonts.py | py | 572 | python | en | code | 0 | github-code | 13 |
43114768582 | def solution(participant, completion):
answer = ''
hashDict = {}
sumHash = 0
for part in participant:
hashDict[hash(part)] = part # hash()는 각 값에 따른 고유한 hash값을 생성하는 함수
sumHash += hash(part)
# print(hash(part), sumHash)
# print()
for comp in completion:
sum... | jinhyungrhee/Problem-Solving | Programmers/고득점Kit/완주하지못한선수.py | 완주하지못한선수.py | py | 521 | python | en | code | 0 | github-code | 13 |
73702111056 | import unittest
import pandas as pd
from src.cleaning_data.data_transformation_classes import MakeDataframesFromMovies
from src.cleaning_data.cleaning_functions import clean_movies
class TestMakeDataframesFromMovies(unittest.TestCase):
def setUp(self):
clean_movies_df = clean_movies()
self.maker ... | JPatryk13/movie_dataset_analysis | src/tests/transforming_tests/test_movies.py | test_movies.py | py | 1,325 | python | en | code | 1 | github-code | 13 |
17555588516 | import json
from channels.generic.websocket import WebsocketConsumer
import asyncio
from django.contrib.auth import get_user_model
from channels.consumer import AsyncConsumer
#from channels.db import database_sync_to_async
from channels.generic.websocket import AsyncWebsocketConsumer
import pandas.io.sql as sqli... | eric-yim/aws-django-channels | stream/consumers.py | consumers.py | py | 4,019 | python | en | code | 0 | github-code | 13 |
35103337951 | # -*- coding: utf-8 -*-
from forms_builder.forms.forms import FormForForm
from .models import FieldEntry, FormEntry
class FormForForm(FormForForm):
field_entry_model = FieldEntry
class Meta:
model = FormEntry
exclude = ("form", "entry_time")
| sigmacms/fluentcms-forms-builder | fluentcms_forms_builder/forms.py | forms.py | py | 271 | python | en | code | null | github-code | 13 |
41849774563 | from http import HTTPStatus
from fastapi import HTTPException
def validate_salary(salary_from: int, salary_to: int) -> None:
if salary_to < salary_from:
raise HTTPException(
status_code=HTTPStatus.UNPROCESSABLE_ENTITY,
detail='Интервал зарплат указан некорректно',
)
| Flopp30/vacancy_searcher_bot | app/endpoints/validators.py | validators.py | py | 346 | python | en | code | 1 | github-code | 13 |
41882942450 | import math
def find_divisor(n):
shifts = 0
while not (n & 1):
n >>= 1
if n == 1:
return 2**shifts
shifts += 1
return 2**shifts
def reduce(n, nums):
if n == 1:
nums.append(str(n))
return
else:
nums.append(str(n))
reduce(n - find... | danherbriley/acm4 | 01/divisor_chain.py | divisor_chain.py | py | 611 | python | en | code | 0 | github-code | 13 |
4511778510 | #
# @lc app=leetcode.cn id=133 lang=python
#
# [133] 克隆图
#
# https://leetcode-cn.com/problems/clone-graph/description/
#
# algorithms
# Medium (66.68%)
# Likes: 343
# Dislikes: 0
# Total Accepted: 58.4K
# Total Submissions: 87.6K
# Testcase Example: '[[2,4],[1,3],[2,4],[1,3]]\n[[]]\n[]'
#
# 给你无向 连通 图中一个节点的引用,请你返... | lagoueduCol/Algorithm-Dryad | 13.DFS.BFS/133.克隆图.py | 133.克隆图.py | py | 2,947 | python | zh | code | 134 | github-code | 13 |
781044414 | import os
import cv2
import pandas as pd
import numpy as np
from sklearn.cluster import MeanShift # as ms
from sklearn.datasets.samples_generator import make_blobs
import matplotlib.pyplot as plt
from collections import Counter
keyword = input("Search: ");
PATH = "data/"
for category in os.listdir(PATH):
if category... | riti1302/AI-Based-Shopping-Assistant | main.py | main.py | py | 2,213 | python | en | code | 9 | github-code | 13 |
5091338931 | from books.models import Book
from infrastructure.book.BookRepository import BookRepository
from integration_tests.integration_test_case import IntegrationTestCase
from test_data_provider.ChefDataProvider import ChefDataProvider
from test_data_provider.RecipeDataProvider import RecipeDataProvider
class BookRepository... | khoaanh2212/nextChef | backend_project/backend/integration_tests/tests/infrastructure/book/test_book_repository.py | test_book_repository.py | py | 5,120 | python | en | code | 0 | github-code | 13 |
22478113469 | # Importação do panda
import pandas as pd
# Carrega seu arquivo csv
ovnis_preparado = pd.read_csv('df_OVNI_preparado.csv')
ovnis_preparado
#filtra a cidade dentro do csv
cidade_phoenix = ovnis_preparado[ovnis_preparado['City']=='Phoenix']
cidade_phoenix.sort_values(by='Sight_date')
import pandasql
# Roda o seu comando ... | samuellopes223/ProjetoIntegradoIAeCD | 3.4 Analise Temporal/3.4 Analise Temporal.py | 3.4 Analise Temporal.py | py | 1,033 | python | pt | code | 0 | github-code | 13 |
4818540730 | class RBNode:
def __init__(self, key):
#트리 내에서 유일한 키
self.key=key
#노드의 색 : RED or BLACK
#트리에 insert 연산을 할 때 먼저 새 노드의 색은 RED로 한다.
self.color="RED"
self.left=None
self.right=None
#부모
self.parent=None
def __str__(self):
retu... | gilbutITbook/080200 | ch09/red_black_tree.py | red_black_tree.py | py | 4,896 | python | ko | code | 3 | github-code | 13 |
2741863236 | import socket
import os
TARGET_IP = "127.0.0.1"
TARGET_PORT = 5005
sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
namafile="bart.png"
ukuran = os.stat(namafile).st_size
fp = open('bart.png','rb')
k = fp.read()
terkirim=0
for x in k:
k_bytes = bytes([x])
sock.sendto(k_bytes, (TARGET_IP, TARGET_PORT))
... | rm77/progjar | progjar2/udpfileclient.py | udpfileclient.py | py | 401 | python | en | code | 5 | github-code | 13 |
70302990417 | from django.db.models import Avg, Count
from django.db.models.functions import Round
from rest_framework import status
from rest_framework.renderers import TemplateHTMLRenderer
from rest_framework.response import Response
from rest_framework.views import APIView
from .constants import MAX_REACTION_RATE
from .models im... | mario-nunez/mood_tracker | apps/mood_tracker/views.py | views.py | py | 3,341 | python | en | code | 0 | github-code | 13 |
74371289936 | from FeatureExplorer import *
import matplotlib.pyplot as plt
import scipy.io as sio
import numpy as np
import string
import time
import os
trainingdir = "E:/training results 5/"
testingdir = "E:/DATA/"
outputfile = "E:/testing results/training5.txt"
f = open(outputfile, 'w')
for dn in os.listdir(trainingdir):
... | alexmcmaster/detection | Classifier.py | Classifier.py | py | 3,344 | python | en | code | 0 | github-code | 13 |
36945611349 | """
Also first task
The previous task was intentionally simplified. Usually I have more data about participants:
solutions = [
{
'date': '2021-01-01 10:00:00',
'name': 'Brad Pitt',
'email': 'Participant1@mail.com',
'phone': '+7 912-345-67-89',
'code': '...'
},
{
... | iaramer/algorithms | python/mipt/mipt_python course/homework/hw2/also_first_task.py | also_first_task.py | py | 2,298 | python | en | code | 0 | github-code | 13 |
7835200880 | import re
import subprocess
from pathlib import Path
from typing import List
import i18n
import journalist_app as journalist_app_module
import pytest
import source_app
from babel.core import Locale, UnknownLocaleError
from db import db
from flask import render_template, render_template_string, request, session
from fl... | freedomofpress/securedrop | securedrop/tests/test_i18n.py | test_i18n.py | py | 17,510 | python | en | code | 3,509 | github-code | 13 |
1886852216 | from __future__ import annotations
import logging
from tuxemon.tools import NamedTupleProtocol, cast_parameters_to_namedtuple
from typing import TypeVar, Generic, ClassVar, Type, Sequence, Any, TypedDict,\
TYPE_CHECKING
from tuxemon.session import Session
if TYPE_CHECKING:
from tuxemon.npc import NPC
from... | 26eldrpau/Tuxemon | tuxemon/item/itemeffect.py | itemeffect.py | py | 3,231 | python | en | code | null | github-code | 13 |
14646716575 | from sqlalchemy import Column, ForeignKey, Identity, Integer, Table
from . import metadata
SetupAttemptPaymentMethodDetailsCardJson = Table(
"setup_attempt_payment_method_details_cardjson",
metadata,
Column(
"three_d_secure",
ThreeDSecureDetails,
ForeignKey("ThreeDSecureDetails"),
... | offscale/stripe-sql | stripe_openapi/setup_attempt_payment_method_details_card.py | setup_attempt_payment_method_details_card.py | py | 566 | python | en | code | 1 | github-code | 13 |
35579941585 | from selenium import webdriver
import pytest
_driver = None
def pytest_addoption(parser):
'''添加命令行参数--browser、--host'''
parser.addoption(
"--browser", action="store", default="chrome", help="browser option: firefox or chrome"
)
'''添加host参数,设置默认测试环境地址'''
parser.addoption(
... | zxiaoxing/web_auto | conftest.py | conftest.py | py | 1,288 | python | en | code | 0 | github-code | 13 |
70994369299 | import os
from flask import Flask, flash, request, redirect, render_template
from werkzeug.utils import secure_filename
import netifaces
from flask_qrcode import QRcode
import click
app=Flask(__name__)
port_number = 5000
app.secret_key = "secret key"
app.config['MAX_CONTENT_LENGTH'] = 1 * 1024 * 1024 * 1024
QRcode(ap... | GLinBoy/general-uploader | app.py | app.py | py | 2,173 | python | en | code | 0 | github-code | 13 |
19337603034 | """
Use this script to upload a pypi package, require below package:
pip install setuptools -U
pip install wheel -U
pip install twine -U
This is the script to release manually, now the package can be released via Github Actions:
- https://github.com/tobyqin/xmind2testlink/actions
"""
import os
egg = 'd... | tobyqin/xmind2testlink | publish.py | publish.py | py | 501 | python | en | code | 105 | github-code | 13 |
74009544656 | from datetime import datetime
from flask import request
from app import db
from models import ShortUrl, short_id
class ShortUrlService:
@staticmethod
def short(short_url):
short = db.session.query(ShortUrl).\
filter_by(short_url=short_url).first()
return short
@staticmeth... | AlimkhodjaevaSevinch/url-shortener | services.py | services.py | py | 1,024 | python | en | code | 0 | github-code | 13 |
1430456147 | __author__ = 'halley'
import random
from music21 import stream, note
scale = [0,2,4,5,7,9,11] #standard C-major scale
octave = 6
total_measures = 16
#possible rhythms that span half a measure
half_measure_rhythms = ([[1.5,0.5], [1.5,0.25,0.25], [1.0,1.0], [1.0,0.5,0.5], [0.5,0.5,1.0]])
durs = []
degrees = []
prev_d... | HalleyYoung/MusicTalk | random_melody2.py | random_melody2.py | py | 955 | python | en | code | 1 | github-code | 13 |
17176906452 | import os
import openai
import pandas as pd
import numpy as np
from sentence_transformers import SentenceTransformer, CrossEncoder, util
import os
import torch
import json
import pickle
with open('api_key.json', 'r') as f:
key = json.load(f)['key']
openai.api_key = key
ceos_table = pd.read_csv('CEOS.csv')
#We us... | ESA-PhiLab/TestCase_1 | EO_portal_demo/launch_query.py | launch_query.py | py | 3,949 | python | en | code | 0 | github-code | 13 |
11593109172 | #
# 따라하며 배우는 파이썬과 데이터과학(생능출판사 2020)
# LAB 6-2 n-각형을 그리는 함수 만들어보기, 154쪽
#
import turtle
t = turtle.Turtle()
# n-각형을 그리는 함수를 정의한다.
def n_polygon(n, length):
for i in range(n):
t.forward(length)
t.left(360 // n) # 정수 나눗셈은 //으로 한다.
for i in range(20):
t.left(30)
n_polygon(4, 100)
turtle.done... | dongupak/DataSciPy | src/파이썬코드(py)/Ch06/lab_6_2.py | lab_6_2.py | py | 438 | python | ko | code | 12 | github-code | 13 |
70185317777 | import torch
import torch.nn as nn
from torch.distributions import Categorical
class Network:
def __init__(self, network_type, lr, target=False):
self.net = network_type()
self.optim = torch.optim.Adam(self.net.parameters(), lr=lr)
if target:
self.target_net = network_type()
... | BCHoagland/VINS | vins/models.py | models.py | py | 2,711 | python | en | code | 2 | github-code | 13 |
41243209154 | import sys
from collections import defaultdict
from copy import deepcopy
import json
import resource
import timeit
import traceback
from statistics import median_high, median_low, mean
import difflib as df
import re
import subprocess
# import multiprocessing.pool
# from multiprocessing import TimeoutError
from os.path ... | gsakkas/seq2parse | src/run_parse_test_time_top_n_preds_partials.py | run_parse_test_time_top_n_preds_partials.py | py | 33,281 | python | en | code | 8 | github-code | 13 |
1721828877 | import RPi.GPIO as GPIO
from lib_utils import *
import numpy as np
class GBlob():
"""Blob detection. Returns coordinates of all blobs
This class takes a camera image and returns the pixel coordinates of all blobs.
It contains functions to convert the image to grayscale, threshold the image to
separ... | fberlinger/blueswarm | fishfood/old_but_dont_delete/lib_globalblob.py | lib_globalblob.py | py | 4,809 | python | en | code | 2 | github-code | 13 |
24083013204 | import cv2
import pandas as pd
# Função para processar uma imagem e extrair informações
def processar_imagem(imagem):
# Carrega a imagem utilizando o pacote OpenCV
img = cv2.imread(imagem)
# Converte a imagem para escala de cinza
img_gray = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY)
# Calcula ... | rodrigosiqq/processPandas | processamento_imagens.py | processamento_imagens.py | py | 1,158 | python | pt | code | 0 | github-code | 13 |
1199702475 | # 给定一个整数数组 A,返回 A 中最长等差子序列的长度。
#
# 回想一下,A 的子序列是列表 A[i_1], A[i_2], ..., A[i_k] 其中 0 <= i_1 < i_2 < ... < i_k <= A.length - 1。
# 并且如果 B[i+1] - B[i]( 0 <= i < B.length - 1) 的值都相同,那么序列 B 是等差的。
# 示例 1:
# 输入:[3,6,9,12]
# 输出:4
# 解释:
# 整个数组是公差为 3 的等差数列。
#
# 示例 2:
# 输入:[9,4,7,2,10]
# 输出:3
# 解释:
# 最长的等差子序列是 [4,7,10]。
#
# 示例 3:
... | Lemonstars/algorithm | leetcode/1027.最长等差数列/solution.py | solution.py | py | 1,371 | python | zh | code | 0 | github-code | 13 |
7438304831 | class Property:
def init(self, name, price, rent, color, position, houses=0, owner=None):
self.name = name
self.price = price
self.rent = rent
self.color = color
self.position = position
self.houses = houses
self.owner = owner
# def set_name(self, name):
... | rbridges12/Monopopy | Property.py | Property.py | py | 1,264 | python | en | code | 0 | github-code | 13 |
33934705300 | import requests
import re
import pymysql
import time
from lxml import etree
import numpy.random
conn = pymysql.connect(host='localhost', user='root', passwd='123456', db='crawler', charset='utf8')
cur = conn.cursor()
headers = {
'User-Agent': 'Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 '
... | protheanzZ/web_crawler | douban_movie.py | douban_movie.py | py | 2,172 | python | en | code | 0 | github-code | 13 |
11742877804 | #By a mcmc I will try to sample a sin(x)^2 on the interval [0,2pi]
import math
import rosenbrock
import random
import histogram
import histo
# assume the testfunction is two-dimensional
def daserste(num,xstartpoint,ystartpoint):
#print '------------'
#print testfun.testfun(3)
#print '------------'
#num=50000
#x=(r... | Solaro/Brave-New-World | numeric/project/daserste.py | daserste.py | py | 2,236 | python | en | code | 0 | github-code | 13 |
20296184634 | # Licensed under a 3-clause BSD style license - see LICENSE.rst
# -*- coding: utf-8 -*-
"""
desitarget.brightmask
=====================
Module for studying and masking bright sources in the sweeps
.. _`Tech Note 2346`: https://desi.lbl.gov/DocDB/cgi-bin/private/ShowDocument?docid=2346
.. _`Tech Note 2348`: https://de... | desihub/desitarget | py/desitarget/brightmask.py | brightmask.py | py | 42,013 | python | en | code | 17 | github-code | 13 |
39579931041 | # Path: app.py
import streamlit as st
from fastai.vision.all import *
st.title("Fruit Classification")
st.write("This is a simple image classification web app to classify fruits")
# Load your trained model
model = load_learner('fruit-classifier.pkl')
# Upload an image
uploaded_file = st.file_uploader("Choose an imag... | egoist000/fruit-classifier | app.py | app.py | py | 724 | python | en | code | 0 | github-code | 13 |
24554191016 | import os
import db_orm_youbike.YoubikeDAO as dao
import db_orm_youbike.YoubikeUtil as util
import threading
import time
def menu():
clear_screen()
print("台北市 Youbike 出借查詢系統")
print("------------------------")
print("1. 資料同步")
print("2. 列出所有站點資料")
print("3. 取出某站號或站名的資料")
print("4. 我要借 N 台")... | vincenttuan/PythonCourse | db_orm_youbike/YoubikeMain.py | YoubikeMain.py | py | 1,811 | python | en | code | 4 | github-code | 13 |
21220393315 | from turtle import Turtle, Screen
import random
WIDTH = 900
HEIGHT = 500
screen = Screen()
screen.setup(WIDTH*2, HEIGHT*2)
screen.screensize(WIDTH*2, HEIGHT*2, 'lightblue')
screen.tracer(0)
class PlayerPad(Turtle):
def __init__(self):
super().__init__()
#self.resizemode("user")
self.penu... | ismaelconejeros/break_out_game | main.py | main.py | py | 3,906 | python | en | code | 0 | github-code | 13 |
2032518490 | import sys
rl = sys.stdin.readline
N = int(rl())
Card = rl().split()
M = int(rl())
Find = rl().split()
Table = [0] * 20000001
for i in Card:
Table[int(i)+10000000] += 1
for x in Find:
print(Table[int(x)+10000000], end=' ') | YeonHoLee-dev/Python | BAEKJOON/[10816] 숫자 카드 2.py | [10816] 숫자 카드 2.py | py | 235 | python | en | code | 0 | github-code | 13 |
39844753468 | #!/usr/bin/env python3
# OneTime Papa Edition Main Window
# With an overview of everything:
# key manager
# en/de-crypter
# KeyGen(r) :p
from tkinter import *
from tkinter import filedialog
import random, pickle, os, sys
def keygen():
save_file = filedialog.asksaveasfilename()
key = [ random.randint(0,255) for x in... | agwilt/python | onetime/OneTime_Main.py | OneTime_Main.py | py | 1,974 | python | en | code | 0 | github-code | 13 |
41071665356 | from django.test import TestCase
from beerbookapp.models import Rating, Location, City, Beer, BeerType, BeerProducer, Event
from datetime import datetime
from django_countries.fields import CountryField
from django.contrib.auth.models import User
from django.db import IntegrityError
from django.core.urlresolvers import... | enzoroiz/beerbook | beerbookapp/tests.py | tests.py | py | 11,242 | python | en | code | 1 | github-code | 13 |
16543787969 | from layers.dynamic_rnn import DynamicLSTM
from layers.attention import Attention
import torch
import torch.nn as nn
class AELSTM(nn.Module):
def __init__(self, embedding_matrix, opt):
super(AELSTM, self).__init__()
self.opt = opt
self.n_head = 1
self.embed_dim = opt.embed_dim
... | xunan0812/MIMN | models/ae_lstm.py | ae_lstm.py | py | 1,549 | python | en | code | 84 | github-code | 13 |
7133931146 | """Script to plot consumers-resource population dynamics and save to PDF"""
__author__ = 'Matthew Campos (matthew.campos19@imperial.ac.uk)'
__version__ = '0.0.1'
import scipy as sc
import scipy.integrate as integrate
def dCR_dt(pops, t=0):
"""returns the growth rate of consumer and resource population at any gi... | matthewcampos/CMEECourseWork | Week7/Code/LV1.py | LV1.py | py | 1,656 | python | en | code | 0 | github-code | 13 |
20364607369 | import math
fb = math.fabs
dotes = [[int(l) for l in input().split()] for i in range(int(input()))]
tdotes = []
for i in dotes:
if fb(i[0]) > fb(i[1]):
tdotes.append(i)
top, left, right, bottom = -1000000, 100000000, -10000000, 10000000
for i in dotes:
if i[1] > top:
dt = i
top = i[1]
... | Qwerty10291/lyceum | 1/homework/dotes.py | dotes.py | py | 665 | python | en | code | 0 | github-code | 13 |
23148232930 | # biblioteca para lidar com chamadas asyncronas no mongo
import os
from dotenv import load_dotenv
from pymongo.mongo_client import MongoClient
from scraper import manage_scrape
load_dotenv()
uri = os.environ.get('MONGO_URL')
client = MongoClient(uri)
db = client['products_data']
products_collection = db['products'... | IgorBrizack/Crawler-Web | backend/server/database.py | database.py | py | 1,875 | python | en | code | 0 | github-code | 13 |
17046519464 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import json
from alipay.aop.api.constant.ParamConstants import *
from alipay.aop.api.domain.SettleClause import SettleClause
class AlipayTradeBatchSettleModel(object):
def __init__(self):
self._biz_product = None
self._extend_params = None
se... | alipay/alipay-sdk-python-all | alipay/aop/api/domain/AlipayTradeBatchSettleModel.py | AlipayTradeBatchSettleModel.py | py | 3,735 | python | en | code | 241 | github-code | 13 |
41848550713 | import logging
from uuid import UUID
from lib.exceptions import EntityNotFoundException
from lib.ydb.mixin import YbdMixin
from modules.todo.schemas.request import TaskRequestSchema, TaskRequestUpdateSchema
logger = logging.getLogger(__name__)
class Task(YbdMixin):
table = 'task'
async def cre... | Gamer201760/Task-app | modules/todo/crud.py | crud.py | py | 1,144 | python | en | code | 0 | github-code | 13 |
73644105299 | from django.urls import path
from rest_framework_simplejwt.views import TokenRefreshView
from auth.views import (
MyObtainTokenPairView,
RegisterView,
UserView,
)
urlpatterns = [
path('login/', MyObtainTokenPairView.as_view(), name='token_obtain_pair'),
path('login/refresh/', TokenRefreshView... | tgardela/event_manager | auth/urls.py | urls.py | py | 586 | python | en | code | 0 | github-code | 13 |
40846227022 | # -*- Mode:python; c-file-style:"gnu"; indent-tabs-mode:nil -*- */
import shutil
import os, sys, re
from mininet.clean import sh
from mininet.examples.cluster import RemoteMixin
from mininet.log import warn
from mininet.node import Switch
from minindn.apps.application import Application
from minindn.util import scp,... | FabioSantosSantos/ndvr-pathvector | minindn/apps/ndvr.py | ndvr.py | py | 4,834 | python | en | code | 0 | github-code | 13 |
22415573768 | cluster_tokens = {}
vault_clusters = ["vault-east", "vault-west"]
def get_secret():
global cluster_tokens
with open("tokens_mem", "r") as fh_:
cluster_tokens = json.load(fh_)
for vserv in vault_clusters:
if vserv not in cluster_tokens:
if not get_token(vserv):
... | btkrausen/hashicorp | vault/scripts/ha-script.py | ha-script.py | py | 1,145 | python | en | code | 771 | github-code | 13 |
10687625776 | import os
import serial
import time
port = "/dev/cu.usbserial-1420"
mirror = serial.Serial(port, 115200)
while True:
time.sleep(3600) # in sec
datas = mirror.readline()
# Got string like
# "ctn: 12, pump: open , humi: 12.3, temp: 12.3");
datas = str(datas)
datas = datas.replace("b'", "").re... | llPekoll/aquaPoney | raspi/get_serial.py | get_serial.py | py | 795 | python | en | code | 0 | github-code | 13 |
5902683365 | from copy import deepcopy
class BackendConfig:
# configs not needed for actor creation when
# instantiating a replica
_serve_configs = ["_num_replicas", "max_batch_size"]
# configs which when changed leads to restarting
# the existing replicas.
restart_on_change_fields = ["resources", "num_cp... | zhuohan123/hoplite-rllib | python/ray/experimental/serve/backend_config.py | backend_config.py | py | 1,686 | python | en | code | 2 | github-code | 13 |
17109134506 | from collections import OrderedDict
import json
from django.contrib.auth.models import User
from rest_framework.decorators import list_route
from rest_framework.response import Response
from rest_framework.test import APIClient
from api.pagination import CustomReadOnlyModelViewSet
from api.queries.tags import get_sa... | staphopia/staphopia-web | api/tests.py | tests.py | py | 9,077 | python | en | code | 4 | github-code | 13 |
74187775697 | """
Django settings for macPay project.
For more information on this file, see
https://docs.djangoproject.com/en/1.7/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.7/ref/settings/
"""
# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
imp... | emmanuel-isaac/macPay | macPay/settings/base.py | base.py | py | 2,490 | python | en | code | 1 | github-code | 13 |
26654171798 | import cv2
import numpy as np
def parse_vgg(l):
d = {}
for i in l:
i = i.strip().split(",")
imagename = i[0]
coords = (int(x) for x in i[2:])
if imagename not in d.keys():
d[imagename] = [coords]
else:
d[imagename].append(coords)
return d,imagename
# imagelist = "MabiniD1_align.csv"
imagelist = "B... | rizarae-p/reef-stitching | translate.py | translate.py | py | 2,045 | python | en | code | 0 | github-code | 13 |
73564100816 | import pandas as pd
from sklearn.ensemble import RandomForestRegressor
from sklearn.metrics import mean_absolute_error
from sklearn.model_selection import train_test_split
from sklearn.preprocessing import Imputer
# this is the path to the Iowa data that you will use
main_file_path = '../input/house-prices-advanced-re... | jaimecuellar14/MachineLearning | HandlingMissingValues.py | HandlingMissingValues.py | py | 2,453 | python | en | code | 0 | github-code | 13 |
22268826285 | # path/to/your/python/script.py
import sys
# 获取参数
parameter1 = sys.argv[1]
parameter2 = sys.argv[2]
# 执行计算
result = int(parameter1) + int(parameter2)
# 将结果输出到标准输出
print(result)
| matriz23/KeChengSheJi_Group2 | 后端/pyscripts/func_evaluate.py | func_evaluate.py | py | 217 | python | ja | code | 0 | github-code | 13 |
30258053564 | import torch
import torch.nn as nn
import torch.nn.functional as F
class Actor(nn.Module):
"""Actor (Policy) Model."""
def __init__(self, state_size, action_size, seed, fc_units_1=32, fc_units_2=32):
"""Initialize parameters and build model.
Params
======
state_size (int):... | Axel-Bravo/19_udacity_drlnd | 3_007_Project_Continuous_Control/model.py | model.py | py | 2,798 | python | en | code | 2 | github-code | 13 |
28942285793 | from sweetpea import *
samples = [
{
'color': ['red', 'green', 'red', 'green', 'red', 'green'],
'word': ['red', 'green', 'red', 'green', 'red', 'red'],
'congruency': ['con', 'con', 'inc', 'con', 'inc', 'con']
},
{
'color': ['red', 'green', 'red', 'green', 'red', 'green'],
... | sweetpea-org/sweetpea-py | acceptance/test_auto_correlation_score.py | test_auto_correlation_score.py | py | 1,446 | python | en | code | 10 | github-code | 13 |
10526352013 | #Universidad de el Salvador - GUI1
#GarciaHernandez_CarlosEduardo GH17045
#Determinar la mediana de tres numeros
n1= int(input("Ingrese el primer numero"))
n2= int(input("Ingrese el segundo numero"))
n3= int(input("Ingrese el tercer numero"))
#creando funcion
def calcular_mediana(a, b, c):
if (a>b):
if(a... | ues-fmocc-prn335/Guia01 | GarciaHernandezCarlosEduardo_GH17045_GUIA1.py | GarciaHernandezCarlosEduardo_GH17045_GUIA1.py | py | 1,020 | python | es | code | 3 | github-code | 13 |
13985382663 | l = ["margareta", "crizantema","lalea"," zorea , violeta, orhidee","trandafir","gerbera , iasomie","iris","crin "]
# 1
def add():
s = input()
if s in l:
l.remove(s)
l.append(s)
add()
print(l)
# 2
for i in range(0, len(l)):
el = l[0].split()
l.remove(l[0])
for j in el:
if j ... | Loila11/fmi | Licenta 2/AI/lab1/ex8.py | ex8.py | py | 590 | python | en | code | 0 | github-code | 13 |
39817490513 | import requests
from bs4 import BeautifulSoup
import time
from pymongo import MongoClient
class Events:
def __init__(self):
# Initialize MongoDB connection
self.client = MongoClient('mongodb://your_username:your_password@localhost:27017')
self.db = self.client['your_database_n... | RumbleJack56/web_scrapper_hf23 | Github Education/main.py | main.py | py | 4,410 | python | en | code | null | github-code | 13 |
8951583079 | from flask import Flask, request, Response, jsonify
from flask_cors import CORS, cross_origin
import random
import re
app = Flask(__name__)
CORS(app)
app.config['CORS_HEADERS'] = '*'
@app.route('/detectpropaganda', methods = ['POST'])
def detect_propaganda():
text = request.data.decode("utf-8")
spllitted = re.sp... | GenchoBG/NotInfo | NotInfo.API/dummyserver.py | dummyserver.py | py | 819 | python | en | code | 0 | github-code | 13 |
39859979061 |
class MotorVehicle():
color = 'black'
engineCapacity = '100'
def __init__(self,name, fuelType, yearOfManufacture):
self.name = name
self.fuelType = fuelType
self.yearOfManufacture = yearOfManufacture
def displayCarDetails(self):
print("Name: {}\nfuelType: {}\n"
... | Prathamesh0421/Practice-Problems-in-CPP-and-Python | class_objects/python/MotorVehicle.py | MotorVehicle.py | py | 535 | python | en | code | 0 | github-code | 13 |
73492570576 | from collections import deque
class Node:
def __init__(self,data):
self.left=None
self.data=data
self.right=None
def BuildTree(s):
nodes=s.split()
n=len(nodes)
if n==0 or nodes[0]=='N':
return None
root=Node(int(nodes[0]))
dq=deque()
dq.append(root)
size... | Ayush-Tiwari1/DSA | Days.18/5.Flatten-Binary-Tree-into-Linked-List.py | 5.Flatten-Binary-Tree-into-Linked-List.py | py | 1,411 | python | en | code | 0 | github-code | 13 |
71702220499 | import codecs
from hacktools import common, ws
# The value in pixels that we can fit before wordwrapping
wordwrap = 206
wordwrap_angel = 136
# Speaker codes
speakercodes = {
0x00: 'Shigeru',
0x02: 'Asuka',
0x04: 'Fuyutsuki',
0x06: 'Gendo',
0x08: 'Makoto',
0x0a: 'Hikari',
0x0c:... | Illidanz/ShitoTranslation | game.py | game.py | py | 13,959 | python | en | code | 3 | github-code | 13 |
8764641611 | soma = 0
maioridade = 0
maisvelho = ' '
mulher = 0
for c in range (1,3):
print(f'===== PESSOA N°{c} =====')
nome = input('Nome: ')
sexo = input('Sexo (M/F): ').upper().strip()
idade = int(input('Idade: '))
soma = idade + soma
print(' ')
if c == 1 and sexo == 'M':
maioridade = idade
maisvelho = nome
... | luanalbis/python | Exercícios CEV/EX056.py | EX056.py | py | 679 | python | pt | code | 0 | github-code | 13 |
13897231359 | import matplotlib.pyplot as plt
import numpy as np
import scipy as sp
from scipy.stats import norm
from sklearn.pipeline import Pipeline
from sklearn.linear_model import LinearRegression
from sklearn.preprocessing import PolynomialFeatures
from sklearn import linear_model
x = np.arange(0, 1, 0.002)
y = nor... | FangYikaii/MachineLearning_Python | Logistic Regression/LinerRegression.py | LinerRegression.py | py | 1,344 | python | en | code | 2 | github-code | 13 |
9821493998 | # coding:utf8
"""
@author: Zhangao Lu
@contact: zlu2@laurentian.ca
@time: 2021/10/10
@description:
Display the picture with bounding box
"""
import cv2
import pandas as pd
from matplotlib import pyplot as plt
BOX_COLOR = (255, 0, 0) # Red
TEXT_COLOR = (255, 255, 255) # White
def visualize_bbox(img, bbox, class... | luzhangao/wow-object-detection | control/check_bounding_box.py | check_bounding_box.py | py | 3,796 | python | en | code | 0 | github-code | 13 |
29660271006 |
import hashlib
from django.core.cache import cache
from .constants import CACHE_TIMEOUT_IN_SECS
def store_response_in_cache(func):
"""
Decorator to store in cache response from inner function.
"""
def wrapper_func(*args, **kwargs):
cache_key = '{sha1_key}'.format(
sha1_key=h... | junior92jr/location-advisor-backend | recommendations/decorators.py | decorators.py | py | 949 | python | en | code | 0 | github-code | 13 |
13014004832 | import collections
import logging
import math
import itertools
import graphviz
import torch
import numpy as np
import mfst
from mathtools import utils
from . import semirings
logger = logging.getLogger(__name__)
class FST(mfst.FST):
EXPECTATION_USES_FB = False
def __init__(
self, *args,
... | jd-jones/seqtools | seqtools/fstutils_mfl.py | fstutils_mfl.py | py | 38,842 | python | en | code | 1 | github-code | 13 |
10252628368 | from turtle import Turtle
class Paddle(Turtle):
def __init__(self, x_coordinate):
super().__init__()
self.shape("square")
self.turtlesize(stretch_wid=5, stretch_len=1)
self.color("white")
self.penup()
self.goto(x_coordinate, 0)
def up(self):
y_coordinat... | joaopulsz/pong | paddle.py | paddle.py | py | 492 | python | en | code | 0 | github-code | 13 |
32604675156 | import mysql.connector
import configparser
class MySQL:
def __init__(self, config_file):
self.config = configparser.ConfigParser()
self.config.read(config_file)
self.connection = None
self.cursor = None
def connect(self):
try:
self.connection = m... | liangmartin/python-myops-tool | Mysql/conn_mysql.py | conn_mysql.py | py | 1,406 | python | en | code | 0 | github-code | 13 |
25661456785 | import numpy as np
# ASCII a = 97; A = 65
# Priority a = 1; A = 27
# 97-1 = 96; 65 - 27 = 38
def get_priority(letter: chr) -> int:
return (ord(letter) - 38) if letter.isupper() else (ord(letter) - 96)
def part1():
input_list = [x.strip() for x in open('input/day3.txt').readlines()]
intersections = map(lam... | Kitri/AdventOfCodePython | 2022/day3.py | day3.py | py | 936 | python | en | code | 0 | github-code | 13 |
72829504979 | import bpy
from bpy.props import *
from ... base_types import AnimationNode
class tankSuspensionNode(bpy.types.Node, AnimationNode):
bl_idname = "an_tankSuspensionNode"
bl_label = "Suspension Wheel Tracker"
bl_width_default = 200
message1 = StringProperty("")
message2 = StringProperty("")
def... | Clockmender/My-AN-Nodes | nodes/general/suspension.py | suspension.py | py | 1,419 | python | en | code | 16 | github-code | 13 |
9070879280 | from collections import deque
# def solution(n, v):
# q = deque(v)
# total_gap = [0] * (n + 1)
#
# left_total = 0
# for i in range(n + 1):
# right = v[i:]
# temp_total = left_total - sum(right)
# total_gap[i] = abs(temp_total)
#
# total_gap[-1] = sum(v)
#
# return total_... | mins1031/coding-test | programmers/Ace1.py | Ace1.py | py | 1,924 | python | en | code | 0 | github-code | 13 |
35596788969 | from .i2cDevice import *
from ..device import pyLabDataLoggerIOError
import datetime, time, sys
import numpy as np
from termcolor import cprint
import smbus
########################################################################################################################
class h3lis331dlDevice(i2cDevice):
"... | djorlando24/pyLabDataLogger | src/device/i2c/h3lis331dlDevice.py | h3lis331dlDevice.py | py | 3,987 | python | en | code | 11 | github-code | 13 |
28280930549 | import asyncio
async def rhythm():
print('1')
for i in range(10):
await asyncio.sleep(1)
print('1')
async def bang():
print('Bang')
for i in range(5):
await asyncio.sleep(3)
print('Bang')
async def main():
# task1 = asyncio.create_task(bang())
# task2 = asyn... | AndreiZherder/python-practice | async/async2.py | async2.py | py | 478 | python | en | code | 0 | github-code | 13 |
70866692819 | import base64
import hashlib
#import secrets # no, is python3.6
from random import SystemRandom
import pkg_resources
import io
stream = io.TextIOWrapper(pkg_resources.resource_stream(__package__,'words.txt'))
try:
all_words = [line.strip() for line in stream.readlines()]
finally:
stream.close()
def randomwor... | sanderevers/80by24 | run80by24-common/run80by24/common/id_generator/__init__.py | __init__.py | py | 753 | python | en | code | 1 | github-code | 13 |
27891630874 | from __future__ import print_function
import collections
import difflib
import os
import re
import sys
import gyp_compiler
# Find chromite!
sys.path.insert(0, os.path.join(os.path.dirname(os.path.realpath(__file__)),
'..', '..', '..'))
from chromite.lib import commandline
from chromi... | ansiwen/chromiumos-platform2 | common-mk/gyplint.py | gyplint.py | py | 10,714 | python | en | code | 0 | github-code | 13 |
73718709136 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import sys
from distutils.core import setup
pkg_name = 'symodesys'
version_ = '0.0.1'
classifiers = [
"Development Status :: 2 - Pre-Alpha",
"Intended Audience :: Developers",
"License :: OSI Approved :: BSD License",
"Operating System :: OS Independent"... | bjodah/symodesys | setup.py | setup.py | py | 1,911 | python | en | code | 1 | github-code | 13 |
32994523406 | import cv2
import numpy as np
import statistics as stat
def adjust_gamma(image):
# Load in the image using the typical imread function using our watch_folder path, and the fileName passed in, then set the final output image to our current image for now
# Set thresholds. Here, we are using the Hue, Saturation, ... | mhamdan91/IMAGE_2_CODE | utils.py | utils.py | py | 6,674 | python | en | code | 3 | github-code | 13 |
41139536739 | import numpy as np
from orangecontrib.associate.fpgrowth import *
from sklearn.externals import joblib
from os import listdir
from os.path import isfile, join
import os
master_index = {}
def create_graph(input_file, output_file, output_named_file, year_count, min_transactions = 2, confidence = 0.02 ):
print('Creat... | vijinkp/graph-analysis | associate_rule_mining.py | associate_rule_mining.py | py | 2,713 | python | en | code | 0 | github-code | 13 |
18314464325 | """
An implementation of WORDLE(tm) designed with the visually impaired
in mind.
"""
import sqlite3
import random
import datetime
import pygame
from more_itertools import collapse
# pylint: disable=no-member
class Paterdal:
"""
The implementation
"""
def __init__(
self,
... | SeanWH/paterdal | src/paterdal.py | paterdal.py | py | 9,844 | python | en | code | 0 | github-code | 13 |
30643291242 | from tkinter import *
def click1(event):
login_entry.configure(state=NORMAL)
login_entry.delete(0,END)
login_entry.unbind("<Button-1>", clicked1)
def click2(event):
pw_entry.configure(state=NORMAL)
pw_entry.delete(0,END)
pw_entry.unbind("<Button-1>", clicked2)
window = Tk()
win... | 5puki/TheBasicsPractice | Kickloginpractice.py | Kickloginpractice.py | py | 1,655 | python | en | code | 0 | github-code | 13 |
2325284451 | import numpy as np
import torch
import torch.nn as nn
from scipy.io import loadmat
from sklearn.preprocessing import MinMaxScaler
from torch.autograd import Variable
import matplotlib.pyplot as plt
"""
Author: Sheng Kuang, Yimin Yang
"""
# Load data
training_data_path = 'Xtrain.mat'
test_data_path = 'Xtest-1.mat'
ra... | YangYimin98/deep_learning_Assignment | Group2_assignment_1/LSTM_code/LSTM_model.py | LSTM_model.py | py | 11,508 | python | en | code | 0 | github-code | 13 |
28912303060 | import os
from centerfinder import util
from centerfinder import sky
def test_pickle():
sky_ = sky.Sky(util.load_data('data/cf_mock_catalog_83C_120R.fits'), 5)
# expected radius should be default to 108
filename = 'dummy'
sky_.vote(radius=108)
util.pickle_sky(sky_, filename)
sky_1 = util.unpi... | yliu134/center-finder | tests/test_vote.py | test_vote.py | py | 664 | python | en | code | 0 | github-code | 13 |
31969272941 | from django.urls import path , include
from django.contrib import admin
from . import views
from .views import *
from django.conf import settings
from django.conf.urls.static import static
from django.shortcuts import render
urlpatterns = [
path('', views.login , name='login'),
path('index/', views.index , n... | shakti001/Besttutorils | webadmin/urls.py | urls.py | py | 1,471 | python | en | code | 0 | github-code | 13 |
5505690475 | from discord.ext import commands
from utils.mysql import *
from utils.tools import *
from utils import checks
from utils.language import Language, lang_list
class Configuration(commands.Cog):
def __init__(self, bot):
self.bot = bot
@checks.server_admin_or_perms(manage_guild=True)
@commands.guild_o... | script-head/deadhead | commands/configuration.py | configuration.py | py | 2,528 | python | en | code | 10 | github-code | 13 |
35219091445 | import numpy as np
import cupy as cp
from cupy import dot
def init_matvec(N, local_N, T):
local_A = cp.empty((local_N, N), T)
Ax = np.empty(N, T)
local_Ax = cp.empty(local_N, T)
return local_A, Ax, local_Ax
def init_vecvec(local_N, T):
local_a = cp.empty(local_N, T)
local_b = cp.empty(local_... | 5enxia/parallel-krylov | v1/processes/gpu.py | gpu.py | py | 1,233 | python | en | code | 1 | github-code | 13 |
17776956497 | import turtle as t
def rectangle(horizontal,vertical,colour):
t.pendown()
t.pensize(1)
t.color(colour)
t.begin_fill()
for counter in range(1,3):
t.forward(horizontal)
t.right (90)
t.forward(vertical)
t.right(90)
t.end_fill()
t.penup()
t.penup()
... | YITExperiment/ppv2_level-3-kapinath | robot_builder 2.py | robot_builder 2.py | py | 1,100 | python | en | code | 0 | github-code | 13 |
19552359290 | import sys
memo = dict()
coinValues = [1, 5, 10, 25, 50]
def coin_change(i, n):
if n == 0:
memo[(n)] = 1
return 1
if n < 0:
memo[(n)] = 0
return 0
if i <= 0 and n >=1:
return 0
# First Term
if (i-1, n) not in memo:
# a = coin_change(i-1, n, memo)
memo[(i-1, n)] = coin_change(i-1, n)
# Second t... | tristan-hunt/UVaProblems | coin_change.py | coin_change.py | py | 674 | python | en | code | 0 | github-code | 13 |
38319545100 | #!/usr/bin/env python3
import csv
import json
import os
import sys
from argparse import ArgumentParser
from datetime import datetime
from subprocess import list2cmdline
from typing import Dict, Tuple
from urllib.request import urljoin
import requests
session = requests.session()
session.headers["Content-Type"] = "app... | NiceLabs/ituring-helper | ituring.py | ituring.py | py | 7,319 | python | en | code | 0 | github-code | 13 |
16550668986 | from django import forms
from django.forms import ModelForm
from .models import *
from multiupload.fields import MultiFileField
class UserForm(ModelForm):
class Meta:
model = User
fields = ('email',)
class LinearForm(ModelForm):
class Meta:
model = Linear
fields = '__all__'
... | tagirova33/bim-zadanie | forms.py | forms.py | py | 3,951 | python | ru | code | 0 | github-code | 13 |
9072170480 | import sys
sys.stdin = open("in_out/chapter7/in4.txt", "rt")
def dfs(L, sum):
global change, smaller
if L >= smaller:
return
if sum == change:
if L < smaller:
smaller = L
return
elif sum > change:
return
else:
for i in coins:
dfs(L + ... | mins1031/coding-test | section6/Chapter7.py | Chapter7.py | py | 557 | python | en | code | 0 | github-code | 13 |
13342109511 | import socket, struct, math, pickle, random, copy, json, time, pygame
from matplotlib.pyplot import disconnect
from _thread import start_new_thread
from constants import *
from games_logic import TTT_Logic, Connect4_Logic
# import numpy as np
IP = "0.0.0.0" # Address to bind to
PORT = 5555 # Arbitrary non-privileg... | AaravGang/server-public | server.py | server.py | py | 27,113 | python | en | code | 0 | github-code | 13 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.