text stringlengths 3 1.05M |
|---|
from matplotlib import pyplot as plt
from plot_metrics import PlotMetrics
def show_rmse_graph(plot_metrics: list[PlotMetrics], margin_ratio=0.99):
name_list: list[str] = []
rmse_list: list[float] = []
for pm in plot_metrics:
name_list.append(pm.plot_name)
rmse_list.append(pm.metrics.rmse... |
import sys
if sys.version_info < (3, 7):
from .typing_patch_36 import *
else:
from .typing_patch_37 import *
def element_conforms(element, etype) -> bool:
""" Determine whether element conforms to etype"""
from pyjsg.jsglib import Empty
if isinstance(element, etype):
return True
# Th... |
# coding: utf-8
"""
Flip API
Flip # noqa: E501
The version of the OpenAPI document: 3.1
Contact: cloudsupport@telestream.net
Generated by: https://openapi-generator.tech
"""
from __future__ import absolute_import
import atexit
import datetime
from dateutil.parser import parse
import json
import... |
# modified from Pytorch official resnet.py
import torch.nn as nn
import torch.utils.model_zoo as model_zoo
import torch
from torchsummary import summary
import torch.nn.functional as F
__all__ = ['ResNet', 'resnet18', 'resnet34', 'resnet50', 'resnet101',
'resnet152']
model_urls = {
'resnet18': 'https:/... |
from __future__ import absolute_import
from . import SendTelegramMessage
class SendTelegramMessageSpiderStarted(SendTelegramMessage):
message_template = "telegram/spider/notifier/start/message.jinja"
class SendTelegramMessageSpiderFinished(SendTelegramMessage):
message_template = "telegram/spider/notifier/f... |
/*
* (C) Copyright 2017-2018 UCAR
*
* This software is licensed under the terms of the Apache Licence Version 2.0
* which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
*/
#ifndef UFO_ATMVERTINTERP_OBSATMVERTINTERPTLAD_H_
#define UFO_ATMVERTINTERP_OBSATMVERTINTERPTLAD_H_
#include <ostream>
#inclu... |
# Copyright 2019 The flink-ai-extended 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 ... |
"""
The MIT License (MIT)
Copyright (c) 2015-present Rapptz
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, merg... |
angular.module('PetAppUI').controller('ModalCtrl', function ($scope) {
$scope.showModal = false;
$scope.toggleModal = function(){
$scope.showModal = !$scope.showModal;
};
});
.directive('modal', function () {
return {
template: '<div class="modal fade">' +
'<div class="modal-d... |
# coding=utf-8
# Copyright 2020 The TF-Agents 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
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable la... |
#!/usr/bin/env python
###############################################################################
# Copyright 2018 The Apollo 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 ... |
from discord.ext import commands
import os
import traceback
bot = commands.Bot(command_prefix='/')
token = os.environ['DISCORD_BOT_TOKEN']
@bot.event
async def on_command_error(ctx, error):
orig_error = getattr(error, "original", error)
error_msg = ''.join(traceback.TracebackException.from_exception(orig_err... |
/* Copyright(c) 1986 Association of Universities for Research in Astronomy Inc.
*/
#define import_spp
#define import_libc
#define import_fpoll
#define import_xnames
#include <iraf.h>
/* C_POLL -- LIBC binding to the FIO polling interface.
**
** fds = c_poll_open () # open a poll descriptor s... |
/*
* Copyright 2021 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 ... |
"""Multitest testsuite/testcase module."""
import functools
import inspect
import traceback
import types
import copy
from collections import defaultdict
from testplan import defaults
from testplan.common.utils.callable import wraps
from testplan.common.utils import interface
from testplan.common.utils.strings import ... |
# Copyright 2018 Capital One Services, LLC
# Copyright The Cloud Custodian Authors.
# SPDX-License-Identifier: Apache-2.0
from c7n_azure.provider import resources
from c7n_azure.resources.arm import ArmResourceManager
@resources.register('batch')
class Batch(ArmResourceManager):
"""Batch Resource
:example:
... |
from __future__ import division
from __future__ import print_function
from builtins import chr
from builtins import str
from builtins import range
from builtins import object
from androguard.core import bytecode
from androguard.core.bytecodes.apk import APK
from androguard.core.androconf import CONF
from androguard.c... |
# import lookml as lookml
# # import src.lookml.lang as lang
# # import src.lookml.project as Project
# import lookml.lkml as lkml
# from lookml import lookml,lkml
# from lookml.common import project
import lookml
import lookml.lkml as lkml
import unittest, copy, json
from pprint import pprint
import warnings
import co... |
const express = require("express");
const router = express.Router();;
const controller = require("../../src.web/controllers/donvitinh.controller");
const response = require('../../utils/api.res/response');
router.get("/", async(req, res) => {
let body = req.body;
try {
const result = await controller.g... |
//
// FactorProfile.h
// Pods
//
// Created by Chandra Shirashyad on 12/19/14.
//
//
#import <Foundation/Foundation.h>
#import "Mantle.h"
@interface FactorProfile : MTLModel <MTLJSONSerializing>
@end
|
// Users array list
const users = [];
// Join user to chat
const userJoin = (id, username, room) => {
const user = { id, username, room };
users.push(user);
return user;
};
// Get current user
const getCurrentUser = (id) => users.find((user) => user.id === id);
// User leaves chat
const userLeave = (id)... |
"""Entity representing a Sonos battery level."""
from __future__ import annotations
from homeassistant.components.sensor import SensorEntity
from homeassistant.const import DEVICE_CLASS_BATTERY, PERCENTAGE
from homeassistant.helpers.dispatcher import async_dispatcher_connect
from .const import SONOS_CREATE_BATTERY
fr... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# Euler's and Related Methods for Solving Differential Equations documentation build configuration file, created by
# sphinx-quickstart on Fri May 18 17:58:58 2018.
#
# This file is execfile()d with the current directory set to its
# containing dir.
#
# Note that not all... |
###
#
# Full history: see below
#
# Version: 1.1.0
# Date: 2020-04-15
# Author: Yves Vindevogel (vindevoy)
#
# Changes:
# - Added logging
# - Added try except on read of the files in case they don't exist
#
###
import logging
import markdown
import os
import yaml
from common.options import Optio... |
#include "udp_comm.h"
#define UDP_COMM_BLOCKING 0
#define UDP_COMM_NONBLOCKING 1
Std_ReturnType udp_comm_create_ipaddr(const UdpCommConfigType *config, UdpCommType *comm, const char* my_ipaddr)
{
int err;
struct target_os_api_sockaddr_type addr;
u_long val;
err = socket(AF_INET, SOCK_DGRAM, 0);
if (err < 0) {
... |
from __future__ import division
from __future__ import print_function
import glob
import json
import math
import numpy as np
import os
import random
import sys
import tensorflow as tf
import time
import audio_producer
import models
tf.app.flags.DEFINE_string("config", "configs/kws.json",
"Configuration json for... |
{"project": [null,"Splash",[[0,true,false,false,false,false,false,false,false,false],[1,true,false,false,false,false,false,false,false,false],[2,true,false,false,false,false,false,false,false,false],[3,true,false,false,false,false,false,false,false,false],[4,true,false,false,false,false,false,false,false,false],[5,fal... |
import json
import os
import re
import argparse
from nltk.tokenize import sent_tokenize
import enchant
from sofia import *
import requests
from requests.auth import HTTPBasicAuth
lang_encoding_dict = enchant.Dict("en_US")
def remove_empty_lines(text_init):
lines = text_init.split('\n')
new_lines = []
fo... |
import React from "react"
import 'aframe'
function Camera() {
return (
<a-camera>
<a-entity cursor=""
position="0 0 -1"
geometry="primitive: ring; radiusInner: 0.02; radiusOuter: 0.03"
material="color: black; shader: flat">
</a-entity>
</a... |
import numpy as np
from ..core import *
from ..distributions import *
from ..tuning.starting import find_MAP
import patsy
import theano
import pandas as pd
from collections import defaultdict
from statsmodels.formula.api import glm as glm_sm
import statsmodels.api as sm
from pandas.tools.plotting import scatter_matrix
... |
#if 0
-- #############################
-- Definition of range constants
-- #############################
leg1 LegType ::= '01'H
leg2 LegType ::= '02'H
numOfInfoItems INTEGER ::= 4
opcode-initialDP Code ::= 0
opcode-assistRequestInstructions Code ::= 16
opcode-establishTemporaryConnection ... |
from django.contrib import admin
from .models import Address, CartProduct, Product, Category, Order, Review, Refund, Balance, Card
# Register your models here.
admin.site.register(Product)
admin.site.register(Category)
admin.site.register(CartProduct)
admin.site.register(Order)
admin.site.register(Address)
admin.site... |
import os
import numpy as np
import pandas as pd
import unittest
from datetime import datetime
from bom_data_parser import read_hrs_csv
class HRSTest(unittest.TestCase):
def setUp(self):
self.test_cdo_file = os.path.join(os.path.dirname(__file__), 'data', 'HRS', '410730_daily_ts.csv')
def test_hrs(se... |
# -*- coding: utf-8 -*-
# Copyright (C) 2016, the Pyzo development team
#
# Pyzo is distributed under the terms of the 2-Clause BSD License.
# The full license can be found in 'license.txt'.
""" Module baseTextCtrl
Defines the base text control to be inherited by the shell and editor
classes. Implements styling, intr... |
# Blueprint initialization optinal args.
BLUEPRINT_INIT = {
'static_folder': None,
'static_url_path': None,
'template_folder': None,
'url_prefix': '',
'subdomain': None,
'url_defaults': None,
'root_path': None
}
|
import argparse
import json
from runners import runners
def parse_args():
parser = argparse.ArgumentParser()
parser.add_argument("--config", required=True)
return parser.parse_args()
if __name__ == "__main__":
args = parse_args()
config = json.loads(open(args.config).read())
runner_type = g... |
const PreLoader = () => {
return (
<div className="lds-ripple">
<div></div>
<div></div>
</div>
)
}
export default PreLoader; |
/**
* Copyright (c) 2016-present, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*/
#pragma on... |
import zeeguu.core
db = zeeguu.core.db
def date_format(date_object):
return date_object.strftime("%Y-%m-%d")
def datetime_format(date_object):
return date_object.strftime("%Y-%m-%d %H:%M:%S")
def list_of_dicts_from_query(query, values):
rows = db.session.execute(query, values)
result = []
fo... |
/**
* 使用redux实现将state提交给后端的功能
* 一个合法的redux包括:
* reducer
* action
* action creator
*/
import axios from 'axios'
import { getRedirectPath } from '../util'
const REGISTER_SUCCESS = 'REGISTER_SUCCESS'
const ERROR_MSG = 'ERROR_MSG'
const LOGIN_SUCCESS = 'LOGIN_SUCCESS'
const LOAD_DATA = 'LOAD_DATA'
const initState ... |
from query.base import BaseQuery
class CommitMetaQuery(BaseQuery):
table_name = 'commit_meta'
class DiffusionFeaturesQuery(BaseQuery):
table_name = 'diffusion_features'
class SizeFeaturesQuery(BaseQuery):
table_name = 'size_features'
class PurposeFeaturesQuery(BaseQuery):
table_name = 'purpose_f... |
__author__ = 'tylin'
__version__ = '2.0'
# Interface for accessing the Microsoft COCO dataset.
# Microsoft COCO is a large image dataset designed for object detection,
# segmentation, and caption generation. pycocotools is a Python API that
# assists in loading, parsing and visualizing the annotations in COCO.
# Pleas... |
from pyglet.gl import *
from .plot_mode import PlotMode
from threading import Thread, Event, RLock
from .color_scheme import ColorScheme
from sympy.core import S
from sympy.core.compatibility import is_sequence
from time import sleep
from sympy.core.compatibility import callable
class PlotModeBase(PlotMode):
"""
... |
/*!
* A MongoDB inspired ES6 Map() query language. - Copyright (c) 2017 Louis T. (https://lou.ist/)
* Licensed under the MIT license https://raw.githubusercontent.com/LouisT/MapQL/master/LICENSE
*/
'use strict';
const Helpers = require('../../Helpers');
module.exports = {
'$exists': {
chain: function (k... |
class ApiClient {
DEFAULT_API_HEADERS = {
'Content-Type': 'application/vnd.api+json',
Accept: 'application/json'
}
constructor(options = {}) {
this.apiBase = options.apiBase || '/api';
this.path = options.path || '';
this.authenticate = options.authenticate || (() =>... |
module.exports = {
"id": "es_ea",
"data": {
"long": {
"years": {
"one": "{0} año",
"other": "{0} años"
},
"months": {
"one": "{0} mes",
"other": "{0} meses"
},
"weeks": {
"one": "{0} semana",
"other": "{0} semanas"
},
"day... |
#!/usr/bin/env python
"""Collection of simple functions useful in computational chemistry scripting.
Many of the following functions are used to make operations on xyz coordinates
of molecular structure. When refering to ``xyz_data`` bellow, the following
structures (also used in :py:mod:`~comp_chem_utils.molecule_dat... |
document.onreadystatechange = function() {
const getTotalPointsForColumn = column => Array.from(column.querySelectorAll('aui-badge')).reduce((init, current) => init + Number(current.textContent), 0)
const updateColumn = (column, columnPoints) => {
const div = document.createElement("div")
const text = doc... |
import os
import os.path as op
import pickle
import pandas as pd
import mne
exclude_subjects = dict(camcan=["CC220352"],
ds117=["sub001", "sub005", "sub016"])
def get_params(dataset):
if os.path.exists("/home/parietal/"):
subjects_dir = get_subjects_dir(dataset)
data_path ... |
/*
* This header is generated by classdump-dyld 1.5
* on Tuesday, November 10, 2020 at 10:11:16 PM Mountain Standard Time
* Operating System: Version 14.2 (Build 18K57)
* Image Source: /System/Library/PrivateFrameworks/GeoServic... |
// ***********************************************************************
// DO NOT EDIT THIS FILE !!!
// ***********************************************************************
// This file is automatically generated from the grib_api templates. All
// changes will be overridden. If you want ... |
import argparse
from lycanthrope.game import Game
from lycanthrope.irc import LycanthropeBot
def argparser():
parser = argparse.ArgumentParser()
parser.add_argument(
"-s", "--server", dest="server", default="chat.freenode.net"
)
parser.add_argument("-p", "--port", dest="port", default=6697, t... |
// Copyright (c) 2012-2017, The CryptoNote developers, The Bytecoin developers
// Copyright (c) 2014-2018, The Monero Project
// Copyright (c) 2018, The TurtleCoin Developers
// Copyright (c) 2018-2019, The BLOC.MONEY Developers
//
// Please see the included LICENSE file for more information.
//
// BLOC is free softwa... |
#!/usr/bin/env python3
'''
Short script to make OPL music (in DOSBox DRO files) less loud.
More information on DRO and OPL:
* https://zdoom.org/wiki/DRO
* http://www.shikadi.net/moddingwiki/DRO_Format
* http://www.fit.vutbr.cz/~arnost/opl/opl3.html
(C) Michiel Sikma <michiel@sikma.org>. MIT licensed.
'''
from struct... |
from django.conf.urls import url, include
from rest_framework import routers
from user.views import UserViewSet
router = routers.DefaultRouter()
router.register(r'users', UserViewSet)
urlpatterns = [
url(r'^', include(router.urls)),
] |
import {ThemableMixin} from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';
import {ElementMixin} from '@vaadin/component-base/src/element-mixin.js';
import {ShadowFocusMixin} from '@vaadin/field-base';
import {mixinBehaviors} from '@polymer/polymer/lib/legacy/class.js';
import '../components/color-picker-res... |
import torch
import numpy as np
import time
import os
import csv
import cv2
import argparse
def load_classes(csv_reader):
result = {}
for line, row in enumerate(csv_reader):
line += 1
try:
class_name, class_id = row
except ValueError:
raise(V... |
/**
* @license
* Copyright Google Inc. All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*/
// THIS CODE IS GENERATED - DO NOT MODIFY
// See angular/tools/gulp-tasks/cldr/extract.js
(function(global) {
glo... |
#!c:\users\microdata\documents\eao\wa\src\djangocmsdemo\djangocmsdemo\env_rafpizza\scripts\python.exe
#
# The Python Imaging Library
# $Id$
#
# this demo script illustrates how a 1-bit BitmapImage can be used
# as a dynamically updated overlay
#
import sys
if sys.version_info[0] > 2:
import tkinter
else:
impo... |
/* 1. Leia três números e retorne o maior deles. */
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <stdbool.h>
int main(){
int x, y, z;
scanf("%d %d %d", &x, &y, &z);
if (x > y && x > z){
printf("%d\n", x);
}
else if(y > x && y > z){
printf("%d\n", y);
}
else{
printf("... |
"""Tests for the lock entity."""
from pytest_homeassistant_custom_component.common import MockConfigEntry
from unittest.mock import AsyncMock, Mock
from custom_components.tuya_local.const import (
CONF_LOCK,
CONF_DEVICE_ID,
CONF_TYPE,
DOMAIN,
)
from custom_components.tuya_local.generic.lock i... |
/**
* Copyright 2012-2019, Plotly, Inc.
* 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.
*/
'use strict';
var colorAttrs = require('../../components/color/attributes');
var axesAttrs = require('../cartesian/layout_attr... |
#!/usr/bin/env python3
import numpy as np
from astropy.table import Table
from ctapipe.utils import datasets
from ctapipe.visualization import ArrayDisplay
from matplotlib import pyplot as plt
if __name__ == '__main__':
plt.style.use("ggplot")
plt.figure(figsize=(10, 8))
arrayfile = datasets.get_datase... |
import enum
import typing
import pymongo
class Order(int, enum.Enum):
ASCENDING = pymongo.ASCENDING
DESCENDING = pymongo.DESCENDING
class IndexType(str, enum.Enum):
GEO2D = pymongo.GEO2D
GEOSPHERE = pymongo.GEOSPHERE
HASHED = pymongo.HASHED
TEXT = pymongo.TEXT
class Index(pymongo.IndexMod... |
# Building an LSTM
# Part 1: Data Preprocessing
# Importing Libraries
import numpy as np
import matplotlib.pyplot as plt
import pandas as pd
# Importing Training Set (as a dataframe)
dataset_train = pd.read_csv('Full_Google_Training_Data.csv')
# Creating numpy array (which is how we have to deal with our data) of ... |
#ifndef _WEGeometryAnalyzer_h
#define _WEGeometryAnalyzer_h
#include "WEGeometryVertexBuffer.h"
#include "WEGeometryIndexBuffer.h"
#include "../math/WEAAB.h"
#include "../coll/narrowPhase/WECollFaceArray.h"
namespace WE {
class GeometryAnalyzer {
public:
static void addToVolume(GeometryVertexBu... |
// Copyright 2009 the Sputnik authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
info: Check {} for automatic semicolon insertion
es5id: 7.9_A10_T2
description: Checking if execution of "{}*1" fails
negative:
phase: parse
type: SyntaxError
---*/
// throw "T... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Fri Aug 10 11:07:05 2018
@author: chrispedder
To train the model, run from the top-level dir as:
python3 -m src.CNN_models.train_model --args ...
"""
import numpy as np
import os
import argparse
import json
import tensorflow as tf
from abc import ABC, ... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import pkg_resources
import sys
import os
from os import path
DEBUG = True
# set only to True in DEBUG mode
DEBUG_MAIL = True
PROPAGATE_EXCEPTIONS = True
DISPLAY_EXCEPTIONS = True
DEBUG_PRINT = False
LOG_QUERIES = False
# Either None (no timeout) or a positive integ... |
import torch
import numpy as np
from models import AutoregressiveModel
from data import get_ASR_datasets, read_config
from training import Trainer
import argparse
# Get args
parser = argparse.ArgumentParser()
parser.add_argument('--train', action='store_true', help='run training')
parser.add_argument('--restart', acti... |
"""
Funds API For Digital Portals
Search for mutual funds and ETFs using one single consolidated API, including a criteria-based screener. The API provides also base data, key figures, and holdings. A separate endpoint returns the possible values and value range for the parameters that the endpoint /fund/nota... |
const faker = require("faker");
const { User } = require("../../../src/models");
describe("User model", () => {
describe("User validation", () => {
let newUser;
beforeEach(() => {
newUser = {
name: faker.name.findName(),
email: faker.internet.email().toLowerCase(),
password: "pa... |
import { PROFILE_PAGE_TOGGLE, SEARCH_HOMEPAGE } from './navigationActions';
const initState = {
profileOpen: false,
search: {
homepage: false,
cookbook: false,
},
};
export const navigationReducer = (state = initState, action) => {
switch (action.type) {
case PROFILE_PAGE_TOGGLE:
return {
... |
/**
* The MIT License (MIT)
*
* Copyright (c) 2014-2019 Mickael Jeanroy
*
* 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
... |
import React, { Component } from 'react';
export default class Title extends Component {
render () {
const { props } = this;
return (
<h1 {...props}>{props.title}</h1>
);
}
}
export class Subtitle extends Component {
render () {
const { props } = this;
return (
<h3 {...props}>{props.title}</h3>
... |
# Copyright 2020 Division of Medical Image Computing, German Cancer Research Center (DKFZ), Heidelberg, Germany
#
# 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://w... |
// Copyright (c) 2011 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.
#ifndef CHROME_BROWSER_UI_COCOA_EXTENSIONS_BROWSER_ACTIONS_CONTROLLER_H_
#define CHROME_BROWSER_UI_COCOA_EXTENSIONS_BROWSER_ACTIONS_CONTROLLER_H_
#im... |
# Test cases for FILS
# Copyright (c) 2015-2017, Qualcomm Atheros, Inc.
#
# This software may be distributed under the terms of the BSD license.
# See README for more details.
import binascii
import hashlib
import logging
logger = logging.getLogger()
import os
import socket
import struct
import time
import hostapd
fr... |
import useIsIE11 from './useIsIE11'
import useCookie from './useCookie'
import useInsights from './useInsights'
export {
useIsIE11,
useCookie,
useInsights
}
|
#!/usr/bin/python
# ckblip.py
# checks metadata on blib
# like 'is there a flash version?'
# or 'if a format is not on blip, is it local?'
# and maybe upload it.
# and maybe delete it:
# if the .fvl is not the same file size as the local copy on disk,
# delete the one on blip.
import os
import xml.etree.ElementTree
... |
#
# Copyright 2021 Red Hat Inc.
# SPDX-License-Identifier: Apache-2.0
#
"""Tests the AWSProvider implementation for the Koku interface."""
import logging
from unittest.mock import Mock
from unittest.mock import patch
from botocore.exceptions import ClientError
from botocore.exceptions import ParamValidationError
from ... |
const mongoose = require("mongoose");
const MetadataModel = require("./interoperability_metadata/interoperability_metadata_schema").Metadata;
const SliceInformation = require("./slice_information/slice_information_schema").Slice;
const Schema = mongoose.Schema;
const ObjectId = Schema.ObjectId;
const Bridge = new Sc... |
'''
This file contains the basic classes needed for threading
'''
import traceback
import sys
from PyQt5.QtCore import QObject, QRunnable, pyqtSignal, pyqtSlot
class WorkerSignals(QObject):
'''
Defines the signals available from a running worker thread.
Supported signals are:
finished No data
erro... |
(function() {
var root = this;
var previousTransition = root.Transition;
var Transition = root.Transition = function(val, dest) {
this.value = val;
this.destination = dest || val;
};
Transition.prototype.drag = 0.125;
Transition.prototype.update = function() {
this.value += (this.destinati... |
from django.db import models
from django.utils import timezone
from django.template.defaultfilters import truncatechars
# Create your models here.
class brand(models.Model):
name = models.CharField(verbose_name="品牌名称", max_length=50)
description = models.TextField(verbose_name="品牌描述")
class product(models.M... |
#import <Foundation/Foundation.h>
#import "SentryDefines.h"
#import "SentrySerializable.h"
NS_ASSUME_NONNULL_BEGIN
@class SentryStacktrace, SentryMechanism;
NS_SWIFT_NAME(Exception)
@interface SentryException : NSObject <SentrySerializable>
SENTRY_NO_INIT
/**
* The name of the exception
*/
@property (nonatomic, ... |
const brs = require("brs");
const { ComponentFactory, RoSGNode, Callable, ValueKind } = brs.types;
describe("ComponentFactory", () => {
describe("createComponent", () => {
it("returns a properly constructed built in Node with default name", () => {
const component = ComponentFactory.createCompo... |
import setuptools
with open("README.md", "r") as f:
long_description = f.read()
setuptools.setup(
name="yenerate",
version="0.1.0",
author="groupbool",
description="generate custom ye album art",
long_description=long_description,
long_description_content_type="text/markdown",
url="htt... |
import React from 'react'
import PropTypes from 'prop-types'
import { graphql, Link } from 'gatsby'
import Layout from '../../components/layout/layout'
import Content, { HTMLContent } from '../../components/content/content'
import { FaFacebook, FaLinkedin, FaTwitter } from 'react-icons/fa'
import CollectionStyles fro... |
import os
import pdb
import glob
import cv2
import numpy as np
from keras.preprocessing.image import ImageDataGenerator
def adjustData(img, label, data, cnt, val='F'):
''' Adjust images and labels using data flag for network inputs
Args:
img (np.array): Augmented images
label (np.array):... |
import App from '../App.vue'
import Login from '../view/Auth/Login'
import AllContacts from '../view/Contacts/All'
import AddContact from "../view/Contacts/Add";
const routes = [{
path: '/',
component: App,
children: [
{
path: '',
name: 'home',
redirect: '/all... |
const cacheBuster = require('@mightyplow/eleventy-plugin-cache-buster');
module.exports = function(config) {
// Add a date formatter filter to Nunjucks
config.addFilter("dateDisplay", require("./filters/dates.js") );
config.addFilter("timestamp", require("./filters/timestamp.js") );
config.addFilter("squash",... |
"""
AMAK: 20050515: This module is the test_select.py from cpython 2.4, ported to jython + unittest
"""
try:
object
except NameError:
class object: pass
import errno
import select
import socket
import os
import sys
import test_support
import unittest
class SelectWrapper:
def __init__(self):
sel... |
// Adapting code from https://qiskit.org/textbook/ch-algorithms/quantum-key-distribution.html
const keyImports = `
from qiskit import QuantumCircuit, Aer, transpile, assemble
from qiskit.visualization import plot_histogram, plot_bloch_multivector
from numpy.random import randint
import numpy as np
import pickle
import... |
/**
* Main server ladder library
* Pokemon Showdown - http://pokemonshowdown.com/
*
* This file handles ladders for the main server on
* play.pokemonshowdown.com.
*
* Ladders for all other servers is handled by ladders.js.
*
* Matchmaking is currently still implemented in rooms.js.
*
* @license MIT license
... |
#!/usr/bin/env python3
# Copyright (c) Facebook, Inc. and its affiliates. All rights reserved.
import copy
import logging
from reagent.core import aggregators as agg
from reagent.core.observers import IntervalAggregatingObserver
from reagent.models.base import ModelBase
from reagent.reporting.reporter_base import Rep... |
// Licensed under the Apache License. See footer for details.
var winston = require("winston");
// default to in-memory datasource
var datasources = {
"db": {
"name": "db",
"connector": "memory"
}
};
// then use VCAP_SERVICES
if (process.env.VCAP_SERVICES) {
var vcapServices = JSON.parse(process.env.VCA... |
import json
from collections.abc import Mapping, Sequence
class PropDict(Mapping):
__slots__ = ["_inner"]
def __init__(self, inner):
self._inner = inner
def __contains__(self, key):
return key in self._inner
def __iter__(self):
return iter(self._inner)
def __len__(self)... |
import { getComments, addComment } from "../../lib/data";
import { getSession } from "next-auth/client";
export default async function comments(req, res) {
const { slug } = req.query;
if (req.method === "GET") {
const comments = await getComments(slug);
return res.send(comments);
}
if (req.method ===... |
import React from 'react';
import {
Route,
Switch,
} from 'react-router-dom';
import { asyncRouter, nomatch } from 'choerodon-front-boot';
const IssueLinkHome = asyncRouter(() => (import('./IssueLinkHome')));
const IssueLinkIndex = ({ match }) => (
<Switch>
<Route exact path={`${match.url}`} component={Issu... |