filename stringlengths 13 19 | text stringlengths 134 1.04M |
|---|---|
the-stack_0_9159 | from __future__ import print_function
import argparse
import torch
import torchvision
import torchvision.transforms as transforms
import torch.optim as optim
import torch.utils.data
from models import vgg, resnet, densenet, base_cnn, TDNN
# Training settings
parser = argparse.ArgumentParser(description='Test architect... |
the-stack_0_9160 | #!/usr/bin/env python
"""
fitpack (dierckx in netlib) --- A Python-C wrapper to FITPACK (by P. Dierckx).
FITPACK is a collection of FORTRAN programs for curve and surface
fitting with splines and tensor product splines.
See
http://www.cs.kuleuven.ac.be/cwis/research/nalag/research/topics/fitpack.html
... |
the-stack_0_9161 | # Copyright (c) 2016 Ansible, Inc.
# All Rights Reserved.
# Python
#import urlparse
import logging
# Django
from django.db import models
from django.conf import settings
from django.utils.translation import ugettext_lazy as _
from django.core.exceptions import ObjectDoesNotExist
#from django import settings as tower_... |
the-stack_0_9162 | from bareosdir import *
from bareos_dir_consts import *
def load_bareos_plugin(context):
DebugMessage(context, 100, "load_bareos_plugin called\n");
events = [];
events.append(bDirEventType['bDirEventJobStart']);
events.append(bDirEventType['bDirEventJobEnd']);
events.append(bDirEventType['bDirEventJobInit'])... |
the-stack_0_9163 | ################################################################################
# BSD LICENSE
#
# Copyright(c) 2019 Intel Corporation. All rights reserved.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
... |
the-stack_0_9164 | """
UI for Nexus Bus
"""
from tabulate import tabulate
import departure.commons.helpers as helpers
def list_stations(stops):
print(
tabulate(
[
[station[0], station[1]]
for station in sorted(stops.items(), key=lambda k: k[1])
],
headers... |
the-stack_0_9169 | """Tests for applications API functionality"""
from decimal import Decimal
from django.core.files.uploadedfile import SimpleUploadedFile
import pytest
from mitol.common.utils import now_in_utc
from applications.api import (
get_or_create_bootcamp_application,
derive_application_state,
get_required_submiss... |
the-stack_0_9171 | """Support for MQTT switches."""
from __future__ import annotations
import functools
import voluptuous as vol
from homeassistant.components import switch
from homeassistant.components.switch import DEVICE_CLASSES_SCHEMA, SwitchEntity
from homeassistant.config_entries import ConfigEntry
from homeassistant.const impor... |
the-stack_0_9172 | # Copyright [2021] [Dylan Johnson]
# 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_9173 | # -*- coding: utf-8 -*-
from unittest import TestCase
from ddt import ddt, data
from pyleecan.Classes.LamSlotMag import LamSlotMag
from pyleecan.Classes.SlotMFlat import SlotMFlat
from pyleecan.Classes.MagnetType12 import MagnetType12
from pyleecan.Methods.Machine.Magnet.comp_surface import comp_surface
from numpy ... |
the-stack_0_9174 | # -*- coding:utf-8 -*-
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import numpy as np
import os
import logging
import json
SEP = "[SEP]"
CLS = "[CLS]"
MASK = "[MASK]"
UNK = "[UNK]"
def _parse_text(file_name: str, word_dict: dict, label_dict: dict, w... |
the-stack_0_9175 | import streamlit as st
import pandas as pd
import plotly.express as px
import numpy as np
import time
from datetime import datetime
#Titles and Mode selections
st.sidebar.title("About Us")
st.sidebar.info("""
The aim of this project is to create an interactive Covid-19 Dashboard. This app is maintained by Team nu... |
the-stack_0_9176 | #
# __COPYRIGHT__
#
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the
# "Software"), to deal in the Software without restriction, including
# without limitation the rights to use, copy, modify, merge, publish,
# distribute, sublicen... |
the-stack_0_9178 | import hashlib
from rhc.database.dao import DAO
class nullcipher(object):
def encrypt(self, v):
return v
def decrypt(self, v):
return v
CRYPT = nullcipher()
class DAOE(DAO):
ENCRYPT_FIELDS = ()
@staticmethod
def makesha(value):
return hashlib.sha256(value).digest()
... |
the-stack_0_9179 | memo = [False] * 10000000
def sum_digit_groups(num):
if num >= 10 and num < len(memo):
if memo[num]:
return memo[num]
result = []
divisor = 10
while divisor < num:
for m in sum_digit_groups(num % divisor):
result.append(num // divisor + m)
divisor *= 10
... |
the-stack_0_9181 | # -*- coding: utf-8 -*-
from __future__ import print_function
from datetime import datetime
from numpy import nan
from numpy.random import randn
import numpy as np
from pandas import DataFrame, Series, Index, Timestamp, DatetimeIndex
import pandas as pd
import pandas.tseries.offsets as offsets
from pandas.util.tes... |
the-stack_0_9183 | ## Compiled from Members.ipynb on Tue Jun 7 15:10:16 2016
## In [1]:
import salib as sl
import numpy as np
from MemberLoads import EF
## In [2]:
class Member(object):
RELEASES = {'MZJ':2, 'MZK':5}
E = 200000.
G = 77000.
def __init__(self,ident,nodej,nodek):
self.id = ident
... |
the-stack_0_9186 | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('billing', '0006_auto_20150401_2006'),
]
operations = [
migrations.AlterField(
model_name='rfidcard',
... |
the-stack_0_9188 | # -*- coding: utf-8 -*-
# Copyright (c) 2020, Jigar Tarpara and contributors
# For license information, please see license.txt
from __future__ import unicode_literals
import frappe
from frappe import _
from frappe.model.document import Document
from frappe.utils import get_datetime, time_diff_in_hours
from frappe.util... |
the-stack_0_9189 | import torch
import torch.nn as nn
import torch.nn.functional as F
from mmcv.runner import auto_fp16, force_fp32
from torch.nn.modules.utils import _pair
from mmdet.core import build_bbox_coder, multi_apply, multiclass_nms
from mmdet.models.builder import HEADS, build_loss
from mmdet.models.losses import accuracy
@H... |
the-stack_0_9191 | import copy
import itertools
import numpy as np
import torch
import torch.nn.functional as F
import torch.utils.model_zoo as model_zoo
from torch.autograd import Variable
import random
from scipy.spatial.distance import cdist
from sklearn.preprocessing import normalize
from torch import nn, optim
from torc... |
the-stack_0_9194 | """
Test the random numbers
"""
from __future__ import print_function, division, unicode_literals, absolute_import
import numpy as np
from numpy.random import RandomState
from smerfs.random import z_standard_normal
def test_zig():
""" Test the Ziggurat generator has approximately normal distribn """
from scip... |
the-stack_0_9195 | import logging
from typing import Dict, List, Optional
from chia.consensus.block_record import BlockRecord
from chia.consensus.blockchain_interface import BlockchainInterface
from chia.types.blockchain_format.sized_bytes import bytes32
from chia.types.blockchain_format.sub_epoch_summary import SubEpochSummary
from chi... |
the-stack_0_9198 | #! /usr/bin/doit -f
from pathlib import Path
DOIT_CONFIG = {'default_tasks': ['small_crush']}
BIG_CRUSH_RNG = """pcg32_random_r pcglite32_random
stdcpp_mt19937 stdcpp_mt19937_64
stdcpp_minstd_rand stdcpp_minstd_rand0
stdcpp_knuth_b stdcpp_random_device
murmur1_counter murmur2_counter murmur3_counter
siphash24... |
the-stack_0_9201 | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
import sys
import re
import os
from bomlib.columns import ColumnList
# Check python version to determine which version of ConfirParser to import
if sys.version_info.major >= 3:
import configparser as ConfigParser
else:
import ConfigParser
clas... |
the-stack_0_9202 | import numpy as np
from collections import OrderedDict
from matplotlib import pyplot as plt
class GesturesVisualizer():
def __init__(self, gestures, deviceWidth=360, deviceHeight=640):
self.gestures = gestures
self.width = deviceWidth
self.height = deviceHeight
def plot_gestures(self)... |
the-stack_0_9204 | # Copyright 2021 The SODA 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 agreed to in wri... |
the-stack_0_9205 | import soundfile as sf
import math
from uuid import uuid4
from typing import List
from .exceptions import ShellError
from pathlib import Path
def fftsanitise(fftsettings) -> List[int]:
return [
int(fftsettings[0]),
int(fftsettings[1]),
int(fftsettings[2])
]
def get_buffer(audio_file_p... |
the-stack_0_9212 | import tensorflow as tf
from tensorflow.keras import backend
from tensorflow.keras import layers
from tensorflow.keras import models
from models.backbone.resnet import ResNet18, ResNet34, ResNet50, ResNet101, ResNet152
from models.backbone.resnext import ResNeXt50, ResNeXt101
from models.backbone.efficientnet import E... |
the-stack_0_9214 | # --Requires--:
# game.get_moves()
# game.execute_move()
# game.undo_move()
# game.is_final()
# game.get_score()
# game.get_states()
# get_board()
# get_turn()
# TODO: update find moves
import numpy as np
import time
class TicTacToe:
def __init__(self):
self.board = np.array([[[0, 0], [0, 0], [0, 0]],
... |
the-stack_0_9216 | from __future__ import print_function
from __future__ import division
import torch
import torch.nn as nn
from torch.optim.lr_scheduler import ExponentialLR, StepLR
import torch.nn.functional as F
from sklearn import metrics
from sklearn.model_selection import KFold, StratifiedKFold
from torch.autograd import Variable
... |
the-stack_0_9222 | from app.announces.models import Announce
from tests.equipments.fakes import equipment1, equipment2, equipment3, get_equipment
from tests.shops.fakes import shop1, shop2, shop3, get_shop
shop1_equipment1_announce1 = Announce(1, shop1.id, shop1.name, equipment1.id, equipment1.name,
... |
the-stack_0_9224 | import os
import secrets
from PIL import Image
from flask import render_template, url_for, flash, redirect, request, abort
from flaskblog import app, db, bcrypt
from flaskblog.forms import RegistrationForm, LoginForm, UpdateAccountForm, PostForm, CommentForm
from flaskblog.models import User, Post, Comment
from flask_l... |
the-stack_0_9225 | import discord
# Imports permissions from discord.commands
from discord.commands import permissions
bot = discord.Bot()
# Note: If you want you can use commands.Bot instead of discord.Bot
# Use discord.Bot if you don't want prefixed message commands
# With discord.Bot you can use @bot.command as an alias
# of @bot.... |
the-stack_0_9226 | # Copyright 2019 kubeflow.org.
#
# 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,... |
the-stack_0_9230 | import tensorflow as tf
import tensorflow_datasets as tfds
import matplotlib.pyplot as plt
import numpy as np
from model.unet import UNet
# download the dataset and get info
dataset, info = tfds.load('oxford_iiit_pet:3.*.*', with_info=True)
# see the possible keys we can access in the dataset dict.
# this contains... |
the-stack_0_9231 | """
This problem was asked by LinkedIn.
Given a list of points, a central point, and an integer k, find the nearest k points from the central point.
For example, given the list of points [(0, 0), (5, 4), (3, 1)], the central point (1, 2), and k = 2,
return [(0, 0), (3, 1)].
"""
def k_nearest(points, central, k):
... |
the-stack_0_9232 | # This is a polyfill for dataclasses
# https://docs.python.org/3/library/dataclasses.html
# Original PEP proposal: PEP 557
# https://www.python.org/dev/peps/pep-0557/
import re
import sys
import copy
import types
import inspect
import keyword
__all__ = [
"dataclass",
"field",
"Field",
"FrozenInstanceEr... |
the-stack_0_9233 | import numpy as np
import matplotlibex as plx
import ml.gptheano.kernels as krn
import ml.gptheano.gplvmfullfit as gplvm
if __name__ == "__main__":
t = np.linspace(0.0, 3*2*np.pi, num=300)
y = np.vstack((3*np.sin(1*t+0.0), 3*np.sin(2*t+1.5),
1*np.sin(1*t+0.4), 1*np.sin(3*t+1.8),
... |
the-stack_0_9234 | import scipy.sparse as sps
from . import register_class
from ..container import Container
from ..utils import docval, getargs, call_docval_func, to_uint_array, get_data_shape
@register_class('CSRMatrix')
class CSRMatrix(Container):
@docval({'name': 'data', 'type': (sps.csr_matrix, 'array_data'),
'd... |
the-stack_0_9236 | from typing import List
from td.session import TdAmeritradeSession
class Quotes():
"""
## Overview
----
Allows the user to query real-time quotes from the TD
API if they have an authorization token otherwise it
will be delayed by 5 minutes.
"""
def __init__(self, session: TdAmeritrad... |
the-stack_0_9240 | # -*- coding: utf-8 -*-
#
# Configuration file for the Sphinx documentation builder.
#
# This file does only contain a selection of the most common options. For a
# full list see the documentation:
# http://www.sphinx-doc.org/en/master/config
# -- Path setup ------------------------------------------------------------... |
the-stack_0_9241 | import sys, os
sys.path.append(os.path.join(os.path.dirname(__file__), '../'))
from synchrophasor.frame import *
from synchrophasor.pmu import Pmu
from synchrophasor.pmuGen import *
from time import sleep
import threading
SLEEP_TIME = 1.0/100
def test_client_single_pmu():
pmu = create_pmu(9006)
pmu.... |
the-stack_0_9243 | ################################################################################
# Example : perform live fire detection in video using FireNet CNN
# Copyright (c) 2017/18 - Andrew Dunnings / Toby Breckon, Durham University, UK
# License : https://github.com/tobybreckon/fire-detection-cnn/blob/master/LICENSE
######... |
the-stack_0_9244 | """
Remove the docs in training set that overlap with test sets or are duplicate
As it loads all data into memory, it requires a large memory machine to run
If you are processing MAG, run pykp.data.mag.post_clearn.py to remove noisy items (abstract contains "Full textFull text is available as a scanned copy of the orig... |
the-stack_0_9245 | # -*- coding: utf-8 -*-
import io
import pandas as pd
import scrapy
from scrapy import Request
from scrapy import signals
from fooltrader.api.quote import get_security_list
from fooltrader.contract.files_contract import get_finance_path
from fooltrader.utils.utils import index_df_with_time
class AmericaStockFinanc... |
the-stack_0_9246 | #
# Copyright (C) 2006-2017 greg Landrum and Rational Discovery LLC
#
# @@ All Rights Reserved @@
# This file is part of the RDKit.
# The contents are covered by the terms of the BSD license
# which is included in the file license.txt, found at the root
# of the RDKit source tree.
#
""" Import all RDKit chemist... |
the-stack_0_9249 | from glumpy import app, gloo, gl
from contextlib import contextmanager
import numpy as np
try:
import pycuda.driver
from pycuda.gl import graphics_map_flags, BufferObject
_PYCUDA = True
except ImportError as err:
print('pycuda import error:', err)
_PYCUDA = False
import torch
class OffscreenRen... |
the-stack_0_9250 | """Provides functionality to interact with image processing services."""
import asyncio
from datetime import timedelta
import logging
from typing import final
import voluptuous as vol
from homeassistant.const import (
ATTR_ENTITY_ID,
ATTR_NAME,
CONF_ENTITY_ID,
CONF_NAME,
CONF_SOURCE,
)
from homeas... |
the-stack_0_9251 | # coding: utf-8
#
# Copyright 2020 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 requi... |
the-stack_0_9255 | load("@bazel_tools//tools/cpp:lib_cc_configure.bzl", "get_cpu_value")
def execute_or_fail_loudly(
repository_ctx,
arguments,
environment = {},
working_directory = ""):
"""Execute the given command
Fails if the command does not exit with exit-code 0.
Args:
arguments: ... |
the-stack_0_9261 | # 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, ... |
the-stack_0_9262 | # -*- coding: utf-8 -*-
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# MIT License. See license.txt
from __future__ import unicode_literals
import os
from six import iteritems
import logging
from werkzeug.wrappers import Request
from werkzeug.local import LocalManager
from werkzeug.exceptions ... |
the-stack_0_9264 | import argparse
import json
import os
import numpy as np
import tensorflow.compat.v1 as tf
import time
class AccumulatingOptimizer(object):
def __init__(self, opt, var_list):
self.opt = opt
self.var_list = var_list
self.accum_vars = {tv : tf.Variable(tf.zeros_like(tv.initialized_value()), ... |
the-stack_0_9265 | import os
import time
from gym_idsgame.config.runner_mode import RunnerMode
from gym_idsgame.simulation.dao.simulation_config import SimulationConfig
from gym_idsgame.agents.dao.agent_type import AgentType
from gym_idsgame.config.client_config import ClientConfig
from gym_idsgame.runnner import Runner
from gym_idsgame.... |
the-stack_0_9266 |
def read_verilog(args):
assert(len(args) == 1)
filename = args[0]
with open(filename, 'r') as verilogfile:
content = [line for line in verilogfile if 'assign' in line][:-1]
boolDict = dict()
for line in content:
left, right = line.split('=')
name = left.split()[1]
... |
the-stack_0_9267 | from quanser_robots import GentlyTerminating
import threading
import gym
import torch
import numpy as np
from abstract_rl.src.data_structures.temporal_difference_data.trajectory_builder import TrajectoryBuilder
from abstract_rl.src.data_structures.temporal_difference_data.trajectory_collection import TrajectoryColle... |
the-stack_0_9268 | # Download the Python helper library from twilio.com/docs/python/install
from twilio.rest import TwilioTaskRouterClient
# Your Account Sid and Auth Token from twilio.com/user/account
account_sid = "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
auth_token = "your_auth_token"
workspace_sid = "WSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
w... |
the-stack_0_9269 | import torch
from torch import nn
import numpy as np
import os
from .utils.detect_face import detect_face, extract_face
class PNet(nn.Module):
"""MTCNN PNet.
Keyword Arguments:
pretrained {bool} -- Whether or not to load saved pretrained weights (default: {True})
"""
def __init__(self, ... |
the-stack_0_9270 | # coding=utf-8
# Copyright (c) 2017,2018, F5 Networks, Inc.
#
# 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 applicabl... |
the-stack_0_9272 | import gym
from gym import error, spaces, utils
from gym.utils import seeding
from math import gcd
import pygame
import numpy as np
class MARLEnv(gym.Env):
WINDOW_HEIGHT = 360
WINDOW_WIDTH = 640
CELL_LENGTH = gcd(WINDOW_HEIGHT, WINDOW_WIDTH)
WHITE = (255, 255, 255)
BLACK = (0, 0, 0)
YELLOW ... |
the-stack_0_9273 | from typing import List, NamedTuple
import libkol
from ..Error import (
InvalidLocationError,
NotEnoughMeatError,
UnknownError,
WrongKindOfItemError,
)
from ..util import parsing
from .request import Request
from ..Store import Store
class Response(NamedTuple):
items: List["libkol.types.ItemQuan... |
the-stack_0_9276 | # Copyright 2018 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_9280 | import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
from matplotlib.path import Path
from matplotlib.patches import PathPatch
import seaborn as sns
from ipywidgets import *
from IPython.display import display, HTML
def prodmix_graph(zoom):
# create the plot object
fig, ax = plt.subplots(figs... |
the-stack_0_9282 | import gym
import numpy as np
import tensorflow as tf
from gym.wrappers import TimeLimit
def ortho_init(scale=1.0):
"""
Orthogonal initialization for the policy weights
:param scale: (float) Scaling factor for the weights.
:return: (function) an initialization function for the weights
"""
# ... |
the-stack_0_9283 | # Loads a target data then defines tables for it
spark.read \
.option("header", True) \
.csv("./testdata/adult.csv") \
.write \
.saveAsTable("adult")
delphi.misc \
.options({"db_name": "default", "table_name": "adult", "row_id": "tid"}) \
.flatten() \
.write \
.saveAsTable("adult_flatte... |
the-stack_0_9284 | # Copyright 2019 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_9285 | import os
from .Backend import Backend
class TextFile(Backend):
def __init__(self, filename):
self.filename = filename
i = 1
while os.path.exists(self.filename):
i += 1
self.filename = "%s_%d" % (filename, i)
self.f = open(filename, 'w')
self.last_ro... |
the-stack_0_9286 | # Software License Agreement (BSD License)
#
# Copyright (c) 2012, Willow Garage, Inc.
# 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... |
the-stack_0_9287 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Unit tests for gluon.contenttype
"""
import unittest
from .fix_path import fix_sys_path
fix_sys_path(__file__)
from gluon.contenttype import contenttype
from gluon._compat import iteritems
class TestContentType(unittest.TestCase):
def testTypeRecognition(s... |
the-stack_0_9288 | # %%
from numpy import array, matrix, zeros, empty, delete, insert, matmul, divide, add, subtract
from numpy import nanmax, seterr, shape
from numpy.linalg import solve
from scipy.sparse.linalg import spsolve
from scipy.sparse import csc_matrix
from math import isclose
from PyNite.Node3D import Node3D
from PyNite.Sprin... |
the-stack_0_9289 | import pytest
from bispy.utilities.graph_entities import (
_QBlock,
_Vertex,
_Edge,
)
from typing import Set, Tuple, List
import networkx as nx
from bispy.saha.ranked_pta import ranked_split
from bispy.paige_tarjan.paige_tarjan import paige_tarjan
from bispy.saha.saha import add_edge
from bispy.utilities.gr... |
the-stack_0_9290 | # -*- coding: utf-8 -*-
"""
Fast Kalman Filter attitude estimation
======================================
References
----------
.. [Guo] Siwen Guo, Jin Wu, Zuocai Wang, and Jide Qian, "Novel MARG-Sensor
Orientation Estimation Algorithm Using Fast Kalman Filter." Journal of
Sensors, vol. 2017, Article ... |
the-stack_0_9291 | import cv2
import numpy as np
def detect_face(net, frame, conf_threshold=0.7):
# Siapkan input image
h, w, c = frame.shape
blob = cv2.dnn.blobFromImage(frame, 1.0, (300, 300), [104, 117, 123], False, False)
# Feedforward
# prediksi dari SSD mengeluarkan output (1, 1, N, 7)
# 7 output ... |
the-stack_0_9293 | # Copyright 2004-2008 Roman Yakovenko.
# Distributed under the Boost Software License, Version 1.0. (See
# accompanying file LICENSE_1_0.txt or copy at
# http://www.boost.org/LICENSE_1_0.txt)
import os
import sys
import unittest
import fundamental_tester_base
from pyplusplus import code_creators
class test... |
the-stack_0_9294 | from easydict import EasyDict
cartpole_iqn_config = dict(
env=dict(
collector_env_num=8,
evaluator_env_num=5,
n_evaluator_episode=5,
stop_value=195,
),
policy=dict(
cuda=False,
on_policy=False,
priority=True,
model=dict(
obs_shape=... |
the-stack_0_9295 | #!/usr/bin/env python
#
# This example can be used to demonstrate pvaPy server/client channel
# monitoring
#
# Run server.py in one window, and client.py in another one.
#
import sys
import time
from pvaccess import Channel
from collections import OrderedDict
class ClientMonitor:
def __init__(self, name):
... |
the-stack_0_9296 | # -*- coding: utf-8 -*-
"""
drftoolbox.views
~~~~~~~~~~~~~~~~
This module defines view classes used by the API
:copyright: (c) 2018 by Medical Decisions LLC
"""
import functools
import json
import logging
import re
from django.contrib.auth import get_user_model
from rest_framework import generics
fro... |
the-stack_0_9298 | from django.db.models import CharField, Expression
from psycopg2.sql import Identifier, Literal, SQL
from usaspending_api.common.helpers.sql_helpers import convert_composable_query_to_string
from usaspending_api.recipient.models import RecipientLookup, RecipientProfile
from usaspending_api.recipient.v2.lookups import S... |
the-stack_0_9301 | # Copyright 2021 The Kubeflow 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 agreed to in ... |
the-stack_0_9304 | import numpy as np
def kalman_xy(x, P, measurement, R,
motion = np.matrix('0. 0. 0. 0.').T,
Q = np.matrix(np.eye(4))):
"""
Parameters:
x: initial state 4-tuple of location and velocity: (x0, x1, x0_dot, x1_dot)
P: initial uncertainty convariance matrix
measurement: o... |
the-stack_0_9305 | from __future__ import division
import dolfin as df
import numpy as np
import logging
import os
import scipy.sparse.linalg
from time import time
from finmag.util import helpers
from finmag.util.meshes import embed3d
from itertools import izip
from math import pi
from finmag.field import Field
logger = logging.getLogger... |
the-stack_0_9307 | import torch
import torchani
import unittest
import os
import pickle
path = os.path.dirname(os.path.realpath(__file__))
class TestGrad(unittest.TestCase):
# torch.autograd.gradcheck and torch.autograd.gradgradcheck verify that
# the numerical and analytical gradient and hessian of a function
# matches to... |
the-stack_0_9308 | #! /usr/bin/env python
import sys
import yt ; yt.funcs.mylog.setLevel(0)
import numpy as np
from scipy import signal
# Build Jx without filter (from other simulation)
my_F_nofilter = np.zeros([16,16])
my_F_nofilter[8,8] = -1.601068065642412e-11
my_F_nofilter[8,7] = -1.601068065642412e-11
# Build 2D filter
filter0 = ... |
the-stack_0_9310 | # -*- coding: utf-8 -*-
"""Main tasks.py file for current application module."""
import time
import os
import json
import shutil
from datetime import datetime as dtime
from celery import group
from celery import shared_task
from flask import current_app
from libs import helpers
from exts.sqlalchemy import db
from mods.... |
the-stack_0_9312 | # Copyright 2022 Huawei Technologies Co., Ltd
#
# 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... |
the-stack_0_9314 | import pygame as py
import variables as v
class Button(py.sprite.Sprite):
def __init__(self, text, pos, size, normalcolour, hovercolour, font, ID, centred = False, bsize=(0,0)):
"""
Create a simple button.
Arguments:
text <str> -- the button's text
... |
the-stack_0_9316 | import datetime
from io import BytesIO
import os
import shutil
import numpy as np
import pytest
import matplotlib as mpl
import matplotlib.pyplot as plt
from matplotlib.testing import _has_tex_package, _check_for_pgf
from matplotlib.testing.compare import compare_images, ImageComparisonFailure
from matplo... |
the-stack_0_9317 | #!/usr/bin/env python
"""Test the grr aff4 objects."""
import hashlib
import io
import time
from builtins import range # pylint: disable=redefined-builtin
import mock
from grr_response_core.lib import flags
from grr_response_core.lib import rdfvalue
from grr_response_core.lib import utils
from grr_response_core.lib... |
the-stack_0_9319 | import setuptools
from src.ptth import __version__ as version
with open("README.md", "r") as fh:
long_description = fh.read()
setuptools.setup(
name="post-tonal-theory-helper-mbmasuda",
version=version,
author="Mari Masuda",
author_email="mbmasuda.github@gmail.com",
description="Post-tonal m... |
the-stack_0_9320 | """ AIPS STar table
Due to the funky nature of the AIPS STar table it cannot be made in the usual
Obit fashion. This class allows doing this from python.
Symbol type codes
1: Plus sign (default) 12: Five pointed star
2: Cross (X) 13: Star of David
3: Circle 14: Seven-pointed sta... |
the-stack_0_9321 | from django.conf.urls.defaults import *
# Uncomment the next two lines to enable the admin:
from django.contrib import admin
admin.autodiscover()
urlpatterns = patterns('',
# Example:
# (r'^cms/', include('cms.foo.urls')),
# Uncomment the admin/doc line below and add 'django.contrib.admindocs'
# to I... |
the-stack_0_9324 | import numpy as np
def value_iteration(env, gamma, theta, max_iterations, value=None):
if value is None:
value = np.zeros(env.n_states)
else:
value = np.array(value, dtype=np.float)
for _ in range(max_iterations):
delta = 0.
for s in range(env.n_states):
... |
the-stack_0_9325 | import csv
from django.http import HttpResponse
class ExportCsvMixin:
def export_as_csv(self, request, queryset):
meta = self.model._meta
field_names = [field.name for field in meta.fields]
response = HttpResponse(content_type="text/csv")
response["Content-Disposition"] = "attac... |
the-stack_0_9326 | # -*- coding: utf-8 -*-
'''
The music21 Framework is Copyright © 2006-2015 Michael Scott Cuthbert
and the music21 Project
(Michael Scott Cuthbert, principal investigator; cuthbert@mit.edu)
Some Rights Reserved
Released under the Lesser GNU Public License (LGPL) or the BSD (3-clause) license.
See license.txt file fo... |
the-stack_0_9327 | import warnings
import pytest
import flask
from flask.sessions import SecureCookieSessionInterface
from flask.sessions import SessionInterface
try:
from greenlet import greenlet
except ImportError:
greenlet = None
def test_teardown_on_pop(app):
buffer = []
@app.teardown_request
def end_of_requ... |
the-stack_0_9331 | # -*- coding: utf-8 -*-
#
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
#... |
the-stack_0_9332 | # coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may ... |
the-stack_0_9334 | # -*- coding: utf-8 -*-
"""Public section, including homepage and signup."""
from flask import (
Blueprint,
current_app,
flash,
redirect,
render_template,
request,
url_for,
)
from flask_login import login_required, login_user, logout_user
from flask_blog_api.extensions import login_manager
... |
the-stack_0_9335 | # -*- coding: utf-8 -*-
#
# sphinx-nbexamples documentation build configuration file, created by
# sphinx-quickstart on Mon Jul 20 18:01:33 2015.
#
# This file is execfile()d with the current directory set to its
# containing dir.
#
# Note that not all possible configuration values are present in this
# autogenerated f... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.