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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
24759580671 | # Dataset Link: https://www.kaggle.com/datasets/abdalrahmanelnashar/credit-card-balance-prediction
#_____________________________________________________________________________________________________
# load libraries
import seaborn as sns
import statsmodels.api as sm
import numpy as np
import matplotlib.pyplot as py... | mohamed-malk/Machine-Learning-Deep-Learning | Machine Learning/Regression/Credit Card Balance/Code.py | Code.py | py | 3,240 | python | en | code | 0 | github-code | 13 |
45599142394 |
# coding: utf-8
from ...characterType import numeric, alphaNumeric
from ...row import RowElement, Row
class Header(Row):
def __init__(self):
Row.__init__(self)
self.elements = [
RowElement(
index=0,
description="Banco - Código do Banco na Compensaça... | rfschubert/febraban | febraban/cnab240/v83/file/header.py | header.py | py | 5,690 | python | en | code | 1 | github-code | 13 |
37643157938 | import sys
import pygame
from time import sleep
from bullet import Bullet
from alien import Alien
def check_keydown_events(event, ai_settings, screen, ship, bullets): #检测按下按键
if event.key == pygame.K_RIGHT:
ship.moving_right = True
elif event.key == pygame.K_LEFT:
ship.moving_le... | MachoHH/Alien_Project | game_function.py | game_function.py | py | 8,346 | python | en | code | 0 | github-code | 13 |
30598685474 | import json
from shutil import copyfile
#ruta = "/home/nian/Documentos/composerAutomation/composer.json"
#archivo = open(ruta, 'r')
with open("composer.json") as myJson:
datos = json.loads(myJson.read())
with open("composer2.json") as myJson2:
datos2 = json.loads(myJson2.read())
datos.update(datos2)
myJso... | nian8203/composerAutomation | updateJsonFinal.py | updateJsonFinal.py | py | 566 | python | es | code | 0 | github-code | 13 |
25115787699 | __author__ = 'patras'
'''A robot is searching for an object in the environment consisting of a few locations.
The robot knows the map. It is a rigid state variable.
The robot moves from one location to another using Djikstra's shortest path.
It has a battery that needs to be recharged after some moves.
A move consume... | patras91/rae_release | domains/fetch/domain_fetch.py | domain_fetch.py | py | 19,625 | python | en | code | 1 | github-code | 13 |
14463333892 |
import numpy as np
from numpy import SHIFT_UNDERFLOW, pi
from neuroaiengines.utils.angles import wrap_pi
import math
import functools
# pylint: disable=not-callable
from scipy.optimize import minimize
def _root_k(k, fwhm):
c = np.log(np.cosh(k))/k
return np.square(np.cos(fwhm/2) - c)
def _simp_vonmises(a,lo... | aplbrain/seismic | neuroaiengines/utils/signals.py | signals.py | py | 7,307 | python | en | code | 0 | github-code | 13 |
42447288124 | def sort_array_by_parity(nums: list[int]):
"""
Given an integer array nums, move all the even integers at the beginning
of the array followed by all the odd integers.
Return any array that satisfies this condition.
"""
i, j = 0, len(nums) - 1
while i <= j:
if nums[i] % 2 != 0 and num... | Dimaaap/Leetcode | Easy/905.) Sort Array By Parity.py | 905.) Sort Array By Parity.py | py | 665 | python | en | code | 0 | github-code | 13 |
16502378107 | from tinydb import Query, TinyDB
filename = "test2.json"
db = TinyDB(filename)
db.drop_table('fruits')
table = db.table('fruits') # 테이블 생성
# tuple 삽입
table.insert({'name':'사과','price':5000,'지역 이름':'인천'})
table.insert({'name':'바나나','price':7000})
table.insert({'name':'망고','price':8000})
table.insert({'name':'레몬','pric... | So-chankyun/Crawling_Study | week5/ex1.py | ex1.py | py | 665 | python | ko | code | 0 | github-code | 13 |
10552525819 | import random
size = int(input('Введите размерность массива: '))
lst = [random.randint(0, 30) for i in range(size)]
minim = min(lst)
delta = int(input('Введите значение delta: '))
counter = 0
for k in range(size):
if lst[k] - delta == minim:
counter += 1
print(counter) | extraterrrestria/sr6 | bonus.py | bonus.py | py | 322 | python | ru | code | 0 | github-code | 13 |
2715270081 | from scipy.cluster.hierarchy import linkage, fcluster
from sklearn.cluster import KMeans
from enbios2.experiment.bw_vector_db.create_vectors import get_all_vector_docs
from enbios2.experiment.bw_vector_db.psql_vectorDB import Document
def kmeans(docs: list[Document], k: int = 35):
kmeans = KMeans(n_clusters=k, r... | LIVENlab/enbios | enbios2/experiment/bw_vector_db/cluster.py | cluster.py | py | 1,766 | python | en | code | 3 | github-code | 13 |
39752322572 | from datetime import date, timedelta
# Third Party Imports
import pytest
from pubsub import pub
# RAMSTK Package Imports
from ramstk.models.dbrecords import RAMSTKMatrixRecord
from ramstk.models.dbtables import RAMSTKMatrixTable
from tests import MockDAO
DESCRIPTION = "validation-requirement"
@pytest.fixture
def m... | ReliaQualAssociates/ramstk | tests/models/programdb/matrix/conftest.py | conftest.py | py | 2,055 | python | en | code | 34 | github-code | 13 |
1588880812 | import math
import time
from rlbot.agents.base_agent import SimpleControllerState
import util.util as util
from util.vec import Vec3
from util.orientation import relative_location
from util.util import predict_ball_path, GOAL_HOME
class State():
"""State objects dictate the bot's current objective.
Thes... | sDauenbaugh/FirstBot | src/states.py | states.py | py | 11,804 | python | en | code | 0 | github-code | 13 |
25593085160 | from typing import List
class Solution:
def recurSubset(self, nums: List[int], ans: List[int], ds: List[int], idx: int):
ans.append(ds[:])
for i in range(idx, len(nums)):
# do not pick if element is same as previous one
if i != idx and nums[i] == nums[i - 1] :
... | avantika0111/Striver-SDE-Sheet-Challenge-2023 | Recursion/PrintlUniqueSubsets.py | PrintlUniqueSubsets.py | py | 942 | python | en | code | 0 | github-code | 13 |
30957343364 |
# 2'. Напишите программу, которая найдёт произведение пар чисел списка.
# Парой считаем первый и последний элемент, второй и предпоследний и т.д.
# - [2, 3, 4, 5, 6] =>[12,15,16] ([2*6, 3*5, 4*4]);
# - [2, 3, 5, 6] => [12,15] ( [2*6, 3*5])
def sum_list(list, index, i):
multiplier = list[... | BoaL22/3_homework_lesson_three | 2_second_task.py | 2_second_task.py | py | 935 | python | ru | code | 0 | github-code | 13 |
25160035398 | import pygame
import random
from pygame import *
pygame.init()
pygame.display.set_caption("Minesweeper")
list=[True,True,True,False,True,True,True,False,30 ,False]
# run,bomb,close,plyer,gm, mainloop, file, fps,hint
clock = pygame.time.Clock()
size=[]
clicks=[]
list1=[]
bomb=[]
#bomb=[[40,60],[40,80]... | parteekmalik/minesweeper | minesweeper.py | minesweeper.py | py | 12,718 | python | en | code | 1 | github-code | 13 |
8525088956 | import os
import numpy as np
import pandas as pd
import tensorflow as tf
import keras.api._v2.keras as keras
from keras.api._v2.keras import layers, optimizers, losses, models,\
regularizers
from keras.api._v2.keras.preprocessing.image import ImageDataGenerator
from util.util import *
from util.my_tf_callback impo... | NCcoco/kaggle-project | Bird-Species/train-by-easy-cnn.py | train-by-easy-cnn.py | py | 12,581 | python | en | code | 0 | github-code | 13 |
10010423569 | #Pong
import pygame
import random
pygame.init()
pygame.font.init()
BLACK = ( 0, 0, 0)
WHITE = ( 255, 255, 255)
size = (600, 400)
screen = pygame.display.set_mode(size)
myfont = pygame.font.SysFont('trebuchetms', 15)
pygame.display.set_caption("Pong")
carryOn = True
clock = pygame.time.Clock()
WIDTH = 600
HEIGHT = 4... | snigui/pong | src/pong.py | pong.py | py | 4,351 | python | en | code | 0 | github-code | 13 |
5174844496 | import pandas as pd
import numpy as np
import torch
import torch.nn as nn
import heapq
import random
import time
from torch.autograd import Variable
#训练数据加载
delete=pd.read_csv("delete_normal_kdd.csv")
train_data=delete.iloc[:,:12]
train_label=delete.iloc[:,12]
train_data = np.array(train_data)
train_label = np.array(t... | ColeGroup/2023SunJun | model/CESDDM/CESDDM.py | CESDDM.py | py | 7,701 | python | en | code | 0 | github-code | 13 |
13486888005 | # -*- coding: utf-8 -*-
"""
Created on Wed Nov 17 10:56:31 2021
@author: soyrl
"""
#Import libraries and dependencies
import os
import pydicom as dicom
import numpy as np
import cv2
import time
# from termcolor import colored
import matplotlib.pyplot as plt
import pandas as pd
from joblib import Parallel, delayed
fro... | nsourlos/Siemens_AIRadCompanion_automatic_comparison | automated_nodule_comparison.py | automated_nodule_comparison.py | py | 154,938 | python | en | code | 0 | github-code | 13 |
16352036592 | import numba as nb
import numpy as np
@nb.njit(fastmath=False, parallel=False)
def closest(point_assume_f, grid_points_list_f):
N = grid_points_list_f.shape[0]
i1 = 0
maxi = 11.0
for i in range(N):
distance = np.arccos(
grid_points_list_f[i, 0] * point_assume_f[0]
... | grburgess/gbm_drm_gen | gbm_drm_gen/matrix_functions.py | matrix_functions.py | py | 17,080 | python | en | code | 3 | github-code | 13 |
11030353105 | #!/usr/bin/env python3
import csv
with open('padron.txt','r') as padron:
archivo = padron.readlines()
with open('padron_definitivo_2019.csv','w') as padron_csv:
padron_escritor = csv.writer(padron_csv, delimiter=',', quotechar='"', quoting=csv.QUOTE_MINIMAL)
padron_escritor.writerow(['NRO DNI', 'TIPO DNI', 'CLASE... | jpgim/extraer-info-padron | padron.py | padron.py | py | 2,061 | python | es | code | 0 | github-code | 13 |
14880515237 | '''
Ввести небольшое натуральное число 2⩽N⩽1000000 и проверить,
является ли оно степенью натурального числа (>1).
Вывести YES или NO соответственно.
Input:
1024
Output:
YES
'''
import itertools
def PowTest(val):
'''
алгоритм выдуманный за 5 минут, похоже он очень медленный
не используйте его нигде, кром... | ekomissarov/edu | py-basics/uneex_homework/4.py | 4.py | py | 1,459 | python | ru | code | 0 | github-code | 13 |
71412256659 | #!/usr/bin/python3
"""Write out solutions waiting on mentoring."""
import datetime
import os
import pathlib
import time
import dotenv
import exercism
def dump_solutions_to_mentor():
"""Fetch solutions waiting for mentoring and write to file."""
ex = exercism.Exercism()
notifications = bool(ex.notificati... | IsaacG/exercism-py | dump_solutions.py | dump_solutions.py | py | 1,630 | python | en | code | 1 | github-code | 13 |
73734582096 | # Напишіть програму, яка для двох додатних цілих чисел знаходить НСД.
#
# Примітка: Для умови циклу в пункті 3 необхідно пам'ятати, що цикл while виконується за умови True, а наш цикл повинен
# закінчитися, тільки якщо gcd поділив обидва числа без залишку.
first = int(input("Enter the first integer: "))
second = int(i... | Radzihowski/GoIT | module_2/ex-9.py | ex-9.py | py | 657 | python | uk | code | 0 | github-code | 13 |
36143184352 | # author : artemis lightman
# date created : feb 6, 2023
# last modified: feb 6, 2023
# command line arguments
# name - name of pdb structure
# dependencies:
# arty.py
# input: pdb structures to relax
# output: relaxed pdb structures
##############################################################################
#... | artylightman/ppi_docking | scripts/scoring/run_relax.py | run_relax.py | py | 1,224 | python | en | code | 1 | github-code | 13 |
7120873986 | import os
import sys
import torch
import yaml
import tqdm
import torch.nn as nn
from statistics import mean
import torch.optim as optim
from functools import partial
from joblib import cpu_count
from torch.utils.data import DataLoader
from metric import lineCat, draw, saveInfo, readBest
from model import get_model, m... | po-sheng/RSNA_ICH | model/train.py | train.py | py | 6,425 | python | en | code | 0 | github-code | 13 |
11639665006 | """work URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/1.11/topics/http/urls/
Examples:
Function views
1. Add an import: from my_app import views
2. Add a URL to urlpatterns: url(r'^$', views.home, name='home')
Class-based... | Jinnnnyyy/test-ssh-key | work/myadmin/urls.py | urls.py | py | 3,188 | python | en | code | 0 | github-code | 13 |
13440184415 | # -*- coding:utf-8 -*-
import logging
import os
import logging.config
import config
CONSTANTS = config.constant
DEFAULT_CONFIG_FILE = "logging.json"
DEFAULT_ENV_KEY = "LOG_CFG"
DEFAULT_LOG_FILE = CONSTANTS.DEFAULT_LOG_DIR + "eas.log"
DEFAULT_LEVEL = logging.INFO
def get_logger(name=None):
# check whether environ... | wakakalu/Entity-alignment-system | entity_align_system/utils/Logging.py | Logging.py | py | 744 | python | en | code | 8 | github-code | 13 |
23863549553 | import requests
from bs4 import BeautifulSoup
def get_page(url):
response = requests.get(url)
soup = BeautifulSoup(response.text, 'lxml')
return soup
def get_links(url):
soup = get_page(url)
links_div = soup.find_all('div', class_="content__list--item--main")
links = [div.a.get('href') for div... | weizhang3678/pythonstudy | project_examination/WebCrawler.py | WebCrawler.py | py | 520 | python | en | code | 0 | github-code | 13 |
26141909613 | import os
from hammer_art import logo
print(logo)
bidders = {}
def adding_to_list(name, amount):
bidders[name] = f"{amount}"
def clear_display():
os.system('cls')
print(logo)
bid_status_end = False
while not bid_status_end:
bidders_name = input("What's your name?\n")
bid_am... | aytovicc/My_python_journey | Python/Secret_Aucation_Program/Secret_Auction_Program.py | Secret_Auction_Program.py | py | 930 | python | en | code | 0 | github-code | 13 |
3184919789 | #coding:utf-8
import sys
#导入相应的包
import smtplib
import pandas as pd
from email.mime.text import MIMEText
from email.utils import formataddr
def getEmailAd(filePath):
f = open(filePath)
str = f.read()
count = 0
temp = []
length = len(str)
print(length)
while count < length:
if str[c... | misaki-taro/python_email | hello.py | hello.py | py | 3,231 | python | zh | code | 0 | github-code | 13 |
1902080303 | import random
from enum import Enum
from typing import Union
from game.models.components.cell import Cell, CellWithShip
from game.models.components.ship import Ship
class ResultAttack(Enum):
MISS = 1
HIT = 2
SUNK = 3
ATTACKED = 4
ERROR = 5
class Player:
def __init__(self, board_size: (int, ... | Mensh1kov/Sea_battle | game/models/components/player.py | player.py | py | 4,149 | python | en | code | 0 | github-code | 13 |
20056720737 | import urllib
import re
def crawl_names_save_csv():
"""
This function crawls data from site and puts them in csv
"""
country = ["indian", "american", "french", "german", "australian", "arabic", "christian", "english", "iranian", "irish"]
alpha = ["a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "... | DivyaJoshi20/rankwatch17_py_scraping | py_scraping/Project1_py_scraping.py | Project1_py_scraping.py | py | 1,611 | python | en | code | 0 | github-code | 13 |
14133733472 | from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import tensorflow as tf
import tensorflow.contrib.slim as slim
FLAGS = tf.app.flags.FLAGS
# Batch normalization. Constant governing the exponential moving average of
# the 'global' mean and variance for all ... | ZhihengCV/tensorflow_face | models/vgg_model.py | vgg_model.py | py | 7,272 | python | en | code | 3 | github-code | 13 |
16824664314 | """Service for SQL module."""
from typing import Optional, Tuple
from jsonschema import validate
from hyrisecockpit.api.app.connection_manager import ManagerSocket
from hyrisecockpit.api.app.exception import StatusCodeNotFoundException
from hyrisecockpit.message import response_schema
from hyrisecockpit.request impor... | hyrise/Cockpit | hyrisecockpit/api/app/sql/service.py | service.py | py | 1,589 | python | en | code | 14 | github-code | 13 |
31494210872 | # Altere o programa de cálculo dos números primos, informando,
# caso o número não seja primo, por quais número ele é divisível.
import math
l1 = []
a = int(input('Num: '))
for i in range (2,a+1,1):
b = a/i
c = math.floor(b)
d = b - c
if d == 0:
l1.append(b)
if (... | GuilhermeMastelini/Exercicios_documentacao_Python | Estrutura de Repetição/Lição 22.py | Lição 22.py | py | 454 | python | pt | code | 0 | github-code | 13 |
31941587460 | class ListNode:
def __init__(self, x):
self.val = x
self.next = None
class Solution:
def isPalindrome(self, head: ListNode) -> bool:
def reverse(head: ListNode) -> ListNode:
pre, cur = None, head
while cur:
tmp = cur.next
cur.next... | wylu/leetcodecn | src/python/explore/linkedlist/basic/回文链表.py | 回文链表.py | py | 729 | python | en | code | 3 | github-code | 13 |
17916053896 | all_rules = open("Day7", 'r').read().split("\n")
rule_map = {rule.split(" contain ")[0][:-5]: rule.split(" contain ")[1] for rule in all_rules}
def contains_sg(colour):
if "no other bag" not in rule_map[colour]:
if "shiny gold" in rule_map[colour]:
return True
bags = rule_map[colour].s... | aamnaam/AoC-2020 | Day07.py | Day07.py | py | 1,104 | python | en | code | 0 | github-code | 13 |
42446914214 | def are_occurrences_equal(s: str):
"""
Given a string s, return true if s is a good string, or false otherwise.
A string s is good if all the characters that appear in s have the same number of
occurrences (i.e., the same frequency).
"""
count_dict = {}
for char in s:
if char not in ... | Dimaaap/Leetcode | Easy/1941.) Check if All Characters Have Equal Number of Occurences.py | 1941.) Check if All Characters Have Equal Number of Occurences.py | py | 537 | python | en | code | 0 | github-code | 13 |
25605943355 | import requests, csv, json, argparse
from argparse import ArgumentParser
#loads data from setup.json
setupData = json.load(open("setup.json"))
#base url to acess the Aeries API (default is the Aeries demo API)
baseURL = setupData["baseURL"]
#header for Aeries API
#place your Aeries cert here (this is not secure at a... | bwernick/aeries-get-API-data | data.py | data.py | py | 4,610 | python | en | code | 1 | github-code | 13 |
72865799377 | # Di - 1 = 2 * (Di + 1)
def f(day: int, remain: int):
today = remain
total = remain
for i in range(day, 0, -1):
print(f"day {i} eat ${total}")
yesterday = 2 * (today + 1)
total += yesterday - today
today = yesterday
return total
print(f(10, 1))
| zsh2401/oblivion | lang/python/snnu/peach.py | peach.py | py | 296 | python | en | code | 1 | github-code | 13 |
7876521778 | import torch.nn as nn
from DepthwiseSeparableConvolution import depthwise_separable_conv
class bottle_screener(nn.Module):
def __init__(self, num_classes=3):
super(bottle_screener, self).__init__()
input_shape = () #input shape of the image
self.dsc0 = depthwise_separable_conv(nin, nout, k... | andyliu666/RD | DepthwiseSeparableConvolution/model_cnn.py | model_cnn.py | py | 1,637 | python | en | code | 0 | github-code | 13 |
42515194479 | """
:mod: `cli` -- Command line interface to ucalumni
=================================================
.. module: cli
For
(c) Joaquim Carvalho 2021.
MIT License, no warranties.
"""
# cli interface
# we use Typer https://typer.tiangolo.com
import typer
from ucalumni.importer import import_auc_alumni
from ucalumni.al... | joaquimrcarvalho/fauc1537-1919 | notebooks/ucalumni/cli.py | cli.py | py | 2,119 | python | en | code | 2 | github-code | 13 |
18093776811 | from django.urls import path
from . import dbapi
urlpatterns = [
# 添加另一个让后端查询数据库的api接口
path('login', dbapi.login, name='login'), # 数据库登录接口
path('dbapi',dbapi.dbapi,name='dbapi'), # 数据库请求总接口,负责查询所有字段(包括数据库名、表名、列名、注释以及字段数据)
path('select', dbapi.select, name='select'), # 查询接口,负责精确地按条件查询数据
path('mse... | RickySakura/DBSYS | ulb_manager/backend/urls.py | urls.py | py | 990 | python | zh | code | 0 | github-code | 13 |
29671321526 | from django.db import models
from django.core import validators
class Item(models.Model):
SEX_CHOICES = (
(1, '業務'),
(2, '業務以外'),
)
name = models.CharField(
verbose_name='TODO名',
max_length=200,
)
age = models.IntegerField(
verbose_name='期限月',
vali... | akimoto-ri/todoApp | app/models.py | models.py | py | 976 | python | en | code | 0 | github-code | 13 |
74564471378 | #!/usr/bin/env python
"""
_GetSiteInfo_
MySQL implementation of Locations.GetSiteInfo
"""
from WMCore.Database.DBFormatter import DBFormatter
class GetSiteInfo(DBFormatter):
"""
Grab all the relevant information for a given site.
Usually useful only in the submitter
"""
sql = """SELECT wl.site_n... | dmwm/WMCore | src/python/WMCore/WMBS/MySQL/Locations/GetSiteInfo.py | GetSiteInfo.py | py | 2,354 | python | en | code | 44 | github-code | 13 |
1681494826 | #!/usr/bin/env python3
#encoding=utf-8
#-------------------------------------------------
# Usage: python3 4-getattribute_to_compute_attribute.py
# Description: attribute management 4 of 4
# Same, but with generic __getattribute__ all attribute interception
#----------------------------------------------... | mindnhand/Learning-Python-5th | Chapter38.ManagedAttributes/4-4-getattribute_to_compute_attribute.py | 4-4-getattribute_to_compute_attribute.py | py | 1,465 | python | en | code | 0 | github-code | 13 |
71876598097 | from src.nn.activations.hidden_activations import ReLu, Sigmoid, Tanh, Identity
from src.nn.activations.softmax import Softmax
RELU = 'relu'
SIGMOID = 'sigmoid'
TANH = 'tanh'
IDENTITY = 'identity'
SOFTMAX = 'softmax'
def get_activation(name):
if name == RELU:
return ReLu()
elif name == SIGMOID:
... | binkjakub/neural-networks | src/nn/activations/__init__.py | __init__.py | py | 563 | python | en | code | 1 | github-code | 13 |
42514193995 | class addlist:
def __init__(self):
self.list1 = list()
self.size = 0
self.sum = 0
self.accept()
def accept(self):
self.size = int(input("Enter the Number of values in List : "))
def lista(self):
for i in range(self.size):
no2 = int... | Shantanu-gilbile/Python-Programs | oop3.py | oop3.py | py | 1,795 | python | en | code | 0 | github-code | 13 |
72093790739 | import objects
from get_grand_prix_name import GetGrandPrixNameFromCommandLineArguments
import load_config
import load_predictions
import load_race_results
def ProcessProgressionPerformance(grand_prix_name, active_year):
results = load_race_results.ReadRaceResults(grand_prix_name, active_year)
#predictions = l... | JamesScanlan/f1ftw | f1ftw/calculate_progression_performance.py | calculate_progression_performance.py | py | 1,006 | python | en | code | 0 | github-code | 13 |
30138929692 | from flask import Blueprint
from zou.app.utils.api import configure_api_from_blueprint
from zou.app.blueprints.files.resources import (
WorkingFilePathResource,
LastWorkingFilesResource,
ModifiedFileResource,
CommentWorkingFileResource,
NewWorkingFileResource,
TaskWorkingFilesResource,
Enti... | cgwire/zou | zou/app/blueprints/files/__init__.py | __init__.py | py | 3,877 | python | en | code | 152 | github-code | 13 |
33588055570 | import wolframalpha
import webbrowser as wb
import pyttsx3
import pyaudio
import speech_recognition as sr
import wikipedia
import sys
engine = pyttsx3.init('sapi5')
client = wolframalpha.Client('LX3VUJ-P5KRT24VJA')
class assistant:
def say(audio):
print('Computer: '+audio)
engine.sa... | Debjeet-Banerjee/test | assistant.py | assistant.py | py | 1,638 | python | en | code | 0 | github-code | 13 |
19450174255 | #!/usr/bin/python
from gurobipy import *
import pandas as pd
import sys
import time
from Tree import Tree
from BendersOCT import BendersOCT
import logger
import getopt
import csv
from sklearn.model_selection import train_test_split
from utils import *
from logger import logger
def get_left_exp_integer(master, b, n, i... | D3M-Research-Group/StrongTree | Code/StrongTree/BendersOCTReplication.py | BendersOCTReplication.py | py | 14,276 | python | en | code | 11 | github-code | 13 |
37454126363 | import numpy as np
import math
from numpy.linalg import inv
import matplotlib.pyplot as plt
ArrayK = []
XS_1 = 1.2
XS_2 = 0.2
XS_3 = 2.9
XS_4 = 2.1
ave = 0.25*(XS_1 + XS_2 + XS_3 + XS_4)
AK = 0.0
K = 1
ArrayA = [AK]
ArrayK = [0]
while (K <= 5):
XH_1 = AK
XH_2 = AK
XH_3 = AK
XH_4 = AK
deltaX1 = XS_1 - XH_1
delt... | jgonzal3/KalmanFiltering | Chapter18/listing18_1.py | listing18_1.py | py | 741 | python | en | code | 1 | github-code | 13 |
3659551352 | import pandas as pd
import sys
from pathlib import Path
# Set console output formatting
pd.set_option("display.max_columns", 800)
pd.set_option("display.width", 800)
# Define scripts working directory
PWD = Path(sys.argv[0]).absolute().parent
# Set root directory for fractile results
ROOT_RES = Path(__file__).parent... | asarmy/iaea-benchmarking-kea22 | 4_plotting/scripts/plotting_config.py | plotting_config.py | py | 2,360 | python | en | code | 0 | github-code | 13 |
37165091333 | from os import remove
from os.path import exists
from tempfile import mkdtemp, NamedTemporaryFile
from .test_utils import TestCase
from pulsar.cache import Cache
from shutil import rmtree
class CacheTest(TestCase):
def setUp(self):
self.temp_dir = mkdtemp()
self.temp_file = NamedTemporaryFile(de... | galaxyproject/pulsar | test/cache_test.py | cache_test.py | py | 1,309 | python | en | code | 37 | github-code | 13 |
72599707537 | import pytest
from web_driver_setup import WebDriverSetup
from common.test_login import login
from page_object.pages.menu_bar import MenuBar
from page_object.pages.project_page import ProjectPage
from page_object.pages.file_browser_page import FileBrowserPage
from selenium.webdriver.common.keys import Keys
driver = We... | Mrkabu/zadanie_rekrutacyjne | zadanie_rekrutacyjne/tests/test_add_attachment.py | test_add_attachment.py | py | 1,384 | python | en | code | 0 | github-code | 13 |
37387320115 | from rest_framework.response import Response
from rest_framework.views import APIView
from rest_framework_simplejwt.authentication import JWTAuthentication
from rest_framework.permissions import IsAuthenticated
from rest_framework import status
from Accounts.models import User
from .models import *
from .serializers im... | buttonchicken/LandRegistration | Address/views.py | views.py | py | 1,928 | python | en | code | 0 | github-code | 13 |
30139610262 | """Add nb assets ready column
Revision ID: a66508788c53
Revises: 1e150c2cea4d
Create Date: 2021-11-23 00:07:43.717653
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = "a66508788c53"
down_revision = "1e150c2cea4d"
branch_labels = None
depends_on = None
def upgr... | cgwire/zou | zou/migrations/versions/a66508788c53_add_nb_assets_ready.py | a66508788c53_add_nb_assets_ready.py | py | 693 | python | en | code | 152 | github-code | 13 |
34326081472 | import os
import fnmatch
from PIL import Image
def resize(in_path, out_path, size=64):
img_dim = (size, size)
# i = 0
for f in os.scandir(in_path):
if fnmatch.fnmatch(f, '*.jpg'):
with Image.open(f.path) as img:
img = img.resize(img_dim, resample=1, reducing_gap=3)
... | leoagneau/Bib_Racer | RBNR_lixilinx/resize_to_64_64.py | resize_to_64_64.py | py | 537 | python | en | code | 2 | github-code | 13 |
16644738377 | """
You are given two non-empty linked lists representing two non-negative integers.
The digits are stored in reverse order, and each of their nodes contains a single digit.
Add the two numbers and return the sum as a linked list.
You may assume the two numbers do not contain any leading zero, except the number 0 it... | JeffreyAsuncion/CodingProblems_Python | LeetCode/LC002.py | LC002.py | py | 2,105 | python | en | code | 0 | github-code | 13 |
31625649654 | # -*- coding: utf-8 -*-
"""
Created on Tue Mar 15 15:37:12 2016
@author: ajaver
"""
import tables
import pandas as pd
import numpy as np
import matplotlib.pylab as plt
import glob, os
from MWTracker.trackWorms.checkHeadOrientation import isWormHTSwitched
from MWTracker.intensityAnalysis.getIntensityProfile import ge... | ver228/work-in-progress | work_in_progress/_old/worm_orientation/check_orientation_mov.py | check_orientation_mov.py | py | 9,334 | python | en | code | 0 | github-code | 13 |
41767232102 | class Solution:
def divide(self, dividend: int, divisor: int) -> int:
op = dividend/divisor
if op < 0:
op = math.ceil(op)
else:
op = math.floor(op)
if op > 2**31 - 1:
op = 2**31 - 1
if op < -1*(2**31):
... | ritwik-deshpande/LeetCode | 29-divide-two-integers/29-divide-two-integers.py | 29-divide-two-integers.py | py | 368 | python | nl | code | 0 | github-code | 13 |
37035930893 | import tkinter as tk
import requests
#Put your APY
APY_KEY = ""
BASE_URL = "https://api.openweathermap.org/data/2.5/weather"
def get_weather():
city = city_entry.get()
request_url = f"{BASE_URL}?appid={APY_KEY}&q={city}"
response = requests.get(request_url)
if response.status_code == 200:
... | Ma1d3n/Weather-app | Weather.py | Weather.py | py | 1,016 | python | en | code | 0 | github-code | 13 |
776253524 | from numba import njit
from oceantracker.status_modifiers._base_status_modifers import _BaseStatusModifer
from oceantracker.common_info_default_param_dict_templates import particle_info
# globals
status_stranded_by_tide = int(particle_info['status_flags']['stranded_by_tide'])
status_frozen = int(particle_info['status_... | oceantracker/oceantracker | oceantracker/status_modifiers/tidal_stranding.py | tidal_stranding.py | py | 1,701 | python | en | code | 10 | github-code | 13 |
40862270370 | from scapy.all import *
import numpy as np
import binascii
import seaborn as sns
import pandas as pd
sns.set(color_codes=True)
# %matplotlib inline
#this will be loaded into the flask web application in realtime..
def load_analyzer(datafile="dataset/manda-telescope-12-12-09-31-25-163929788500.pcap"):
... | Valmoe/python-machine-learning-on-pcap-files | applib.py | applib.py | py | 8,063 | python | en | code | 0 | github-code | 13 |
10343461791 | from ursina import *
from ursina.prefabs.first_person_controller import FirstPersonController
from math import cos, sin, radians, tan
bullet_speed = 300 #m/s
app = Ursina()
floor_texture = load_texture('floor.png')
target_texture = load_texture('target.png')
sky_texture = load_texture('sky.jpg')
class t... | Hanheum/Gun_firing | ursina_trial.py | ursina_trial.py | py | 6,437 | python | en | code | 0 | github-code | 13 |
10894301162 | import sys
import pygame as py
import math as m
import Senior_Design_Variables as sd
from Iterator import Iterator
sys.path.insert(0, 'C:/Users/drunk/PycharmProjects/pythonProject/Pygame Mechanism Module/Pygame-Mechanism-Module')
import Variables as v
from Point import Point
from CsvWriter import CsvWriter
from CsvR... | mRobinson10-28-98/Pygame-Mechanisms-Projects | Senior Design/PM_Senior_Design.py | PM_Senior_Design.py | py | 2,570 | python | en | code | 0 | github-code | 13 |
7762893596 | import csv
import io
import queue
import datetime
import time
import threading
class loggingTelem():
def __init__(self, telemQ):
self.telemQ = telemQ
self.run_flag = threading.Event()
self.path = 'telemetry/testData%s.csv' % (str(datetime.datetime.today()))
self.csvFile = open(self... | CU-SRL/DAQ | pilot/pilotModule/loggingTelem.py | loggingTelem.py | py | 1,422 | python | en | code | 2 | github-code | 13 |
1652835565 | #这个打败了100%..
class Solution(object):
def maximalSquare(self, matrix):
"""
:type matrix: List[List[str]]
:rtype: int
"""
rows, max_size = len(matrix), 0
'''
size[i]: the current number of continuous '1's in a column of matrix. Reset when discontinued.
T... | fire717/Algorithms | LeetCode/python/_221.MaximalSquare.py | _221.MaximalSquare.py | py | 1,421 | python | en | code | 6 | github-code | 13 |
16774786232 | import json
import os
import sys
import subprocess
import platform
from openmdao.utils.file_utils import files_iter
def nb2dict(fname):
with open(fname) as f:
return json.load(f)
def notebook_filter(fname, filters):
"""
Return True if the given notebook satisfies the given filter function.
... | naylor-b/om_devtools | om_devtools/notebook_utils.py | notebook_utils.py | py | 12,609 | python | en | code | 1 | github-code | 13 |
20498666213 | '''
Created on Sep 6, 2018
@author: Adrian Ridder
'''
#import CardGame
from copy import copy
from CardGame import cardDeck, compareHands,drawRandomCommunityCards, getBestCommunityCards
def hypotheticalHands(times, deck, hand, community, bestCommunityCards = False):
'''Creates hypothetical hands with r... | adrian6912/Card-game | main.py | main.py | py | 4,744 | python | en | code | 0 | github-code | 13 |
2169202586 |
#클래스생성과 객체성성
class 빵틀:
모양=str()
반죽=str()
앙꼬=str()
단가=int()
def 굽기(self,주문갯수):
굽는횟수 = (주문갯수-1)/10+1
완성시간 = int(굽는횟수)*5
return 완성시간
def 가격(self,주문갯수):
금액 = 주문갯수*self.단가
return 금액
def 주문(self,주문갯수,지불금액):
대기시간 = self.굽기(주문갯... | mokimoki191225/jbfc_220506 | pycharm/class/클래스5.py | 클래스5.py | py | 1,563 | python | ko | code | 0 | github-code | 13 |
15805181216 | def average(array):
heights=set(array)
sum=0
for item in heights:
sum+=item
avg=sum/len(heights)
return avg
# n = int(input())
# arr = list(map(int, input().split()))
arr=[161,182,161,154,176,170,167,171,170,174]
result = average(arr)
print(result) | Aakash9399/python | introset.py | introset.py | py | 287 | python | en | code | 0 | github-code | 13 |
39751058272 | from typing import Dict, Union
# Third Party Imports
from sqlalchemy import Column, Float, Integer, String
from sqlalchemy.orm import relationship
# RAMSTK Local Imports
from .. import RAMSTK_BASE
from .baserecord import RAMSTKBaseRecord
class RAMSTKCategoryRecord(RAMSTK_BASE, RAMSTKBaseRecord): # type: ignore
... | ReliaQualAssociates/ramstk | src/ramstk/models/dbrecords/commondb_category_record.py | commondb_category_record.py | py | 4,409 | python | en | code | 34 | github-code | 13 |
17049174494 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import json
from alipay.aop.api.constant.ParamConstants import *
class BelongMerchantInfoDTO(object):
def __init__(self):
self._business_type = None
self._merchant_id = None
self._merchant_open_id = None
@property
def business_type(s... | alipay/alipay-sdk-python-all | alipay/aop/api/domain/BelongMerchantInfoDTO.py | BelongMerchantInfoDTO.py | py | 2,047 | python | en | code | 241 | github-code | 13 |
41603470196 | #!/usr/bin/env python
from setuptools import setup, find_packages
__version__ = '0.1'
setup(
name='nnet',
version=__version__,
url='https://github.com/zhaoyan1117/NeuralNet',
packages=find_packages(),
include_package_data=True,
)
| zhaoyan1117/NeuralNet | setup.py | setup.py | py | 252 | python | en | code | 0 | github-code | 13 |
1721742797 | """Camera library, a component of vision library. Takes images.
"""
import RPi.GPIO as GPIO
import time
from lib_utils import *
import numpy as np
from picamera import PiCamera
class Camera():
"""Camera takes images and saves them in arrays to be processed by Blob.
Attributes:
CAMLED (int): GPI... | fberlinger/blueswarm | fishfood/lib_camera.py | lib_camera.py | py | 3,921 | python | en | code | 2 | github-code | 13 |
35710360766 | from django.urls import path
from . import views
from django.conf.urls.static import static
from django.conf import settings
urlpatterns = [
path('', views.index),
path('generic/', views.generic),
path('elements/',views.elementpage),
path('article/<int:article_id>/', views.article_page,name ='article_p... | jokerhan930/myblog | blog/urls.py | urls.py | py | 610 | python | en | code | 0 | github-code | 13 |
7931900912 | """
Text version of the 52-card Blackjack Late Surrender game for one human Player, and a computer Dealer.
Allows Splits, Doubling Down, Insurance and Surrender.
Dealer stands on soft 17. Blackjack pays 3:2.
To display cards, uses rectangles constructed of pipe operators and underscores.
To display chips, uses colored ... | mvyushko/blackjack_surrender_game | gameplay.py | gameplay.py | py | 23,132 | python | en | code | 0 | github-code | 13 |
31126458194 | from rest_framework.viewsets import ModelViewSet
from rest_framework.permissions import IsAuthenticated, SAFE_METHODS
from rest_framework.response import Response
from rest_framework.status import HTTP_200_OK, HTTP_400_BAD_REQUEST, HTTP_403_FORBIDDEN, HTTP_201_CREATED
from rest_framework.decorators import action
from r... | daxaxelrod/open_insure | policies/claims/views.py | views.py | py | 4,987 | python | en | code | 33 | github-code | 13 |
26525361042 | from .models import Inquiry
def get_business_details(request,user_id,sentence):
reply_dict={}
business_details = request.session.get('business_details',False)
platform= request.session.get('platform',False)
budget = request.session.get('budget',False)
business_type = request.session.get('business_type',False)... | arunraj753/chatbot | chat/extra_cust.py | extra_cust.py | py | 1,641 | python | en | code | 0 | github-code | 13 |
14957774620 | from django.urls import path
from . import views
# . : 현재 디렉토리(blog->urls)
# 경로 urls.py -> index.py
urlpatterns = [
path('search/<str:q>/',views.PostSearch.as_view()), # 글 검색하기
path('delete_comment/<int:pk>/', views.delete_comment),
path('update_comment/<int:pk>/', views.CommentUpdate.as_view()),
path... | Sgkeoi/Goorm_Django | blog/urls.py | urls.py | py | 1,136 | python | ko | code | 0 | github-code | 13 |
23871390903 | import requests
from bs4 import BeautifulSoup
import random as r
from webbrowser import open_new_tab
import spotipy
from spotipy.oauth2 import SpotifyOAuth
a=input("Enter the date you wanna search the songs for in yyyy-mm-dd format")
query="https://www.billboard.com/charts/hot-100/"+a+"/"
res=requests.get(query)
cont... | sandy-iiit/beautifulsoup_projects | bs4-start/best_songs_based_on_date.py | best_songs_based_on_date.py | py | 934 | python | en | code | 0 | github-code | 13 |
70074397459 | import pygame, sys
from pygame.locals import *
from personaggio import Personaggio
from ostacolo import Ostacolo
BLACK = (0,0,0)
WHITE = (255,255,255)
BEIGE = (235,235,235)
pygame.init()
#PARAMETRI FINESTRA
screen_height = 400
screen_length = 900
#SETTAGGI BASE FINESTRA
WINDOW_SIZE = (screen_length, screen_height)
... | caroprosperi6/endless-running-game- | gioco.py | gioco.py | py | 6,223 | python | it | code | 0 | github-code | 13 |
22843668525 | from lr.conflict import ConflictMap
def test_conflict():
con = ConflictMap([1, 2, 3])
con.add(1, 'a')
con.add(1, 'b')
con.add(2, 'c')
good, bad = con.finish()
assert good == {2: 'c'}
assert bad == {1: ['a', 'b']}
def test_default():
con = ConflictMap([1, 2, 3])
con.add(1, 'a')
... | o11c/lr-parsers | lr/tests/test_conflict.py | test_conflict.py | py | 708 | python | en | code | 1 | github-code | 13 |
38321516764 | import pytest
from pygme.game.board import GameBoard
from pygme.hangman import noose
def test_noose_construction():
""" Tests noose.Noose constructor and noose_components class attribute """
test_board = GameBoard(10, 10, " ")
noose_object = noose.Noose(test_board)
required_parts = ["base", "pole", "... | adaros92/pygme | test/hangman/test_noose.py | test_noose.py | py | 3,551 | python | en | code | 0 | github-code | 13 |
14331402747 | import json
import pytest
from flask import Flask
from main import app
# Créez un client de test Flask pour interagir avec l'application
@pytest.fixture
def client():
app.testing = True
return app.test_client()
# Testez la route d'accueil
def test_hello_world(client):
response = client.get('/')
assert... | Walkways/TP3 | python-api-handle-it/app/test_my_module.py | test_my_module.py | py | 1,775 | python | en | code | 0 | github-code | 13 |
30927831375 | import argparse
import datetime
import json
import math
import os
import random
import time
from pathlib import Path
import numpy as np
import ruamel.yaml as yaml
import torch
import torch.backends.cudnn as cudnn
import torch.distributed as dist
import utils
from dataset import create_dataset, create_sampler, create_... | zengyan-97/X-VLM | Grounding_bbox.py | Grounding_bbox.py | py | 10,756 | python | en | code | 411 | github-code | 13 |
16168984975 | #@by mohammadsam ansaripoor
from tkinter import *
from tkinter import font
from tkinter.font import Font
from typing import Sized
from PIL import Image , ImageTk
import tkinter.font as font
from math import *
window = Tk()
window.geometry('1000x800')
window.title('calculator')
window.resizable(width=False,he... | mohammadsam-programmer/calculator | calculator_2.py | calculator_2.py | py | 13,797 | python | en | code | 0 | github-code | 13 |
71588779217 | import trackpy as tp
import argparse
import os
import pandas as pd
from pathlib import Path
import numpy as np
import napari
from datetime import datetime
def track(platelets):
search_range = 3
linked_pc = tp.link_df(platelets, search_range,
pos_columns=['xs', 'ys', 'zs'],
... | AbigailMcGovern/platelet-segmentation | tracking.py | tracking.py | py | 2,465 | python | en | code | 1 | github-code | 13 |
2244444679 | import cairo
import pytest
@pytest.fixture
def context():
surface = cairo.ImageSurface(cairo.FORMAT_ARGB32, 42, 42)
return cairo.Context(surface)
def test_path():
assert cairo.Path
with pytest.raises(TypeError):
cairo.Path()
def test_path_str(context):
p = context.copy_path()
asse... | pygobject/pycairo | tests/test_path.py | test_path.py | py | 1,638 | python | en | code | 570 | github-code | 13 |
19527492822 | import numpy as np
import matplotlib.pyplot as plt
class NeuralNetwork():
def __init__(self, nn_input_dim = 2, nn_output_dim = 2, reg_lambda = 0.01):
"""
nn_input_dim- input layer dimensionality
nn_output_dim - output layer dimensionality
reg_lambda - regularization strength
... | Nusha34/ML-algorithms-from-scratch | ML_algorithms/Neural_Network_Class_without_exercises.py | Neural_Network_Class_without_exercises.py | py | 3,895 | python | en | code | 0 | github-code | 13 |
17588524788 | import logging
import json
from flask import Flask
from flask_cors import CORS
from flask_pymongo import PyMongo
from bson.objectid import ObjectId
mongo = PyMongo()
class JSONEncoder(json.JSONEncoder):
""" extend json-encoder class
"""
def default(self, o):
if isinstance(o, ObjectId):
... | fionamei/chefs-kiss | backend/app.py | app.py | py | 1,870 | python | en | code | 2 | github-code | 13 |
23754558929 | import datetime
from flask import Flask
import unittest
from app import db
from service import user, master, breed, procedure, reservation
class CreateUserTest(unittest.TestCase):
def setUp(self):
"""
Creates a new database for the unit test to use
"""
self.app = Flask(__name__)
... | el-shes/grooming_store | tests/test_reservation_service.py | test_reservation_service.py | py | 4,741 | python | en | code | 0 | github-code | 13 |
13264045813 | # Multiple
class ComputerPart():
def __init__(self, pabrikan, nama, jenis, harga):
self.pabrikan = pabrikan
self.nama = nama
self.jenis = jenis
self.harga = harga
class Processor():
def __init__(self, jumlah_core, speed,):
self.jumlah_core = jumlah_co... | zaedarghazalba/TUGAS-PBOP | TUGAS 5 PBOP/TUGASmultiplecomp.py | TUGASmultiplecomp.py | py | 1,486 | python | en | code | 0 | github-code | 13 |
26617585002 | import argparse
if __name__ == '__main__':
# argument parsing to grab input file
parser = argparse.ArgumentParser(description="Process a list of sea floor depths")
required = parser.add_argument_group("required arguments")
required.add_argument("-i", "--input_file", help="path to the input file", requi... | gmurr20/advent_of_code_2021 | day1/day1_p1.py | day1_p1.py | py | 1,032 | python | en | code | 0 | github-code | 13 |
36565923420 | from django.shortcuts import render,redirect
from .models import Comment
from django.contrib.contenttypes.models import ContentType
# Create your views here.
def comment(request):
user=request.user
text=request.POST.get('text','')
content_type=request.POST.get('content_type','')
object_id=int( request.... | changfengwangluo/zhanku | comment/views.py | views.py | py | 739 | python | en | code | 0 | github-code | 13 |
71135477139 | try:
import qi
from naoqi import ALProxy
except:
print('Not on real Robot')
import argparse
import sys
import time
from PIL import Image
import numpy as np
import cv2 as cv
import copy
import ffmpeg
import math
from PIL import ImageFont, ImageDraw, Image
import zmq
import json, ast
context = zmq.Context()
... | PatrickLowin/RoboCup | utils.py | utils.py | py | 4,689 | python | en | code | 0 | github-code | 13 |
42271967475 | from config import setSelenium, init_crawler,init_parser
from utils import JSONtoExcel, save_to_json, format_text
from current_time import *
from time import sleep
import string
from selenium import webdriver
from selenium.common.exceptions import NoSuchElementException, ElementClickInterceptedException, TimeoutExcepti... | mx-jeff/abrasce-crawler | app.py | app.py | py | 5,929 | python | en | code | 0 | github-code | 13 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.