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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
18143624809 | # // Input
# // 文字列が1行に与えられます。
# // Output
# // 与えられた文字列の小文字と大文字を入れ替えた文字列を出力して下さい。アルファベット以外の文字はそのまま出力して下さい。
line = 'fAIR, LATER, OCCASIONALLY CLOUDY.'
line = input()
output = ''
for i in range(len(line)):
if line[i].isupper():
output += line[i].lower()
elif line[i].islower():
output += line[i].... | Aasthaengg/IBMdataset | Python_codes/p02415/s333326186.py | s333326186.py | py | 522 | python | ja | code | 0 | github-code | 90 |
70085775016 | # Lab08_v4 - Guess the number
import random
# Computer picks a number
comp_choice = random.randint(1,10)
counter = 0
user_choice = 0
last_guess_target = 11
current_guess_target = 0
result =''
# Get user input/Evaluate
while user_choice != comp_choice:
counter += 1
user_choice = 0
while user_choice not i... | jaeceetee/PDX-Code-Guild---Python-Fullstack-Solutions | python/Lab08_v4.py | Lab08_v4.py | py | 1,321 | python | en | code | 0 | github-code | 90 |
5618858381 |
# -*- coding: utf-8 -*-
import numpy as np
import argparse
import cv2
# 构造解析器解析参数
ap =argparse.ArgumentParser()
ap.add_argument("-i","--image",required=True,help="Path to the image")
args = vars(ap.parse_args())
#加载图像并且显示它
image = cv2.imread(args["image"])
cv2.imshow("Original",image)
# 裁剪图像就使用阵列切片一样简单
# 在NumP... | Chentao2000/practice_code | Python_OpenCV/(Practical-Python-and-OpenCV_book1)/ch6/6_13_crop.py | 6_13_crop.py | py | 607 | python | zh | code | 0 | github-code | 90 |
33453415408 | # Візуалізація задачі "Кидок тіла під кутом до горизонту в безповітряному просторі"
# created by NickIT87
import matplotlib.patches as mpatches # імпорт mpl для відображення "легенди"
import matplotlib.pyplot as plt # программний об'єкт для відображення графіку
import numpy as np # біблі... | NickIT87/school | 10b/openLesson/main_task.py | main_task.py | py | 4,454 | python | uk | code | 2 | github-code | 90 |
25446307684 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
-------------------------------
Layer cleanup and outer contour
-------------------------------
Author: Jordan Cave
-------------------------------
"""
import numpy as np
import pickle
import math
import matplotlib.pyplot as plt
from matplotlib.path import Path
from ... | Jcaveee/DED_ProcPlan | pathing.py | pathing.py | py | 7,230 | python | en | code | 0 | github-code | 90 |
24824527485 | from typing import List
from app.database import get_session
from app.models import Delivery, DeliveryCreate, Drone, DroneState, Medication
from fastapi import APIRouter, Depends, HTTPException, status
from sqlalchemy.ext.asyncio import AsyncSession
from sqlmodel import and_, or_, select
router = APIRouter(prefix="/d... | codeshard/drones-api | drones/app/routers/deliveries.py | deliveries.py | py | 3,837 | python | en | code | 2 | github-code | 90 |
37119212833 | # 1. 构建树
# 我们先构建一棵简单的树:
class TreeNode:
def __init__(self, x):
self.val = x
self.left = None
self.right = None
a = TreeNode(1)
b = TreeNode(2)
c = TreeNode(3)
d = TreeNode(4)
e = TreeNode(5)
f = TreeNode(6)
g = TreeNode(7)
a.left = b
a.right = c
b.left = d
b.right = e
c.left = ... | nanw01/python-algrothm | Python Algrothm Advanced/practice/140100tree.py | 140100tree.py | py | 2,833 | python | en | code | 1 | github-code | 90 |
30930477936 | from django.contrib import admin
from .models import Item, Discount, Order
@admin.register(Item)
class ItemAdmin(admin.ModelAdmin):
list_display = ['id', 'name', 'price']
list_display_links = ['id', 'name']
list_filter = ['name', 'price']
search_fields = ['name']
save_on_top = True
save_as = T... | Novak1656/Payment_API | payment_system/payment_app/admin.py | admin.py | py | 870 | python | en | code | 0 | github-code | 90 |
13609610899 | #
# abc182 c
#
import sys
from io import StringIO
from sys import float_repr_style
import unittest
class TestClass(unittest.TestCase):
def assertIO(self, input, output):
stdout, stdin = sys.stdout, sys.stdin
sys.stdout, sys.stdin = StringIO(), StringIO(input)
resolve()
sys.stdout.s... | mskt4440/AtCoder | abc182/c.py | c.py | py | 1,339 | python | en | code | 0 | github-code | 90 |
27176572028 |
import pandas as pd
import tensorflow as tf
import numpy as np
from sklearn.model_selection import train_test_split
from sklearn import preprocessing
import matplotlib.pyplot as plt
from sklearn.metrics import accuracy_score
# df = pd.read_csv('D:/works_tf/test_tensorflow1.x/test_data/Batting.csv')
# print(df.count(... | venuspink/test_tensorflow1.x | linear_regression_test.py | linear_regression_test.py | py | 3,113 | python | en | code | 0 | github-code | 90 |
73176624935 | import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import seaborn as sns
payment = pd.read_csv("payment_data.csv")
customer = pd.read_csv("customer_data.csv")
payment.isnull().sum()
payment1 = payment.drop(columns=['prod_limit','report_date','update_date'])
payment1.info()
payment1['highest_balance'... | Sricharan7113/Fullstack-Futura | model.py | model.py | py | 2,525 | python | en | code | 0 | github-code | 90 |
21858046669 | from sys import stdin
input = stdin.readline
n = int(input())
wei, val = [], []
for _ in range(n):
w, v = map(int, input().split())
wei.append(w)
val.append(v)
d = [[0, 1]] * (n + 1)
print(d)
# d[1]
# for idx in range(1, n + 1):
# d = [[0 for i in range(n + 1)] for _ in range(n + 1)]
# for i in range... | dlams/Algorithm-Practice | Backjoon/14000/14501 퇴사.py | 14501 퇴사.py | py | 577 | python | en | code | 1 | github-code | 90 |
18430209339 | import sys
stdin = sys.stdin
sys.setrecursionlimit(10**6)
ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
nn = lambda: list(stdin.readline().split())
ns = lambda: stdin.readline().rstrip()
n = ni()
print(n*(n-1)//2-n//2)
for i in range(n):
a = n-1-i if n%2 == 0 else n-2-i
for j in... | Aasthaengg/IBMdataset | Python_codes/p03090/s466848027.py | s466848027.py | py | 380 | python | en | code | 0 | github-code | 90 |
18109881449 | from queue import deque
def main():
n, q = tuple(map(int, input().split(' ')))
task_q = deque()
for idx in range(n):
l = input().split(' ')
task_q.append((l[0], int(l[1])))
tot_time = 0
while len(task_q) != 0:
task = task_q.popleft()
if task[1] > q:
ta... | Aasthaengg/IBMdataset | Python_codes/p02264/s589866628.py | s589866628.py | py | 475 | python | en | code | 0 | github-code | 90 |
18317328869 | from numpy import cumsum
n = int(input())
a = list(map(int, input().split()))
l = sum(a)
s = cumsum(a)
c = l*2
for i, x in enumerate(a):
d = abs(s[i] * 2 - l)
c = min(d, c)
print(c)
| Aasthaengg/IBMdataset | Python_codes/p02854/s617895075.py | s617895075.py | py | 192 | python | en | code | 0 | github-code | 90 |
38427903369 | import matplotlib.pyplot as plt
import pandas as pd
# 房价数据集
from sklearn.datasets.california_housing import fetch_california_housing
housing = fetch_california_housing()
print(housing.data.shape)
print(housing.data[0])
from sklearn import tree
dtr = tree.DecisionTreeRegressor(max_depth=2)
dtr.fit(housing.data[:,[6,7]... | w4087165/Machine-Learning-Algorithm | 决策树.py | 决策树.py | py | 1,551 | python | en | code | 0 | github-code | 90 |
8860241052 | import torch
import torch.nn as nn
def _make_simple_block(in_features, out_features, drop_rate=0.0):
layers = [
nn.BatchNorm2d(in_features),
nn.ReLU(inplace=True),
nn.Conv2d(in_features, out_features, kernel_size=3, padding=1, bias=False),
]
if drop_rate > 0.0:
layers.appen... | ychebotarev/yutils | src/yutils/nn/models/densenet.py | densenet.py | py | 3,760 | python | en | code | 0 | github-code | 90 |
17960898489 | from sys import stdout
printn = lambda x: stdout.write(str(x))
inn = lambda : int(input())
inl = lambda: list(map(int, input().split()))
inm = lambda: map(int, input().split())
ins = lambda : input().strip()
DBG = True # and False
BIG = 999999999
R = 10**9 + 7
from collections import defaultdict
def ddprint(x)... | Aasthaengg/IBMdataset | Python_codes/p03618/s121570155.py | s121570155.py | py | 556 | python | en | code | 0 | github-code | 90 |
23563253885 | from django.shortcuts import render
from django.views.generic import View
from django.http import HttpResponse
from .forms import UserUniForm
# Create your views here.
class RegisterUser(View):
NAME = "register_page"
URL = "register/"
URL_PATTERN = URL + "<int:id>"
TEMPLATE_PATH = "signup.ht... | dennyown/uni_bot | uni/bot/views.py | views.py | py | 1,248 | python | en | code | 0 | github-code | 90 |
11760717489 | from bert4keras.snippets import sequence_padding, DataGenerator
import os
import json
from tqdm import tqdm
import pandas as pd
import numpy as np
import re
from matplotlib import pyplot as plt
import glob
def read_txt(filename, use_line=True):
"""
读取 txt 数据
filename : str
use_line : bool
return ... | wolfVbx/ccf-ner | DBC_code/src/test.py | test.py | py | 21,097 | python | en | code | 0 | github-code | 90 |
15695248600 | import os.path
import socket
class Config:
def __init__(self):
self.versionstring = 'v0.0'
# from line which will be put on the report send
self.reportFrom = 'HUDORA Mail System <postmaster@hudora.de>'
# enverlope sender for reports. Bounces will go there
self.reportSender ... | mdornseif/BlackBamBoO | config.py | config.py | py | 1,335 | python | en | code | 2 | github-code | 90 |
19213034151 | import unittest
from client3 import *
class ClientTest(unittest.TestCase):
def test_getDataPoint_calculatePrice(self):
quotes = [
{'top_ask': {'price': 121.2, 'size': 36}, 'timestamp': '2019-02-11 22:06:30.572453', 'top_bid': {'price': 120.48, 'size': 109}, 'id': '0.109974697771', 'stock': 'ABC'},
{'... | cmarian/JPMC-tech-task-1-PY3 | client_test.py | client_test.py | py | 2,260 | python | en | code | null | github-code | 90 |
18292416779 | def abc_150b():
n = input()
s = input()
cnt = 0
for i in range(len(s) - 2):
if s[i : i + 3] == 'ABC':
cnt += 1
print(cnt)
if __name__ == '__main__':
abc_150b() | Aasthaengg/IBMdataset | Python_codes/p02812/s764223387.py | s764223387.py | py | 206 | python | en | code | 0 | github-code | 90 |
44554418717 | """
Merge Sorted Array
You are given two integer arrays nums1 and nums2, sorted in non-decreasing order, and two integers m and n, representing the number of elements in nums1 and nums2 respectively.
Merge nums1 and nums2 into a single array sorted in non-decreasing order.
The final sorted array should not be returne... | kpham841/LeetCode_Python | Array/Merge_Sorted_Arrays.py | Merge_Sorted_Arrays.py | py | 3,717 | python | en | code | 0 | github-code | 90 |
38528778218 | # GYM MANAGEMENT SYSTEM BY PEACE OLORUNTOBA C.E.O. PEASCAINC
# You can contact me on gmail @ profprincepeace@gmail.com or peascainc@gmail.com
# You can also call me or whatsapp me on +2348166846226
# Generated by Django 3.2 on 2021-07-23 17:19
from django.db import migrations, models
class Migration(migrations.Migr... | PeaceOloruntoba/Gym-Management-System | GMS/main/migrations/0010_auto_20210723_2249.py | 0010_auto_20210723_2249.py | py | 750 | python | en | code | 2 | github-code | 90 |
72047269417 | # -*- encoding:utf-8 -*-
from django.shortcuts import render, RequestContext,render_to_response,redirect
from django.core.paginator import Paginator, EmptyPage, PageNotAnInteger
from collections import Counter
from bs4 import BeautifulSoup
from movies.models import Movie,Tag
import re,urllib2
import cPickle
from djang... | fukuta0614/fc2_ranking_django | movies/views.py | views.py | py | 2,527 | python | en | code | 0 | github-code | 90 |
74761194857 | # MIMO - 03 - Declarações Condicionais - DESAFIO 3
# A entrada em determinados estabelecimentos como uma discoteca depende de ultrapassar o limite de idade e de ter reserva. Vamos escrever um programa Python para verificar se uma pessoa pode entrar.
idade = 21
tem_reserva = True
resultado = False
# Tarefa 1: Se idade... | dualsgo/meus-estudos | mimo_app/Desafios/03_desafio_3.py | 03_desafio_3.py | py | 539 | python | pt | code | 0 | github-code | 90 |
35189899173 | from strawberry.core.database.mongitude.base import connection, documents, schema, encoders
from bson import ObjectId
import datetime
class LikesDocument(documents.RevisionedDocument):
class Meta(object):
required_fields = []
indexes = {'username':
{
... | miketheprogrammer/strawberrypy | application/documents.py | documents.py | py | 2,343 | python | en | code | 2 | github-code | 90 |
27642273047 | import tensorflow as tf
import numpy as np
state = tf.Variable(0, name='counter')
one = tf.constant(1)
new_value = tf.add(state, one)
update = tf.assign(state, new_value)
init_op = tf.global_variables_initializer() # 启动图,对op进行初始化
with tf.Session() as sess:
sess.run(init_op)
print(sess.run(state))
for _ i... | Manfestain/MLcombat | WithTensorflow/demo01.py | demo01.py | py | 826 | python | en | code | 1 | github-code | 90 |
12973380098 | #!/usr/bin/env python
# -*- coding: UTF-8 -*-
'''
get paths of stereo dataset
'''
import os
import glob
import logging
#logging.basicConfig(level=logging.DEBUG, format=' %(asctime)s - %(levelname)s - %(message)s')
logging.basicConfig(level=logging.INFO, format=' %(asctime)s - %(levelname)s - %(message)s')
class path... | hlincer/DSMnet | myDatasets_stereo/stereo_paths.py | stereo_paths.py | py | 12,717 | python | en | code | 0 | github-code | 90 |
18379040159 | N, L = map(int, input().split())
if L >= 1:
eat = L
elif L+N-1 <= -1:
eat = L+N-1
else:
eat = 0
taste = eat*(-1)
for i in range(N):
taste += L+i
print(taste) | Aasthaengg/IBMdataset | Python_codes/p02994/s130225952.py | s130225952.py | py | 168 | python | en | code | 0 | github-code | 90 |
17971144699 | # -*- coding: utf-8 -*-
import sys
sys.setrecursionlimit(10**9)
INF=10**18
MOD=10**9+7
input=lambda: sys.stdin.readline().rstrip()
YesNo=lambda b: bool([print('Yes')] if b else print('No'))
YESNO=lambda b: bool([print('YES')] if b else print('NO'))
int1=lambda x:int(x)-1
def main():
H,W=map(int,input().split())
... | Aasthaengg/IBMdataset | Python_codes/p03638/s784181438.py | s784181438.py | py | 1,008 | python | en | code | 0 | github-code | 90 |
18308642859 | n = int(input())
if n%1.08==0:
print(int(n//1.08))
else:
x_init=n//1.08 + 1
x_n = int(1.08*x_init)
if x_n ==n:
print(int(x_init))
else:
print(':(') | Aasthaengg/IBMdataset | Python_codes/p02842/s888161065.py | s888161065.py | py | 165 | python | en | code | 0 | github-code | 90 |
18064939619 | n = int(input())
ans = 0
bef = 0
for _ in range(n):
a = int(input())
if a == 0:
bef = 0
continue
ans += (a + bef) // 2
if (a + bef) % 2 == 1:
bef = 1
else:
bef = 0
print(ans) | Aasthaengg/IBMdataset | Python_codes/p04020/s004743116.py | s004743116.py | py | 200 | python | en | code | 0 | github-code | 90 |
19255689485 | from sys import stdin
stdin = open("./input.txt", "r")
num_of_str = int(stdin.readline())
char_list = []
word_list = set()
def dfs(cur_idx, visited, temp, cur_string_length):
visited[cur_idx] = True
temp.append(char_list[cur_idx])
cur_str = ''.join(temp)
for next_idx in range(len(char_list)):
... | ag502/algorithm | Problem/BOJ_6443_애너그램/main.py | main.py | py | 1,379 | python | en | code | 1 | github-code | 90 |
31348070848 | from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.chrome.service import Service
service_obj = Service("drivers/chromedriver_win32/chromedriver.exe")
options = webdriver.ChromeOptions()
options.add_experimental_option('excludeSwitches', ['enable-logging'])
options.add_e... | AleksGrig/selenium-python-practice | browser/cookies.py | cookies.py | py | 983 | python | en | code | 0 | github-code | 90 |
16997396901 | import matplotlib.pyplot as plt
from sklearn import datasets, svm, metrics
from sklearn.model_selection import train_test_split
digits = datasets.load_digits()
_, axes = plt.subplots(nrows=1, ncols=4, figsize=(10, 3))
for ax, image, label in zip(axes, digits.images, digits.target):
ax.set_axis_off()
ax.imsho... | tym3k1/journey_to_data_science | Learning/scikit/scikit_recognizing_hand_written_digits.py | scikit_recognizing_hand_written_digits.py | py | 1,492 | python | en | code | 0 | github-code | 90 |
5798523322 | # -*- coding: ascii -*-
from ..core import config
class DefaultBootConfigFile(config.ConfigFile):
def inherit(self,section):
if section not in self.builtins:
return "default"
return None
def __init__(self,fn=None,existing=False):
self.builtins = [ "default" ]
config.ConfigFile.__init__(self,fn,existing)... | clickbeetle/boot-update | python/modules/funtoo/boot/config.py | config.py | py | 1,627 | python | en | code | 1 | github-code | 90 |
17405136418 | from person1 import Operation
class AS3_Main(Operation):
def menu(self):
MENU ='''
+-----------------Menu------------------+
| 1.Load data from file |
| 2.Insert a new person |
| 3.Inorder traverse |
| 4.Breath fir... | nphucnguyen/python_cc1 | Algorithm/assignment3/main.py | main.py | py | 1,375 | python | en | code | 0 | github-code | 90 |
5543850262 | # 2022-08-19
# 2022-08-20
def solution(name):
answer = 0
name_list = list(name)
min_cnt = len(name_list) - 1
# 1. 각 자리수 체크
for string in name_list:
cnt = min(abs(ord(string) - ord('A')), 26 - (ord(string) - ord('A')))
answer += cnt
# 2. min 체크
for idx, string in enumer... | SteadyKim/Algorism | language_PYTHON/Programmers/Programmers_조이스틱.py | Programmers_조이스틱.py | py | 823 | python | ko | code | 0 | github-code | 90 |
2675524780 | import os
import xlrd3
#path="D:/微信文件/WeChat Files/wxid_0ky67l09jqcy21/FileStorage/File/2020-07/schema(1)/schema"
path=input("请输入文件夹地址:")
outpath=input("请输入文件夹地址,默认为输入目录下:") or path
filedir=os.listdir(path)
prop=''
for t in filedir:
updir=os.path.join(path,t)
if os.path.isfile(updir):
... | ThehopeofZC/earthquake_code_generation | readxls.py | readxls.py | py | 1,949 | python | en | code | 0 | github-code | 90 |
19254444015 | from sys import stdin, maxsize
def main():
stdin = open("Problem/BOJ_1699_제곱수의 합/input.txt", "r")
target_number = int(stdin.readline())
dp = [maxsize] * (target_number + 1)
cur_num = 1
while True:
cur_mul_num = cur_num ** 2
if cur_mul_num > target_number:
break
... | ag502/algorithm | Problem/BOJ_1699_제곱수의 합/main.py | main.py | py | 650 | python | en | code | 1 | github-code | 90 |
10532786292 | from odoo import models, fields, api
from datetime import date, datetime
class WalletWizard(models.TransientModel):
_name = "wallet.wizard"
date = fields.Date('Hasta', default=fields.Date.today(), help="Seleciona todas las Facturas hasta la fecha indicada.", required=True)
# date_cut = fields.Date('Fecha... | JoryWeb/illuminati | poi_x_toyosa_report/wizard/wallet_wizard.py | wallet_wizard.py | py | 1,556 | python | en | code | 1 | github-code | 90 |
36779242634 | '''
机器学习实战-回归
'''
from numpy import *
def loadDataSet(fileName): #general function to parse tab -delimited floats
numFeat = len(open(fileName).readline().split('\t')) - 1 #get number of fields
dataMat = []; labelMat = []
fr = open(fileName)
for line in fr.readlines():
lineArr =[]
... | hjw199089/ML_Learn_Python | ML_Learn/com/ML/Regression/Regres_Stepwise/stepWiseRegres.py | stepWiseRegres.py | py | 1,954 | python | en | code | 0 | github-code | 90 |
18987467049 | from calendar import month
import os
import requests
from datetime import date, datetime, timedelta
from database import DatabaseHandler
from truelayer import TrueLayerHandler
from dotenv import load_dotenv
load_dotenv()
CLIENT_ID = os.getenv("TRUELAYER_CLIENT_ID")
CLIENT_SECRET = os.getenv("TRUELAYER_CLIENT_SECRET... | birdalicious/FinanceDashboard | datamarshal.py | datamarshal.py | py | 7,659 | python | en | code | 0 | github-code | 90 |
14295090147 | # Myriam KIRIAKOS 1888929
# Marco NOVAES 2166579
import random
from eternity_puzzle import NORTH, SOUTH, WEST, EAST
import copy
import time
def solve_local_search(eternity_puzzle):
"""
Local search solution of the problem
:param eternity_puzzle: object describing the input
:return: a tuple (solution, ... | marco-novaes98/Eternity-II | projet-etudiants/code/solver_local_search.py | solver_local_search.py | py | 5,426 | python | en | code | 0 | github-code | 90 |
31837163799 | import torch
from torch import nn
from torchvision import transforms
import functools
from PIL import Image
import numpy as np
class ResnetBlock(nn.Module):
def __init__(self, dim, padding_type, norm_layer, use_dropout, use_bias):
"""Initialize the Resnet block
A resnet block is a conv block with... | rkhilnani9/pixel-art | model.py | model.py | py | 6,801 | python | en | code | 0 | github-code | 90 |
18063312169 | w=input()
l=[0]*26
for i in range(len(w)):
l[ord(w[i])-97]+=1
for j in range(26):
if l[j]%2==1:
print("No")
break
else:
print("Yes") | Aasthaengg/IBMdataset | Python_codes/p04012/s982039960.py | s982039960.py | py | 146 | python | en | code | 0 | github-code | 90 |
74106490215 | #!/system/bin/env python3
# These functions are meant to be used to create response
# for AJAX requests such as while saving category or item.
from flask import jsonify
def success(redirect_url='/', item_data={}):
response = {}
response['error'] = False
response['redirect_url'] = redirect_url
# Incl... | davidaik/item-catalog | response.py | response.py | py | 564 | python | en | code | 0 | github-code | 90 |
17733458834 | #Programa broma
import os
from pathlib import Path
from time import sleep
from random import randrange
import sqlite3
import re
HACKERFILE_NAME = "LEEME.txt"
def get_user_path():
return "{}/".format(Path.home())
def chaeck_steam_games(hacker_file):
steam_path = "C:\\Program Files (x86)\\Steam\\steamapps\\c... | Riche2000/Python-C1 | HScript/hackerscript.py | hackerscript.py | py | 2,887 | python | en | code | 0 | github-code | 90 |
41288078063 | import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import Axes3D
def plot_scatter(voxels, figsize=(8, 6)):
fig = plt.figure(figsize)
ax = Axes3D(fig)
x_values = voxels[:, 0]
y_values = voxels[:, 1]
z_values = voxels[:, 2]
ax.scatter(x_values, y_values, z_values)
plt.show()
def... | PsorTheDoctor/robotics | utils/utils.py | utils.py | py | 527 | python | en | code | 0 | github-code | 90 |
6142044548 | import torch
import torch.nn as nn
from torch.utils.data import DataLoader, random_split
import methods
def sinusoidal_position_embeddings(seq_length, d_model):
"""
Args:
- seq_length (int): The length of the sequence for which position embeddings are required.
- d_model (int): Dimension of the model... | thomasahle/arithmetic-transformer | model.py | model.py | py | 11,652 | python | en | code | 4 | github-code | 90 |
21628245345 | # name= " Danielle smikle"
# print(name.title())
# greet = 'ebony hubbard is too cool'
# print(greet.title())
# print(name.upper())
# print(name.lower())
first_name= 'danielle'
last_name= 'smikle'
full_name= first_name + ' ' +last_name
print(full_name)
print("Hello, " + full_name.title() + "!") | DanielleSmikle/PyPractice | name.py | name.py | py | 302 | python | en | code | 0 | github-code | 90 |
28730835270 | import pyabf
import numpy as np
import os
import glob
import json
from datetime import datetime
from dateutil.tz import tzlocal
from pynwb import NWBHDF5IO, NWBFile
from .conversion_utils import convertDataset, V_CLAMP_MODE, I_CLAMP_MODE, getStimulusSeriesClass, getAcquiredSeriesClass
class ABF1Converter:
"""
... | OpenSourceBrain/GSoC_2021_OSB_NWB | src/x_to_nwb/ABF1Converter.py | ABF1Converter.py | py | 15,018 | python | en | code | 4 | github-code | 90 |
28104396137 | import json
midic = {1:"Lapiz", 2:"Borrador", 3:"Cuaderno", 4:"Lapiz", "valor":2500}
with open("jsonDic.json", "w") as archivo:
json.dump(midic, archivo)
print("Se ha escrito en disco")
if not archivo.closed:
print("Cerrando archivo")
archivo.close()
print("Se ha cerrado el archivo") | AlejandroP75/CampusAP75 | Python/Clases/Python/C13-Archivos Json/Ejemplo de leer un archivo json.py | Ejemplo de leer un archivo json.py | py | 304 | python | es | code | 0 | github-code | 90 |
42425619809 | from turtle import forward
from numpy import size
import torch
from torch import nn
from torchvision import transforms
from torchvision import datasets
from torch.utils.data import DataLoader
import torch.nn.functional as F
import torch.optim as optim
import os
batch_size = 64
transform = transforms.Compose([
tran... | stevey350/pytorch_learning | 11_advanced_cnn.py | 11_advanced_cnn.py | py | 6,084 | python | en | code | 1 | github-code | 90 |
23474833438 | import io
import os.path
import unittest
import zipfile
from unittest import mock
from zipfile import ZipFile
from django.core import management
from django.core.management.base import CommandError
from django.test import TestCase
from agreements.management.commands import _util
from agreements.management.commands.im... | KonstantinNovizky/Financial-System | python/consumerfinance.gov/cfgov/agreements/tests/test_management.py | test_management.py | py | 2,934 | python | en | code | 1 | github-code | 90 |
14594920322 | # imports
import requests
import time
import pandas
import bs4
from bs4 import BeautifulSoup
#File Number
fileCount = 1
#Amount of jobs per city
maxResults = 100
#Job Titles
jobSet ['software+developer']
#Cities
citySet ['Sheffield']
#Loop through every city
for city in citySet:
#Loop through every Job Title... | Rs3iceman/IndeedJobScrapper | main.py | main.py | py | 3,688 | python | en | code | 1 | github-code | 90 |
32546594886 | from flask import Flask
from flask import jsonify
from flask import request
import sqlite3
app = Flask(__name__)
def db_connection():
conn = None
try:
conn = sqlite3.connect("students.sqlite")
except sqlite3.error as e:
print(e)
return conn
@app.route("/students", methods=["POST",... | volodya-wtf/flask-api-sample | app.py | app.py | py | 2,728 | python | en | code | 0 | github-code | 90 |
39543198807 | from datetime import timedelta
from statistics import mean, median
from typing import List, Dict
import matplotlib.pyplot as plt
def _time_taken(data: List[Dict]):
return [item["end_time"] - item["start_time"] for item in data]
def scan_time(timings: dict):
"""A bar graph that shows how long time each scan... | nicolaei/master | graphing/scan_time.py | scan_time.py | py | 1,990 | python | en | code | 0 | github-code | 90 |
18721399146 | from __future__ import print_function
import urllib2
import sys
#total number of arguments
total = len(sys.argv)
print(" Total number of arguments: %d", total)
# argument list
scriptName = str(sys.argv[0])
FirstArg = str(sys.argv[1])
print(" First arg:%s",FirstArg)
term = urllib2.quote("'{}'".format(FirstArg))
#log... | arunzeon/crawler-c-plus-plus | urtest.py | urtest.py | py | 687 | python | en | code | 0 | github-code | 90 |
18016495409 | N = int(input())
A = sorted(map(int, input().split()))
sum_A = sum(A)
count = N
for i in range(N - 1, -1, -1):
sum_A -= A[i]
if (sum_A) * 2 >= A[i]:
continue
else:
if (i == 0):
continue
count -= len(A[0:i])
break
print(count)
| Aasthaengg/IBMdataset | Python_codes/p03786/s986030278.py | s986030278.py | py | 284 | python | en | code | 0 | github-code | 90 |
74048717417 | import cv2
import numpy as np
from scipy.spatial.distance import cdist
import mantel
from collections import namedtuple
from contour import get_contours
SHAPE_DIFF_MAX = 8
SHAPE_WEIGHT = 0.3
IMAGE_WEIGHT = 0.3
POSITION_WEIGHT = 0.2
BACKGROUND_WEIGHT = 0.2
def _center_position(c, img):
size = img.shape
m = cv... | Guyutongxue/Graduation_Project | packages/rtlib/python/compare.py | compare.py | py | 4,549 | python | en | code | 1 | github-code | 90 |
6414146121 | import asyncio
import json
from typing import Any, List, Optional, Union
import aiohttp
from ggban.exceptions import (
Error,
Forbidden,
NotFoundError,
TooManyRequests,
UnauthorizedError,
)
from ggban.types import BanQuery, ReportQuery
class Client:
def __init__(
self,
id: in... | TheWNetwork/python-ggban-api | ggban/client.py | client.py | py | 3,679 | python | en | code | 0 | github-code | 90 |
18462212269 | '''
in
-----
7
2
9
4
5
1
6
10
'''
'''
out
-----
8
'''
from collections import defaultdict
dp = defaultdict(lambda:int(0))
N = int(input())
L = [0] * (N +2)
for i in range(0, N):
L[i] = list(map(int, input().split()))
for i in range(0, N):
for j in range(0, 3):
for k in range(0, 3):
if j ==... | Aasthaengg/IBMdataset | Python_codes/p03162/s144938033.py | s144938033.py | py | 436 | python | en | code | 0 | github-code | 90 |
74064835817 | import pandas as pd
def loadAndMergeMovieData():
'''
This function loads the movie name dataset and the user rating dataset
Returns merged dataframe with user-movie ratings
'''
rating_cols = ['user_id', 'movie_id', 'rating']
ratings = pd.read_csv('Z:/ML/DataScience/DataScience/ml-100k/u.data'... | abijithsankar/MovieRecommendationSystem | MovieRecommendationSystem.py | MovieRecommendationSystem.py | py | 3,163 | python | en | code | 0 | github-code | 90 |
25996921022 | from owlready2 import *
class Driver:
def __init__(self, driver_instance):
ins = driver_instance[0]
self.phone_number = ins.hasPhoneNumber
self.age = ins.hasAge
self.address = ins.hasAddress
self.name = ins.hasName
self.sex = ins.hasSex
def __repr__(self):
... | lengocluyen/crisismanagement | sources/models/person.py | person.py | py | 447 | python | en | code | 0 | github-code | 90 |
36779207664 | '''
机器学习实战-回归
'''
from numpy import *
def loadDataSet(fileName):
numFeat = len(open(fileName).readline().split('\t')) - 1
dataMat = [];
labelMat = []
fr = open(fileName)
for line in fr.readlines():
lineArr = []
curLine = line.strip().split('\t')
for i in range(numFeat):
... | hjw199089/ML_Learn_Python | ML_Learn/com/ML/Regression/Regres_OLS/regression.py | regression.py | py | 836 | python | en | code | 0 | github-code | 90 |
25571048364 | import copy
from datetime import datetime
import functools
import logging
import os
import sys
import threading
import time
import types
from typing import (
Any,
Callable,
Iterator,
List,
Optional,
Sequence,
Set,
Tuple,
Union,
)
import grpc # pytype: disable=pyi-error
from grpc im... | grpc/grpc | src/python/grpcio/grpc/_channel.py | _channel.py | py | 75,673 | python | en | code | 39,468 | github-code | 90 |
32149857550 | #####################
## TV, WINDMILL ##
## Run 5 ##
## Cleveland, Toby ##
#####################
def mission5():
# First put the truck in the ellipse
# New COmment from zack
br.WaitForSeconds(.5)
br.MoveTank(78, "cm", 100, 100)
br.MoveTank(-78, "cm", 100, 100)
# tv mission
br.W... | FLL-Team-24277/BaseRobotFall2022 | cleveland.py | cleveland.py | py | 1,685 | python | en | code | 5 | github-code | 90 |
7866043946 | # https://school.programmers.co.kr/learn/courses/30/lessons/147354
def solution(data, col, row_begin, row_end):
data = sorted(data, key=lambda x: (x[col-1], -x[0]))
s = sum([x % row_begin for x in data[row_begin - 1]])
for i in range(row_begin + 1, row_end + 1):
s = s ^ sum([x % i for x in data[i - ... | GitofHJH/Programmers-with-Python | Level_2/230418 테이블 해시 함수.py | 230418 테이블 해시 함수.py | py | 413 | python | en | code | 0 | github-code | 90 |
18217527179 | n=int(input())
A=[]
for i in range(n):
s=input()
l=0
o=0
for c in s:
if c=='(':
l+=1
else:
l-=1
o=min(o,l)
A.append((l,o))
A.sort(key=lambda x:-10**9 if x[1]==0 else -x[1] if x[0]>=0 else 10**7+x[1]-x[0])
last=0
for l,o in A:
if last+o<0:
... | Aasthaengg/IBMdataset | Python_codes/p02686/s952933105.py | s952933105.py | py | 396 | python | en | code | 0 | github-code | 90 |
41084111591 | """
Written by Kai Matkin
This is a solution and should only be looked at after you have
attempted to solve the problem on your own.
This creates a primitive word processing document. Where you can enter
a sentance (or more) and can undo one character at a time, or redo one
character at a time. This does not allow ... | kinofmat/Data-Structures-Tutorial | Stacks_Solution.py | Stacks_Solution.py | py | 3,075 | python | en | code | 0 | github-code | 90 |
43156425718 | from django.shortcuts import render
from django.http import HttpResponse
# Create your views here.
def shoppingPage_view(request, *args, **kwargs):
website_info = {
"shoppingPage": "Welcome to the E-Learning-Lab Shoppify Page.",
"description": "Here you can make transactions to buy any of our products!"
... | adriane0523/VirtualLearningLab | Components/shoppifyPage/views.py | views.py | py | 389 | python | en | code | 1 | github-code | 90 |
29412892841 | import numpy as np
from PIL import Image
a = np.zeros((100, 150, 4), dtype=np.uint8)
len(a)
a[:, :, :] = [0, 0, 0, 255]
a[10:, :, :] = [255, 128, 0, 255]
img = Image.fromarray(a, 'RGBA')
img.save('temp.png')
| Thxios/PixelEditor | test.py | test.py | py | 210 | python | en | code | 0 | github-code | 90 |
5108057 | import pandas as pd
from mlxtend.frequent_patterns import apriori
from mlxtend.frequent_patterns import association_rules
#读取数据
with open ('订单表.csv') as f:
order_list = pd.read_csv(f)
# 提取每一天每一位顾客购买的产品列表
transaction_list = []
order_group_by_date = order_list.groupby("订单日期")
for date, daily_order in order_group_by... | zlqxgl/Data_Engine_training | finally exam/ProjectB/project-b.py | project-b.py | py | 1,653 | python | en | code | 0 | github-code | 90 |
4137219748 | """Module containing things to run when maya loads the module."""
import logging
import site
from pathlib import Path
logger = logging.getLogger(__name__)
def initialize() -> None:
"""Initialize function called in userSetup.py"""
link_virtualenv()
def link_virtualenv() -> None:
"""Add the virtualenv to... | Muream/maya-poetry-template | {{ cookiecutter.project_slug }}/scripts/{{ cookiecutter.package_name }}/startup.py | startup.py | py | 649 | python | en | code | 0 | github-code | 90 |
17167617486 | import torch
from torch import nn
class OperationAndCat(nn.Module):
""" Performs concatenation of the decoder path,
after having reshaped the data into 5d Tensors;
This helps in stabilizing the network."""
def __init__(self, logger):
super(OperationAndCat, self).__init__()
self... | proxyma-centauri/c_unet | c_unet/utils/concatenation/OperationAndCat.py | OperationAndCat.py | py | 1,053 | python | en | code | 2 | github-code | 90 |
7337633798 | from rest_framework import status
from rest_framework.decorators import api_view, permission_classes
from rest_framework.response import Response
from rest_framework.permissions import IsAuthenticated
from qleader.models import Result
@api_view(["GET", "POST"])
@permission_classes([IsAuthenticated])
def modify_info(r... | QuantMarkFramework/WebMark | qleader/views/modify_info.py | modify_info.py | py | 1,401 | python | en | code | 0 | github-code | 90 |
13153868408 | import os
import time
from selenium import webdriver
from selenium.webdriver.common.keys import Keys
from datetime import datetime
from bs4 import BeautifulSoup
import pandas as pd
from shutil import copyfile,move
import shutil
"WARNING, BEFORE YOU RUN THE FILE PLEASE MAKE A COPY OF THE ORIGINAL FILE TO THE UTILITIES"... | kaajun/FYP_aircraft_identification | updateAkinoList.py | updateAkinoList.py | py | 2,790 | python | en | code | 0 | github-code | 90 |
18369358849 | import bisect
N=int(input())
A=[int(input()) for _ in range(N)]
color=[]
A=A[::-1]
for a in A:
i=bisect.bisect_right(color,a)
if i==len(color):
color.append(a)
else:
color[i]=a
print(len(color)) | Aasthaengg/IBMdataset | Python_codes/p02973/s110093765.py | s110093765.py | py | 222 | python | en | code | 0 | github-code | 90 |
31444211292 | import torch
from torch import nn
from models.CNN import net3D,ResNet,resnet50_fc512
from models.transformer import transformer
class MedResnet(nn.Module):
def __init__(self, num_classes,in_channel,out_channel_3D,out_dim_2D,pretrained=True,use_gpu=True):
super().__init__()
self.use_gpu = use_gpu
... | shashwatpratik/AMLAssignment | models/MedResnet.py | MedResnet.py | py | 1,756 | python | en | code | 0 | github-code | 90 |
73074311976 | import os
from tqdm import tqdm
import cv2
import numpy as np
from random import shuffle
CAT_TRAIN = "./Datasets/Cats/Images/"
DOG_TRAIN = "./Datasets/Dogs/images/"
SIZE = 50
training_data = []
for img in tqdm(os.listdir(CAT_TRAIN)):
path = os.path.join(CAT_TRAIN, img)
img = cv2.resize(cv2.imread(path, cv2.... | FrancoisBasset/DogVSCat | scripts/train_data.py | train_data.py | py | 797 | python | en | code | 0 | github-code | 90 |
18354114619 | s = list(input())
t = list(input())
l = len(s)
sl = [[] for _ in range(26)]
for i in range(l):
j = ord(s[i])-97
sl[j].append(i)
sord = [[-1 for _ in range(l)] for _ in range(26)]
checksord = [0 for _ in range(26)]
for i in range(26):
for j in range(len(sl[i])):
cnt = sl[i][j]
for q in range(checksord[i], cnt):
... | Aasthaengg/IBMdataset | Python_codes/p02937/s220529898.py | s220529898.py | py | 768 | python | en | code | 0 | github-code | 90 |
11640891286 | #!C:\Users\Rena\AppData\Local\Programs\Python\Python38\python.exe
import os
path=os.getcwd()
content=os.listdir(path)
for file in content:
if file == "fileremove.py" or file == "Proj_arquivoAleatorio.py":
continue
else:
os.remove(path+"\\"+file)
"""==____________________________________________... | renemagaiza/phon | Arquivo e Organizacao/Users/Rena/Documents/phon/Arquivo e Organizacao/fileremove.py | fileremove.py | py | 608 | python | en | code | 1 | github-code | 90 |
70358852137 | #!/usr/bin/env python
#
# Author: Christopher J. Urban
# Affil.: L. L. Thurstone Psychometric Laboratory in the Dept. of Psychology
# and Neuroscience, UNC-Chapel Hill
# E-mail: cjurban@live.unc.edu
#
# Purpose: Utility functions for creating figures.
#
##########################################################... | cjurban/DeepConfirmatoryIFA | src/fig_utils.py | fig_utils.py | py | 10,283 | python | en | code | 1 | github-code | 90 |
33330243080 | import os
import pandas as pd
from binance.spot import Spot
from dataframe_image import export
from pandas._typing import FilePathOrBuffer
class MyWallet:
def __init__(self, client: Spot, history_file: FilePathOrBuffer, earn_file=None):
self.client = client
self.earn_file = earn_file
self... | Aroksak/binance_tg_bot | binance_api/wallet.py | wallet.py | py | 2,441 | python | en | code | 0 | github-code | 90 |
18296150499 | from bisect import bisect_left
def main():
def eratosthenes(n):
A = [i for i in range(2, n+1)]
P = []
i = 2
while i**2 <= n:
prime = min(A)
P.append(prime)
j = 0
while j < len(A):
if A[j] % prime == 0:
... | Aasthaengg/IBMdataset | Python_codes/p02819/s341906079.py | s341906079.py | py | 647 | python | en | code | 0 | github-code | 90 |
2854369435 | import random
avail_Choice=["Rock","Paper","Scissor"]
while True:
print("Welcome to Rock Paper Scissor Game:")
YourWin=0
ComputerWin=0
for i in range(1,6):
print("Round",i,"Begin:")
print("Please Select any One of these Options:")
print("1-Rock","2-Paper","3-Scissor",sep... | Samrat740/Rock-Paper-Scissors-Game | Rock, Paper, Scissors game.py | Rock, Paper, Scissors game.py | py | 2,065 | python | en | code | 0 | github-code | 90 |
18326256979 | import sys
input = sys.stdin.readline
def main():
N = int(input())
# N = 10
ok = False
for i in range(1, 10):
for j in range(1, 10):
if i*j == N:
ok = True
break
if ok:
break
print("Yes" if ok else "No")
if __name__ == "__mai... | Aasthaengg/IBMdataset | Python_codes/p02880/s652967171.py | s652967171.py | py | 336 | python | en | code | 0 | github-code | 90 |
10725411727 | from __future__ import print_function
import keras
import h5py
from keras.preprocessing.image import ImageDataGenerator
from keras.models import Sequential
from keras.layers import Dense, Dropout, Flatten
from keras.layers import Conv2D, MaxPooling2D, Lambda
from keras.models import load_model
from keras.optimizers imp... | milesjwinter/DECO_sandbox | Rot_inv_Deco_CNN.py | Rot_inv_Deco_CNN.py | py | 5,498 | python | en | code | 0 | github-code | 90 |
2612374495 | import json
import urllib2
import urllib
import sys
import osmscript
import json
import geopy
from geopy.distance import VincentyDistance
import xmltodict
def getBoundaryBox(lat,lng,dist):
origin = geopy.Point(lat, lng)
destination = VincentyDistance(kilometers=dist).destination(origin, 45)
MAXLAT, MAXLON ... | usc-isi-i2/image-metadata-enhancement | scripts/publishdata-ES.py | publishdata-ES.py | py | 8,262 | python | en | code | 1 | github-code | 90 |
24982734450 | # 완주하지 못한선수 -hash
# sol1 -dictionary
def solution(participant,completion):
d={}
for x in participant:
d[x]=d.get(x,0)+1
for x in completion:
d[x]-=1
dnf=[k for k, v in d.items() if v >0]
answer=dnf[0]
return answer
# sol2 -sort
def solution2(participant, completion):
... | AnnaloveTojji/pynote | solutions/pro1.py | pro1.py | py | 648 | python | en | code | 1 | github-code | 90 |
21304194423 | import cv2 as cv
import matplotlib.pyplot as plt
import numpy as np
#image normal
img = cv.imread('images\lower.jpg')
cv.imshow('Normal' , img )
blank = np.zeros ((1000,1000) , dtype='uint8')
blank[:,500:] = 100
cv.imshow('blank' , blank )
#kernels
kernel_X = np.array([[-1,0,1],
[-2,0,2],
... | es-OmarHani/ImageProcessing_1 | section #3/Edge_detection_1.py | Edge_detection_1.py | py | 731 | python | en | code | 0 | github-code | 90 |
13290630779 | import time
def obtenerHora():
"""
devuelve una tupla con la hora local
"""
r = time.localtime()
return r
def diaActual():
"""
devuelve una tupla en formado %dd%mm%yyyy
"""
tupla = obtenerHora()
dia = (tupla[2],tupla[1],tupla[0])
return dia
def horaFaltante():
"""
... | emirocampo/open.bootcamp.python.unidad7.ejercicio2 | tiempo/faltante.py | faltante.py | py | 601 | python | es | code | 0 | github-code | 90 |
18214495549 | import itertools
n,m,x = (int(i) for i in input().split())
A = []
for i in range(n):
A.append([int(i) for i in input().split()])
ans = float('inf')
for p in itertools.product(range(2), repeat=n):
knowledges = [0 for _ in range(m)]
tmp = 0
for i,a in zip(p,A):
if i == 0: continue
tmp ... | Aasthaengg/IBMdataset | Python_codes/p02683/s194300011.py | s194300011.py | py | 523 | python | en | code | 0 | github-code | 90 |
10831564589 | import os
from celery import Celery
from celery.schedules import crontab
BROKER_URL = os.environ.get("CELERY_BROKER_URL")
BACKEND_URL = os.environ.get("CELERY_RESULT_BACKEND")
app = Celery(
'tasks',
backend=BACKEND_URL,
broker=BROKER_URL,
include=['celery_worker.tasks']
)
app.conf.beat_schedule = {
... | mateusz0malecki/polish-rappers-analysis | app/celery_worker/celery.py | celery.py | py | 758 | python | en | code | 0 | github-code | 90 |
17949030209 | def resolve():
n, m, k = map(int, input().split())
for l in range(n + 1):
for r in range(m + 1):
black = l * m + r * n - 2 * r * l
if black == k:
print("Yes")
return 0
print("No")
if __name__ == "__main__":
resolve()
| Aasthaengg/IBMdataset | Python_codes/p03592/s394124120.py | s394124120.py | py | 299 | python | en | code | 0 | github-code | 90 |
72069445418 | from tkinter import *
from tkinter.colorchooser import askcolor
class Scribble(object):
'''a simple pen drawing application'''
def __init__(self):
master = Tk()
master.title = ('Simple Mouse/Stylus/Finger Scribble')
#mouse coordinates and the drawing color are instance var... | PeakFiction/CodingProjects | Python/VSCode Projects/Lab 09/Lab09Test.py | Lab09Test.py | py | 1,397 | python | en | code | 0 | github-code | 90 |
7187443107 |
def formatLetters(inputText):
"""
This function takes a string of letters and returns a list of integers
and, split by spaces, converts them into integers and returns a list of
floats.
"""
return [float(i) for i in inputText.split()]
## Function that converts a float to an int if it is exactly... | WhyDoWeLiveWithoutMeaning/ICS_Grd12 | Unit1/AssignmentTuesday16/divPolyEq.py | divPolyEq.py | py | 3,394 | python | en | code | 0 | github-code | 90 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.