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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
650534977 | #! /bin/python
import os
import sys
import json
from concurrent import futures
import luigi
import numpy as np
import nifty.tools as nt
import elf.segmentation.features as feats
import elf.segmentation.multicut as mc
from vigra.analysis import relabelConsecutive
import cluster_tools.utils.volume_utils as vu
import ... | constantinpape/cluster_tools | cluster_tools/watershed/slice_agglomeration.py | slice_agglomeration.py | py | 8,264 | python | en | code | 32 | github-code | 6 |
1293372351 | import inspect
from functools import partial
import jax.numpy as jnp
from jax import jit, lax
from onnx_jax.handlers.backend_handler import BackendHandler
from onnx_jax.handlers.handler import onnx_op
from onnx_jax.pb_wrapper import OnnxNode
@onnx_op("MaxPool")
class MaxPool(BackendHandler):
@classmethod
de... | gglin001/onnx-jax | onnx_jax/handlers/backend/maxpool.py | maxpool.py | py | 2,911 | python | en | code | 7 | github-code | 6 |
277421218 | import torch
import torch.nn as nn
import torch.nn.functional as F
from time import time
import numpy as np
from pointnet2.lib import pointnet2_utils as pointutils
# import lib.pointnet2_utils as pointutils
def quat2mat(quat):
x, y, z, w = quat[:, 0], quat[:, 1], quat[:, 2], quat[:, 3]
B = quat.size(0)
... | uncbiag/shapmagn | pointnet2/util.py | util.py | py | 17,400 | python | en | code | 94 | github-code | 6 |
24199755237 | # -*- coding: utf-8 -*-
"""
Created on Fri Jul 5 16:12:19 2019
@author: Administrator
"""
import copy
class Solution:
def permuteUnique(self, nums):
self.__res = []
if not nums:
return self.__res
nums.sort()
self.__used = [False for _ in range(len(nu... | AiZhanghan/Leetcode | code/47. Permutations II.py | 47. Permutations II.py | py | 1,095 | python | en | code | 0 | github-code | 6 |
28181321143 | import asyncio
from dotenv import find_dotenv, load_dotenv
import os
class CreateClients(object):
def __init__(self):
load_dotenv(find_dotenv())
self.account_url = os.environ["CONTAINERREGISTRY_ENDPOINT"]
async def create_registry_client(self):
# Instantiate the ContainerRegistryClien... | teaglebuilt/azure-sdk-for-python | sdk/containerregistry/azure-containerregistry/samples/async_samples/sample_create_client_async.py | sample_create_client_async.py | py | 2,315 | python | en | code | null | github-code | 6 |
75136482107 | import attr
import requests
from typing import Dict, List, Optional
@attr.s
class Image:
id: str = attr.ib()
size: int = attr.ib()
createdAt: str = attr.ib()
origUrl: Optional[str] = attr.ib(default=None)
class YandexImageAPI:
"""
This class is a wrapper around Yandex image storage API.
... | avidale/dialogic | dialogic/utils/content_manager.py | content_manager.py | py | 4,070 | python | en | code | 22 | github-code | 6 |
797067392 | from flask import Blueprint, render_template, url_for, flash, redirect, request, abort
from flask_login import login_user, current_user, logout_user, login_required
from app import db, bcrypt
from app.forms import LoginForm, RegistrationForm, AddBookForm, UpdateBookForm
from app.models import User, Book, BookListBook, ... | AdrienDEBREUILLY/Library_perso_and_family | app/routes.py | routes.py | py | 5,345 | python | en | code | 0 | github-code | 6 |
30914361148 | import streamlit as st
import openai
openai.api_key = st.secrets["OPENAI_API_KEY"]
def write_page_config():
st.set_page_config(
page_title="AI 서비스 개발하기",
page_icon="🧠"
)
def request_chat_completion(prompt, stream=False, system_role=None):
messages = [{"role": "user", "... | yeomko22/useful_chatgpt | common.py | common.py | py | 948 | python | en | code | 0 | github-code | 6 |
32275396284 | import torch
from torch.utils.data import Dataset
from torchvision.datasets import ImageFolder
import torchvision.transforms as transforms
import os
import pandas as pd
import numpy as np
from sklearn.model_selection import train_test_split
class TabularDataset(Dataset):
def __init__(
self,
datase... | cmougan/SelectiveRegression | tools/datasets.py | datasets.py | py | 3,006 | python | en | code | 2 | github-code | 6 |
33526625463 | #Faça um programa que jogue par ou ímpar com o computador. O jogo só será interrompido quando o jogador perder, mostrando o total de vitórias consecutivas que ele conquistou no final do jogo.
from random import randint
vitórias=0
while True:
escolha=input("Você quer par ou ímpar?(DIGITE PAR OU ÍMPAR)").upper()
... | cauavsb/python | mundo-2-py/ex33.py | ex33.py | py | 1,455 | python | pt | code | 0 | github-code | 6 |
24582961875 | import os
# accessible as a variable in index.html:
from sqlalchemy import *
from sqlalchemy.pool import NullPool
from flask import Flask, request, render_template, g, redirect, Response
from flask import redirect, url_for
tmpl_dir = os.path.join(os.path.dirname(os.path.abspath(__file__)), 'templates')
a... | YueWang417/w4111-proj1-group69 | webserver/server.py | server.py | py | 9,229 | python | en | code | 0 | github-code | 6 |
33645813981 | # -*- coding: utf-8 -*-
import os
import importlib
import yaml
#Imports das bibliotecas: Comunicação com Webservers
import json
import requests
from requests.exceptions import ConnectionError
from WebService import *
import re as regex
from PyQt5 import QtWidgets
from PyQt5.QtCore import *
import time
from OS_define im... | Jhonatan-Avelar/aioJhonatan | jhonatanaio/script/ApiManager.py | ApiManager.py | py | 8,318 | python | en | code | 0 | github-code | 6 |
33645832811 | # -*- coding: utf-8 -*-
import yaml
import os
from pathlib import Path
class GlobalParameters:
script_location = Path(__file__).absolute().parent
def __init__(self, FilePath = script_location / 'GlobalParameters.yml'):
# Load the yml config file
with open(FilePath, 'r') as ymlfile:
... | Jhonatan-Avelar/aioJhonatan | jhonatanaio/script/GlobalParameters.py | GlobalParameters.py | py | 862 | python | en | code | 0 | github-code | 6 |
23854746715 | from django.urls import path
from . import views
urlpatterns = [
path('', views.home, name='home'),
path('setup', views.setup, name='setup'),
path('about', views.about, name='about'),
path('real_record', views.real_record, name='real_record'),
path('result', views.result, name='result'),
]
| CHELSEYliuqy/Robo-Website | Robo/Optimizer/urls.py | urls.py | py | 313 | python | en | code | 0 | github-code | 6 |
21965282646 | import argparse
import glob
from pathlib import Path
import numpy as np
import torch
from pcdet.config import cfg, cfg_from_yaml_file
from pcdet.datasets import DatasetTemplate
from pcdet.models import build_network, load_data_to_gpu
from pcdet.utils import common_utils
class DemoDataset(DatasetTemplate):
def _... | adept-thu/Dual-Radar | tools/demo_text.py | demo_text.py | py | 3,490 | python | en | code | 62 | github-code | 6 |
10418893375 | from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.support.wait import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
from selenium.webdriver.common.keys import Keys
from selenium.common.exceptions import NoSuchElementException
from webdriv... | andyvauliln/Google-Maps-Scraper | scrap_place_info_from_googlemap_site.py | scrap_place_info_from_googlemap_site.py | py | 18,017 | python | en | code | 0 | github-code | 6 |
2578272371 | def solution(rows, columns, queries):
answer = []
matrix = [[0] * columns for _ in range(rows)]
for i in range(rows):
for j in range(columns):
matrix[i][j] = i * columns + j + 1
for query in queries:
r1, c1, r2, c2 = query[0]-1, query[1]-1, query[2]-1, query[3]-1
... | mayo516/Algorithm | 주리머/2-3w/행렬 테두리 회전하기.py | 행렬 테두리 회전하기.py | py | 1,104 | python | en | code | null | github-code | 6 |
32341174856 | '''
gamebot.py
Discord bot to let a discord server play gameboy games together. Put discord bot token into 'token.txt'
Requires:
- PILlow
- Discord.py
- PyBoy
Author: CPunch
'''
import io
import os
from pyboy import PyBoy, WindowEvent
from PIL import Image
import discord
im... | CPunch/Gamebot | bot.py | bot.py | py | 17,355 | python | en | code | 4 | github-code | 6 |
18849568621 | # -*- coding: UTF-8 -*-
import gtk
import os
import pango
import gobject
MULT = 1
KB_COLS = 13
KB_ROWS = 1
buttons_ru = [ "ESC", "0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "BACKSP", "GO"]
class Numpad(gtk.Window):
def __init__(self):
super(Numpad, self).__init__()
self.fla... | Andvari/Wordscard | src/Numpad.py | Numpad.py | py | 2,454 | python | en | code | 0 | github-code | 6 |
8642734794 | from typing import (
Protocol,
Type,
runtime_checkable,
)
@runtime_checkable
class ClientProtocol(Protocol):
async def connect(self):
...
async def disconnect(self):
...
def is_client(cls: Type[ClientProtocol]) -> bool:
try:
return issubclass(cls, ClientProtocol)
... | avito-tech/trainspotting | trainspotting/clients.py | clients.py | py | 360 | python | en | code | 5 | github-code | 6 |
30545228636 | import numpy as np
from keras.models import Sequential
from keras.layers import Dense
import matplotlib.pyplot as plt
np.random.seed(1337)
# create some data
X = np.linspace(-1,1,200)
np.random.shuffle(X)
Y = 0.5 * X + np.random.normal(0,0.1,(200,))
# plot data
plt.scatter(X,Y)
plt.show()
X_train, Y_train = X[:160],Y... | limingwu8/ML | regression/regression.py | regression.py | py | 1,009 | python | en | code | 1 | github-code | 6 |
1492499597 | import pymysql
from pymysql import connect
# from baiyu.function.zudai_to_fumudai import *
from baiyu.models import *
import datetime
class OpenDB(object):
def __init__(self):
# 初始化
self.conn = connect(host='localhost', port=3306, user='root', password='123456', database='forecastsystem', charset=... | Suefly/BoyarForecastSystem | baiyu/db.py | db.py | py | 45,424 | python | en | code | 0 | github-code | 6 |
73477696507 | #!/usr/bin/env python
import os
import unittest
import numpy as np
from tinygrad.tensor import Tensor
import tinygrad.optim as optim
from extra.training import train, evaluate
from extra.utils import fetch, get_parameters
# mnist loader
def fetch_mnist():
import gzip
parse = lambda file: np.frombuffer(gzip.open(fi... | fpaboim/tinysparse | test/test_mnist.py | test_mnist.py | py | 2,579 | python | en | code | 9 | github-code | 6 |
35051600024 | class Judy:
@staticmethod
def min(self,list1):
min = list1[0]
for a in list1:
if a < min:
min = a
return min
list2 = [9,6,3,4,8,52,11]
min = Judy.min(list2)
print(min) | JackyCafe/basicProject | basic_14.py | basic_14.py | py | 229 | python | en | code | 0 | github-code | 6 |
38759751525 | import cv2
import imutils
import os
import random
from deletor import delete_randomly
"""
image = cv2.imread("dataedit3/train/iv/edit.png")
rows = image.shape[0]
cols = image.shape[1]
img_center = (cols / 2, rows / 2)
M = cv2.getRotationMatrix2D(img_center, -30, 1)
rotated_image = cv2.warpAffine(image,M, (... | HiteshKhandelwal901/Data-Centric-Ai-Competation | augmentor.py | augmentor.py | py | 4,681 | python | en | code | 0 | github-code | 6 |
70824848187 | from resources.models import datetime
import psycopg as ps
from app.utils.validators import user_check, category_check
from app.resources.exceptions import WrongValue
from settings import settings
def dbconnect(func):
def wrapper(*args):
conn = ps.connect(dbname="data",
user=sett... | buluvva/moneyflow | app/process.py | process.py | py | 1,225 | python | en | code | 0 | github-code | 6 |
10812141792 | import random
import time
gests = ('rock', 'scissor', 'paper')
def computer_random():
rad = random.randrange(3)
return rad
def user_win():
print("User win!")
def computer_win():
print("Computer win!")
def draw():
print("Draw!")
def user_gest_number(x):
return gests.index(x)
def who_win(us... | trytek235/Python_programs | rockScissorsPaper.py | rockScissorsPaper.py | py | 860 | python | en | code | 0 | github-code | 6 |
3666732447 | import middle
import env
import os
import time
import json
env.TMP_FOLDER = os.path.join(env.TMP_FOLDER, 'recheck' + time.strftime('%m-%d_%H-%M-%S'))
if not os.path.exists(env.TMP_FOLDER):
os.mkdir(env.TMP_FOLDER)
with open(env.POISONING_DOMAINS_LIST, 'r') as f:
pds = json.load(f)
zdns_domains = os.path.j... | yingziwu/neatdns | recheck.py | recheck.py | py | 772 | python | en | code | 14 | github-code | 6 |
43282712189 | from .base import BaseContract
class BuyContract(BaseContract):
"""
Seller sets a specific price, and buyer pays for that price
"""
ENTITY_BUYER = "buyer"
ENTITY_CONTENT_OWNER = "content_owner"
TX_TYPE_CONTENT_TRANSFER = "user-content"
ACTION = "buy"
@property
def req_entities(... | joshtechnologygroup/smart-contract | apps/contract/direct_contracts.py | direct_contracts.py | py | 1,800 | python | en | code | 0 | github-code | 6 |
70321062267 | class NodoArbol:
def __init__(self,capacidad , ocupado = None, etiqueta = None,izquierdo=None,derecho=None,padre=None):
self.capacidad = capacidad
self.ocupado = ocupado
self.etiqueta = etiqueta
self.hijoIzquierdo = izquierdo
self.hijoDerecho = derecho
self.padre = pa... | lombac97/Examen-Lenguajes-1 | Pregunta 3/buddy.py | buddy.py | py | 8,716 | python | es | code | 0 | github-code | 6 |
29218727720 | import pytest
from django.test import Client
from django.urls import reverse
@pytest.fixture
def basic_user_client():
return Client()
@pytest.mark.django_db
class TestWebsiteViews:
def test_index_view_get_response_200(self, basic_user_client):
url = reverse("website:index")
response = basic_... | smz6990/DRF-Blog | core/website/tests/test_views.py | test_views.py | py | 1,530 | python | en | code | 2 | github-code | 6 |
2734227744 | # -*- coding: utf-8 -*-
"""
@project ensepro
@since 25/02/2018
@author Alencar Rodrigo Hentges <alencarhentges@gmail.com>
"""
from ensepro.constantes import SinonimosConstantes, LoggerConstantes
from nltk.corpus import wordnet as wn
logger = LoggerConstantes.get_logger(LoggerConstantes.MODULO_SINONIMOS)
def get_si... | Ensepro/ensepro-core | ensepro/sinonimos/sinonimos.py | sinonimos.py | py | 1,735 | python | pt | code | 1 | github-code | 6 |
36706243233 | from audioop import reverse
import re
from math import log
from collections import defaultdict
def solve(N, budget):
def prepare_hash():
maximum = int('1'*N)
max1 = int(log(maximum)/log(2)) + 1
max2 = int(log(maximum)/log(3)) + 1
_hash = []
for a in range(max1):
... | franza73/puzzles | ibm_feb_2022_2.py | ibm_feb_2022_2.py | py | 782 | python | en | code | 0 | github-code | 6 |
2373356170 | from huggingface_hub import login
from transformers import AutoTokenizer, AutoModelForCausalLM, LlamaTokenizer
login(token='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')
tokenizer = AutoTokenizer.from_pretrained("meta-llama/Llama-2-13b-chat-hf")
model = AutoModelForCausalLM.from_pretrained("meta-llama/Llama-2-13b-chat-hf")... | mario872/Isaac-Voice-Assistant | main/Llama2.py | Llama2.py | py | 612 | python | en | code | 0 | github-code | 6 |
29448499379 | #input
num = input("please enter a number")
#remainers function
def remainers(a):
return [int(a) % f for f in range(2, int(a))]
#function multiplying all ints in a list, returns "0" if list contains at least one "0"
def multiplyList(myList):
result = 1
for x in myList:
result = result * x
retu... | CheeseC4k3/practicepython | pythonexercise11.py | pythonexercise11.py | py | 480 | python | en | code | 0 | github-code | 6 |
7259084876 | import os
import re
# Define the OWASP Top 10 vulnerabilities patterns
OWASP_TOP_10 = {
"Injection": [
r"(?i)\b(?:select|insert|update|delete|drop|alter|create)\b[^;]*\b(?:from|into|where)\b",
r"(?i)\b(?:exec|eval|system|os\.popen|subprocess\.call)\b",
r"(?i)\b(?:<\?php|\$_(GET|POST|REQUEST... | asbuch99/VulnerabilityScanner | VulnScanner.py | VulnScanner.py | py | 2,364 | python | en | code | 1 | github-code | 6 |
40695193074 | # coding: utf-8
from db import db
from models.revision import Revision, RevisionItem
from services.core import BaseSQLAlchemyModelService
__author__ = 'StasEvseev'
class RevisionService(BaseSQLAlchemyModelService):
model = Revision
class RevisionServiceException(
BaseSQLAlchemyModelService.Se... | StasEvseev/adminbuy | services/revisionservice.py | revisionservice.py | py | 2,224 | python | en | code | 0 | github-code | 6 |
30367059061 | from contextlib import contextmanager
import sys
import traceback
# ######### Testing tools
@contextmanager
def store_exceptions_on_all_threads():
"""Context manager that captures all exceptions, even those coming from
the UI thread. On exit, the first exception is raised (if any).
"""
exceptions ... | enthought/chaco | chaco/tests/_tools.py | _tools.py | py | 725 | python | en | code | 286 | github-code | 6 |
39287424615 | import array
# check the following code for typecode for converting arrays into bytes
# and then cast bytes into memoryview object.
# https://docs.python.org/3/library/array.html
b = bytes(array.array("i", [1, 2, 3]))
print(b)
d = memoryview(b).cast("i")
# memory view object is an array actually so we can expand it... | 1995parham-learning/python101 | memory-view/main.py | main.py | py | 332 | python | en | code | 3 | github-code | 6 |
1112432236 | import numpy as np
from PIL import Image
import re
from wordcloud import WordCloud, ImageColorGenerator, STOPWORDS
import matplotlib.pyplot as plt
import matplotlib.pyplot as plt
mask= plt.imread('b.jpg')
#准备utf-8编码的文本文件file
fo=open('input.txt', 'r', encoding='utf-8')
strThousand = fo.read().lower()
fo.close()
#print(... | Wang993/code_ | code/ENGLISH WORD FRUQUECY_wordcloud.py | ENGLISH WORD FRUQUECY_wordcloud.py | py | 1,768 | python | en | code | 0 | github-code | 6 |
27250414296 | import django
from django.contrib import admin
from django.urls import path, include
from django.conf.urls.static import static
from django.conf import settings
from drf_yasg.views import get_schema_view
from rest_framework.permissions import AllowAny
from drf_yasg import openapi
schema_url_v1_patterns = [
path(... | moon-hy/lunch-recommendation | config/urls.py | urls.py | py | 1,754 | python | en | code | 0 | github-code | 6 |
8397431053 |
import os
from wsgiref.simple_server import make_server
from pyramid.config import Configurator
from colander import (
Boolean,
Integer,
Length,
MappingSchema,
OneOf,
SchemaNode,
SequenceSchema,
String
)
from deform import (
Form,
ValidationFailure,
widget
)
here = os.p... | tennisracket/bonkh | bonkh/bonkh/app.py | app.py | py | 1,227 | python | en | code | 0 | github-code | 6 |
73758139386 | """Docstring"""
import os
import ezdxf
from .file_utilities import check_file
def check_file_and_folder(
path, save_path, save=True
) -> list[ezdxf.document.Drawing] | None:
"""
Handle file or folder to apply the cleaning process
"""
if os.path.isdir(path):
list_dir = os.listdir(path)
... | ldevillez/pySwTools | pyswtools/ready_dxf/dxf_utilities.py | dxf_utilities.py | py | 1,326 | python | en | code | 3 | github-code | 6 |
35070389629 | import shutil, errno, os
def copy(src, dst):
try:
shutil.copytree(src, dst)
except OSError as exc: # python >2.5
if exc.errno == errno.ENOTDIR:
shutil.copy(src, dst)
else: raise
def merge(src_dir, dest_dir):
#http://stackoverflow.com/questions/7419665/python-move-and-overw... | jsdelivr/cleaner | cleaner/utils/copy.py | copy.py | py | 737 | python | en | code | 1 | github-code | 6 |
73507090108 | #!/usr/bin/python // 파이썬을 위한 파일임을 선언
# -*- coding: utf8 -*- // 인코딩 방식 지정 => 한글 주석으로 인한 실행 에러 방지
# 반복문 : for : 반복 횟수 예측 가능
# while : 반복 횟수 예측 불가능
# for : 사전에 또는 특정 상황에 맞춰서 미리 반복횟수 설정
# while : 특정 조건에 도달할 때까지 반복한다.
# for (초기값;조건식;증감값) --> for : 예측가능
# 파이썬 : 향상된 for문을 사용한다.
# for 변수 in 수열(리스트, 튜플)
# 파이썬... | Fhwang0926/class | python/basic/class_study_for.py | class_study_for.py | py | 2,118 | python | ko | code | 0 | github-code | 6 |
41417945016 | #!/usr/bin/env python3
# Cryptopals Challenge, Set 2, Challenge 12
# CJ Guttormsson
# 2017-01-03
import sys
sys.path.append('..')
from common import (get_random_key, base64_to_bytes, aes_128_ecb_encrypt,
guess_mode, pkcs7_pad)
import random
import itertools
#############
# CONSTANTS #
##########... | cjguttormsson/cryptopals | set2/challenge12.py | challenge12.py | py | 3,257 | python | en | code | 1 | github-code | 6 |
20723823317 | # Exercise 1 : What Are You Learning ?
#
# 1. Write a function called display_message() that prints one sentence telling everyone what you are learning in this course.
# 2. Call the function, and make sure the message displays correctly.
def display_message() :
print("I'm trying to become a web developer")
displ... | Alex-Rabaev/DI-Bootcamp | week 2/Day 4/ExercisesXP/w2d4exerciseXP.py | w2d4exerciseXP.py | py | 7,262 | python | en | code | 1 | github-code | 6 |
43724375221 | import sys
from PySide6.QtGui import QGuiApplication
from PySide6.QtQml import *
from ppt import Maker
if __name__ == "__main__":
app = QGuiApplication(sys.argv)
qmlRegisterType(Maker, "ppt", 1, 0, "Maker")
engine = QQmlApplicationEngine()
engine.load('main.qml')
if not engine.rootObjects():
... | JunTae90/MinChae | main.py | main.py | py | 400 | python | en | code | 0 | github-code | 6 |
21485752439 | # import heapq
from collections import deque
class Solution:
def ladderLength(self, beginWord: str, endWord: str, wordList: List[str]) -> int:
wordList = set(wordList)
if endWord not in wordList:return 0
n = len(wordList)
# def getdist(x, y):
# count = 0
... | bboychencan/Algorithm | leetcode/127.py | 127.py | py | 2,238 | python | zh | code | 0 | github-code | 6 |
43633665683 | # pylint: disable=no-self-use,invalid-name
from __future__ import division
from __future__ import absolute_import
import pytest
from allennlp.data.dataset_readers.conll2003 import Conll2003DatasetReader
from allennlp.common.util import ensure_list
from allennlp.common.testing import AllenNlpTestCase
class TestConll... | plasticityai/magnitude | pymagnitude/third_party/allennlp/tests/data/dataset_readers/conll2003_dataset_reader_test.py | conll2003_dataset_reader_test.py | py | 1,471 | python | en | code | 1,607 | github-code | 6 |
11826395530 | # Example Keplerian fit configuration file
# Required packages for setup
import os
import pandas as pd
import numpy as np
import radvel
import os
# Define global planetary system and dataset parameters
starname = 'HD217014'
nplanets = 1 # number of planets in the system
instnames = ['j'] # list of instrument nam... | ruben-santana/Astro-Research | HD217014/HD217014.py | HD217014.py | py | 3,206 | python | en | code | 0 | github-code | 6 |
71888988667 | """
需要备份的文件和目录由一个列表指定。
备份应该保存在主备份目录中。
文件备份成一个zip文件。
zip存档的名称是当前的日期和时间。
我们使用标准的zip命令,它通常默认地随Linux/Unix发行版提供。Windows用户可以使用Info-Zip程序。注意你可以使用任何地存档命令,
只要它有命令行界面就可以了,那样的话我们可以从我们的脚本中传递参数给它。
"""
import zipfile
def zip_files(files, zip_name):
zip = zipfile.ZipFile( zip_name, 'w')
for file in files:
print (... | fivespeedasher/Pieces | 重要文件创建备份.py | 重要文件创建备份.py | py | 874 | python | zh | code | 0 | github-code | 6 |
71443305149 | # 6.100A Fall 2023
# Problem Set 3
# Name: <insert name>
# Collaborators: <insert collaborators>
"""
Description:
Computes the similarity between two texts using two different metrics:
(1) shared words, and (2) term frequency-inverse document
frequency (TF-IDF).
"""
import string
import math
import re
### DO NOT ... | Shad0wSeven/6.100A | 1_ps3/document_distance.py | document_distance.py | py | 8,407 | python | en | code | 1 | github-code | 6 |
73860373627 | # coding: utf-8
import pilasengine
import random
puntos = 0
pilas = pilasengine.iniciar()
sonido_menu = pilas.sonidos.cargar('Z_Spirit_Of_Fire.wav')
sonido_nivel_1 = pilas.sonidos.cargar('Z_Nightfall.wav')
sonido_nivel_2 = pilas.sonidos.cargar('Z_Just_Ad_Nauseam.wav')
sonido_del_final = pilas.sonidos.cargar(... | da8ah/UTPL-PilasEngineGame | Halo/1.Ejecutable.py | 1.Ejecutable.py | py | 17,937 | python | es | code | 0 | github-code | 6 |
9074380203 |
import requests
import pandas as pd
from pytube import YouTube, Search
import os
from pathlib import Path
from .serializers import *
# Youtube credentials
YOUTUBE_KEY_API = 'YOUR_YOUTUBE_KEY_API'
# Setting url for videos and searching list
SEARCH_URL = 'https://www.googleapis.com/youtube/v3/search'
VIDEOS_URL = 'htt... | nikavgeros/DJ-Studio | backend/dj_studio/utils.py | utils.py | py | 9,608 | python | en | code | 0 | github-code | 6 |
21217863407 | import cgi
from http.server import BaseHTTPRequestHandler,HTTPServer
from db_setup import Base,Restaurant,MenuItem
from sqlalchemy import create_engine
from sqlalchemy.orm import sessionmaker
engine = create_engine('sqlite:///restaurantmenu.db')
Base.metadata.bind = engine
DBSession = sessionmaker(bind=engine)
sess... | SelbayevAlmas/fullstack_foundations_example | myserver.py | myserver.py | py | 7,756 | python | en | code | 1 | github-code | 6 |
20573212978 | from flask import Flask, send_file
app = Flask(__name__)
from tools.sound_file_generator import sound_generator
from tools.interval import Interval
@app.route("/")
def index ():
return "MusicApp is active"
@app.route("/audiofile/<note>")
def get_note_sound(note):
generator = sound_generator()
sound_url = ... | DanieleSpera/EarTraningAPI | __init__.py | __init__.py | py | 822 | python | en | code | 0 | github-code | 6 |
16021103449 | ''''
Testando o que já vi em python com apenas um programa
'''
class NuBankNextWithLepra:
fish = 100.00
cashFish = 0
tiger = 50.00
cashTiger = 0
monkey = 20.00
cashMonkey = 0
bird = 10.00
cashBird = 0
birdWithLongFeet = 5.00
cashBirdWithLongFeet = 0
turtle = 2.00
cashTu... | Renanas-zz/Python-Scripts | bancoComLepra.py | bancoComLepra.py | py | 2,349 | python | en | code | 0 | github-code | 6 |
1706295460 | import numpy as np
from sklearn import datasets
from sklearn.model_selection import train_test_split
import matplotlib.pyplot as plt
import numpy as np
from sklearn.model_selection import train_test_split
# MED分类器
class Medclass:
def __init__(self):
self.center_dict = {} # 分类中心点,以类别标签为键 label: center_po... | suudeer/iris-su2021 | iris-su2021/iris/main.py | main.py | py | 11,704 | python | en | code | 0 | github-code | 6 |
26447487026 | import os
import json
from PIL import Image
import numpy as np
from numpy.core.numeric import full
import torch
from torch.utils.data import Dataset
from tqdm import tqdm
import sys
from pcl_generator import PointCloudGenerator
from lidar_generator import PseudoLidarGenerator
def load_pose(extrinsics: dict) -> np.a... | jonathsch/multisensor | pseudolidar/pseudo_lidar_dataset.py | pseudo_lidar_dataset.py | py | 18,526 | python | en | code | 0 | github-code | 6 |
28960969271 | import gpudb
import collections
import time
import pandas as pd
pd.options.display.max_columns = 100
pd.set_option('display.width', 10000)
# init
TABLE = "risk_inputs"
COLLECTION = "RISK"
NEW_TABLE = "bs_stream"
HOST = "<ipaddress>"
ENCODING = "binary"
PORT = "9191"
DATA_PACK = 1
INGEST_FREQ = 3
"Execute python scrip... | nickalonso/Utilities | stream.py | stream.py | py | 5,101 | python | en | code | 0 | github-code | 6 |
72774157309 | def Productsmallpair(sum, arr):
if len(arr)<2:
return -1
arr = sorted(arr)
hashMap = dict()
for i in range(len(arr)):
hashMap[arr[i]] = 1
for i in range(len(arr)):
num1 = arr[i]
num2 = sum-num1
if hashMap.get(num2) != None and num2+num1 <= sum:
ret... | V-nsh/DSA | accenture practice/from_coding_ninjas_Site/Productsmallpair.py | Productsmallpair.py | py | 642 | python | en | code | 1 | github-code | 6 |
30107078628 | """ Python Package Imports """
# Not Applicable
""" Django Package Support """
from django.contrib import admin
""" Internal Package Support """
""" -- IMPORTED AT APPROPRIATE SUBSECTION -- """
"""
event/admin.py
Author: Matthew J Swann
Version: 1.0
Last Update: 2014-06-05
Update b... | mjs0031/view_trials | Event/admin.py | admin.py | py | 1,197 | python | en | code | 0 | github-code | 6 |
32481834912 | import matplotlib.pyplot as plt
import pandas as pd
import tensorflow as tf
from constants import nb_class
from tracking import get_dataframes
tf.compat.v1.enable_eager_execution() # Remove when switching to tf2
pd.plotting.register_matplotlib_converters()
###############################
# Methods for data formattin... | benoitkoenig/blobWar-image | faster_rcnn/visualization.py | visualization.py | py | 3,864 | python | en | code | 0 | github-code | 6 |
27009683508 | from sklearn.gaussian_process import GaussianProcessRegressor
def run(x_train, y_train, x_test, y_test,
kernel, alpha, optimizer, n_restarts_optimizer, normalize_y, copy_X_train, random_state
):
reg = GaussianProcessRegressor(kernel=kernel,
alpha=alpha,
... | lisunshine1234/mlp-algorithm-python | machine_learning/regression/gaussian_processes/GaussianProcessRegressor/run.py | run.py | py | 1,133 | python | en | code | 0 | github-code | 6 |
36052032500 | import cv2
cap = cv2.VideoCapture(1,cv2.CAP_DSHOW)
if not cap.isOpened:
print('Cant open camera')
exit(0)
cap.set(3,480)
cap.set(4,720)
cnt = 80
path = "Main_picture/"
ret,frame = cap.read()
H,W,_ = frame.shape
while True:
ret,frame = cap.read()
cv2.circle(frame,(W//2,H//2),5,(0,255,0),-1)
... | HieunnUTE/Rubik-solver-with-Image-processing | capture.py | capture.py | py | 628 | python | en | code | 3 | github-code | 6 |
20800499152 | n = int(input())
def prime_factors(n):
i = 2
factors = []
while i * i <= n:
if n % i:
i += 1
else:
n //= i
factors.append(i)
if n > 1:
factors.append(n)
return factors
product = 1
factors = prime_factors(n)
for i in f... | michbogos/olymp | 335/K.py | K.py | py | 384 | python | en | code | 0 | github-code | 6 |
42483090749 | # pylint: disable=redefined-outer-name, unused-argument
"""
test src/config.py
"""
from contextlib import contextmanager
import pytest
from src.config import ConfigLoader
@contextmanager
def mock_open(config_content):
"""
Create config from mock file
"""
try:
yield config_content
finally... | dom38/secret-distribution-operator | tests/config_test.py | config_test.py | py | 1,161 | python | en | code | 0 | github-code | 6 |
30513785226 | from gaesessions import get_current_session
import logging
import levr_classes as levr
import levr_encrypt as enc
import base64
from google.appengine.api import urlfetch,taskqueue
import json
import urllib
from datetime import datetime, timedelta
def login_check(self):
''' for merchants ONLY
check if logged in, and... | holmesal/levr-2 | merchant_utils.py | merchant_utils.py | py | 4,377 | python | en | code | 0 | github-code | 6 |
22023765931 | #!/usr/bin/env python3
info = dict()
while(True):
e = input("Insira nome e idade separador por espaço: ")
if e == "sair" or e == "quit" or e == "exit":
break
dados = e.split()
if len(dados) > 2:
print("Use apenas um espaço para inserir dados")
continue
try:
info.upda... | Ruanfc/lista3_python_para_engenharia | 10/main.py | main.py | py | 748 | python | pt | code | 0 | github-code | 6 |
74946284667 | import random
# losuje liczby całkowite z podanego przedziału i dodaje do tablicy
def drawingNumbers():
i = 0
global randomNumbers
randomNumbers = []
while i < 10:
randomNumber = random.randint(1, 20)
randomNumbers.append(randomNumber)
i = i + 1
# liczy ilość liczb większych ... | damqu44/Python-Course | algorytmy/main.py | main.py | py | 2,015 | python | pl | code | 0 | github-code | 6 |
26555794429 | from django.test import TestCase
from django.contrib.contenttypes.models import ContentType
from .models import RootObject, Uri
class ModelTestCase(TestCase):
def setUp(cls):
# Set up data for the whole TestCase
user_type = ContentType.objects.get(app_label="auth", model="user")
RootObjec... | acdh-oeaw/apis-core-rdf | apis_core/apis_metainfo/test_models.py | test_models.py | py | 778 | python | en | code | 3 | github-code | 6 |
72698063549 | # -*- coding: utf-8 -*-
"""
Created on Fri Sep 21 10:29:50 2018
@author: qwzhou
"""
"""
=======================================
plot line and dash
=======================================
ASM across the site
"""
import numpy as np
import matplotlib.pyplot as plt
import sys
from matplotlib.backends.backend_pdf import P... | ZhouQiangwei/MethHaploScripts | plotASM-expressiongene.py | plotASM-expressiongene.py | py | 5,901 | python | en | code | 0 | github-code | 6 |
24764641791 | # -*- coding: utf-8 -*-
import numpy as np
import matplotlib.pyplot as plt
from .module import Module
from ...autograd import Variable, Backward
class Regression(Module):
'''Base loss function class for Regression task\n
Regression is the task of approximating a mapping function (f) from input variable... | Kashu7100/Qualia | qualia/nn/modules/loss.py | loss.py | py | 10,787 | python | en | code | 3 | github-code | 6 |
74348735227 | # https://www.acmicpc.net/problem/1912
# 예상 알고리즘: DP, 슬라이딩 윈도우?
# 베스트 알고리즘: DP
import sys
input = sys.stdin.readline
def solutionInput():
n = int(input().rstrip())
numbers = list(map(int, input().split()))
return n, numbers
def solution(n, numbers):
dp = numbers[0]
answer = numbers[0]
for i i... | ksh103/Algorithm-Study-Reboot | 230102/장예찬_boj_1912_연속합.py | 장예찬_boj_1912_연속합.py | py | 504 | python | en | code | 0 | github-code | 6 |
36609287561 | import re
message = 'Call me 415-555-2345 tomorrow, or at 415-555-1245.'
phoneNumRegex = re.compile(r'(\d\d\d)-(\d\d\d-\d\d\d\d)')
mo = phoneNumRegex.search(message)
print(mo.group(1))
phoneNumRegex = re.compile(r'\d\d\d-\d\d\d-\d\d\d\d')
moList = phoneNumRegex.findall(message)
print(moList)
batRegex = re.compile(... | rain15/MyPythonScripts | phone.py | phone.py | py | 857 | python | en | code | 0 | github-code | 6 |
15932153331 | """
A simple cache system for storing such things as project hierarchies and templates.
By default uses diskcache for simpler setup and backward compatibility
unless 'memcached' is set in the 'cache' section of the
config, in which case use that.
"""
import logging
from hydra_base import config as hydr... | hydraplatform/hydra-base | hydra_base/lib/cache.py | cache.py | py | 1,015 | python | en | code | 8 | github-code | 6 |
35611313706 | """
In this we write an Algorithm for Linear search
"""
# Linear Search:
"""
Linear Search is a algorithm in which we find a given number is present in the array at which index
Example:
array = [1,2 3, 4]
# Number which we need to find at which index: 4
output:3
Because 4 its present at 3rd index
"""
# size of Array
s... | MDTalha178/Python_DSA | Array/linear_serach.py | linear_serach.py | py | 1,892 | python | en | code | 0 | github-code | 6 |
44669737946 | # https://docs.python.org/3/library/socket.html#socket.SOCK_DGRAM
# used this to learn how to initialize socket.
import ipaddress
# https://www.securecoding.com/blog/how-to-build-a-simple-backdoor-in-python/
# This file itself is an iteration on the client described here.
import socket
import subprocess
import... | gavinlampton/CECS378_Group6_Project | client.py | client.py | py | 3,358 | python | en | code | 0 | github-code | 6 |
3083968092 | import ball_reader
import csv
from StackedESN import StackedESN
import matplotlib.pyplot as plt
import numpy as np
import os
def train_tracker(ball_data_folder, plot_path, networks_count, n_reservoir,
train_cycles=20, test_cycles=10,
alpha=0.8, resSize=100, plot_show=True):
plot_name='tracker'
if not ... | ksk-S/DynamicChangeBlindness | workspace_models/echo_state_network/switch_tracker.py | switch_tracker.py | py | 4,370 | python | en | code | 0 | github-code | 6 |
21188550409 | class Solution:
def kClosest(self, points: List[List[int]], k: int) -> List[List[int]]:
dist = []
for i in range(len(points)):
dist.append([sqrt(points[i][0] ** 2 + points[i][1] ** 2), points[i]]) #getting the
dist.sort() # √ of square numbers in... | AhmedMaherTohmay/IEEE-ZSB-Technica1-Rookies-23 | task7/p3.py | p3.py | py | 562 | python | en | code | 0 | github-code | 6 |
10294260342 | __url__ = "$URL: svn://gizmojo.org/pub/evoque/trunk/domain.py $"
__revision__ = "$Id: domain.py 1153 2009-01-20 11:43:21Z mario $"
import sys, logging
from evoque.collection import Collection
from evoque.evaluator import set_namespace_on_dict, xml
def get_log():
logging.basicConfig(level=logging.INFO,
f... | phonybone/Rnaseq | ext_libs/evoque/domain.py | domain.py | py | 7,129 | python | en | code | 3 | github-code | 6 |
45180348436 | #判断一个视频是否属于幽默类还是实用类
import numpy as np
import operator
from matplotlib import pyplot as plt
def traindataset():
datagroup=np.loadtxt('C:\\Users\\Dell\Desktop\\classification\\diabetes_train.txt',dtype=float,delimiter=',')
dataset=datagroup[:,1:]
label=datagroup[:,0]
return dataset,label
def testdat... | lijiaming666/Python_demo | K近邻法+ROC.py | K近邻法+ROC.py | py | 2,540 | python | zh | code | 0 | github-code | 6 |
16462145161 | import cv2
import numpy as np
# np.set_printoptions(threshold=np.inf)
import time
from collections import deque
import threading
# Low Quality
# PAUSE_INDICATOR = (-1, 0)
# RESOLUTION = "480p15"
# FPS = 15
# Production quality
PAUSE_INDICATOR = (-1, 0)
RESOLUTION = "1440p60"
FPS = 60
cv2.namedWindow("Frame", 0);
cv... | bsamseth/masters-presentation | player.py | player.py | py | 5,552 | python | en | code | 2 | github-code | 6 |
2799581400 | import streamlit as st
import pandas_ta as ta
import pandas as pd
import yfinance as yf
import pandas as pd; import numpy as np
st.title("Volatility Dashboard")
st.sidebar.title("selection")
option = st.sidebar.selectbox("options",('long signal', 'short signal', 'data frame', 'Important dates', 'implinks'))
st.subhead... | carolinedlu/volatility-dashboard | dashboard.py | dashboard.py | py | 7,458 | python | en | code | 0 | github-code | 6 |
29699780347 | import pandas as pd
import numpy as np
import geopandas as gpd
import matplotlib.pyplot as plt
from scipy import ndimage
import geoplot
import matplotlib.pylab as pylab
# import geoplot as gp
from models import Simulation, NTAGraphNode, DiseaseModel
def read_hospital_data(filename):
df = pd.read_csv(filename,... | cwaldron97/Comp-Epi-Project | hospitals.py | hospitals.py | py | 2,990 | python | en | code | 0 | github-code | 6 |
30217438684 | import seaborn as sns
import matplotlib.pyplot as plt
#%matplotlib inline
tips = sns.load_dataset('tips')
fluege = sns.load_dataset('flights')
###Matrixplots###
#Heatmap
#Damit die Heatmap gut funktioniert sollten eure Daten bereits in Matrixform vorliegen. Die sns.heatmatp() übernimmt dann die Einfärbung dieser Date... | ThePeziBear/MyPythonLibrary | Visualizing_Python/Seaborn/2_matrix_regression_function_seaborn.py | 2_matrix_regression_function_seaborn.py | py | 2,082 | python | de | code | 0 | github-code | 6 |
4357761100 | from flask_wtf import Form
from wtforms import StringField, TextAreaField, SelectField
from wtforms import SubmitField, validators
# from wtforms.ext.sqlalchemy.fields import QuerySelectField
from ..models import Department, Service
class RequestForm(Form):
'''This class creates an RequestForm
object.
'''... | bazanovam/smartIT | app/request/forms.py | forms.py | py | 1,819 | python | en | code | 0 | github-code | 6 |
71602794748 | #
#
# Key-Holding-Macro made by JngVedere
# Github : https://github.com/JngVedere
# version 0.1.0 - Released on 03-06-2023
#
#
from tkinter import messagebox, ttk
from tendo import singleton
try:
singleton.SingleInstance()
except SystemExit as e:
messagebox.showerror("ERROR", e)
import tkint... | JngVedere/Key-Holding-Macro | main.py | main.py | py | 7,540 | python | en | code | 0 | github-code | 6 |
22218753276 | from director import lcmUtils
from director import transformUtils
import PythonQt
import bot_core as lcmbotcore
from director.simpletimer import SimpleTimer
import numpy as np
class StateListener(object):
def __init__(self):
self.subscriber = None
self.transforms = []
self.timer = SimpleT... | RobotLocomotion/director | src/python/director/statelistener.py | statelistener.py | py | 1,387 | python | en | code | 176 | github-code | 6 |
35073881294 | # helper functions
def format_show_info(show):
empty_placeholder = "—"
star_emoji = "★"
empty_star_emoji = "☆"
text = "_{name} ({start} - {end})_\
\nRating: {rating}\
\nGenres: _{genres}_\
\nRuntime: _{runtime}_\
\nStatus: _{status}_"
name = getatt... | devanjith/tvtimebot | helpers/util.py | util.py | py | 1,599 | python | en | code | 0 | github-code | 6 |
42667622123 | from models import db
from flask import Flask, request, jsonify
from bson.json_util import dumps
def getPacientes():
con = db.get_connection()
dbejercicios = con.ModeloEjercicios
try:
pacientes = dbejercicios.pacientes
retorno = dumps(pacientes.find({}))
return jsonify(retorno)
... | andres94091/projectEjerciciosBackend | models/pacientes.py | pacientes.py | py | 2,139 | python | es | code | 0 | github-code | 6 |
42727324036 | import os
import csv
import numpy as np
import sys
from PIL import Image
class DataBuilder:
def __init__(self, image_dir, label_file, output_dir,output_file, output_label_file, target_size):
self.image_dir = image_dir
self.label_file = label_file
self.target_size = target_size
self.... | maximiliann97/TIF360-project-GIF-emotion-flipper | generate_data/DataBuilder.py | DataBuilder.py | py | 4,326 | python | en | code | 0 | github-code | 6 |
2845548081 | from django.shortcuts import render
from .models import Directores, Peliculas
def index (request):
directores = Directores.objects.all()
return render(request, 'index.html', context={
'directores': directores,
})
# Capturando la variable ids pasada en la url
# El nombre de la variable debe coinc... | Ranset/django_openbootcamp_exercise12 | directores/views.py | views.py | py | 1,805 | python | es | code | 0 | github-code | 6 |
314481349 | # imports
import os
import numpy as np
import pandas as pd
import pymysql
from pandas.plotting import table
import matplotlib.pyplot as plt
from datetime import datetime
from util.Event import Event
from matplotlib import rc
font = {'family' : 'DejaVu Sans',
'weight' : 'normal',
'size' : 12}
rc('font'... | noahfranz13/IOU | util/IO.py | IO.py | py | 8,566 | python | en | code | 1 | github-code | 6 |
41366711164 | # -*- encoding: utf-8 -*-
import sys, argparse, json, ovh, re, datetime,configparser
from urllib import parse
def main(argv):
parser = argparse.ArgumentParser()
parser.add_argument('--url','-u', help='Url recu par email du type https://www.ovh.com/manager/#/useraccount/contacts/123456?tab=REQUESTS&token=monsupe... | FlorianKronos/ovh-api-scripts | acceptTranfert.py | acceptTranfert.py | py | 2,376 | python | en | code | 0 | github-code | 6 |
27731604302 | import pandas as pd
import numpy as np
import re
class loadCSV(object):
def __init__(self):
dataSet = [i.strip().split(",") for i in open('smileannotationsfinal.csv', 'r', encoding="utf8").readlines()]
for index, val in enumerate(dataSet):
if len(val) > 3:
dataSet[inde... | thanapol2/twitter_python | loadCSV.py | loadCSV.py | py | 1,202 | python | en | code | 0 | github-code | 6 |
18417538437 | from typing import List
from functools import lru_cache
class Solution:
def canJump_top_down(self, nums: List[int]) -> bool:
n = len(nums)
@lru_cache(None)
def can_jump(i):
if i < 0 or i >= n:
return False
if i + nums[i] >= n - 1:
ret... | ace-wu/oj | leetcode/0055-jump-game.py | 0055-jump-game.py | py | 850 | python | en | code | 3 | github-code | 6 |
17767255083 | from datetime import datetime
import uuid
class Order():
def __init__(self, order):
self.__dict__ = order
self.id = str(uuid.uuid4())
class RenderDishInfo():
def __init__(self, id, name, shelf, value, isPicked, isDecayed):
self.id = id
self.name = name
self.shelf = shelf
self.value = value
self.isPic... | purifier1990/PythonLearn | kitchen/order.py | order.py | py | 363 | python | en | code | 1 | github-code | 6 |
11779785900 | from scripts.util import read_supertopics, SuperTopic, get_spottopics, DateFormat, read_temp_dist
from typing import Literal
import numpy as np
import json
from prettytable import PrettyTable
DATASET = 'climate2'
LIMIT = 7000000
DATE_FORMAT: DateFormat = 'monthly'
NORM: Literal['abs', 'col', 'row'] = 'abs'
BOOST = ['r... | TimRepke/twitter-climate | code/figures/supertopics/spot_topic_stats.py | spot_topic_stats.py | py | 3,415 | python | en | code | 1 | github-code | 6 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.