text stringlengths 2 999k |
|---|
#!/usr/bin/python
#
# linearize-hashes.py: List blocks in a linear, no-fork version of the chain.
#
# Copyright (c) 2013-2014 The Bitcoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
#
from __future__ import pr... |
from typing import Any, List, Dict, Optional, Tuple
from django.conf import settings
from django.urls import reverse
from django.http import HttpResponseRedirect, HttpResponse, HttpRequest
from django.shortcuts import redirect, render
from django.utils import translation
from django.utils.cache import patch_cache_cont... |
__all__ = ['BitOrder']
from typing import Tuple
import attr
@attr.s(frozen=True, auto_attribs=True)
class BitOrder:
decision_bits: int
chance_bits: int
horizon: int
@property
def total_bits(self) -> int:
return self.decision_bits + self.chance_bits
def round_index(self, lvl: int) -... |
"""The code template to supply to the front end. This is what the user will
be asked to complete and submit for grading.
Do not include any imports.
This is not a REPL environment so include explicit 'print' statements
for any outputs you want to be displayed back to the user.
Use triple single q... |
# coding: utf-8
"""
Ed-Fi Operational Data Store API
The Ed-Fi ODS / API enables applications to read and write education data stored in an Ed-Fi ODS through a secure REST interface. *** > *Note: Consumers of ODS / API information should sanitize all data for display and storage. The ODS / API provides reas... |
import math
from binascii import hexlify
from clvm_tools import binutils
from greenberry.types.blockchain_format.program import Program
from greenberry.types.blockchain_format.sized_bytes import bytes32
from greenberry.types.condition_opcodes import ConditionOpcode
from greenberry.util.ints import uint64
from greenbe... |
#!/usr/bin/python3
# -*- coding: utf-8 -*-
import requests
from settings import WOW_API_KEY, LOCALE
from constants import *
def get_data(name, realm, field, region):
"""Helper function that grabs data from the World of Warcraft API."""
path = 'https://%s.api.battle.net/wow/character/%s/%s?fields=%s&l... |
################################################################################
# Copyright (c) 2022 ContinualAI #
# Copyrights licensed under the MIT License. #
# See the accompanying LICENSE file for terms. ... |
# Copyright 2020 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... |
#!/bin/sh
sudo apt-get remove -y --purge node
sudo apt-get autoremove -y node
echo "step 1"
sudo apt-get install -y nodejs global
sudo apt-get install -y npm global
sudo rm -rf /usr/bin/node > /dev/null 2>&1
echo "step 2"
sudo ln -s /usr/bin/nodejs /usr/bin/node
echo "step 3"
sudo npm update -g
echo "step 4"
echo "s... |
import re
def an_finder(text):
pattern = re.compile(' an an ')
result = pattern.search(text)
return result.group()
|
# exported from PySB model 'model'
from pysb import Model, Monomer, Parameter, Expression, Compartment, Rule, Observable, Initial, MatchOnce, Annotation, ANY, WILD
Model()
Monomer('C6A', ['C8pro'])
Monomer('Ligand', ['Receptor'])
Monomer('ParpU', ['C3A'])
Monomer('C3ub')
Monomer('C3A', ['Xiap', 'ParpU', 'C6pro'])
Mo... |
# -*- coding: utf-8 -*-
"""plot.py.
Hotelling's T-Squared multivariate control charts
See:
- Hotelling, Harold. (1931). The Generalization of Student's Ratio. Ann. Math. Statist. 2,
no. 3, 360--378. doi:10.1214/aoms/1177732979.
- Tukey, J. W. (1960). A survey of sampling from contaminated distributions. In: ... |
from sanskrit_data.db.interfaces import DbInterface, get_random_string, users_db, ullekhanam_db
from sanskrit_data.schema.common import JsonObject
class InMemoryDb(DbInterface):
def __init__(self, db_name_frontend, external_file_store=None):
super(InMemoryDb, self).__init__(external_file_store=external_file_sto... |
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the Apache 2.0 License.
import os
import getpass
import logging
import time
import math
import infra.ccf
import infra.proc
import infra.jsonrpc
import e2e_args
from loguru import logger as LOG
# This test starts from a given number of nodes ... |
# coding: utf-8
# Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License.
# This product includes software developed at Datadog (https://www.datadoghq.com/).
# Copyright 2019-Present Datadog, Inc.
import re # noqa: F401
import sys # noqa: F401
import nulltype # ... |
# Generated by Django 1.10 on 2016-09-06 14:14
import django.core.validators
from django.db import migrations, models
import django.db.models.deletion
import sorl.thumbnail.fields
import apps.photo.models
class Migration(migrations.Migration):
dependencies = [
('photo', '0006_auto_20151025_2149'),
... |
from __future__ import print_function
import torch
import torch.nn as nn
import torch.nn.parallel
import torch.optim as optim
import torch.utils.data
import torchvision.datasets as dset
import torchvision.transforms as transforms
import torchvision.utils as vutils
from torch.autograd import Variable
batchSize = 64
... |
# Copyright 2017-2021 TensorHub, 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 applicable law or agreed to in writ... |
"""A flow graph representation for Python bytecode"""
import dis
import types
import sys
from compiler import misc
from compiler.consts \
import CO_OPTIMIZED, CO_NEWLOCALS, CO_VARARGS, CO_VARKEYWORDS
class FlowGraph:
def __init__(self):
self.current = self.entry = Block()
self.e... |
# Copyright 2021, Kay Hayen, mailto:kay.hayen@gmail.com
#
# Part of "Nuitka", an optimizing Python compiler that is compatible and
# integrates with CPython, but also works on its own.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in complianc... |
from big_example.Info import Info
from mdsd.item.printto import printto
from mdsd.item_support import adjust_array_sizes_and_variants
from big_example.VersionedData import VersionedData
import io
def test_string_with_print():
i = Info()
i.text1_as_str = 'Hello "Test"'
i.n = 3
adjust_array_sizes_and_va... |
# Configuration file for the Sphinx documentation builder.
#
# This file only contains a selection of the most common options. For a full
# list see the documentation:
# https://www.sphinx-doc.org/en/master/usage/configuration.html
# -- Path setup --------------------------------------------------------------
# If ex... |
"""
ASGI config for test_django_project project.
It exposes the ASGI callable as a module-level variable named ``application``.
For more information on this file, see
https://docs.djangoproject.com/en/3.2/howto/deployment/asgi/
"""
import os
from django.core.asgi import get_asgi_application
os.environ.setdefault('... |
# This file is generated by objective.metadata
#
# Last update: Sun Mar 22 14:57:32 2020
#
# flake8: noqa
import objc, sys
if sys.maxsize > 2 ** 32:
def sel32or64(a, b):
return b
else:
def sel32or64(a, b):
return a
misc = {}
constants = """$NSFileProviderErrorCollidingItemKey$NSFileProvi... |
# Copyright (c) 2006-2007 The Regents of The University of Michigan
# 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 copyright
# notice, this ... |
from Instrucciones.Excepcion import Excepcion
from lexico import columas
from tkinter.constants import FALSE
from Instrucciones.Sql_create.ShowDatabases import ShowDatabases
from Instrucciones.TablaSimbolos.Instruccion import *
from Instrucciones.Tablas.BaseDeDatos import BaseDeDatos
from storageManager.jsonMode import... |
from __future__ import unicode_literals
from __future__ import print_function
from __future__ import division
from __future__ import absolute_import
from builtins import str
from builtins import range
from future import standard_library
standard_library.install_aliases()
# Copyright 2020 Google LLC All rights reserved.... |
import commands
import sys
use_locale = True
if use_locale:
currency = commands.getoutput('./work/reader.cout 0')
decimal = commands.getoutput('./work/reader.cout 1')
cmd = ('java -cp work checker ' + currency
+ sys.argv[1] + decimal + sys.argv[2])
print commands.getoutput(cmd)
|
import hashlib
import re
from dataclasses import dataclass
from typing import (
Generic, TypeVar, Dict, Any, Tuple, Optional, List, Sequence
)
from dbt.clients.jinja import get_rendered, SCHEMA_TEST_KWARGS_NAME
from dbt.contracts.graph.unparsed import (
UnparsedNodeUpdate, UnparsedSourceDefinition,
Unparse... |
# A simple object oriented tkinter window
import tkinter as tk
from tkinter import ttk
import math
from tkinter.constants import E, W
import serial
import serial.tools.list_ports
import time
# -- Windows only configuration --
try:
from ctypes import windll
windll.shcore.SetProcessDpiAwareness(1)
except:
p... |
# -*- coding: utf-8 -*-
import random
import torch
class DynamicNet(torch.nn.Module):
def __init__(self, D_in, H, D_out):
"""
In the constructor we construct three nn.Linear instances that we will use
in the forward pass.
"""
super(DynamicNet, self).__init__()
self.... |
# Copyright 2013-2015 ARM Limited
#
# 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 w... |
'''
Copyright (c) 2020, Pycom Limited.
This software is licensed under the GNU GPL version 3 or any
later version, with permitted additional terms. For more information
see the Pycom Licence v1.0 document supplied with this file, or
available at https://www.pycom.io/opensource/licensing
'''
try:
from pybytes_libra... |
import re
import psycopg2
from werkzeug.security import generate_password_hash, check_password_hash
from flask import Blueprint, request, jsonify, make_response
from app.api.v1.models.landlord_models import LandlordRecords
from app.api.v1.models.database import init_db
from app.api.v1.utils.validators import validate
... |
from django.contrib import admin
from django.contrib.auth import get_user_model
User = get_user_model()
admin.site.register(User)
|
#!/usr/bin/env python
from cStringIO import StringIO
import gzip
import json
import os
import os.path
import regex as re
import shutil
import sys
from pake import Target
from pake import ifind, main, output, rule, target, variables, virtual, which
if sys.platform == 'win32':
""" windows_defaults assumes that js... |
"""
Copyright 2009-2010 Mozes, 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 applicable law or agreed to in ... |
# -*- coding: utf-8 -*-
"""
pip_services3_container.build.DefaultContainerFactory
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Default container factory implementation
:copyright: Conceptual Vision Consulting LLC 2018-2019, see AUTHORS for more details.
:license: MIT, see LICENSE f... |
async def gifspam(e, smex):
try:
await e.client(
functions.messages.SaveGifRequest(
id=types.InputDocument(
id=sandy.media.document.id,
access_hash=smex.media.document.access_hash,
file_reference=smex.media.document.file... |
# noinspection PyUnusedLocal
# skus = unicode string
items_prices = {
'A': 50,
'B': 30,
'C': 20,
'D': 15,
'E': 40,
'F': 10,
'G': 20,
'H': 10,
'I': 35,
'J': 60,
'K': 80,
'L': 90,
'M': 15,
'N': 40,
'O': 10,
'P': 50,
'Q': 30,
'R': 50,
'S': 30,
... |
# -*- coding: utf-8 -*-
#
# 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, software
... |
# 5.1. Layers and Blocks
import torch
from torch import nn
from torch.nn import functional as F
# A Custom Block
class MLP(nn.Module):
# Declare a layer with model parameters. Here, we declare two fully connected layers
def __init__(self):
# Call the constructor of the `MLP` parent class `Module` to... |
#
# Copyright (c) 2021 Airbyte, Inc., all rights reserved.
#
from setuptools import find_packages, setup
MAIN_REQUIREMENTS = ["airbyte-cdk~=0.1", "pendulum==2.1.2"]
TEST_REQUIREMENTS = ["pytest~=6.1", "pytest-mock~=3.6.1", "source-acceptance-test", "responses~=0.13.3", "pendulum==2.1.2"]
setup(
name="source_or... |
# encryption.py
#
# Has been created to declutter script.py
# Holds functions related to encryptions and initializes modules needed
#
from flask_bcrypt import Bcrypt #install flask-bcrypt
# Set up bcrypt for password hashing
bcrypt = Bcrypt()
# Give a password to encrpyt by salting and hashing
def encrypt_passwor... |
import os
from gora import app
__author__ = "Pedro Guzman (pedro@subvertic.com)"
__version__ = "1.0.0"
if __name__ == "__main__":
port = int(os.environ.get("PORT", 8190))
app.run(host='0.0.0.0', port=port)
|
#!/usr/bin/python
"""Download a GSE Study in a clean format. Writes to local directory by default.
Packaged as an easy script wrapper that doesn't require the local environment
variables to be set and intelligently handles substudies.
Downloads each substudy as a separate file. Writes log about results.
SAMPLE USE:
$... |
#!/usr/bin/python
# SPDX-License-Identifier: GPL-2.0-only
#
# Tool for analyzing suspend/resume timing
# Copyright (c) 2013, Intel Corporation.
#
# This program is free software; you can redistribute it and/or modify it
# under the terms and conditions of the GNU General Public License,
# version 2, as published by the... |
# Copyright (c) 2015, Matt Layman
__all__ = ['TAPTestRunner']
from .runner import TAPTestRunner
|
#
# Copyright (c) 2018 Juniper Networks, Inc. All rights reserved.
#
import ast
import json
import os
import signal
import socket
import subprocess
import time
import traceback
from cfgm_common.exceptions import NoIdError
from cfgm_common.exceptions import ResourceExistsError
from cfgm_common.uve.vnc_api.ttypes impor... |
import voluptuous as vol
import homeassistant.helpers.config_validation as cv
import logging
import traceback
from homeassistant.helpers.entity import Entity
from typing import Any, Awaitable, Dict, Iterable, List, Optional
from homeassistant.helpers.typing import StateType
from homeassistant.const import (
ATTR_AS... |
# In production set the environment variable like this:
# DJANGO_SETTINGS_MODULE=my_proj.settings.production
from .base import * # NOQA
import logging.config
# For security and performance reasons, DEBUG is turned off
DEBUG = False
TEMPLATE_DEBUG = False
# Must mention ALLOWED_HOSTS in production!
# AL... |
import os
import pytest
from server.api.blueprints import user
from server.api.database.models import Teacher
def test_make_teacher(user, auth, requester):
auth.login()
resp = requester.post("/user/make_teacher", json={"price": 100, "crn": 9999})
assert resp.json["data"]["user"]["id"] == user.id
teac... |
# Copyright (C) 2003-2007 Robey Pointer <robeypointer@gmail.com>
#
# This file is part of paramiko.
#
# Paramiko is free software; you can redistribute it and/or modify it under the
# terms of the GNU Lesser General Public License as published by the Free
# Software Foundation; either version 2.1 of the License, or (a... |
import pyblish.api
import avalon.api as avalon
class CollectHierarchy(pyblish.api.ContextPlugin):
"""Collecting hierarchy from `parents`.
present in `clip` family instances coming from the request json data file
It will add `hierarchical_context` into each instance for integrate
plugins to be able t... |
from optparse import OptionParser, OptionGroup
from arc_hybrid import ArcHybridLSTM
from options_manager import OptionsManager
import pickle, utils, os, time, sys, copy, itertools, re, random
from shutil import copyfile
import codecs
def run(experiment,options):
if not options.predict: # training
paramsf... |
# Copyright (c) 2012 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
request_freq_table = [
( 0, 0),( 1, 0),( 2, 0),
( 3, 0),( 4, 0),( 5, 0),
( 6, 0),( 7, 0),( ... |
from django.core.management.base import BaseCommand
import json
import peeringdb_server.models as pdbm
from django.contrib.contenttypes.models import ContentType
from reversion.models import Version
MODELS = [
pdbm.Organization,
pdbm.Network,
pdbm.InternetExchange,
pdbm.InternetExchangeFacility,
pd... |
class RefreshIPOperation(object):
def __init__(self, vm_service, resource_id_parser):
"""
:param vm_service: cloudshell.cp.azure.domain.services.virtual_machine_service.VirtualMachineService
:param resource_id_parser: cloudshell.cp.azure.common.parsers.azure_model_parser.AzureModelsParser
... |
# -*- coding: utf-8 -*-
from __future__ import division
import numpy as np
import torch
Transition_dtype = np.dtype([('timestep', np.int32), ('state', np.uint8, (1, 512)), ('action', np.int32), ('reward', np.float32), ('nonterminal', np.bool_)])
blank_trans = (0, np.zeros((1, 512), dtype=np.uint8), 0, 0.0, False)
#... |
#!/usr/bin/python
'''
Run with -h to see usage options.
Notes:
* Emscripten expects the .ll input to be formatted and annotated the way
llvm-dis -show-annotations
does. So if you get .ll from something else, you should run it through
llvm-as (to generate LLVM bitcode) and then llvm-dis -show-annota... |
# encoding: utf-8
"""
Test suite for pptx.shapes.shape module
"""
from __future__ import absolute_import
import pytest
from pptx.enum.shapes import PP_PLACEHOLDER
from pptx.oxml.shapes.shared import BaseShapeElement
from pptx.oxml.text import CT_TextBody
from pptx.shapes import Subshape
from pptx.shapes.autoshape i... |
import socket, os, time, sys
from os import system, name
from datetime import datetime, timedelta
IP = '10.0.2.15'
PORT = 142
SIZE = 2048
def clear(): # Terminal ekranini temizleme fonksiyonu
if (name == 'nt'):
_ = system('cls')
else:
_ = system('clear')
def update_time_on_Linux(currentTim... |
import numpy as np
def make_basis_vec(n_par, l_d, m_d):
"""
Generating the basis polynomial to compute the phase equation. Right now,
it is of the form [1, l_d, m_d, l_d**2, m_d**2, ...] with l_d and m_d being
scalars. The function returns a vector of length n_par.
"""
N = (n_par+1) // ... |
# This is the instrument-specific file for the PS6000 series of instruments.
#
# pico-python is Copyright (c) 2013-2014 By:
# Colin O'Flynn <coflynn@newae.com>
# Mark Harfouche <mark.harfouche@gmail.com>
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are pe... |
#!/bin/false
# Copyright (c) 2022 Vít Labuda. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
# following conditions are met:
# 1. Redistributions of source code must retain the above copyright notice, this list of conditions an... |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# Copyright (c) 2019 Red Hat, Inc.
#
# 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
# ri... |
#!/usr/bin/env python
#
# test_enumerator.py
# EnumeratorProject
#
import unittest
from peppercornenumerator.input import read_pil, read_seesaw
from peppercornenumerator.objects import clear_memory, PepperComplex, PepperReaction
from peppercornenumerator.enumerator import (PeppercornUsageError,
... |
#!/usr/bin/env python
#############################################################################
##
# This file is part of Taurus
##
# http://taurus-scada.org
##
# Copyright 2011 CELLS / ALBA Synchrotron, Bellaterra, Spain
##
# Taurus is free software: you can redistribute it and/or modify
# it under the terms of t... |
"""
Created on Dec 12, 2017
@author: nhan.nguyen
Verify that user cannot store 'their_did' with invalid json.
"""
import pytest
from indy import did
from indy.error import ErrorCode
from utilities import utils, common
from test_scripts.functional_tests.did.signus_test_base \
import DidTestBase
class TestStoreD... |
import logging
import math
import time
from asyncio import Lock
from random import choice, randrange
from secrets import randbits
from typing import Dict, List, Optional, Set, Tuple
from profit.types.peer_info import PeerInfo, TimestampedPeerInfo
from profit.util.hash import std_hash
from profit.util.ints import uint1... |
import os.path
import unittest
# 3rd party
import jinja2
from ddtrace import Pin, config
from ddtrace.contrib.jinja2 import patch, unpatch
from tests.test_tracer import get_dummy_tracer
TEST_DIR = os.path.dirname(os.path.realpath(__file__))
TMPL_DIR = os.path.join(TEST_DIR, 'templates')
class Jinja2Test(unittest.T... |
# Copyright 2016-2017 Capital One Services, 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 ... |
#!/usr/bin/env python
import pika
connection = pika.BlockingConnection(pika.ConnectionParameters(
host='localhost'))
channel = connection.channel()
channel.queue_declare(queue='hello')
def callback(ch, method, properties, body):
print(" [x] Received %r" % body)
channel.basic_consume(callback,
... |
from dataclasses import dataclass
from typing import TypeVar
from pyckaxe.lib.pack.abc.resource import Resource
from pyckaxe.lib.pack.physical_resource_location import PhysicalResourceLocation
from pyckaxe.lib.pack.resource_dumper.common_resource_dumper import CommonResourceDumper
from pyckaxe.lib.types import JsonVal... |
__package__ = 'archivebox'
import os
import shutil
from json import dump
from pathlib import Path
from typing import Optional, Union, Set, Tuple
from subprocess import run as subprocess_run
from crontab import CronTab
from atomicwrites import atomic_write as lib_atomic_write
from .util import enforce_types, Extend... |
from __future__ import print_function
import time
import mock
from asyncpushbullet import chat
class TestChats:
def setup_class(self):
self.contact_email = "test.chat@example.com"
chat_info = {
"active": True, "created": time.time(), "modified": time.time(),
"with": {
... |
# coding: utf-8
import pprint
import re
import six
from huaweicloudsdkcore.sdk_response import SdkResponse
class ListSlowLogsResponse(SdkResponse):
"""
Attributes:
openapi_types (dict): The key is attribute name
and the value is attribute type.
attribute_map (dict... |
def test_resources():
from . import qt
assert qt.QtCore.__package__ == 'qtpy'
|
import sys
import sysconfig
import warnings
import numpy as nu
import ctypes
import ctypes.util
from numpy.ctypeslib import ndpointer
import os
from galpy import potential
from galpy.util import galpyWarning
from galpy.orbit_src.integratePlanarOrbit import _parse_integrator, _parse_tol
#Find and load the library
_lib= ... |
from django.contrib import admin as default_admin
from authy_admin.sites import AuthyAdminSite
# replace django's default admin site with our version
default_admin.site = AuthyAdminSite()
|
# generated from catkin/cmake/template/pkg.context.pc.in
CATKIN_PACKAGE_PREFIX = ""
PROJECT_PKG_CONFIG_INCLUDE_DIRS = "".split(';') if "" != "" else []
PROJECT_CATKIN_DEPENDS = "actionlib_msgs".replace(';', ' ')
PKG_CONFIG_LIBRARIES_WITH_PREFIX = "".split(';') if "" != "" else []
PROJECT_NAME = "enph353_utils"
PROJECT_... |
import unittest
import numpy as np
from pymatgen.core import Structure
from matbench.constants import CLF_KEY, REG_KEY
from matbench.data_ops import load, mean_absolute_percentage_error, score_array
from matbench.metadata import mbv01_metadata
from matbench.tests.util import FULL_TEST
class TestDataOps(unittest.Tes... |
from django.db import models
# Create your models here.
#Samples
"""
from django.contrib.auth.models import User
class Category(models.Model):
name = models.CharField('Nome', max_length=150)
description = models.TextField('Descrição', blank=True, null=True)
owner = models.ForeignKey(User, on_delete=models.... |
"""This module implement sources."""
from __future__ import annotations
import logging
from functools import partial
from typing import Callable, Optional, Tuple, Union
import numpy as np
from .bases import FDTDElementBase
from .constants import FREESPACE_PERMITTIVITY as EPS_0
from .constants import SPEED_LIGHT as C... |
# -*- coding: utf-8 -*-
"""XGBoost_Random_Forest.ipynb
Automatically generated by Colaboratory.
Original file is located at
https://colab.research.google.com/drive/1hQKL12syLK-EkzaEL9ul8uw8MrxEBgkN
# Random Forests in XGBoost
- XGBoost is normally used to train gradient-boosted decision trees and other gradient... |
import os
import re
import sys
import subprocess
import pytest
from testplan.common.utils.path import change_directory
import platform
_FILE_DIR = os.path.dirname(__file__)
# This file is under tests/functional/examples, so the root directory is 3
# levels up.
_REPO_ROOT = os.path.abspath(os.path.join(
_FILE_D... |
#!/usr/bin/env python3
# --------------------( LICENSE )--------------------
# Copyright (c) 2014-2022 Beartype authors.
# See "LICENSE" for further details.
'''
Project-wide :pep:`586`-compliant **type hint test data.**
'''
# ....................{ IMPORTS }........... |
# -*- coding: utf-8 -*-
# Copyright (C) 2018-2022 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
import numpy as np
import onnx
import pytest
from tests.test_onnx.utils import run_node
def import_and_compute(op_type, input_data, **node_attrs):
data_inputs = [np.array(input_data)]
node = onnx.helper... |
import functools
from typing import TYPE_CHECKING
from ..bases.port_l23_genuine import BasePortL23Genuine
from xoa_driver.internals.core.commands import (
P_FAULTSIGNALING,
P_FAULTSTATUS,
P_DYNAMIC,
)
from xoa_driver.internals.utils import attributes as utils
if TYPE_CHECKING:
from xoa_driver.internals.... |
# 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 ... |
from typing import Dict, List, Tuple, Union
Source = Dict[str, Union[str, bool]]
RequirementDict = Union[str, Dict[str, Union[bool, str]]]
CandidateInfo = Tuple[List[str], str, str]
SearchResult = List[Dict[str, Union[str, List[str]]]]
|
# This code is part of Qiskit.
#
# (C) Copyright IBM 2017, 2020.
#
# 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... |
"""
BitBake 'Fetch' implementations
Classes for obtaining upstream sources for the
BitBake build tools.
"""
# Copyright (C) 2003, 2004 Chris Larson
#
# SPDX-License-Identifier: GPL-2.0-only
#
# Based on functions from the base bb module, Copyright 2003 Holger Schurig
import shlex
import re
import tempfile
import o... |
import os, glob, torch, time
import numpy as np
import pandas as pd
from PIL import Image
from torchvision import transforms
import torch.nn as nn
from torch.utils.data import DataLoader, Dataset
from loaders.OAI_imorphics_extras import get_ids_by_subjects, imorphics_info
from loaders.loader_utils import imorphics_mask... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#===============================================================================
#
# Copyright (c) 2017 <stakeholder> All Rights Reserved
#
#
# File: /Users/hain/ai/chop/test.py
# Author: Hai Liang Wang
# Date: 2018-07-20:10:29:58
#
#========================================... |
# -*- coding: utf-8 -*-
'''
Management of Heat
==================
.. versionadded:: Nitrogen
:depends: - heat Python module
:configuration: See :py:mod:`salt.modules.heat` for setup instructions.
The heat module is used to create, show, list and delete Heat staks.
Stack can be set as either absent or deploy.
.. c... |
"""
Preprocess the XSUM dataset
There are several noisy training instances which do not contain any words in pre-defined vocabulary of NTM.
We remove these instances.
Here are the details about these removed instance:
- instance #37993:
input: Here are our favourites:
target: On Monday, we ask... |
# 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 ... |
import numpy as np
import pandas as pd
import seaborn as sns
from nninst.backend.tensorflow.model import AlexNet
from nninst.op import Conv2dOp, DenseOp
from nninst.utils.fs import abspath
threshold = 0.5
path_template = "alexnet_imagenet_real_metrics_per_layer_{0:.1f}_{1}_{2}.csv"
attack_name = "FGSM"
label_name = ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.