filename stringlengths 13 19 | text stringlengths 134 1.04M |
|---|---|
the-stack_0_6273 | #!/usr/bin/env python3
# IMPORTS
# system
import sys, time
from copy import copy
from collections import defaultdict
import pdb
# math
import numpy as np
from scipy.spatial.transform import Rotation as R
# ros
from utils import *
class RaptorLogger:
"""
This helper class writes to /reads from log files.
... |
the-stack_0_6274 | #!/usr/bin/env python
#
# This software is Copyright (c) 2010-2016
# Adam Maxwell. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
#
# - Redistributions of source code must retain the above cop... |
the-stack_0_6277 | # This code is part of Qiskit.
#
# (C) Copyright IBM 2017, 2018.
#
# This code is licensed under the Apache License, Version 2.0. You may
# obtain a copy of this license in the LICENSE.txt file in the root directory
# of this source tree or at http://www.apache.org/licenses/LICENSE-2.0.
#
# Any modifications or derivat... |
the-stack_0_6278 | #! /usr/bin/env python3
# coding=utf-8
# This code is licensed under a non-commercial license.
import os
import sys
import argparse
from tqdm import trange
from torchtext import data as torchtext_data
from torchtext import datasets
import torch
import torch.utils.data as data
from torchtext.vocab import Vectors, Gl... |
the-stack_0_6280 | """Compute the largest double precision number that doesn't cause
exp/cosh/sinh to overflow.
"""
import numpy as np
np.seterr(all='ignore')
def find_overflow(f, a, b):
# Start with a binary search
while True:
mid = 0.5*(a + b)
if f(mid) == np.inf:
b = mid
else:
... |
the-stack_0_6281 | # load extern modules
import gym
import csv
import time
import numpy as np
from stable_baselines.bench import Monitor
from supervisors.utils import distance_from_obstacles
from env.utils import obs_lidar_pseudo
import threading
from supervisors.cbf import initialize_gp_dynamics, predict_successor_state_gp, initialize_s... |
the-stack_0_6282 |
import matplotlib
matplotlib.use("Agg")
from keras.preprocessing.image import ImageDataGenerator
from keras.optimizers import Adagrad
from keras.utils import np_utils
from sklearn.metrics import classification_report
from sklearn.metrics import confusion_matrix
import net
from configuration import config
from imutils... |
the-stack_0_6283 | #!/usr/bin/python
"""
Wi-Fi protocol definitions
current supports for packets below
Management
-Probe Request
-Probe Response
-Beacon
Control
-RTS
-CTS
-Block Acknowledgement
Data
-QoS Data
Also have Radiotap support
http://www.radiotap.org/defined-fields
"""
import ctypes
import struct... |
the-stack_0_6285 | import json
import pandas as pd
import numpy as np
import requests
from cleanup import bubi_coredata
try:
from BeautifulSoup import BeautifulSoup
except ImportError:
from bs4 import BeautifulSoup
# ruft die collection id für einen collection-Eintrag ab
def get_ezb_id(collection):
# falls keine collectio... |
the-stack_0_6286 | from ibm_cloud_security_advisor import NotificationsApiV1
from ibm_cloud_sdk_core.authenticators import IAMAuthenticator
authenticator = IAMAuthenticator(
apikey='abc')
notifications_service =NotificationsApiV1(authenticator=authenticator)
notifications_service.set_service_url("https://us-south.secadvisor.cloud.i... |
the-stack_0_6287 | #! /usr/bin/env python
from os import environ
from insightlab import Insight, InsightObjects
TOKEN = environ.get("INSIGHT_TOKEN", "")
## Set login
i = Insight.API(TOKEN, "4")
## Load the object
my_server = i.load("IDLAB-5709")
print(f"Current hostname: {my_server.attribute_value_by_name('Hostname')}")
## Find the a... |
the-stack_0_6292 | # Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# MIT License. See license.txt
from __future__ import unicode_literals
import frappe
from frappe import _
from frappe.utils import now_datetime, cint, cstr
import re
from six import string_types
from frappe.model import log_types
def set_new_name(d... |
the-stack_0_6293 | # Version 1.0; Erik Husby; Polar Geospatial Center, University of Minnesota; 2017
from __future__ import division
import os
import numbers
from operator import itemgetter
import gdal, ogr, osgeo, osr
import numpy as np
PROJREF_POLAR_STEREO = """PROJCS["unnamed",GEOGCS["WGS 84",DATUM["WGS_1984",SPHEROID["WGS 84",637... |
the-stack_0_6294 | # Copyright 2019 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, s... |
the-stack_0_6295 | #!/usr/bin/env python
"""
Created by howie.hu at 2021/4/10.
Description:常用调度函数
- 运行: 根目录执行,其中环境文件pro.env根据实际情况选择即可
- 命令: PIPENV_DOTENV_LOCATION=./pro.env pipenv run python src/schedule_task/all_tasks.py
Changelog: all notable changes to this file will be documented
"""
import time
from src.clas... |
the-stack_0_6296 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""A module that implements the "theanolm train" command.
"""
import sys
import mmap
import logging
import h5py
import numpy
import theano
from theanolm import Vocabulary, Architecture, Network
from theanolm.backend import TextFileType, get_default_device
from theanolm.... |
the-stack_0_6300 | from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from symbol.resnet import *
from symbol.config import config
from symbol.processing import bbox_pred, clip_boxes, nms
import face_embedding
from mapr_streams_python import Consumer, KafkaError, Producer
import ... |
the-stack_0_6301 | # additional transforms for okutama-action dataset
import random
from PIL import Image, ImageOps
class GroupRandomVerticalFlip(object):
"""
Randomly vertical flips the given PIL.Image with a probability of 0.5
"""
def __init__(self, is_flow=False):
self.is_flow = is_flow
def __call__(se... |
the-stack_0_6303 | from flask import Flask, render_template, request, json
from module import utils
from os import remove
import face_recognition
app = Flask(
__name__,
static_url_path="",
static_folder="static",
template_folder="template"
)
@app.route("/", methods=["GET","POST"])
def index():
if request.method ==... |
the-stack_0_6304 | """Script to produce catalogues for use in stacking analysis.
The catalogues themselves are randomly produced for the purpose of trialing
the code. Modification of variable n can produces a catalogue with an
arbitrary number of sources.
"""
import numpy as np
import os
import logging
import random
import zlib
from fl... |
the-stack_0_6305 | import json
from herbieapp.services import logging, SchemaRegistry, SchemaPackage
from herbieapp.models import Schema
class SchemaImporter:
def __init__(self):
self._logger = logging.getLogger(__name__)
self._schema_package = SchemaPackage()
def import_schemas(self):
schema_list = sel... |
the-stack_0_6306 | import numpy as np
from opytimizer.optimizers.science import eo
from opytimizer.spaces import search
def test_eo_params():
params = {
'a1': 2.0,
'a2': 1.0,
'GP': 0.5,
'V': 1.0
}
new_eo = eo.EO(params=params)
assert new_eo.a1 == 2.0
assert new_eo.a2 == 1.0
a... |
the-stack_0_6307 | # Copyright (C) 2001-2006 Python Software Foundation
# Author: Barry Warsaw
# Contact: email-sig@python.org
"""Base class for MIME specializations."""
__all__ = ['MIMEBase']
import email.policy
from email import message
class MIMEBase(message.Message):
"""Base class for MIME specializations."""
def __i... |
the-stack_0_6309 | # Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import os
import sys
import shutil
import tempfile
import subprocess
from typing import List, Any, Union, Optional, Dict
... |
the-stack_0_6310 | from django.contrib.auth import get_user_model
from django.urls import reverse
from django.test import TestCase
from rest_framework import status
from rest_framework.test import APIClient
from core.models import Ingredient, Recipe
from recipe.serializers import IngredientSerializer
INGREDIENT_URL = reverse('recipe:in... |
the-stack_0_6312 | from asyncio import Lock, create_task
from time import time
from pyrogram import filters
from pyrogram.types import Message
from wbb import BOT_ID, SUDOERS
from wbb.core.sections import bold, section, w
tasks = {}
TASKS_LOCK = Lock()
arrow = lambda x: (x.text if x else "") + "\n`→`"
def all_tasks():
return tas... |
the-stack_0_6313 | import subprocess
from text2speech.modules import TTS, TTSValidator
class ESpeakNG(TTS):
audio_ext = "wav"
def __init__(self, config=None):
config = config or {"lang": "en-us", "voice": "m1"}
super(ESpeakNG, self).__init__(config, ESpeakNGValidator(self),
... |
the-stack_0_6314 | import datetime
import json
import operator
import time
from typing import Any, Callable, Generator, List, Optional, Tuple, Union
from sqlalchemy import inspect
from wtforms import Form, ValidationError, fields, widgets
from sqladmin import widgets as sqladmin_widgets
from sqladmin.helpers import as_str
__all__ = [
... |
the-stack_0_6315 | _base_ = '../faster_rcnn/faster_rcnn_r50_caffe_fpn_1x_icdar2021.py'
rpn_weight = 0.7
model = dict(
rpn_head=dict(
_delete_=True,
type='CascadeRPNHead',
num_stages=2,
stages=[
dict(
type='StageCascadeRPNHead',
in_channels=256,
... |
the-stack_0_6317 | #!/usr/bin/python
#-*- coding: utf-8 -*-
# Library: pip3 install opencv-python
import cv2
# Load the cascade
# /Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/cv2/data/haarcascade_frontalface_alt.xml
face_cascade = cv2.CascadeClassifier('face_detector.xml')
# Read the input image
img = ... |
the-stack_0_6318 | #!/usr/bin/env python3
from marshmallow import Schema, fields, RAISE
from marshmallow import ValidationError
from marshmallow.validate import Range
class BytesField(fields.Field):
def _validate(self, value):
if not isinstance(value, bytes):
raise ValidationError('Invalid input type.')
... |
the-stack_0_6319 | ##########################################################################
#
# pgAdmin 4 - PostgreSQL Tools
#
# Copyright (C) 2013 - 2020, The pgAdmin Development Team
# This software is released under the PostgreSQL Licence
#
##########################################################################
import uuid
impor... |
the-stack_0_6322 | import extract_sift, extract_global, retrieval, config
import os, shutil, argparse
def parse_arguments():
parser = argparse.ArgumentParser(description='Evaluate dataset')
parser.add_argument(
'--sift_mode', # mode = 0 -> SIFT detector; 1 -> Hessian affine detector
type=int,
required=Fal... |
the-stack_0_6323 | #Built in Python
import os
import sys
import glob
#Standard Packages
from astropy.io import ascii
from astropy import table
from astropy.time import Time
import numpy as np
from matplotlib import pyplot as plt
import matplotlib
matplotlib.style.use('seaborn-colorblind')
from scipy.interpolate import interp1d
#Instal... |
the-stack_0_6324 | import time
import urllib
import urllib2
from bs4 import BeautifulSoup
from google import search
from slackclient import SlackClient
# from nltk.sentiment.vader import SentimentIntensityAnalyzer
import config
bot_name = 'ninja'
bot_id = SlackClient(config.bot_id['BOT_ID'])
at_bot = "<@" + str(bot_id) + ">:"
slack_clie... |
the-stack_0_6325 | import tkinter as tk
from tkinter import messagebox
class FillAllFields(Exception):
pass
class StudentAlreadyRegistered(Exception):
pass
class EmptyField(Exception):
pass
class MatriculaRepeated(Exception):
pass
class Estudante:
def __init__(self, nroMatric, nome):
... |
the-stack_0_6327 | #!/usr/bin/env python3
# -*- coding:utf-8 -*-
# author: bigfoolliu
from turtle import Turtle # 引入turtle库的turtle模块
import turtle
p = Turtle()
p.speed(2) # 设置速度
p.pensize(3) # 设置线条粗细
p.color('black', 'yellow') # 笔的颜色及填充颜色
p.begin_fill() # 开始填充
for i in range(5): # 5条线
p.fd(200) # 向前200
p.right(144) # 向... |
the-stack_0_6331 | # -*- coding: utf-8 -*-
#
# This file is part of PyBuilder
#
# Copyright 2011-2014 PyBuilder Team
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/l... |
the-stack_0_6332 | # -*- coding: utf-8 -*-
# Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or... |
the-stack_0_6335 | """
sphinx.domains.c
~~~~~~~~~~~~~~~~
The C language domain.
:copyright: Copyright 2007-2021 by the Sphinx team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
import re
from typing import (Any, Callable, Dict, Generator, Iterator, List, Optional, Tuple, TypeVar,
Uni... |
the-stack_0_6337 | # Copyright 2020 The TensorFlow Probability Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law o... |
the-stack_0_6338 | # *******************************************************************************************
# *******************************************************************************************
#
# File: gentest.py
# Date: 18th November 2020
# Purpose: Generates test code.
# ... |
the-stack_0_6345 | #!/usr/bin/env python
import sys
from setuptools import setup
try:
from setuptools_rust import RustExtension
except ImportError:
import subprocess
errno = subprocess.call([sys.executable, "-m", "pip", "install", "setuptools-rust"])
if errno:
print("Please install setuptools-rust package")
... |
the-stack_0_6347 | import datetime
import os
import random
import re
import string
import sys
import unittest2
from mock import patch, Mock
import stripe
NOW = datetime.datetime.now()
DUMMY_CARD = {
'number': '4242424242424242',
'exp_month': NOW.month,
'exp_year': NOW.year + 4
}
DUMMY_DEBIT_CARD = {
'number': '4000056... |
the-stack_0_6349 | import _plotly_utils.basevalidators
class ColorValidator(_plotly_utils.basevalidators.ColorValidator):
def __init__(
self,
plotly_name='color',
parent_name='scatterpolar.textfont',
**kwargs
):
super(ColorValidator, self).__init__(
plotly_name=plotly_name,
... |
the-stack_0_6351 | import argparse, os, pathlib
parser = argparse.ArgumentParser(description='Convert training data to PEPREC')
parser.add_argument('-f', '--files', nargs='+', help='files contaning peptides')
parser.add_argument('-s', '--suffix', default='peprec', help='suffix for the output file names')
parser.add_argument('-o', '--out... |
the-stack_0_6353 | def async_migrations_ok() -> bool:
from posthog.async_migrations.runner import is_posthog_version_compatible
from posthog.models.async_migration import AsyncMigration, MigrationStatus
for migration in AsyncMigration.objects.all():
migration_completed_or_running = migration.status in [
M... |
the-stack_0_6354 | from experiment import Experiment
import logging
import time
from traitlets import Enum, Float, Int, Unicode
try:
from tqdm import trange
except ImportError:
trange = range
class Main(Experiment):
#
# Description of the experiment. Used in the help message.
#
description = Unicode("Basic expe... |
the-stack_0_6356 | #!/usr/bin/env python3
# Copyright (c) 2015-2017 The Bitcoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
"""Test a node with the -disablewallet option.
- Test that validateaddress RPC works when running with -d... |
the-stack_0_6357 | import discord
from discord.ext import commands
class Pingmodule():
def __init__(self, bot):
self.bot = bot
async def on_message(self, message):
if self.bot.user in message.mentions:
await message.add_reaction(':ping:456793379808870401')
def setup(bot):
bot.add_cog(Pin... |
the-stack_0_6358 | # SPDX-License-Identifier: BSD-3-Clause
from typing import ClassVar, Mapping, cast
from softfab.ControlPage import ControlPage
from softfab.Page import InvalidRequest, PageProcessor
from softfab.configlib import ConfigDB
from softfab.joblib import JobDB
from softfab.pageargs import DictArg, PageArgs, StrArg
from soft... |
the-stack_0_6359 | #!/usr/bin/env python3
from pathlib import Path
from textwrap import indent
import hashlib
import json
import urllib.request
CMAKE_SHA256_URL_TEMPLATE = "https://cmake.org/files/v{minor}/cmake-{full}-SHA-256.txt"
CMAKE_URL_TEMPLATE = "https://github.com/Kitware/CMake/releases/download/v{full}/{file}"
CMAKE_VERSIONS... |
the-stack_0_6362 | import random
MOZNOSTI_Z = 'ABCDEFGV'
MOZNOSTI_NA = 'ABCDEFGWXYZ'
NAPOVEDA = """
Příkazy:
? - Vypíše tuto nápovědu.
U - Otočí kartu balíčku (z U do V).
Nebo doplní balíček U, pokud je prázdný.
EC - Přemístí karty z E na C.
Za E dosaď odkud karty vzít: A-G nebo V.
Za C dosaď kam chceš karty dát: A-G nebo ... |
the-stack_0_6363 | # Copyright (c) 2013 OpenStack Foundation
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless ... |
the-stack_0_6365 | from typing import List
import networkx as nx
from pycid.analyze.requisite_graph import requisite_graph
from pycid.core.cid import CID
def admits_voi(cid: CID, decision: str, node: str) -> bool:
r"""Return True if cid admits value of information for node.
- A CID admits value of information for a node X if... |
the-stack_0_6366 | # Copyright (C) 2019-2020 Intel Corporation
#
# SPDX-License-Identifier: MIT
import os
import tempfile
import shutil
import zipfile
import io
import itertools
import struct
from abc import ABC, abstractmethod
from contextlib import closing
import av
import numpy as np
from pyunpack import Archive
from PIL import Imag... |
the-stack_0_6370 | from favourites_list import *
from positional_list import *
class FavouritesListMTF(FavouritesList):
"""List of elements odered with move-to-front heuristic."""
# we override _move_up provide move to front semantics.
def _move_up(self,p):
"""Move accesses item at Position p to frony of the list.""... |
the-stack_0_6371 | from setuptools import setup, find_packages
import os
version = '0.2.1'
def read(*rnames):
return open(os.path.join(os.path.dirname(__file__), *rnames)).read()
long_description = (
read('README.txt')
+ '\n' +
read('js', 'gridster', 'test_gridster.txt')
+ '\n' +
read('CHANGES.txt'))
setup(
... |
the-stack_0_6372 | from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
from abc import abstractmethod
from collections import Hashable
from functools import wraps
from aif360.datasets import Dataset
from aif360.decorating_metaclass import A... |
the-stack_0_6374 | from flask import Flask, jsonify, render_template, request
from flask_sqlalchemy import SQLAlchemy
app = Flask(__name__)
# Connect to Database
app.config['SQLALCHEMY_DATABASE_URI'] = 'sqlite:///cafes.db'
app.config['SQLALCHEMY_TRACK_MODIFICATIONS'] = False
db = SQLAlchemy(app)
# Cafe TABLE Configuration
class Cafe(... |
the-stack_0_6377 | # Copyright 2020 - 2021 MONAI Consortium
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# http://www.apache.org/licenses/LICENSE-2.0
# Unless required by applicable law or agreed to in wri... |
the-stack_0_6378 | from keras import activations, layers, models
from keras.utils.generic_utils import register_keras_serializable
from keras.utils.tf_utils import shape_type_conversion
from tfreplknet.drop import DropPath
@register_keras_serializable(package='TFRepLKNet')
class FFN(layers.Layer):
def __init__(self, ratio, dropout,... |
the-stack_0_6379 | add_library('video')
add_library('opencv_processing')
video = None
opencv = None
def setup():
size(720, 480, P2D)
video = Movie(this, "street.mov")
opencv = OpenCV(this, 720, 480)
opencv.startBackgroundSubtraction(5, 3, 0.5)
video.loop()
video.play()
def draw():
image(video, 0, 0)
... |
the-stack_0_6383 | # This file is a demo for the 'Isothermal_Monolith_Simulator' object
import sys
sys.path.append('../..')
from catalyst.isothermal_monolith_catalysis import *
# Read in the data (data is now a dictionary containing the data we want)
data = naively_read_data_file("inputfiles/SCR_all-ages_300C.txt",factor=5)
# T... |
the-stack_0_6387 | """
Train the ESIM model on the preprocessed SNLI dataset.
"""
# Aurelien Coet, 2018.
from utils.utils_top_transformer import train, validate
from vaa.droped import TransformerESIM as ESIM
# from vaa.model_esim import ESIM
from vaa.model_transformer_top import TOP
# from vaa.model_bert_transformer import ESIM
import t... |
the-stack_0_6390 | #!/usr/bin/python3
import pandas as pd
from os.path import join as oj
import os
def load_google_mobility(data_dir='.'):
''' Load in Google Community Mobility Reports
Parameters
----------
data_dir : str; path to the data directory containing 'google_mobility.csv'
Returns
-------
... |
the-stack_0_6391 | # Copyright 2019 NVIDIA Corporation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in wr... |
the-stack_0_6394 | from .exception import *
from .bitoperations import *
from copy import deepcopy
# Finding range sum [i,j] in a flat array
class FenwickTree():
"""Fenwick Tree is Binary Indexed tree.
"""
def __init__(self, values):
self.size = len(values)
self.values = values
self.tree = [0]
... |
the-stack_0_6395 | #!/usr/bin/env python
# Simple checker for whether valgrind found errors
import sys
import xml.etree.ElementTree as ElementTree
e = ElementTree.parse(sys.argv[1])
states = [x.find('state').text for x in e.findall('status')]
errors = [x.find('kind').text for x in e.findall('error')]
if "RUNNING" not in states or "FI... |
the-stack_0_6397 | # coding=utf-8
# Copyright 2021 The Trax Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or a... |
the-stack_0_6398 | # -*- coding: utf-8 -*-
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('sponsors', '0001_squashed_0012_auto_20170921_1332'),
]
operations = [
migrations.CreateModel(
name='Job',
fields=[
('id', m... |
the-stack_0_6399 | #!/usr/bin/env python3
header = '''
file {
name="/opt/rtcds/userapps/release/vis/common/medm/steppingmotor/OVERVIEW/STANDALONE_STEPPER_OVERVIEW.adl"
version=030107
}
display {
object {
x=1996
y=56
width=512
height=400
}
clr=14
bclr=11
cmap=""
gridSpacing=5
gridOn=0
snapToGrid=0
}
"color map" {
ncolo... |
the-stack_0_6400 | # Copyright (c) 2016 Ryan Rossiter
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in wri... |
the-stack_0_6403 | from viadot.flows import DuckDBTransform
from viadot.tasks import DuckDBQuery, DuckDBToDF
import pytest
import pandas as pd
from unittest import mock
from viadot.sources import DuckDB
import os
TABLE = "test_table"
SCHEMA = "test_schema"
TABLE_MULTIPLE_PARQUETS = "test_multiple_parquets"
DATABASE_PATH = "test_db_123.d... |
the-stack_0_6404 | from unittest import TestCase, mock
from unittest.mock import MagicMock
from sklearn.ensemble import RandomForestClassifier
from source.analysis.classification.classifier_service import ClassifierService
from source.analysis.setup.data_split import DataSplit
from source.analysis.performance.raw_performance import Raw... |
the-stack_0_6405 | import contextlib
import time
from math import ceil, log
from mock import mock, MagicMock, Mock
from pyqryptonight.pyqryptonight import StringToUInt256
from qrl.core import config
from qrl.core.Block import Block
from qrl.core.ChainManager import ChainManager
from qrl.core.DifficultyTracker import DifficultyTracker
f... |
the-stack_0_6406 | """Unit tests for JWTAuthenticator"""
import datetime
from pathlib import Path
import pytest
import jwt
from karp.errors import ClientErrorCodes
from karp.domain.errors import AuthError
from karp.infrastructure.jwt.jwt_auth_service import JWTAuthenticator
from . import adapters
with open(Path(__file__).parent / ".... |
the-stack_0_6407 |
from .engine import Engine
import pyglet
from pyglet import gl
from gem import vector
import ctypes as ct
import random
import math
class Rect(object):
def __init__(self, minVec, maxVec):
self.min = minVec
self.max = maxVec
def clone(self):
return Rect(self.min.clone(), self.max.cl... |
the-stack_0_6408 | #!/usr/bin/env python3
# This file is copied from GCoder.
#
# GCoder is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# GCoder is dist... |
the-stack_0_6409 | """
Define functions needed for the demos.
"""
import numpy as np
from scipy.fftpack import fft2, ifft2, fftshift, ifftshift
from scipy.signal import fftconvolve
from bm3d import gaussian_kernel
def get_psnr(y_est: np.ndarray, y_ref: np.ndarray) -> float:
"""
Return PSNR value for y_est and y_ref... |
the-stack_0_6410 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright (c) 2014-18 Richard Hull and contributors
# See LICENSE.rst for details.
# PYTHON_ARGCOMPLETE_OK
"""
Rotating 3D box wireframe & color dithering.
Adapted from:
http://codentronix.com/2011/05/12/rotating-3d-cube-using-python-and-pygame/
"""
import sys
import m... |
the-stack_0_6411 | # -*- coding: utf-8 -*-
"""
MIT License
Copyright (c) 2020 Matteo Ingrosso
In combination with top_3 script, this one plot the top 3 patches with their values.
"""
from get_top_3 import *
import matplotlib.pyplot as plt
import os
from PIL import Image
Image.MAX_IMAGE_PIXELS = 1000000000
from matplo... |
the-stack_0_6413 | #!/usr/bin/env python
import metadata.io
import phylodist.io
import phylodist.histogram
DATA_ROOT = '/dacb/globus'
metadataDF = metadata.io.loadFile(
DATA_ROOT + '/metadata.tab',
indexCols=['origin_O2', 'O2', 'week', 'replicate', 'sample', 'date', 'type'],
verbose=True
)
phylodistSampleDict = phylo... |
the-stack_0_6415 | import os
from Crypto.Cipher import Blowfish
from Crypto.Random import get_random_bytes
import codecs
import kbr.file_utils as file_utils
import re
import sys
import requests
import time
id_cipher = None
def init( id_secret:str) -> None:
global id_cipher
id_cipher = Blowfish.new(id_secret.encode('utf-8'), m... |
the-stack_0_6416 | import numpy as np
from numpy.core.umath_tests import inner1d
from scipy.ndimage.filters import gaussian_filter
from scipy.ndimage.interpolation import map_coordinates
def image_histogram_equalization(image, number_bins=256):
'''histogram equalization the image
'''
# from http://www.janeriksolem.net/2009/... |
the-stack_0_6417 | import numpy
from panda3d.core import Point3, TransformState, Vec3
from panda3d.bullet import BulletSphereShape, BulletRigidBodyNode
from panda3d.ode import OdeBody, OdeMass, OdeSphereGeom
from .Ingredient import Ingredient
import cellpack.autopack as autopack
helper = autopack.helper
class SingleSphereIngr(Ingredi... |
the-stack_0_6418 | import argparse
import json
import sys
import time
import uuid
import os
import sh
from sh import docker
parentdir = os.path.dirname(os.path.dirname(os.path.realpath(__file__)))
os.sys.path.insert(0, parentdir)
from configfinder import config_settings
def build_and_commit(package: str, fuzzer_image: str, json_outpu... |
the-stack_0_6419 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Fri May 11 10:08:27 2018
@author: rflamary
"""
import numpy as np
import pylab as pl
import scipy
import scipy.optimize
import stdgrb
import time
t_start=time.clock()
def tic():
global t_start
t_start=time.clock()
def toc():
global t_start
... |
the-stack_0_6422 | # Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... |
the-stack_0_6423 | # coding: utf-8
import toml
import logging
import argparse
from laputa.watch import Watcher
from laputa.record import Recorder
from laputa.notify import IFTTTNotifier
def read_config(file_name):
with open(file_name) as config_file:
config = toml.loads(config_file.read())
return config
def parse():... |
the-stack_0_6425 | import numpy as np
import pytest
from pandas import DataFrame, Series
import pandas._testing as tm
from pandas.api.indexers import BaseIndexer, FixedForwardWindowIndexer
from pandas.core.window.indexers import ExpandingIndexer
def test_bad_get_window_bounds_signature():
class BadIndexer(BaseIndexer):
def... |
the-stack_0_6426 | #@+leo-ver=5-thin
#@+node:ekr.20101110092851.5742: * @file leoOPML.py
#@+<< docstring >>
#@+node:ekr.20060904103412.1: ** << docstring >>
#@@language rest
r'''A plugin to read and write Leo outlines in .opml
(http://en.wikipedia.org/wiki/OPML) format.
The OPML plugin creates two new commands that read and write Leo o... |
the-stack_0_6428 | """Class implementation for the scale_y_from_point interfaces.
"""
from typing import Any
from typing import Dict
from apysc._animation.animation_scale_y_from_point_interface import \
AnimationScaleYFromPointInterface
from apysc._type.dictionary import Dictionary
from apysc._type.expression_string import... |
the-stack_0_6430 | import datetime
def get_pages(posts):
""" Groups blog posts into 'pages' of five posts """
pages = []
for i in range(4, len(posts), 5):
pages.append(posts[i-4: i+1])
r = len(posts) % 5
if r > 0:
pages.append(posts[len(posts) - r:])
return pages
def gen_tags(posts):
""" Ret... |
the-stack_0_6433 | import pytest
from seedwork.domain.exceptions import BusinessRuleValidationException
from seedwork.domain.value_objects import Money
from modules.catalog.domain.entities import Seller, Listing
from modules.catalog.domain.value_objects import ListingStatus
def test_seller_publishes_listing_happy_path():
seller = S... |
the-stack_0_6434 | # Copyright 2016 The Oppia Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable ... |
the-stack_0_6435 | from mock import Mock, call, patch
from pip._internal.commands.install import build_wheels
class TestWheelCache:
def check_build_wheels(
self,
pep517_requirements,
legacy_requirements,
):
"""
Return: (mock_calls, return_value).
"""
def build(reqs, **kw... |
the-stack_0_6438 | from services.module.moduleService import ModuleService
from repositories.demoddata.demoddataRepo import DemoddataRepo
from repositories.payload.payloadRepo import PayloadRepo
from repositories.waterfall.waterfallRepo import WaterfallRepo
from repositories.observation.observationsRepo import ObservationRepo
class Obse... |
the-stack_0_6439 | """evaluate.py
This script is used to evalute trained ImageNet models.
"""
import sys
import argparse
import tensorflow as tf
import numpy as np
import tensorflow_datasets as tfds
from config import config
from utils.utils import config_keras_backend, clear_keras_session
from utils.dataset import get_dataset
from ... |
the-stack_0_6440 | # def fib(n): # write Fibonacci series up to n
# a, b = 0, 1
# while a < n:
# print(a, end=' ')
# a, b = b, a+b
# print()
# def fib2(n): # return Fibonacci series up to n
# result = []
# a, b = 0, 1
# while a < n:
# result.append(a)
# a, b = b, a+b
# ret... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.