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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
34774711459 | import boto3
import sys
import json
from pygments import highlight, lexers, formatters
from src.s3_event_config import S3EventConfig, TopicConfig, QueueConfig, LambdaConfig
class S3Events:
def __init__(self, client):
self.Config = {}
self.Client = client
def __str__(self, pretty=True):
... | hsk86/s3_event_deploy | src/s3_event.py | s3_event.py | py | 2,330 | python | en | code | 0 | github-code | 1 |
2061777653 | from django.conf.urls import url
from . import views
app_name = 'food'
urlpatterns = [
url(r'^order/$', views.order, name="order"),
url(r'^$', views.homepage, name="home"),
url(r'^prepare/$', views.prepare, name="prepare"),
url(r'^success/$', views.success, name="success"),
url(r'^business/$', vie... | rifatblack/Coffee-Shop-System | food/urls.py | urls.py | py | 581 | python | en | code | 6 | github-code | 1 |
37046986835 | from datetime import datetime
from channels.generic.websocket import AsyncJsonWebsocketConsumer
from asgiref.sync import sync_to_async
from .models import Room,Message
class ChatConsumer(AsyncJsonWebsocketConsumer):
async def connect(self):
self.room_name = self.scope['url_route']['kwargs']['room_name']
... | WellingtonNico/django_channels_chat | room/consumers.py | consumers.py | py | 1,307 | python | en | code | 0 | github-code | 1 |
40690193714 | from flask_restplus import Api
from flask import Blueprint
from .offices import offices
from .meetings import meetings
blueprint = Blueprint('api', __name__, url_prefix='/api')
api = Api(
blueprint,
title='Office Data Manager',
description='Manages and provides data about each office, meeting, and sugge... | Larry-Gan/PCS-Node | Back End/office-data-manager/officedatamanager/main/routes/__init__.py | __init__.py | py | 469 | python | en | code | 1 | github-code | 1 |
10125170936 | #!/root/mypy/bin/python
'''find the difference of two files
test
'''
import sys
def diff(fpath1,fpath2):
f1=open(fpath1,'r')
f2=open(fpath2,'r')
f1set=set(f1.readlines())
f2set=set(f2.readlines())
fdiff=set(f1set-f2set)
return fdiff
if __name__ == '__main__':
result=diff(sys.argv[1],sys... | WilliamFWG/Warehouse | python/logdiff.py | logdiff.py | py | 347 | python | en | code | 0 | github-code | 1 |
30992765140 | from .colors import Color
from fastapi import APIRouter, Response
from jinja2 import Template
from os import path
class SvgResponse(Response):
media_type = "image/svg+xml"
def __init__(self, *args, **kwargs) -> None:
super().__init__(media_type="image/svg+xml", *args, **kwargs)
class Markers:
de... | HakierGrzonzo/PBL-polsl-2022 | backend/backend/markers.py | markers.py | py | 1,298 | python | en | code | 3 | github-code | 1 |
11001710120 | # -*- coding: utf-8 -*-
# python 3.x
# Filename: StrUtil.py
# 定义一个StrUtil工具类实现字符串操作相关的功能
from util.LogUtil import *
TAG = 'StrUtil'
class StrUtil:
@staticmethod
def capitalize(data: str):
"""
将字符串的首字母大写,其余字母大小写不变
:param data: data
:return: value
"""
if not data... | lkl22/CommonTools | util/StrUtil.py | StrUtil.py | py | 2,008 | python | zh | code | 2 | github-code | 1 |
4688893528 | import datetime
from django.shortcuts import render
from .models import Agreement, Period
import json
from django.http import HttpResponse
# Function of separation ID
# Returns a single identifier without a comma
# Returns "None", if not number or 0
def separation(set_in):
double_comma = 0
result = []
set... | EvgeniyArefa/B2B | agreement/views.py | views.py | py | 4,510 | python | en | code | 0 | github-code | 1 |
7461357986 | # pylint: skip-file
# Still work in progress
import math
from struct import pack, unpack
from bot.actions_generator import ActionsGenerator
from bot.bot import Bot
from bot.mcst.mcst_bot_game_state import MCSTBotGameState
from game_client.actions import Action, ActionCode
from utility.coordinates import Coords
def a... | VaSeWS/Vangarning-Team | bot/mcst/mcst.py | mcst.py | py | 4,507 | python | en | code | 0 | github-code | 1 |
21707608745 | from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import tensorflow as tf
from core import utils
from core import box_utils
from object_detection.builders.model_builder import _build_faster_rcnn_feature_extractor as build_faster_rcnn_feature_extractor
slim ... | yekeren/Cap2Det | models/utils.py | utils.py | py | 6,855 | python | en | code | 29 | github-code | 1 |
10541655560 | from collections import deque
N, K = map(int, input().split(' '))
que = deque(list(range(1, N+1))) # 큐로 문제 풀이
tmp_list = []
while que :
que.rotate(-K + 1)
tmp_list.append(str(que.popleft()))
print("<",', '.join(tmp_list),">", sep = '') | Lee-han-seok/Solving_Algorithm_SQL | 백준/Silver/11866. 요세푸스 문제 0/요세푸스 문제 0.py | 요세푸스 문제 0.py | py | 271 | python | en | code | 0 | github-code | 1 |
14945088805 | # encoding: utf-8
"""
通过fp-growth算法寻找购物篮数据当中的频繁项集,算法逻辑来源于:Tan, Pang-Ning, Michael Steinbach, and Vipin Kumar.
Introduction to Data Mining. 1st ed. Boston: Pearson / Addison Wesley, 2006. (pp. 363-370)
"""
# original author information
__copyright__ = 'Copyright © 2022 ERSSLE'
__license__ = 'MIT License'
... | ERSSLE/association-analysis | fp_growth2.py | fp_growth2.py | py | 11,722 | python | en | code | 1 | github-code | 1 |
42318918858 | from tkinter import *
from functools import partial
import connection
import time
def end_shift(user_id,start_time):
global newTab
t = time.localtime()
date_time = time.strftime("%Y/%m/%d, %H:%M:%S",t)
print(date_time,user_id,start_time)
query = connection.cur.execute("UPDATE bj_clock_in SET e... | b00t3r322/DB_Project | userpage.py | userpage.py | py | 1,329 | python | en | code | 0 | github-code | 1 |
37759877266 | # coding: utf-8
class FukumenzanSolver():
def __init__(self, probrem_):
'''
:param probrem_: 問題の文字列のリスト(刺繍要素は、合計値の文字列)
このクラスの中では、左からの桁位置を扱いやすくするため、逆順にしておく。数字が入る board_もその位置に対応するように扱う。
probrem_ ['SEND', 'MORE', 'MONEY']
, self.probrem_['DNES', 'EROM', 'YENOM']
, self.board_ [[v11,v12,v13,v14], [....],... | umeya/puzzle_alogorithm_python | ch02/fukumenzan_solver.py | fukumenzan_solver.py | py | 3,362 | python | en | code | 0 | github-code | 1 |
24021315413 | import tweepy
import logging
import time
from config import create_api, download_media
import os
import glob
logging.basicConfig(level=logging.INFO)
logger = logging.getLogger()
def check_mentions(api, since_id):
logger.info("Retrieving mentions")
new_since_id = since_id
# fetch items (tweets) from menti... | seanfinnessy/deep-fry-reply | bots/bot.py | bot.py | py | 3,034 | python | en | code | 0 | github-code | 1 |
8785567077 | from __future__ import absolute_import, division, print_function
import paayes
TEST_RESOURCE_ID = "promo_123"
class TestPromotionCode(object):
def test_is_listable(self, request_mock):
resources = paayes.PromotionCode.list()
request_mock.assert_requested("get", "/api/v1/promotion_codes")
... | paayes/paayes-python | tests/api_resources/test_promotion_code.py | test_promotion_code.py | py | 1,614 | python | en | code | 1 | github-code | 1 |
73757899875 |
#
# Your previous Plain Text content is preserved below:
#
# This is just a simple shared plaintext pad, with no execution capabilities.
#
# When you know what language you'd like to use for your interview,
# simply choose it from the dropdown in the top bar.
#
# You can also change the default language your pads ... | alfonsolzrg/hackingtime-ejercicios | algorithms/test/test_roman_numeral.py | test_roman_numeral.py | py | 2,155 | python | en | code | 0 | github-code | 1 |
25168573512 | from django.urls import path
from .views import licence_list, licence_details, ask_licence, buy_licences, release_licence
urlpatterns = [
path('/', licence_list),
path('/details/<int:pk>', licence_details),
path('/get/<int:pk>', ask_licence),
path('/buy/<str:company_name>/<int:quantity>', buy_licences)... | Donovan1905/Licence-api | app_licences/urls.py | urls.py | py | 371 | python | en | code | 0 | github-code | 1 |
11343348277 | """
预测年收入是否超过 5W 美元
参考: https://github.com/tensorflow/models/blob/r1.8.1/official/wide_deep/wide_deep.py
python -m tutorials.wide_deep --help
"""
import os.path as osp
import shutil
import sys
from dataclasses import dataclass
import pandas as pd
from absl import app
from tensorflow import keras
from utils import log... | henryhyn/caesar-next | tutorials/wide_deep.py | wide_deep.py | py | 7,267 | python | en | code | 1 | github-code | 1 |
38349127063 | import random
n = int(input("Maksimal təxmin etmə şansını daxil edin:->"))
number = random.randint(1, 99)
s = n
while n >= s > 0:
texmin = int(input("Eded daxil edin"))
s = s - 1
if texmin == number:
print("Tebrikler dogru texmin elediniz")
break
elif texmin < number and s > 0 :
... | azmiu-bootcamp/third-seminar-Nihad1999 | Problem7.py | Problem7.py | py | 538 | python | tr | code | 0 | github-code | 1 |
7641609513 | #DriveMan CLI by OxxoCode
#https://github.com/OxxoCode/DriveMan
import argparse
import gdrive
class DriveMan:
#Parse any DriveMan arguments passed by the user
def parse_args(self):
self.parser = argparse.ArgumentParser()
self.parser.add_argument('-user', '--username', nar... | OxxoCodes/DriveMan | driveman.py | driveman.py | py | 4,142 | python | en | code | 2 | github-code | 1 |
18637684084 | # The game Bot Clean took place in a deterministic environment. In this
# version, the bot is given 200 moves to clean as many dirty cells as possible.
# The grid initially has 1 dirty cell. When the bot cleans this cell, a new
# cell in the grid is made dirty. The new cell can be anywhere in the grid.
# The bot he... | devanshi16/hackerRank-bot-challenges | botClean-stochastic.py | botClean-stochastic.py | py | 1,080 | python | en | code | 0 | github-code | 1 |
16236213310 | import requests
import base64
import os
# Obtained from your app dashboard
CLIENT_ID = os.getenv("SPOTIFY_CLIENT_ID")
CLIENT_SECRET = os.getenv("SPOTIFY_CLIENT_SECRET")
# Obtained after the initial user authorization request
CODE = os.getenv("CODE")
STATE = os.getenv("STATE")
# Obtained in the response body when reque... | xalxnder/spotifork | spotify_connector.py | spotify_connector.py | py | 2,021 | python | en | code | 0 | github-code | 1 |
44399324332 | import os
import sys
from PyQt5 import QtWidgets, QtCore
from pyqtgraph import PlotWidget, plot
import pyqtgraph as pg
class MainWindow(QtWidgets.QMainWindow):
def __init__(self, *args, **kwargs):
super(MainWindow, self).__init__(*args, **kwargs)
self.graphWidget = pg.PlotWidget()
self.... | Gravios/tutorials | python/py-qt/hello-qtgraph.py | hello-qtgraph.py | py | 1,378 | python | en | code | 0 | github-code | 1 |
33806039867 | from httprunner.utils import get_platform
def __get_variables_to_list(config_vars):
variables_list = []
for k, v in config_vars.items():
variables_list.append({"key": k, "value": v})
return variables_list
def get_summary(test_results):
summary = {
"success": True,
"test_succe... | SeaZhusp/rocket | app/libs/http_run/report.py | report.py | py | 1,130 | python | en | code | 6 | github-code | 1 |
27037400078 | #!/usr/bin/env python3
import os
from jmapc import (
Address,
Client,
Email,
EmailAddress,
EmailBodyPart,
EmailBodyValue,
EmailHeader,
EmailSubmission,
Envelope,
Identity,
MailboxQueryFilterCondition,
Ref,
)
from jmapc.methods import (
EmailSet,
EmailSubmissionS... | smkent/jmapc | examples/create_send_email.py | create_send_email.py | py | 4,437 | python | en | code | 19 | github-code | 1 |
1070819232 | import asyncio
import json
from aiohttp import web
from rpc_client import RemoteDictRpcClient
from loguru import logger
import sys
logger.remove()
logger.add(sys.stdout, format="{time:HH:mm:ss} - {level} - {message}", level="INFO")
routes = web.RouteTableDef()
@routes.get('/get_value')
async def get_from_remote_dic... | jaksklo/RemoteDictionary | src/client_main.py | client_main.py | py | 3,129 | python | en | code | 0 | github-code | 1 |
71507038435 | import pandas as pd
from sklearn.model_selection import train_test_split
from sklearn.preprocessing import LabelEncoder
from sklearn.neighbors import KNeighborsClassifier
from sklearn.tree import DecisionTreeClassifier
from sklearn.svm import SVC
from sklearn.model_selection import GridSearchCV
from sklearn.metrics im... | JustinValentine/Iris-Flower-Classification | main.py | main.py | py | 4,990 | python | en | code | 0 | github-code | 1 |
70888312035 | # n명의 사람의 소득이 주어졌을 때 이 중 평균 이하의 소득을 가진 사람들의 수를 출력
T = int(input())
for test_case in range(1, T + 1):
num = int(input())
money = list(map(int,input().split(' ')))
sum = 0
for el in money:
sum += el
avg = sum / num
res = 0
for el in money:
if avg >= el:
res += 1
... | rhkddud3917/Algorithm-Practice | SW Expert Academy/10505-소득불균형.py | 10505-소득불균형.py | py | 417 | python | ko | code | 0 | github-code | 1 |
32166692076 | """A growing set of tests designed to ensure when isort implements a feature described in a ticket
it fully works as defined in the associated ticket.
"""
from functools import partial
from io import StringIO
import pytest
import isort
from isort import Config, exceptions
def test_semicolon_ignored_for_dynamic_line... | PyCQA/isort | tests/unit/test_ticketed_features.py | test_ticketed_features.py | py | 23,756 | python | en | code | 6,145 | github-code | 1 |
24632464580 | #menggunakan library numpy sebagai operasi matrix
import numpy as nump
#fungsi iTerminal digunakan untuk input matrix dari Terminal
def iTerminal():
print('================================')
n=int(input("Masukkan ukuran Matriks : "))
a=nump.zeros((n,n),float)
b=nump.zeros(n,float)
print("==========... | ryan-ern/tubes-mrv | Main.py | Main.py | py | 6,135 | python | ms | code | 0 | github-code | 1 |
12330263546 | import unittest
import wx
import os
import sys
from mockito import mock
from nose.tools import assert_equal, assert_true
from robotide.robotapi import Variable
from robotide.controller import DataController
from robotide.controller.robotdata import NewTestCaseFile
from robotide.controller.settingcontrollers import Var... | camppolite/MyTools | RIDE3/utest/editor/test_editor_creator.py | test_editor_creator.py | py | 4,099 | python | en | code | 2 | github-code | 1 |
8939825128 | # 测试VOC2007数据集的读取
import cv2
import numpy as np
import os
import pandas as pd
import torch
import albumentations as A
from PIL import Image, ImageFile
from torch.utils.data import Dataset, DataLoader
ImageFile.LOAD_TRUNCATED_IMAGES = True
class YOLODataset(Dataset):
def __init__(
self,
csv_file,... | huansu/yolov1 | Dataset.py | Dataset.py | py | 2,257 | python | en | code | 0 | github-code | 1 |
20334280359 | import socket
addr = ('localhost', 8001)
cli = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
cli.connect(addr)
cli.send(bytearray("something",'utf-8'))
reply = cli.recv(4096)
cli.close()
print(reply) | uzamakihina/Networks-Lab2- | proxy_client.py | proxy_client.py | py | 209 | python | en | code | 0 | github-code | 1 |
1076514044 | from tqdm import tqdm
import json
import os
lang = 'fortran'
rel_constrcuts = ['do' if lang == 'fortran' else 'for']
rel_clauses = ['private', 'reduction', 'simd', '_']
data_dir = '/home/1010/talkad/Downloads/OMP_Dataset/fortran/source'
counter = {construct:{clause:0 for clause in rel_clauses} for construct in rel_... | talkad/OMPify | HPCorpus/omp_gen_data/data_stats.py | data_stats.py | py | 1,172 | python | en | code | 3 | github-code | 1 |
1621459625 | import sys
from bzrlib import branch
from bzrlib.lazy_import import lazy_import
lazy_import(globals(), """
import urllib
from bzrlib import builtins, errors, option
""")
LINUX = sys.platform.startswith('linux')
WINDOWS = sys.platform.startswith('win')
def master_to_path(master):
path = urllib.unquote(master.base... | CamelliaDPG/Camellia | docs/Jesse/Confusion Notes/figs/phatch-0.2.7/tests/test_suite/bzr_precommit_test.py | bzr_precommit_test.py | py | 1,966 | python | en | code | 16 | github-code | 1 |
6392984137 | # -*- coding: utf-8 -*-
"""
Created on Sun Nov 10 15:10:01 2019
@author: Rajdeep
@author: Mtajic
"""
import pydotplus
import numpy as np
import matplotlib.pyplot as plt
from sklearn import svm, tree, datasets
from sklearn.utils import shuffle
from sklearn.metrics import confusion_matrix, classification_report
from ... | rajdeepslather/gesture.py | DT.py | DT.py | py | 5,235 | python | en | code | 0 | github-code | 1 |
24557332875 | from pygame import *
import random
init()
screen_width = 1200
screen_height = 800
screen = display.set_mode((screen_width,screen_height))
display.set_caption("ping-pong virus")
bg = image.load("e:/dev/python_workspace/img/bg.jpg")
bg = transform.scale(bg,(1200,800))
ball = image.load("e:/dev/python_workspace/img/lo... | soli1101/python_workspace | d20200818/Practice_ppVirus.py | Practice_ppVirus.py | py | 846 | python | en | code | 0 | github-code | 1 |
33692704779 | import webapp2
import jinja2
import os
from google.appengine.ext import ndb
from twilio.rest import TwilioRestClient
from time import time
import json
import logging
from common import make_template
from private import account_sid, auth_token
class User(ndb.Model):
"""Model for the user db"""
fullname = ndb.St... | mtbentley/teenlink | action.py | action.py | py | 4,311 | python | en | code | 1 | github-code | 1 |
71380731554 | totalequity=0
equitysharecapital=0
reservesandsurplus=0
preferredequity=0
totaldebt=0
shorttermdebt=0
longtermdebt=0
print("CALCULATING DEBT TO EQUITY RATIO:")
print("PROVIDE THE EQUITY VALUES")
equitysharecapital=float(input("ENTER EQUITY SHARE CAPITAL"))
reservesandsurplus=float(input("ENTER RESERVESAND SURPLUS:"))
... | vamsi-4-3-4/FINANCIAL-CALCULATIONS | debttoequityratio.py | debttoequityratio.py | py | 671 | python | en | code | 1 | github-code | 1 |
75261792673 | import json
import psycopg2
import os
def lambda_handler(event, context):
user = event['request']['userAttributes']
print('userAttributes')# for debugging
print(user)# for debugging
try:
print('entered-try') # for debugging
sql = """
INSERT INTO public.users (
displ... | seanware/aws-bootcamp-cruddur-2023 | aws/lambdas/cruddur-post-connfirmation.py | cruddur-post-connfirmation.py | py | 1,213 | python | en | code | 0 | github-code | 1 |
32186915496 | import math
import re
from math import * # noqa: F401, F403
from sympy import Eq, solve, symbols
from .calculate import Calculate
def Solve(equations_str):
try:
equations_str = equations_str.replace(' ', '')
equations_ori = re.split(r'[,;]+', equations_str)
equations_str = equations_str... | InternLM/xtuner | xtuner/tools/plugins/solve.py | solve.py | py | 2,370 | python | en | code | 626 | github-code | 1 |
43779497317 | import os,sys
import numpy as np
import cv2,time
import re
data_dir = '/home/sjhbxs/code/ICDAR_TASK2_new1/train_data/out'
i = 0
for root, sub_folder, file_list in os.walk(data_dir):
for file_path in file_list:
try:
Olddir=os.path.join(root,file_path);
... | SJHBXShub/Tool | tool_cv/change_pic_name.py | change_pic_name.py | py | 931 | python | en | code | 0 | github-code | 1 |
34236014841 | # 新建登录测试类,继承 unittest.Testcase
import unittest
from parameterized import parameterized
from base.get_driver import GetDriver
from page.page_login import PageLogin
# from base.base import base_click
from tools.read_txt import read_txt
from base.get_logger import GetLogger
log = GetLogger().get_logger()
def get_dat... | XuLai-7/projectWebAutoTest | scripts/test01_login.py | test01_login.py | py | 2,938 | python | en | code | 1 | github-code | 1 |
29434889395 | import os
import re
import psutil
from time import process_time
import csv
# Start time
startTime = process_time()
#variable for unique list of words that was replace
uniqueWord = []
#variable for no. of times a word replace
wordFrequency = []
def createRequiredWordDictionary(enWord, frWord):
""... | devakumar0107/exeter-coding-challenge | index.py | index.py | py | 2,564 | python | en | code | 0 | github-code | 1 |
16503333002 | from sqlalchemy.exc import IntegrityError
from src.config.database import SessionLocal
from ..config.models import Timezones, ZoneDetails, ErrorLog
def populate_timezones_table(timezones):
with SessionLocal() as db:
try:
db.query(Timezones).delete()
for tz in timezones:
... | marivfa/timezone_proyect | src/crud/timezone.py | timezone.py | py | 1,960 | python | en | code | 0 | github-code | 1 |
42951044565 | """
Created on Nov 25, 2016
Utility class for image processing
@author: Levan Tsinadze
"""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import argparse
from cnn.utils.image_utils import image_converter
IMAGE_SIZE = 299
class document_image_converter(... | ChelovekHe/tensorflow_ann_modules | cnn/documents/image_utils.py | image_utils.py | py | 6,982 | python | en | code | null | github-code | 1 |
11875021314 | import CDAE
import load_data
import metrics
import sys
from sklearn.metrics import precision_recall_fscore_support
import numpy as np
batch_size = int(sys.argv[1])
epochs = int(sys.argv[2])
embedding_size = int(sys.argv[3])
# Load the proejct data
train_movies, train_x, test_movies, test_x = load_data.load_movies()... | tjcdev/sci-autoencoder | src/experiments/collaborative-filtering/train_movies.py | train_movies.py | py | 1,134 | python | en | code | 2 | github-code | 1 |
11456849964 | def solution(string,markers):
ORIGINAL_STRING = string
for m in markers:
string = string.replace(m,"#")
mas = string.split("#")
SAXLANILACAQ = mas[0].strip()
for hedd in mas:
if "\n" in hedd:
muveq = hedd.split("\n")
for i in range(1,len(muveq)):
... | ilyas0v/codewars-python-solutions | strip_comments.py | strip_comments.py | py | 398 | python | en | code | 0 | github-code | 1 |
24849937803 | """
Kártyák definíciója
"""
from enum import IntEnum, unique
from functools import total_ordering
@unique
class Szinek(IntEnum):
"""
Francia kártya színek
"""
KARO = 0
PIKK = 1
KOR = 2
TREFF = 3
JOKER = 4
def __str__(self):
"""
Stringgé alakítja az értéket.
... | cogitoergoread/rlcard3 | rlcard3/games/mocsar/card.py | card.py | py | 4,062 | python | hu | code | 1 | github-code | 1 |
72347994595 | __author__ = "Manuel Yves Galliker"
__maintainer__ = "Manuel Yves Galliker"
__license__ = "Apache-2.0"
from PyQt5 import QtCore
from PyQt5.QtWidgets import QVBoxLayout, QWidget, QDialog, QDialogButtonBox
class ConfirmSelectionWindow(QDialog):
def __init__(self):
super().__init__()
buttonBox = QDi... | manumerous/vpselector | src/vpselector/windows/confirm_selection_window.py | confirm_selection_window.py | py | 715 | python | en | code | 58 | github-code | 1 |
30485595234 | def permute(nums):
# Approach uses recursion:
# Base case is if list is length 1, then return that list
# Find the ith element in the list
# Find the remaining elements in the list
# Call the permute function on the remaining elements list
if len(nums) == 0:
return []
if len(nums... | mrodrigues17/leetcode_algorithms | permutations/permutations.py | permutations.py | py | 586 | python | en | code | 0 | github-code | 1 |
6422773296 | #!/usr/bin/env python2
import json
import math
import re
import sys
def entropy(seq):
bins = {}
total = 0
for x in seq:
bins[x] = 1 + bins.get(x,0)
total += 1
return 0 - sum((float(p) / total) * math.log(float(p) / total, 2) for p in bins.itervalues())
if __name__ == "__main__":
... | maugier/cs422 | high-entropy/mapper.py | mapper.py | py | 626 | python | en | code | 1 | github-code | 1 |
22392012000 |
import setuptools
import setuptools.command.install
from setuptools import setup
from torch.utils.cpp_extension import CppExtension, BuildExtension, CUDAExtension
import subprocess
import os
import sys
import torch
import glob
BUILD_PATH = os.path.join(os.getcwd(), 'python', 'cpp_build')
INSTALL_PATH = os.path.join(o... | AIS-Bonn/stillleben | setup.py | setup.py | py | 3,314 | python | en | code | 59 | github-code | 1 |
30584439371 | import torch
import time
import sys
import pickle
debug = 0
class Node:
def __init__(self, state):
self.state = state
self.n_actions = state.count(' ')
self.regret_sum = torch.zeros(self.n_actions)
self.strategy_sum = torch.zeros(self.n_actions,1)
self.strateg... | JaLnYn/pokerbot | pokerbot/tictactoe/nttt.py | nttt.py | py | 6,415 | python | en | code | 0 | github-code | 1 |
14450483805 |
import time
from pymavlink import mavutil
# from iq_pymavlink_.arm import arm
# from iq_pymavlink_.takeoff import takeoff
# from iq_pymavlink_.land import land
# from iq_pymavlink_.speed_yaw import set_speed
# from iq_pymavlink_.get_autopilot_info import get_autopilot_info
# from iq_pymavlink_.wait_for_posit... | aleksejvalenkov/hakaton_baumanka | autopilot/main.py | main.py | py | 2,658 | python | en | code | 0 | github-code | 1 |
14385630591 | # 두 정렬 리스트의 병합
# 정렬되어있는 두 리스트를 연결하라!
class Node:
def __init__(self, val, next=None):
self.val = val
self.next = next
node1 = Node(1)
node2 = Node(2)
node3 = Node(4)
node1.next = node2
node2.next = node3
node4 = Node(1)
node5 = Node(3)
node6 = Node(4)
node4.next = node5
node5.nex... | hyo-eun-kim/algorithm-study | ch08/misung/ch8_2_misung.py | ch8_2_misung.py | py | 720 | python | en | code | 0 | github-code | 1 |
42583445382 | # Our implementation of insert for the DynamicArray class, as given in Code Fragment 5.5, has the following inefficiency. In the case when a resize occurs, the resize operation takes time to copy all the elements from an old array to a new array, and then the subsequent loop in the body of insert shifts many of those e... | guoweier/DSAP_exercise | Chapter5/R-5-6.py | R-5-6.py | py | 2,620 | python | en | code | 0 | github-code | 1 |
41641060372 | # Block Swap Algo
def swap(arr, firstIndex, secondIndex, d):
for i in range(d):
temp = arr[firstIndex+i]
arr[firstIndex+i] = arr[secondIndex+i]
arr[secondIndex+i] = temp
def leftRotate(arr, d, n):
if d == 0 or d ==n: return
i = d
j = n - d
while (i != j):
... | qxzsilver1/HackerRank | Data-Structures/Arrays/Left-Rotation/Python3/solution.py | solution.py | py | 602 | python | en | code | 0 | github-code | 1 |
26055359083 | import json
import torch
import yaml
from torchvision.transforms import transforms
from tqdm import tqdm
from src.data.tooth_segmentation_dataset import ToothSegmentationDataset
from src.model.unet.unet import UNet
from src.utils.transforms import SquarePad
if __name__ == "__main__":
with open("./src/model/unet/... | tudordascalu/2d-teeth-detection-challenge | src/model/unet/scripts/predict.py | predict.py | py | 1,748 | python | en | code | 2 | github-code | 1 |
6488484519 | '''PACKAGE PROBLEM
You want to send your friend a package with different things.
Each thing you put inside the package has such parameters as index number,
weight and cost.
The package has a weight limit.
Your goal is to determine which things to put into the package so that the total
weight is less than or equal to t... | mgorgei/codeeval | Hard/c114 Package Problem.py | c114 Package Problem.py | py | 2,720 | python | en | code | 1 | github-code | 1 |
74532486752 | MENU = {
"espresso": {
"ingredients": {
"water": 50,
"coffee": 18,
},
"cost": 1.5,
},
"latte": {
"ingredients": {
"water": 200,
"milk": 150,
"coffee": 24,
},
"cost": 2.5,
},
"cappuccino": {
... | yong197578/CoffeeMachine | main.py | main.py | py | 2,458 | python | en | code | 0 | github-code | 1 |
24348933296 | import time
import torch
import numpy as np
from CycleGAN.options.train_options import TrainOptions
from CycleGAN.data.create_numpy_data_loader import get_numpy_loader, define_transformer
from CycleGAN.models import create_model
from CycleGAN.util.visualizer import Visualizer
from CycleGAN.util.load_npy import load_npy... | minhto2802/T2_ADC | CycleGAN/train.py | train.py | py | 3,413 | python | en | code | 0 | github-code | 1 |
32377246266 | class little_r(object):
def __init__(self):
default_str = ''
default_float = -888888.
default_qc = 0
self.latitude = default_float
self.longitude = default_float
self.station_id = default_str
self.name = 'SURFACE... | vyesubabu/work | yangjiang_test/cft2littler/classes.py | classes.py | py | 5,265 | python | en | code | 0 | github-code | 1 |
70242359395 | #!/usr/bin/env python
'''This demo illustrates how to set up a persistent questionnaire. The main
advantage of this approach is that you have less to fill in case you have
already filled the questionnaire before. In addition it is possible to
share these answers between multiple questionnaires as long as the given
ids ... | bebraw/pyqa | demos/persistency/demo.py | demo.py | py | 1,393 | python | en | code | 2 | github-code | 1 |
14353845555 | """Test interpellation parsing."""
from dataclasses import asdict
from lxml import etree
from fi_parliament_tools.parsing.documents import Interpellation
true_interpellation_statement = {
"type": "L",
"mp_id": 1144,
"firstname": "Suna",
"lastname": "Kymäläinen",
"party": "sd",
"title": "",
... | arcada-uas/fi-parliament-tools | tests/test_parsing/test_interpellation.py | test_interpellation.py | py | 1,253 | python | en | code | null | github-code | 1 |
36805691224 | import os
import sys
import numpy as np
from dataclasses import dataclass
from art.attacks.evasion import ProjectedGradientDescent
from art.estimators.classification import SklearnClassifier
from sklearn.linear_model import LogisticRegression
from sklearn.metrics import accuracy_score
from src.exception import Custom... | archanachintagari/attacks_aml | src/components/model_trainer.py | model_trainer.py | py | 2,595 | python | en | code | 0 | github-code | 1 |
38833321589 | assignments = []
with open("assignment.txt") as file:
assignments = [line.split(",") for line in file.read().splitlines()]
def create_range(interval):
return list(range(interval[0], interval[1]+1))
assignments = list(map(lambda sections: tuple(map(lambda section: create_range(list(map(int, section.... | VJ-Duardo/Advent-of-code-2022 | day4/cleanup.py | cleanup.py | py | 871 | python | en | code | 0 | github-code | 1 |
30114689964 | import os
from tqdm import tqdm
from utils import *
from chain import L2R_Chain
from evaluate import *
from prompts.multiple_choice_1 import MULTIPLE_CHOICE_1_PROMPT_TEMPLATE
from env import OPENAI_API_KEY
os.environ["OPENAI_API_KEY"] = OPENAI_API_KEY
model = L2R_Chain()
load_ratio = 0.75
load_num = int(load_ratio... | windszzlang/Learn-to-Refuse | gold_l2r.py | gold_l2r.py | py | 2,931 | python | en | code | 3 | github-code | 1 |
14404159318 |
nums1 = [1,3,5,7,9,11,13,15]
def baseseq(base,num):
s = []
a = num//base
b = num%base
s.append(b)
num = a
while a > base:
a = num//base
b = num%base
s.append(b)
num = a
s.append(a)
return s
# print(baseseq(3,130))
def basesum(base,seq1,seq2):
i... | wurui1994/record | Python/Category/game.py | game.py | py | 1,243 | python | en | code | 29 | github-code | 1 |
17083232439 | import cv2
import numpy as np
net = cv2.dnn.readNetFromTorch('models/instance_norm/mosaic.t7')
net2 = cv2.dnn.readNetFromTorch('models/instance_norm/the_scream.t7')
net3 = cv2.dnn.readNetFromTorch('models/instance_norm/candy.t7')
net4 = cv2.dnn.readNetFromTorch('models/instance_norm/feathers.t7')
img = cv2.imread('im... | seulachoi/myproject | openCV_imgcrop4.py | openCV_imgcrop4.py | py | 2,034 | python | en | code | 1 | github-code | 1 |
3842401558 | # -*- coding: utf-8 -*-
from pdfminer.pdfparser import PDFParser
from pdfminer.pdfdocument import PDFDocument
from pdfminer.pdfpage import PDFPage
from pdfminer.pdfpage import PDFTextExtractionNotAllowed
from pdfminer.pdfinterp import PDFResourceManager
from pdfminer.pdfinterp import PDFPageInterpreter
from pdfminer.pd... | chiellini/fyp_finance | test/main.py | main.py | py | 3,418 | python | en | code | 0 | github-code | 1 |
71153767073 | '''
Desafio 2 - Duas pessoas terão dois trabalhos para apresentar em dois dias diferentes,
Um na terca-feira e outro na quinta-feira. Se os dois trabalhos derem certo,
a pessoa prometeu que vai no shopping comprar uma televisão de 50.
Se apenas um dos trabalhos der certo será uma de 32 polegadas.
Nos dois Cenários, a ... | maik001/python3-udemy | fundamento_projetos/desafio-2.py | desafio-2.py | py | 1,017 | python | pt | code | 0 | github-code | 1 |
166570434 | # -*- coding: utf-8 -*-
'''
.. module:: skrf.media.coaxial
============================================================
coaxial (:mod:`skrf.media.coaxial`)
============================================================
A coaxial transmission line defined from its electrical or geometrical/physical properties
.. autosu... | jem0101/BigSwag-SQA2022-AUBURN | TestOrchestrator4ML-main/resources/Data/supervised/GITHUB_REPOS/scikit-rf@scikit-rf/skrf/media/coaxial.py | coaxial.py | py | 9,549 | python | en | code | 2 | github-code | 1 |
35262645275 | from flask_admin import Admin, BaseView, expose
from flask_admin.contrib.sqla import ModelView
from app import app, db
from model import Category, Products
from flask_login import logout_user, current_user
from flask import redirect
admin = Admin(app=app, name="Quan tri ban hang", template_mode="bootstrap4")
class ... | NguyenHoangPhucBao/Sale_App_v1 | app/admin.py | admin.py | py | 1,230 | python | en | code | 0 | github-code | 1 |
20283883307 | from cocos.sprite import Sprite
from time import sleep
from pygame.mixer import Sound, music
from resource import flying_squirrel, flying_squirrel_flying, rush, die, jump
class Flying_squirrel(Sprite):
def __init__(self, game):
self.image1 = flying_squirrel
self.image2 = flying_squirrel_flying
... | liang212/Pyhton_Final_Game | GAME/flying_squirrel.py | flying_squirrel.py | py | 2,792 | python | en | code | 1 | github-code | 1 |
26859983639 | import tkinter as tk
from tkinter import messagebox
import random
from tkinter.ttk import *
class QuizGame(tk.Tk):
def __init__(self, questions_file):
super().__init__()
self.title("Quiz Game")
self.geometry("1600x800")
self.p1 = tk.PhotoImage(file = 'civ_logo.png')
... | PawelCentkowski/QUIZ-GAME | QUIZ GAME/main.py | main.py | py | 7,937 | python | en | code | 0 | github-code | 1 |
70352199714 |
import pandas as pd
class Bollingerband:
def __init__(self, ohlcv, span, sigma1_ratio=1.0, sigma2_ratio=2.0, sigma3_ratio=3.0):
self.symbol = ohlcv.symbol
self.start_date = ohlcv.start_date
self.end_date = ohlcv.end_date
self.ohlcv = ohlcv.values
self.span = span
s... | tranducquy/lii3ra | lii3ra/technical_indicator/bollingerband.py | bollingerband.py | py | 1,564 | python | en | code | 0 | github-code | 1 |
12505261323 | """Write a Python program to count the number of strings from a given list of strings.
The string length is 2 or more and the first and last characters are the same."""
list = ['abc', 'xyz', 'aba', '1221']
def number_of_string(input_list):
count_num = 0
for i in input_list:
if len(input_list) > 1 and... | kuldeepsinghn/python_coding | python_list.py | python_list.py | py | 2,671 | python | en | code | 0 | github-code | 1 |
42904566825 | from util import readfile
from collections import deque
DAY = 18
OPERATORS = {"*": 1, "+": 2}
def solve_1(data):
def _eval(out):
s = []
for token in reversed(out):
if token.isdigit():
s.append(token)
elif token in OPERATORS:
a, b = list(map... | rainmayecho/aoc2020 | 18.py | 18.py | py | 1,584 | python | en | code | 0 | github-code | 1 |
44312590749 | from detect import FaceDetect, CodeDetect
from abc import ABC, abstractmethod
from updater import Updater
import cv2
import re
import sys
class Scanner(ABC):
def __init__(self):
self.cap = None
def __del__(self):
self.cap.release()
cv2.destroyAllWindows()
@abstractmethod
... | fuisl/checkin | bin/scan.py | scan.py | py | 4,964 | python | en | code | 1 | github-code | 1 |
30340948646 | # #################################################################################
# # GJI final pub specs #
# import matplotlib #
# from matplotlib import rc ... | LemmaSoftware/akvo | akvo/tressel/rotate.py | rotate.py | py | 11,120 | python | en | code | 2 | github-code | 1 |
40501692044 | import socket,random,pickle
def receiveStopNWait():
s=socket.socket(socket.AF_INET,socket.SOCK_STREAM)
s.bind((socket.gethostname(),5000))
s.listen(5)
clientsocket,address=s.accept()
print(f"Connection from {address} has been established.")
recv_msg=clientsocket.recv(100)
print("Message Re... | mesaum12/BCSE_LAB_ASSIGNMENTS | SEM5/Computer_Networks/ASSIGN2/saum/Receiver/receiverStopNWait.py | receiverStopNWait.py | py | 583 | python | en | code | 0 | github-code | 1 |
27458271918 | from flask import Flask, request, jsonify
import maritalk
import requests
app = Flask(__name__)
API_KEY = '100967333014773694334$301a2d09eb5a949372342c6ce125335b346740cecd46dbe12fc2fa326cf315f3'
URL = "https://chat.maritaca.ai/api/chat/inference"
MODEL = maritalk.MariTalk(key=API_KEY)
auth_header = {
"authoriz... | matheus-a-r/projeto-pln | backend/app.py | app.py | py | 1,722 | python | en | code | 0 | github-code | 1 |
5385272577 |
def settleResult(first_date, last_date, total, settlement):
message_dict = {
"type": "bubble",
"body": {
"type": "box",
"layout": "vertical",
"spacing": "md",
"contents": [
{
"type": "text",
"text": "結算結果",
"weight": "bold",
"size": "xl"
},
{
"type": "separator",
"margin": ... | y1lichen/budgetcopilot-linebot | ResultMessage.py | ResultMessage.py | py | 2,752 | python | en | code | 0 | github-code | 1 |
38851038019 | """
normal: fine-tune learning rate 0.1
parameters: --config_file ../configs/CUB/cub_vgg16_cam.yaml BASIC.GPU_ID [0]
"""
import os
import sys
import datetime
import pprint
import _init_paths
from config.default import cfg_from_list, cfg_from_file, update_config
from config.default import config as cfg
from core.engin... | vasgaowei/transformer-loc-voc | tools_cam/train_cam_cor_loc.py | train_cam_cor_loc.py | py | 9,229 | python | en | code | 4 | github-code | 1 |
27783772856 | import math
import sys
a = int(input())
b = int(input())
c = int(input())
if a >= (b + c) or b >= (a + c) or c >= (a + b):
print("impossible")
sys.exit()
A = math.degrees(math.acos((b**2 + c**2 - a**2)/(2 * b * c)))
B = math.degrees(math.acos((a**2 + c**2 - b**2)/(2 * a * c)))
C = 180 - A - B
if C > 0:
... | GHCherk/Coursera | Week_2/02_13_triangle.py | 02_13_triangle.py | py | 536 | python | en | code | 0 | github-code | 1 |
30552261597 | import gc
import os
import supervisely as sly
from supervisely.app.widgets import (
Card,
Button,
Container,
Progress,
Empty,
FolderThumbnail,
DoneLabel,
GridGallery,
Field,
ImagePairSequence
)
import torch
import src.globals as g
from src import train
from src.monitoring import... | supervisely-ecosystem/hrda | src/ui/training.py | training.py | py | 5,113 | python | en | code | 0 | github-code | 1 |
3050422417 | """
自动抽取本体的脚本
"""
# 领域
domains = ["套餐", "流量", "WLAN", "号卡", "国际港澳台", "家庭多终端", "个人"]
# user act
USER_ACT = ["告知", "问询", "比较", "要求更多", "要求更少", "更换", "同时办理", "问询费用选项", "问询通话时长选项", "问询流量选项", "闲聊"]
# 个人业务
Personal_name_entity = {"名称": ["180元档幸福流量年包", "18元4G飞享套餐升级版", "流量安心包",
"139邮... | zhangyi24/CMCC_DialogSystem | data/DataBase/Ontology.py | Ontology.py | py | 20,955 | python | zh | code | 0 | github-code | 1 |
15256429404 | # -*- coding: utf-8 -*-
from .parser import Parser
from .summarizer import Summarizer
__version__ = '0.0.7'
def summarize(title, text, count=3, summarizer=None):
if not summarizer:
summarizer = Summarizer()
result = summarizer.get_summary(text, title)
result = summarizer.sort_sentences(result[:co... | ganesh10-india/TextSum_App | venv/Lib/site-packages/summarizer/__init__.py | __init__.py | py | 395 | python | en | code | 0 | github-code | 1 |
41914122273 | #! /usr/bin/python3
from math import sqrt
# import ottaa käyttöön neliöjuuri funktion moduulista math.
print("Haluatko laskea hypotenuusan(1) vai kateetin(2)?")
vastaus = input("")
if vastaus == "1":
kateetti1 = int(input("anna ensimmäinen kateetti "))
kateetti2 = int(input("anna toinen kateetti "))
hypot... | Sammmster/python_harjoitukset | 3s_palautettava.py | 3s_palautettava.py | py | 901 | python | fi | code | 0 | github-code | 1 |
7419945532 | #!/usr/bin/env python3
# consumed by pre-push test 009
# confirms if response from delegator is valid json
import sys
import json
import traceback
try:
filepath = sys.argv[1]
except:
print("must supply file path as argv[1]")
exit(2)
try:
with open(filepath) as f:
try:
string = f.read()
jsonstring = j... | GLYCAM-Web/gems | testbin/isvalidjson.py | isvalidjson.py | py | 518 | python | en | code | 1 | github-code | 1 |
1541112013 | #!/usr/bin/env python
import os
import sys
import frida
import psutil
# In case of infinite loops, deadpool_dfa may have killed previous run of this script
# but not the spawned process so let's make it sure by ourselves:
for proc in psutil.process_iter():
if proc.name() == 'drmless':
proc.kill()
os.chmod... | SideChannelMarvels/Deadpool | wbs_aes_plaidctf2013/DFA2/spawn_drmless.py | spawn_drmless.py | py | 1,125 | python | en | code | 595 | github-code | 1 |
3081142223 | from Instruction import *
class Instruction_Memory:
def __init__(self, instructions_file):
self.instruction = []
set1 = ['add', 'sub', 'mul', 'div', 'and', 'or']
set2 = ['addi', 'subi']
set3 = ['not']
set4 = ['blt', 'bgt', 'beq', 'bne']
set5 = ['j']
... | VtrCecilio/Simulador_CPU_Paralelo | Instruction_Memory.py | Instruction_Memory.py | py | 1,816 | python | en | code | 0 | github-code | 1 |
3846931421 | from setuptools import setup
import os
def read(*parts):
retval = ''
with open(os.path.join(*parts), 'r') as f:
retval = f.read()
return retval
def requirements():
return read('requirements.txt').split()
setup(
name='yggdrasil',
url='https://github.com/Moguri/yggdrasil',
licen... | Moguri/yggdrasil | setup.py | setup.py | py | 389 | python | en | code | 0 | github-code | 1 |
5410327142 | # -*- coding: utf-8 -*-
import cv2
import numpy as np
if __name__ == '__main__':
# 画像の読み込み
img_src = cv2.imread("./image/te.jpg", 0)
# 4近傍の定義
neiborhood4 = np.array([[0, 1, 0],
[1, 1, 1],
[0, 1, 0]],
np.uint8)
#... | umentu/opencv | opening_closing.py | opening_closing.py | py | 844 | python | ja | code | 1 | github-code | 1 |
2599616076 | import pandas as pd
url = "https://bilkav.com/satislar.csv"
veriler = pd.read_csv(url)
veriler = veriler.values
X = veriler[:,0:1]
Y = veriler[:,1]
#verilerin egitim ve test icin bolunmesi
from sklearn.model_selection import train_test_split
x_train, x_test,y_train,y_test = train_test_split(X,Y,test_size=0.33, ran... | AyseErdanisman/MakineOgrenmesiKurs | Model Kaydetme Picle/model_kaydetme.py | model_kaydetme.py | py | 610 | python | en | code | 6 | github-code | 1 |
3914770626 | """
练习1: 模拟售票系统
现有500 张票 记为 T1--T500 放在一个列表
有10个窗口一起买票 记为 w1 -- w10 ,每张票卖出需要0.1秒
创建10个线程 模拟10个窗口,票的售出顺序必须是1--500
每张票卖出时 打印 w2----T203
编程创建10个 线程模拟这个过程
"""
from threading import Thread
from time import sleep
# 存储票
ticket = ["T%d" % x for x in range(1, 501)]
# 模拟每个窗口的买票情况 w 窗口编号
def sell(w):
while ticket:
... | dalaAM/month02 | day14/exercise_1.py | exercise_1.py | py | 723 | python | zh | code | 0 | github-code | 1 |
71377839714 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""Plotting functions for traveltime."""
import numpy as np
import pygimli as pg
from pygimli.viewer.mpl import createColorBar
from .utils import shotReceiverDistances
def drawTravelTimeData(ax, data, t=None):
"""Draw first arrival traveltime data into mpl ax a.
... | gimli-org/gimli | pygimli/physics/traveltime/plotting.py | plotting.py | py | 5,897 | python | en | code | 312 | github-code | 1 |
16322339038 | #!/usr/bin/env python
from PIL import Image
import mysql.connector
import sys
imagePath = "/var/www/thedisplay.studio/userimages/" + sys.argv[1]
im = Image.open(imagePath, 'r')
im = im.convert('RGB')
width, height = im.size
pixel_values = list(im.getdata())
dataForPanel = ""
if(int(sys.argv[3]) == 1):
startRa... | thereelaman/webToPanel | api/panel/imageToModule.py | imageToModule.py | py | 1,351 | python | en | code | 0 | github-code | 1 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.