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
13102906744
# A program that takes two integer inputs a and b, and prints a + b caseNum = int(input()) sumArr = [] for i in range(caseNum): temp = input().split() a = int(temp[0]) b = int(temp[1]) sumArr.append(a + b) for i in range(caseNum): print(sumArr[i])
olwooz/algorithm-practice
2020_March/200318_10950_A+B-3.py
200318_10950_A+B-3.py
py
290
python
en
code
0
github-code
13
3381176707
import numpy as np from multiclassLRTrain import multiclassLRTrain def trainModel(x, y): param = {} param['lambda'] = 0.008 # Regularization term param['maxiter'] = 1000 # Number of iterations param['eta'] = 0.01 # Learning rate return multiclassLRTrain(x, y, param) """ Testset=2 Digits-nor...
pavitradangati/mini-project-5
code/trainModel.py
trainModel.py
py
578
python
en
code
0
github-code
13
71202880979
def calculator(): correct = False while not correct: try: number1 = int(input("Please enter the first operand:")) correct = True except ValueError: print("Please enter a number") while correct: try: number2 = int(input("Please...
jaruwitteng/6230401856-oop-labs
jaruwit-6230401856-lab4/Problem2.py
Problem2.py
py
1,672
python
en
code
0
github-code
13
28672395305
""" 配置文件 """ configs = { 'path': { 'monitor': r'E:\data\webspider', # 监测新文件产生的路径 'temp_out': r'E:\data\webspider_temp_out', 'out': r'E:\data\webspider_out', # 结果文件的保存路径 'word_config': r'E:\项目\移动在线本部\词条匹配\rules\test_config.json', # 词条配置文件的位置 'word_config_txt': r'E:\项目\移动在...
SnailDM/rule_matching
config.py
config.py
py
1,437
python
zh
code
4
github-code
13
73910584016
import random import time try: only = [] i = j = 0 sTime = eTime = 0.0 number = int(input("请输入要随机几位:")) xiao = int(input("请输入最小随机数:")) da = int(input("请输入最大随机数:")) isOnly = int(input("请输入是否唯一(1/0)")) sTime = time.perf_counter() if isOnly == 1: tempCount = da-xiao+...
learnemt/py
random.py
random.py
py
1,473
python
en
code
0
github-code
13
24550131706
from django import views from django.urls import path from .import views urlpatterns = [ path('', views.home), path('logup', views.logup), path('login', views.login), path('search', views.search), path('taskes', views.taskes), ]
saramoh20/ToDo-project
task/urls.py
urls.py
py
249
python
en
code
0
github-code
13
20336012866
# complete # 3 # 1 8 -> 44 # 2 1 -> 2 # 3 10 -> 65 numberOfDataSets = int(input()) dataSets = [] for i in range(0, numberOfDataSets): currentInput = input().split(" ") dataSets.append(currentInput) for i in dataSets: print(i[0], end=" ") print(int(int(i[1]) * ((int(i[1]) + 1) / 2) + int(i[1...
LukeDul/kattis
chanukah.py
chanukah.py
py
325
python
en
code
0
github-code
13
5884326715
# ------------------------------------------ # # Program created by Maksim Kumundzhiev # # # email: kumundzhievmaxim@gmail.com # github: https://github.com/KumundzhievMaxim # ------------------------------------------- """ A left rotation operation on an array shifts each of the array's elements 1 unit to the left. F...
MaxKumundzhiev/Practices-for-Engineers
Algorithms/left_rotation.py
left_rotation.py
py
821
python
en
code
3
github-code
13
18562250878
from torch.utils.tensorboard import SummaryWriter from PIL import Image import numpy as np writer = SummaryWriter("../logs") image_path = "../dataset/hymenoptera_data/train/bees/95238259_98470c5b10.jpg" img_PIL = Image.open(image_path) print(type(img_PIL)) img_array = np.array(img_PIL) print(type(img_array)) print(i...
sun1f/code_learning
learn_pytorch/src/test_tb.py
test_tb.py
py
483
python
en
code
1
github-code
13
8885180322
# coding: utf-8 # In[1]: import numpy as np import pandas as pd import seaborn as sns import missingno as msno import matplotlib.pyplot as plt import warnings plt.style.use('ggplot') # other options are 'classic', 'grayscale', 'fivethirtyeight', 'ggplot', # seaborn-whitegrid', 'seaborn-white...
michaelbasca/jupyter-reference-guide
scripts/Quick_reference.py
Quick_reference.py
py
3,856
python
en
code
0
github-code
13
17055323834
#!/usr/bin/env python # -*- coding: utf-8 -*- import json from alipay.aop.api.constant.ParamConstants import * class LinkMallCallBackInfo(object): def __init__(self): self._action = None self._bizid = None self._extinfo = None self._lmuserid = None self._promotionid = Non...
alipay/alipay-sdk-python-all
alipay/aop/api/domain/LinkMallCallBackInfo.py
LinkMallCallBackInfo.py
py
4,300
python
en
code
241
github-code
13
44023969943
#!/usr/bin python2.7 #acquery.py #Retrieval and audio playback of Audio Commons sounds using OSC server #listening to text-based queries # #The example retrieves sounds from Freesound using the Audio Commons API. # #Dependencies: #pyosc: https://github.com/ptone/pyosc/ # #Usage: #python acquery.py #(uses de...
mabara/oscaudiocommons
acquery.py
acquery.py
py
8,635
python
en
code
0
github-code
13
29848062496
import os basedir = os.path.abspath(os.path.dirname(__file__)) class Config(object): SECRET_KEY = os.environ.get('FLASK_SECRET') or 'shhh-they-will-never-know' SESSION_TYPE = "sqlalchemy" SESSION_USE_SIGNER = True SQLALCHEMY_TRACK_MODIFICATIONS = False SESSION_SQLALCHEMY_TABLE = "session" SQ...
foster999/project-planner
app/config.py
config.py
py
1,405
python
en
code
0
github-code
13
7159701447
import pymongo myclient = pymongo.MongoClient("mongodb://localhost:27017/") parking_db = myclient["parking_db"] parking = parking_db["parking"] # print(myclient.list_database_names()) parking_lot_size = 0 parking_lot_capacity = 0 command_map = { "Create_parking_lot": 1, "Park": 2, "Slot_numbers_for_driver_o...
may98ank/Parking-Assignment
app.py
app.py
py
3,271
python
en
code
1
github-code
13
2526197966
import sys import time sys.path.append("../..") from qunetsim.backends import CQCBackend from qunetsim.components.host import Host from qunetsim.components.network import Network def main(): backend = CQCBackend() network = Network.get_instance() nodes = ["Alice", "Bob", "Eve", "Dean"] network.start(...
rheaparekh/QuNetSim
tests/integration_test_single_hop/send_classical_check.py
send_classical_check.py
py
1,613
python
en
code
null
github-code
13
26084287123
from controls import * from game import * from random import randint from online import * from threading import Thread from header import get_music import subprocess import sys class SceneLogo (Scene): """scene with my logo""" def __init__(self, time=5000, *argv): Scene.__init__(self, *argv) s...
Anovi-Soft/Python
Revers_Game/Scene.py
Scene.py
py
32,642
python
en
code
0
github-code
13
40617262391
# -*- coding: utf-8 -*- """ Created on Wed Sep 28 15:41:27 2018 @author: Thanh Tung Khuat Another method for serial combination of online learning and agglomerative learning gfmm Using Agglomerative learning to train a base model, then deploy the trained model for online learning with different training data ...
thanhtung09t2/Hyperbox-classifier
GFMM/agglo_onlgfmm.py
agglo_onlgfmm.py
py
9,804
python
en
code
0
github-code
13
10547654316
#!/usr/bin/env python # encoding: utf-8 from django.contrib import admin from .models import Rating class RatingAdmin(admin.ModelAdmin): ordering = ['id', 'rating'] list_display = ['rating', 'comment', 'recipe', 'author'] list_filter = ['recipe', 'author'] search_fields = ['rating', 'comment', ] ad...
open-eats/openeats-api
v1/rating/admin.py
admin.py
py
359
python
en
code
10
github-code
13
19056602940
try: numerator = int(input("Enter the numerator: ")) denominator = int(input("Enter the denominator: ")) if denominator == 0: print("Cannot divide by zero!") else: fraction = numerator / denominator print(fraction) except ValueError: print("Numerator and denominator must be v...
laijunren/cp1404practicalsLJR
prac-02/exceptions_demo.py
exceptions_demo.py
py
417
python
en
code
1
github-code
13
74564375378
from __future__ import (print_function, division) from future.utils import viewitems import json import traceback import cherrypy import WMCore.ReqMgr.Service.RegExp as rx from Utils.Utilities import strToBool from WMCore.REST.Format import JSONFormat, PrettyJSONFormat from WMCore.REST.Server import RESTEntity, rest...
dmwm/WMCore
src/python/WMCore/ReqMgr/Service/RequestAdditionalInfo.py
RequestAdditionalInfo.py
py
11,646
python
en
code
44
github-code
13
38273661855
from django.conf import settings from django.test.signals import setting_changed from django.utils.translation import gettext_lazy as _ from rest_framework.settings import APISettings, api_settings USER_SETTINGS = getattr(settings, 'HEALTH_CHECK', None) DEFAULTS = { # View 'PERMISSION_CLASSES': api_settings....
shinneider/django-k8s-health-check
django_k8s_health_check/settings.py
settings.py
py
1,247
python
en
code
0
github-code
13
28095826273
from tkinter import * import mysql.connector from tkinter import messagebox from datetime import datetime class FriendsPage(Frame): def __init__(self, parent, controller): Frame.__init__(self, parent) self.configure(bg="gray8") # connect to db and query for info conn...
rachellaurentidwell/darkspear
darkspear/pages/FriendsPage.py
FriendsPage.py
py
6,213
python
en
code
0
github-code
13
2244673329
""" Overview ======== Key-Commands ============ Namespace: assoc Mode: Event: Description: """ from vyapp.app import root def install(area): area.install('assoc', ('NORMAL', '<Key-question>', lambda event: root.status.set_msg('\n'.join( event.widget.get_assoc_data()))))
vyapp/vy
vyapp/plugins/assoc.py
assoc.py
py
305
python
en
code
1,145
github-code
13
28679954305
n,m = map(int,input().split()) def lastJudge(n : int, m : int) -> tuple: # 크기가 n,m인 직사각형 기준으로 #현재 xy위치가 끝임 if m * n == 1: #둘다 1인 경우 계산대로 나옴 return (0,0,0) #그냥 자기 위치 elif m == 1: return (1, n - 1, 0) # 아래쪽으로 한번 더 꺾을 수 있음 n만큼 elif n == 1: return (0, 0, m - 1) # 꺾임은 그대로 ...
hodomaroo/BOJ-Solve
백준/Gold/1959. 달팽이3/달팽이3.py
달팽이3.py
py
809
python
ko
code
2
github-code
13
16411493855
from PIL import Image import time def get_concat_v(im1, im2): dst = Image.new('RGB', (im1.width, im1.height + im2.height)) dst.paste(im1, (0, 0)) dst.paste(im2, (0, im1.height)) return dst im1 = Image.open('slice1.png') im2 = Image.open('slice2.png') time.sleep(10) get_concat_v(im1, im2).save('result...
i-mostafa/publicProjects
netslicer-master/mergResults.py
mergResults.py
py
326
python
en
code
0
github-code
13
5085813669
import torch import torch.nn.functional as F from torch import nn _ACTIVATIONS = { "relu": nn.ReLU, "gelu": nn.GELU, } _POOLING = { "max": nn.MaxPool2d, "avg": nn.AvgPool2d, } class ConvUnit(nn.Module): def __init__( self, input_channels: int, output_channels: int, ...
RajatRasal/Contrastive-Learning-with-MNIST
src/components.py
components.py
py
2,365
python
en
code
0
github-code
13
23602590152
import os from tqdm import tqdm from numpy.lib.function_base import append label_name1 = '/mnt/cephfs/home/chenguo/code/FAS/feathernet2021/feathernet_mine/data/train_file_list/exp_train_set_21060301_exp_20210603221606NIR_train_label.txt' train_name1 = '/mnt/cephfs/home/chenguo/code/FAS/feathernet2021/feathernet_mine/d...
CN1Ember/feathernet_mine
data/filelist_nir_rgb.py
filelist_nir_rgb.py
py
2,276
python
en
code
1
github-code
13
8536381472
#!/usr/bin/python # -*- coding: UTF-8 -*- ''' Created on Oct 30, 2017 @author: hadoop ''' from email.mime.multipart import MIMEMultipart from email.mime.text import MIMEText from email.mime.base import MIMEBase from email import utils, encoders from drawing.drawing_utils import draw_stock_with_candlestick_macd from...
liujinguang/stockquantpro
stock-quant-pro/libs/utils/emails.py
emails.py
py
3,276
python
en
code
0
github-code
13
18340239807
import csv import matplotlib.pyplot as plt import numpy as np # import data A - D ta = [] # column 0 data1a = [] # column 1 tb = [] # column 0 data1b = [] # column 1 tc = [] # column 0 data1c = [] # column 1 td = [] # column 0 data1d = [] # column 1 with open('sigA.csv') as fa: # open the csv file readera ...
nbaptist16/me433
hw2test/me433_hw2_5.py
me433_hw2_5.py
py
7,515
python
en
code
0
github-code
13
28147081447
import unittest from character_sheet import * class MyTests(unittest.TestCase): def test_calc_level(self): input_and_expected = ( (0, 1), (14000, 6), (265000, 18) ) for inp, expected in input_and_expected: self.assertEqual(calc_level(inp), e...
Mubbly/5edCharacterSheet
tests.py
tests.py
py
2,670
python
en
code
0
github-code
13
14885806359
def spy_game(nums): str_nums = '' for i in nums: str_nums+= str(i) tmp_str = str_nums null1 = tmp_str.find("0") tmp_str.replace("0", "", 1) null2 = tmp_str.find("0") seven = tmp_str.find("7") if (str_nums.find("007") != -1) or (null1 <= nu...
AbdullaAzadov/PP2
week_3/lab3/functions1/task8.py
task8.py
py
558
python
en
code
0
github-code
13
32212357290
def solution(board, skill): answer = 0 x=len(board) y=len(board[0]) accum_sum=[ [ 0 for _ in range(y+1)] for _ in range(x+1)] for type_skill, r1,r2, c1,c2, degree in skill: c1+=1 c2+=1 if type_skill==1: accum_sum[r1][r2]-=degree accum_sum[c1][c2]-=deg...
BlueScreenMaker/333_Algorithm
백업/220604~230628/Programmers/파괴되지 않는 건물.py
파괴되지 않는 건물.py
py
1,777
python
en
code
0
github-code
13
43104799442
import csv import random dataPath = './train_data/dga-feed.txt' resultPath = './train_data/binary_training.txt' dgaTypePath = './conf/dga/dga_type_list.txt' #DGA is marked with 1, whitelist websites are marked with 0 with open(dataPath, "r") as f: data = f.read().split('\n') for i, line in enumerate(data): d...
Jingyuanisxzs/dga_detect_lstm
generate_data_with_white_list.py
generate_data_with_white_list.py
py
1,012
python
en
code
0
github-code
13
24534408840
from ds_templates import test_series as ts from test_cases import tests """ 1) Parse through list word by word, sorting each word to obtain a 'key' 2) Use sorted word as key for 'anas' and the value is a list with words within. 3) One full list has been parsed, iterate through anas.values() and append to results list ...
Hintzy/leetcode
Medium/49_group_anagrams/group_anagrams.py
group_anagrams.py
py
701
python
en
code
0
github-code
13
41420985869
""" 空气质量计算AQI 作者:Yang 功能:AQI计算. 新增功能:读取CSV文件. 新增功能:读取文件,判断格式调取相应的操作,利用OS模块. 新增功能:爬虫-网页访问. 版本:5.0 日期:31/08/2018 """ import requests def get_html_text(url): """ 返回url的文本 """ r = requests.get(url, timeout=5) print(r.status_code) return r.text...
Lighthouse-Yang/python_learning_test
AQI/AQI_5.0.py
AQI_5.0.py
py
1,374
python
zh
code
1
github-code
13
70095269137
# def get_url(url): # # do something 1 # html = get_html(url) # 耗IO的操作,等待网络请求,此处暂停,切换到其他函数 # # parse html # urls = parse_url(html) """ 传统的函数调用过程:A->B->C,栈 我们需要一个可以暂停的函数,并且可以在适当的情况下恢复该函数 出现了协成->有多个入口的函数,可以暂停的函数(可以向暂停的地方传入值),生成器yield """ def gen_func(): # 可以产出值,可以接收值(调用方传递进来的值) html = yield "htt...
Zbiang/Python-IO
multi-threaded and multi-process/coroutine.py
coroutine.py
py
1,306
python
zh
code
0
github-code
13
27152233454
from django.urls import path from django.conf import settings from django.conf.urls.static import static from . import views #app_name = "repository" urlpatterns = [ path('<int:id>', views.index, name='repository'), path('newRepository', views.newRepository, name='newRepository'), path('all_repositories'...
marijamilanovic/UksGitHub
Uks/repository/urls.py
urls.py
py
2,022
python
en
code
0
github-code
13
18769405092
from django.contrib.auth import authenticate, login from django.contrib.auth.decorators import login_required from django.http import HttpResponse from django.shortcuts import get_object_or_404, render from orders.models import Order, OrderItem from .forms import LoginForm, ProfileForm, UserForm, UserRegistrationForm...
JeffersonRolino/xpiece
account/views.py
views.py
py
2,056
python
en
code
0
github-code
13
4346851923
# 13305: 주유소 n = int(input()) # 도시의 수 km = list(map(int, input().split())) # 각 도시 사이 거리 (n-1)개 city = list(map(int, input().split())) # n개 도시 result = km[0] * city[0] for i in range(1, n-1) : if city[i-1] > city[i] : result += km[i] * city[i] else : # 전것이 다음것보다 더 싸면 그대로 유지 city[i] = city[i-1] ...
mosePark/Algorithm
그리디/13305: 주유소.py
13305: 주유소.py
py
436
python
ko
code
0
github-code
13
37164760463
import os from .curl import ( curl_available, PycurlTransport, ) from .requests import requests_multipart_post_available from .ssh import ( rsync_get_file, rsync_post_file, scp_get_file, scp_post_file, ) from .standard import UrllibTransport if curl_available: from .curl import ( g...
galaxyproject/pulsar
pulsar/client/transport/__init__.py
__init__.py
py
1,489
python
en
code
37
github-code
13
34420981898
# coding=utf-8 """Compute the solution of the Day 1: Calorie Counting puzzle.""" # Standard library imports: from pathlib import Path # Local application imports: from aoc_tools import read_puzzle_input from aoc2022.day_1.tools import ExpeditionSupplies def compute_solution() -> tuple[int, int]: """Compute the ...
JaviLunes/AdventCode2022
src/aoc2022/day_1/solution.py
solution.py
py
755
python
en
code
0
github-code
13
30365096821
from __future__ import print_function, unicode_literals, division def aufg1(): import ROOT as r import numpy as np import math as m GAMMA = 2.7 - 1 # Datei datei = r.TFile("NeutrinoMC.root", "RECREATE") ############################ #a ############################ data = np.z...
chasenberg/smd1516
sheet3/aufgabe1.py
aufgabe1.py
py
9,193
python
de
code
0
github-code
13
28989726634
''' https://leetcode.com/problems/letter-combinations-of-a-phone-number/ ''' def letterCombinations(A): letter_pad = {'0':['0'],'1':['1'],'2':['a','b','c'],'3':['d','e','f'],'4':['g','h','i'], '5':['j','k','l'],'6':['m','n','o'],'7':['p','q','r','s'],'8':['t','u','v'], '9':[...
riddheshSajwan/data_structures_algorithm
recursion/letterPhone.py
letterPhone.py
py
719
python
en
code
1
github-code
13
7702145221
# Author:成为F # -*- codeing = utff-8 -*- # @Time : 2020/11/7 19:52 # @Author : 成为F # @File : 正则1.py # @Software : PyCharm import requests import re import os if __name__ == '__main__': headers = { 'User-Agent': 'User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chr...
pale-F/Reptile
pythin/venv/str/数据解析/正则1.py
正则1.py
py
1,299
python
en
code
0
github-code
13
8573240044
# compose_flask/app.py from flask import Flask from redis import Redis app = Flask(__name__) redis = Redis(host='redis', port=6379) @app.route('/') def hello(): redis.incr('hits') counter = redis.get('hits').decode('utf-8') return f"This Compose/Flask demo has been viewed {counter} time(s)." if __name_...
EekaMau5/compose_flask
app.py
app.py
py
377
python
en
code
0
github-code
13
18120130656
import sys, os, subprocess from characters import Characters # from board import Board #mario cannot go out of window!!!!!!!!!!!!!!!!!! class Mario(Characters): def __init__(self, char, height, width): Characters.__init__(self, char, height, width) self.matrix = [['(', '^', '^', ')'], ['/', ']', '['...
hellomasaya/Mario-game
mario.py
mario.py
py
1,686
python
en
code
0
github-code
13
26414802042
from ursina import * import Game from ...Test import Test from ...TestTypes import TestTypes from Overlays.Notification import Notification from Content.Enemies.TestEnemy import TestEnemy from Content.Characters.TestCharacter import TestCharacter from Content.Weapons.Knife.Knife import Knife class Fight(): # just...
GDcheeriosYT/Gentrys-Quest-Ursina
Screens/Testing/TestingCategories/Gameplay/FightTest.py
FightTest.py
py
2,100
python
en
code
1
github-code
13
29033393404
#data preprocessing #import libraries import numpy as np import matplotlib.pyplot as plt import pandas as pd from sklearn.preprocessing import LabelEncoder,OneHotEncoder labelencoder_independantvar=LabelEncoder() dataset=pd.read_excel('Friesian.xlsx') #extracting Feature columns that is independant variable matrix #...
labibmasud251/SVR
mydataprocess.py
mydataprocess.py
py
5,241
python
en
code
0
github-code
13
42520625781
#Saltelli algorithm for computing firs and total order sensitivity indices import numpy as np import chaospy as cp from numpy.core.fromnumeric import size import matplotlib.pyplot as plt import sys sys.path.insert(0, './Assignment1') from functions import c import parameters as par x = par.x t = par.t fig, axes = ...
Petru289/Uncertainty-Quantification-in-Hydrology
Assignment2/sobol.py
sobol.py
py
6,566
python
en
code
0
github-code
13
8838600278
import numpy as np class PCA: def __init__(self, data, component=1): self.data = data self.component = component self.total, self.dimension = data.shape if self.component >= self.total or self.component >= self.dimension: raise "Invalid component" self.transfer ...
xxyQwQ/awesome-AI
AI1602 人工智能问题求解与实践/Project/Experiment/Algorithm/PCA.py
PCA.py
py
893
python
en
code
8
github-code
13
5400099904
# %% #################### import torch # value t1 = torch.tensor(4.) # vector t2 = torch.tensor([1., 2, 3, 4]) # matrix t3 = torch.tensor([[5, 6], [7, 8], [9, 10]]) # size of tensor print(t3.shape) # %% #################### x = torch.tensor(3.) w = torch.tensor(4., requires_grad...
a23956491z/deep-learning-research
python/pytorch-practice/basic.py
basic.py
py
715
python
en
code
0
github-code
13
20293400484
import contextlib import os from typing import Dict from chaoslib.exceptions import InterruptExecution from msrest.exceptions import AuthenticationError from msrestazure.azure_active_directory import AADMixin from chaosazure.auth.authentication import ServicePrincipalAuth, TokenAuth AAD_TOKEN = "aad_token" SERVICE_P...
chaostoolkit-incubator/chaostoolkit-azure
chaosazure/auth/__init__.py
__init__.py
py
3,679
python
en
code
22
github-code
13
39277666506
from __future__ import division import numpy as np from scipy.optimize import minimize # ############################################################################## # LoadData takes the file location for the yacht_hydrodynamics.data and returns # the data set partitioned into a training set and a test set. # the X...
cmw2196/fall_sem_imperial
gauss_process_cw.py
gauss_process_cw.py
py
10,404
python
en
code
0
github-code
13
38889768693
#! python3 #Write a program that finds all files #with a given prefix in a single folder and locates any gaps in the numbering #Have the program rename all the later files to close this gap. import os,shutil,re def FindFile(prefix,folder): #get the absolute path of the folder folder=os.path.abspath(...
DrakeChow3/Stupid-stuff
Script1/PreFix.py
PreFix.py
py
1,555
python
en
code
0
github-code
13
1067217289
from flask import redirect,Flask, render_template, request, url_for import sqlite3 import datetime app = Flask(__name__) def add_database(fro,to,f_credit,t_credit,amount): con = sqlite3.connect('database.db') cur = con.cursor() try: cur.execute("UPDATE users SET credit=? WHERE email=?", [int(f_cr...
manishkumar212111/sparks_internship
app.py
app.py
py
5,222
python
en
code
0
github-code
13
26771122238
from .controltypes import Types from .curtain import Curtain class MinimunVentilation(object): def __init__(self): self._abrefecha = 30 self._aberto = 40 self._fechado = 180 self._limite = 30 self._state = Types.VM_INITIAL_STATE self._time = 0 self._curtain ...
gitandlucsil/curtain_temperature_control
models/minimum_ventilation.py
minimum_ventilation.py
py
3,294
python
en
code
0
github-code
13
25714482062
import numpy as np import matplotlib.pyplot as plt from PIL import Image, ImageDraw import turtle # Sierpinski Set class SierpinskiSet: def __init__(self, depth=5): self.depth = depth def draw_sierpinski(self, t, length, depth): if depth == 0: for _ in range(3): t.fo...
RickysChocolateBox/artificial_brain
ProtoBrainModel/SierpinskiSetclass.py
SierpinskiSetclass.py
py
1,031
python
en
code
0
github-code
13
9087635290
#https://www.acmicpc.net/problem/16194 #백준 16194번 카드 구매하기 2 (DP) #import sys #input = sys.stdin.readline n = int(input()) cards = [0]+list(map(int, input().split())) for i in range(1,n+1): for j in range(i//2,i): cards[i] = min(cards[i], cards[i-j]+cards[j]) print(cards[n]) #속도면에서 개선하기 위해서는 불필요한...
MinsangKong/DailyProblem
07-03/3-2.py
3-2.py
py
402
python
ko
code
0
github-code
13
27187945803
import sys from collections import deque input = sys.stdin.readline def bfs(s): queue = deque() queue.append(s) visited = [[[0] * (K + 1) for _ in range(M)] for _ in range(N)] visited[s[0]][s[1]][K] = 1 while queue: n = queue.popleft() di, dj = [0, 1, 0, -1], [1,...
Nam4o/Algorithm
백준/Gold/14442. 벽 부수고 이동하기 2/벽 부수고 이동하기 2.py
벽 부수고 이동하기 2.py
py
1,145
python
en
code
1
github-code
13
42798354745
import argparse, os, subprocess, string, sys from elftools.elf.elffile import ELFFile def parse_args(): p = argparse.ArgumentParser() p.add_argument('--datadir', required=True) args = p.parse_args() return args # -------------------------------->% POSITIVES = [0.55, 0.6, 0.65, 0.7, 0.75, 0.8, 0.85, 0.9, 0....
B2R2-org/FunProbe
param/report.py
report.py
py
4,173
python
en
code
3
github-code
13
17938824746
import asyncio from io import BytesIO import discord import pandas as pd from plotly import express as px from economytrack.abc import MixinMeta class PlotGraph(MixinMeta): async def get_plot(self, df: pd.DataFrame, y_label: str) -> discord.File: return await asyncio.to_thread(self.make_plot, df, y_labe...
vertyco/vrt-cogs
economytrack/graph.py
graph.py
py
927
python
en
code
33
github-code
13
70624498258
import re class FilterMiddleware(object): def process_request(self, request): request.GET = request.GET.copy() filters_dict = {} removed_keys = [] for key in request.GET: if key.startswith('filter['): match = re.match( r'filter\[(.*?...
anehx/anonboard-backend
jsonapi/middleware.py
middleware.py
py
604
python
en
code
0
github-code
13
43813281073
#这是datacleaning的完整运行文件,先仅限于2014-11-30.txt这一个文件,测试一下速度 #bisai2excel即便是单场比赛也有5240次变盘,写入excel非常缓慢 #即便转成json,单场比赛写入后的文件居然有400M,因为拆分后每张表的keys都要重复一遍,这样就变得很大 #应该想办法把数据缩小,比如看能不能用多维数组之类的 #尝试用xarray然后以netCDF格式(.nc)存储,但是出了个问题,float object has no attribute 'encode' #可能是因为数据集里有缺失值nan被当做字符串了,但是后面又有浮点数据,所以出错。 #只要设一个frametime作为索...
Utschie/ML_Monitoring_Trade
Apocalypse/datacleaning_1.0.py
datacleaning_1.0.py
py
4,155
python
zh
code
0
github-code
13
10336343860
#!/usr/bin/env python3 import argparse import asyncio import logging import socket import socketserver import threading from db_operation import * from database import db from flask import g def get_db(): if 'db' not in g: g.db = connect_to_database() return g.db LOG = logging.getLogger(logging.basi...
johnstcn/cs7ns6groupF
booking/ipc.py
ipc.py
py
10,822
python
en
code
1
github-code
13
17055791894
#!/usr/bin/env python # -*- coding: utf-8 -*- import json from alipay.aop.api.constant.ParamConstants import * from alipay.aop.api.domain.MemberCardTemplateAuxiliaryItem import MemberCardTemplateAuxiliaryItem from alipay.aop.api.domain.MemberCardTemplateHeaderConfig import MemberCardTemplateHeaderConfig from alipay.ao...
alipay/alipay-sdk-python-all
alipay/aop/api/domain/MemberCardTemplateConfig.py
MemberCardTemplateConfig.py
py
5,222
python
en
code
241
github-code
13
12702637524
''' Check whether a element entered by a user is present in the array or not. ''' def search_in_array(arr): element = int(input('enter the number to search: ')) for i in range(len(arr)): if element == arr[i]: return True else: return False if __name__ == '__main__': n = i...
Mayur-Debu/Datastructures
Array/Basic/Exercise_2.py
Exercise_2.py
py
449
python
en
code
0
github-code
13
26802304612
from __future__ import print_function import scripts_helper import json from keras.models import model_from_json from deepmoji.model_def import deepmoji_architecture, load_specific_weights from deepmoji.global_variables import RAW_DATA_PATH, MODEL_DATA_PATH, \ STOCKTWITS_DATA_PATH, ORIGINAL_DATA_PATH, PROCESSED_DAT...
dballinari/DeepMoji-StockTwits-Classifier
scripts/predict_sentiment.py
predict_sentiment.py
py
11,175
python
en
code
1
github-code
13
41567663691
def solution(p): if not p: return "" u, v = split_p(p) if correct(u): return u + solution(v) else: answer = '(' + solution(v) + ')' u = u[1:-1] u = reverse(u) answer += u return answer def split_p(p): left_count = 0 right_cou...
bnbbbb/Algotithm
프로그래머스/lv2/60058. 괄호 변환/괄호 변환.py
괄호 변환.py
py
901
python
en
code
0
github-code
13
19749816046
# coding: utf-8 # In[8]: import pandas as pd import preprocess_picanet import os # In[1]: def airways(row): if row['InvVentET'] == True or row['InvVentTT'] == True or row['Niv'] == True or row['AvsJet'] == True or row['AvsOsc'] == True or row['AsthmaIVBeph'] == True...
conorhaynesm/CodeLesson1
activity_picanet.py
activity_picanet.py
py
3,823
python
en
code
0
github-code
13
12941229568
def execute(numofnodes, node_connections): graph = create_dictionary(numofnodes, node_connections) traverse(graph) def create_dictionary(numofnodes, node_connections): graph = {} for node in range(numofnodes): graph[node] = [] for conn in node_connections: graph[conn[0]]....
kaushik84/python_code_examples
Graph_traverse.py
Graph_traverse.py
py
758
python
en
code
0
github-code
13
3726115590
from garage.envs import PointEnv from garage.tf.algos.rl2 import RL2Env class TestRL2Env: # pylint: disable=unsubscriptable-object def test_observation_dimension(self): env = PointEnv() wrapped_env = RL2Env(PointEnv()) assert wrapped_env.spec.observation_space.shape[0] == ( ...
jaekyeom/IBOL
garaged/tests/garage/envs/test_rl2_env.py
test_rl2_env.py
py
728
python
en
code
28
github-code
13
7525302120
import cv2 import numpy as np import torch # Load the YOLOv5 model using torch.hub.load model = torch.hub.load('ultralytics/yolov5', 'yolov5s') # Set the device to 'cuda' if available, otherwise use 'cpu' device = torch.device('cuda' if torch.cuda.is_available() else 'cpu') model.to(device) # Create a Kalman filter ...
MidlajN/OpenCV
object_tracking/kalman_filter.py
kalman_filter.py
py
2,282
python
en
code
0
github-code
13
21928522258
# ------ # # Utils for PlantUML format # ------ # # In this file there are functions, classes or variables that are used widely # in the GitHub actions of this repository and imported accordingly in other # scripts. # - # # System imports # - # import json import os from typing import Union from json_manipulation ...
EbiEga/ega-metadata-schema
.github/scripts/utils/plantuml_format.py
plantuml_format.py
py
7,010
python
en
code
4
github-code
13
73503639376
import requests from LedgerBoardApp.models import Node import time #distributes a new post or block to all known nodes def distributeEntity(dataArray, type, originHost, selfHost): urlAddition = "" payload = {} if type == "block": urlAddition = "/newBlock/" payload = { 'in...
basilthebeagles/LedgerBoard
LedgerBoardApp/helperFunctions/distributeEntity.py
distributeEntity.py
py
1,781
python
en
code
0
github-code
13
43263383112
from collections import Counter n = int(input()) a = list(map(int, input().split())) mod = 10 ** 9 + 7 cnt = Counter(a) if any(n % 2 == i % 2 for i in cnt): print(0); exit() if any(cnt[i] != 2 for i in cnt if i != 0): print(0); exit() print(pow(2, n // 2, mod))
Shirohi-git/AtCoder
arc058-/arc066_a.py
arc066_a.py
py
272
python
en
code
2
github-code
13
70502037778
from chat.models import Chat def getNumUnreadChatsForAccount(accountId): buyerChats = Chat.objects.filter( buyer__pk=accountId ).filter(hasUnreadBuyer=True) sellerChats = Chat.objects.filter( item__seller__pk=accountId ).filter(hasUnreadSeller=True) return len(buyerChats) + len(s...
vanshg/Bakkle
www/bakkle/common/methods.py
methods.py
py
332
python
en
code
0
github-code
13
73098271056
""" This file contains the definition of the SMPL model forward: using pose and beta calculate vertex location function get joints: calculate joints from vertex location """ from __future__ import division from numpy.core.defchararray import array import cv2 import torch import torch.nn as nn import numpy as np try:...
climbingdaily/SLOPER4D
smpl/smpl.py
smpl.py
py
6,214
python
en
code
58
github-code
13
2920602976
import csv from statistics import mean csvpath = '/Users/Zhisen/Downloads/budget_data.csv' with open(csvpath, 'r') as csvfile: budget = csv.reader(csvfile, delimiter=',') header = next(budget) month_count = 0 total_net = 0 profit_list = [] month_list = [] for row in budget: month_co...
Zhisen/python-challenge
PyBank/main.py
main.py
py
1,804
python
en
code
0
github-code
13
26785879472
import numpy as np import cv2 from mss import mss from PIL import Image from Projects.DinoGame.ScreenRecorder import ScreenRecorder from Projects.DinoGame.DinoWorld import DinoWorld import Projects.DinoGame.KeyboardSim as KeyboardSim import timeit from Classification.NonLinear.NeuralNetwork.FeedForwardNN import FeedFor...
peterhusisian/MLExperiments
Projects/DinoGame/ChromeDinoGameBot2.py
ChromeDinoGameBot2.py
py
6,462
python
en
code
0
github-code
13
9063296083
import sys input = sys.stdin.readline # n, m을 입력받음 n, m = map(int, input().split()) # 이름이 key인 딕셔너리 book1 = {} # 번호가 key인 딕셔너리 book2 = {} # 포켓몬 이름을 입력받고 딕셔너리 생성 for i in range(1, n + 1): i = str(i) s = input().rstrip() book1[s] = i book2[i] = s # 출력문 생성을 위한 리스트 str_list = [] # 리스트에 딕셔너리를 이용해 출력문을 넣...
yudh1232/Baekjoon-Online-Judge-Algorithm
1620 나는야 포켓몬 마스터 이다솜.py
1620 나는야 포켓몬 마스터 이다솜.py
py
676
python
ko
code
0
github-code
13
32904747255
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import models # Create your models here. class bmrtable(models.Model): gender_choices = ( ('m' , "Male"), ('f', 'Female') ) age = models.IntegerField() height = models.DecimalField(max_digits=4, dec...
SnehaDL/MET-Calculator
simple/models.py
models.py
py
1,173
python
en
code
0
github-code
13
318845839
# Renders a 2D model into a PPM image import sys import numpy as np from commands.draw_line import draw_line from commands.polyline import polyline from commands.polygon import polygon from commands.change_color import change_color from commands.paint_screen import paint_screen from commands.matrix import set_matrix, ...
gnsoares/UNICAMP_EA979_ComputerGraphics
lab01_2DDrawing/draw_2d_model.py
draw_2d_model.py
py
4,803
python
en
code
0
github-code
13
3041308761
from maze import * import random class Player: def __init__(self): self.location = (29,21) self.moves = [] # n is how many moves def randomMoves(self, n): for i in range(n): self.moves.append(random.randint(0,3)) if __name__ == '__main__': p = Player() p.randomM...
cjaltic/Personal
maze evolution/player.py
player.py
py
351
python
en
code
0
github-code
13
71087170257
''' segments.py segments an image using image segmentation algorithms (currently felzenszwalb or slic) and returns those segments as transparent pngs. ''' import numpy as np import os import os.path from collagen import utils from PIL import Image, ImageOps from random import choice from skimage.segmentation import f...
r3vl1s/collagen
collagen/segments.py
segments.py
py
2,538
python
en
code
0
github-code
13
67336302
import re def parse(inpath): with open(inpath, 'r') as input: results = {} for i, line in enumerate(input): try: date = re.split('\t', line)[14] year = int(re.split('/', date)[0]) try: r...
xescape/scripts
misc/SequenceNumberCounter.py
SequenceNumberCounter.py
py
1,096
python
en
code
0
github-code
13
14357051892
import os,json from time import gmtime, strftime, sleep #Configuer au prealable la commande cli aws avec votre API SECRET KEY et aussi la region souhaité #Voir https://docs.aws.amazon.com/cli/latest/index.html FILE_CREATION_IP = "ip.json" GOOD_FILE = 'good.log' BAD_FILE = 'bad.log' API_TELEGRAM_API_KEY = "" #OBLIGAT...
franckkragbe/bounty
verif.py
verif.py
py
2,227
python
en
code
0
github-code
13
20674769941
def hello(): print("Greetings, python user!") def pack(param1, param2, param3): print([param1, param2, param3]) return [param1, param2, param3] def eat_lunch(list_input): if len(list_input) == 0: print("My lunchbox is empty") elif len(list_input) ==1: print("First I eat", list_inpu...
alicia-marie/local-python-setup
function_practice.py
function_practice.py
py
592
python
en
code
0
github-code
13
35661055650
from django.core.paginator import Paginator from django.shortcuts import render, redirect from AIProjektZaliczeniowy.settings import MEDIA_URL from Backend.forms import PicForm from Backend.detect_face_image import detect_image from Backend.models import Pic def index(request): media_url = MEDIA_URL form = P...
jakubmisiak/AIProject
Backend/views.py
views.py
py
909
python
en
code
0
github-code
13
70609614738
''' Spark Custom Environment with the following modules: vector-spark-module-py vector-spark-module-r foundry_ml geopy keras python r-base seaborn spacy spacy-model-en_core_web_md tensorflow ''' def acled_cleaned(ds_1900_01_01_2022_03_21_Middle_East_Iraq_Syria): # discard columns that are only known after the fac...
decoy0ctopus/ACLED_Spacy_Entity_Recognition_Foundry
analysis.py
analysis.py
py
1,835
python
en
code
0
github-code
13
17048235684
#!/usr/bin/env python # -*- coding: utf-8 -*- import json from alipay.aop.api.constant.ParamConstants import * from alipay.aop.api.domain.ReferenceId import ReferenceId from alipay.aop.api.domain.ReferenceId import ReferenceId class AnttechBlockchainDefinSaasPaymentCheckModel(object): def __init__(self): ...
alipay/alipay-sdk-python-all
alipay/aop/api/domain/AnttechBlockchainDefinSaasPaymentCheckModel.py
AnttechBlockchainDefinSaasPaymentCheckModel.py
py
3,704
python
en
code
241
github-code
13
31942281480
from collections import defaultdict from typing import List """ 方法一:并查集 思路及解法 既然可以任意地交换通过“索引对”直接相连的字符,那么我们也任意地交换 通过“索引对”间接相连的字符。我们利用这个性质将该字符串抽象:将每 一个字符抽象为“点”,那么这些“索引对”即为“边”,我们只需要维护这个 “图”的连通性即可。对于同属一个连通块(极大连通子图)内的字符,我们 可以任意地交换它们。 这样我们的思路就很清晰了:利用并查集维护任意两点的连通性,将同属一个 连通块内的点提取出来,直接排序后放置回其在字符串中的原位置即可。 """ # @lc code=star...
wylu/leetcodecn
src/python/p1200to1299/1202.交换字符串中的元素.py
1202.交换字符串中的元素.py
py
2,043
python
zh
code
3
github-code
13
14658412694
# -*- coding: utf-8 -*- """ Created on Thu Apr 5 14:38:22 2018 @author: luiss """ from numpy import empty, zeros, full, sqrt, cos, sin, pi from random import random, randint, seed from pylab import figure, plot, show # subplot(111) # subplot(111).clear() # pause # pasos(m) distancia(dr) # 100 5-20 # 200...
luisizq/Advanced_Physics_Computing
Assignment 6- Diffusive-limitted-aggregation/practica6_DAL_version1.py
practica6_DAL_version1.py
py
1,737
python
en
code
0
github-code
13
26348805770
from lib.income_statement import IncomeStatement from lib.balance_sheet import BalanceSheet from lib.cashflow import Cashflow from lib.key_ratio import KeyRatio from lib.quote import Quote from lib.util import log from lib.dcf import DCF from lib import plot_tool import pandas as pd class Business(): def __init__(...
jpsiyu/stock-analysis
lib/business.py
business.py
py
4,279
python
en
code
0
github-code
13
43822427075
import jieba import jieba.analyse class Segment(object): def __init__(self): self.seg_list = '' def cut(self, string_): # 返回的是 generator self.seg_list = jieba.cut(string_) # 默认是精确模式 return self.seg_list def extract_keywords(self, string_): # 返回的是 list # j...
tanx-code/levelup
howtorap/utils/scanner.py
scanner.py
py
697
python
en
code
0
github-code
13
73257321296
from collections import OrderedDict values = ["I", "IV", "V", "IX", "X", "XL", "L", "XC", "C", "CD", "D", "CM", "M"] keys = [1, 4, 5, 9, 10, 40, 50, 90, 100, 400, 500, 900, 1000] digits = OrderedDict(zip(keys[::-1], values[::-1])) def dec2rom(i): res = '' while i > 0: for k in digits.keys(): ...
chisler/basic_algorithms
roman_numerals/dec_2_roman.py
dec_2_roman.py
py
486
python
en
code
0
github-code
13
8972180408
from luigi import Parameter, BoolParameter from luigi.contrib.s3 import S3Target from ob_pipelines import LoggingTaskWrapper from ob_pipelines.apps.kallisto import merge_column from ob_pipelines.config import settings from ob_pipelines.entities.persistence import get_samples_by_experiment_id from ob_pipelines.pipeline...
outlierbio/ob-pipelines
ob_pipelines/tasks/merge_kallisto.py
merge_kallisto.py
py
1,700
python
en
code
11
github-code
13
25102867716
''' count_change(amount, kinds_of_coins) which returns the number of ways to return change for a given amount n. The change can be returned using coins worth 100 cents, 50 cents, 20 cents, 10 cents, 5 cents or 1 cent. For example, count_change(5,2) refers to the number of ways to get 5 cents using only 5-cents and 1-...
bleow/CZ1103-IntroToCS_Python
aengus.py
aengus.py
py
3,349
python
en
code
0
github-code
13
72686140818
""" --- Part Two --- It turns out that this circuit is very timing-sensitive; you actually need to minimize the signal delay. To do this, calculate the number of steps each wire takes to reach each intersection; choose the intersection where the sum of both wires' steps is lowest. If a wire visits a position on the g...
jat255/advent_of_code
03/puzz2.py
puzz2.py
py
4,688
python
en
code
0
github-code
13
8642235852
# ISO3166 python dict # oficial list in http://www.iso.org/iso/iso_3166_code_lists countries = { 'AF': 'AFGHANISTAN', 'AX': 'ÅLAND ISLANDS', 'AL': 'ALBANIA', 'DZ': 'ALGERIA', 'AS': 'AMERICAN SAMOA', 'AD': 'ANDORRA', 'AO': 'ANGOLA', 'AI': 'ANGUILLA', 'AQ': 'ANTARCTICA', 'AG': 'ANTIGUA AND BARBUDA', 'AR': 'AR...
hmiguel/covid
data.py
data.py
py
9,976
python
es
code
0
github-code
13
73617093777
#!/usr/bin/env python3 from flask import Flask, render_template, send_from_directory, make_response, request from flask_mail import Mail, Message import json import os from flask_sslify import SSLify # Change this to False to switch to production mode and force https ALLOW_HTTP = True app = Flask(__name__, static_ur...
ujagaga/audioSampler
sampler.py
sampler.py
py
3,160
python
en
code
0
github-code
13