text stringlengths 3 1.05M |
|---|
from abc import ABC, abstractmethod
from chalicelib.utils import pg_client, helper
class BaseIntegration(ABC):
def __init__(self, user_id, ISSUE_CLASS):
self._user_id = user_id
self.issue_handler = ISSUE_CLASS(self.integration_token)
@property
@abstractmethod
def provider(self):
... |
import React from 'react';
import format from 'date-fns/format';
import {LineChart, XAxis, YAxis, CartesianGrid, Tooltip, Line} from 'recharts';
const CustomizedAxisTick = ({x, y, stroke, payload, range}) => {
const dateFormat = {
day: 'h:mm a',
week: 'MM/dd',
month: 'MM/dd'
};
const date = range ===... |
import django_tables2 as tables
__all__ = (
'TenantColumn',
)
class TenantColumn(tables.TemplateColumn):
"""
Include the tenant description.
"""
template_code = """
{% if record.tenant %}
<a href="{{ record.tenant.get_absolute_url }}" title="{{ record.tenant.description }}">{{ record.... |
def add_rank_score(score, ranked):
if len(ranked) == 0 or ranked[len(ranked)-1] != score:
ranked.append(score)
def add_player_score(score, ranked):
if len(ranked) == 0:
ranked.append(score)
return 1
else:
index = len(ranked) / 2
for i in range(0, len(ranked)):
... |
require('dotenv').config()
module.exports = {
siteMetadata: {
title: `RahatCodes`,
description: `Monday night coding with Rahat.`,
author: `Rahat Chowdhury`,
},
plugins: [
{
resolve: `gatsby-source-contentful`,
options: {
spaceId: process.env.SPACE_ID,
accessToken: pro... |
# -*- coding: utf-8 -*-
#from config import Config
from flask import Flask, render_template
from flask_pymongo import PyMongo
import os
mongo = PyMongo()
def create_app(config_filename):
app = Flask(__name__)
app.config.from_object(config_filename)
app.config["APPLICATION_ROOT"] = "/api"
mongo.in... |
from django.db import models
# Create your models here.
class Question(models.Model):
question_text = models.CharField(max_length=200)
pub_date = models.DateTimeField('date published')
class Choice(models.Model):
question = models.OneToOneField(Question, on_delete=models.CASCADE, primary_key=True)
ch... |
// Copyright 2018 The Abseil 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... |
# coding: utf-8
"""
Cisco Intersight
Cisco Intersight is a management platform delivered as a service with embedded analytics for your Cisco and 3rd party IT infrastructure. This platform offers an intelligent level of management that enables IT organizations to analyze, simplify, and automate their environmen... |
$(document).ready(function () {
let checkers = [];
function saveCheck (opt1) {
let del = 0;
checkers = checkers.reduce(function (a, f) { if (f !== $(opt1.target).attr('data-id')) { a.push(f); } else { del = 1; } return a; }, []);
if (del === 0) checkers.push($(opt1.target).attr('data-id'));
console.... |
/**
* Copyright IBM Corp. 2019, 2020
*
* This source code is licensed under the Apache-2.0 license found in the
* LICENSE file in the root directory of this source tree.
*
* Code generated by @carbon/icon-build-helpers. DO NOT EDIT.
*/
'use strict';
function _interopDefault (ex) { return (ex && (typeof ex === '... |
import * as THREE from 'three';
var scene, listener, timeout, mixer, door, doorMaterial;
const soundNames = [
'bells',
'horn',
'cowbell',
'guiro',
'mandolin',
'squeaker',
'train',
'whistle',
'motorhorn',
'surdo',
'trumpet',
];
var sounds = {};
soundNames.forEach( i => { sounds[i] = {animations: ... |
# -*- coding: utf-8 -*-
import argparse
import os
import shutil
import time
import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.nn.parallel
import torch.backends.cudnn as cudnn
import torch.optim
import torch.utils.data
import torchvision.transforms as transforms
import torchvision.dataset... |
import React from 'react';
import PropTypes from 'prop-types';
import { graphql } from 'gatsby';
import Hero from '../components/hero';
import HomeTemplate from '../templates/homeTemplate';
import Organizers from '../components/organizers';
import KOINIntro from '../components/koinIntro';
import KBNIntro from '../com... |
from creeps.parts.carry_source import CarrySource
from creeps.parts.work_target import WorkTarget
class Carry(CarrySource, WorkTarget):
pass
|
# function get_possible_matches - used to return list of possible
# matching words in a list if the word was supposed to be in the
# list but not found, possibly due to a spelling error.
# adapted from:
# http://norvig.com/spell-correct.html
alphabet = 'abcdefghijklmnopqrstuvwxyz'
def edits1(word):
splits = ... |
import logging
from ...base.models import PositionBase
from .common.convertor import get_symbol
from .common.logger import log_error
logger = logging.getLogger(__name__)
class OANDAPositionMixin(PositionBase):
def pull_position(self, instrument):
"""pull position by instrument"""
instrument = g... |
from .google.google_area_chart import google_area_chart
from .google.google_stepped_area_chart import google_stepped_area_chart
from .google.google_bar_chart import google_bar_chart
from .google.google_column_chart import google_column_chart
from .google.google_material_bar_chart import google_material_bar_chart
from .... |
import unittest
from unittest.mock import Mock, patch, ANY
from pika.spec import Basic
from rabbitmq_client import (
RMQProducer,
ExchangeParams,
QueueParams,
PublishParams,
ConfirmModeOK,
DeliveryError,
DEFAULT_EXCHANGE
)
# noinspection DuplicatedCode
class TestProducer(unittest.TestCa... |
"use strict";var ganttChart=function(t){function e(t){var e=$.call(t);return e!==tt&&e!==et&&C("Expected object or array. Got: "+e),e===tt?(Y(t),W.items=W.items.concat(t)):(P(t),W.items.push(t)),z(),Z}function n(t){return arguments.length?(d3.select(window).on("resize",t!==!1?S:null),W.isAutoResize=t,Z):W.isAutoResize}... |
'use strict';
/**
* This file is part of the NAD package.
*
* (c) Ivan Proskuryakov
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*
* @name NADUser
* @description User module
*/
define(['app',
'./config/user'... |
import asyncio
from autobahn.asyncio.wamp import ApplicationSession, ApplicationRunner
from autobahn.wamp.types import RegisterOptions, SubscribeOptions
from autobahn.wamp import auth
from serpent.config import config
from serpent.utilities import is_windows
from serpent.input_controller import InputController, Inpu... |
#!/usr/bin/env python
# The MIT License (MIT)
#
# Copyright (c) 2018 Bill Ryder
#
# 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
... |
#!/usr/bin/env python3
# Copyright (c) 2015-2020 The Adinkracoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
'''
Perform basic security checks on a series of executables.
Exit status will be 0 if successful, and... |
# Pyrogram - Telegram MTProto API Client Library for Python
# Copyright (C) 2017-2021 Dan <https://github.com/delivrance>
#
# This file is part of Pyrogram.
#
# Pyrogram 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... |
'use strict';
angular.module("ngLocale", [], ["$provide", function($provide) {
var PLURAL_CATEGORY = {ZERO: "zero", ONE: "one", TWO: "two", FEW: "few", MANY: "many", OTHER: "other"};
$provide.value("$locale", {
"DATETIME_FORMATS": {
"AMPMS": [
"AM",
"PM"
],
"DAY": [
"dimanche",
"lu... |
/*
Copyright (c) 2003-2016, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.md or http://ckeditor.com/license
*/
CKEDITOR.lang['sl']={"widget":{"move":"Kliknite in povlecite, da premaknete"},"undo":{"redo":"Ponovi","undo":"Razveljavi"},"toolbar":{"toolbarCollapse":"Skrči Orodno Vrstico","... |
const { format_date, format_plural, format_url } = require("../utils/helpers");
test("format_date() returns a date string", () => {
const date = new Date("2020-03-20 16:12:03");
expect(format_date(date)).toBe("3/20/2020");
});
test("format_plural() returns respective noun pluralization", () => {
expect(format_... |
/*
BLIS
An object-based framework for developing high-performance BLAS-like
libraries.
Copyright (C) 2014, The University of Texas at Austin
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are
met:
- Re... |
#!/usr/bin/env python
# $Id$
"""many solutions"""
import puzzler
from puzzler.puzzles.hexominoes import HexominoesParallelogram15x14 as puzzle
puzzler.run(puzzle)
|
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# File: Ampel-plot/ampel-plot-browse/ampel/plot/SVGLoader.py
# License: BSD-3-Clause
# Author: valery brinnel <firstname.lastname@gmail.com>
# Date: 13.06.2019
# Last Modified Date: 14.05.2022
# Last Modified By: va... |
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
var Berth = (function () {
/**
*
* @param {type} paper
* @param {type} x
* @param {type} y
* @param {t... |
export default {
methods: {
toastSuccess (message, title = undefined) {
if (title === undefined) {
title = this.$t('notification:general.success')
}
this.toast(message, { title, variant: 'success' })
},
toastWarning (message, title = undefined) {
if (title === undefined) ... |
import sys
import os
sys.path.append(os.path.abspath('./plot/'))
from option import *
import matplotlib as mpl
mpl.use('Agg')
import matplotlib.pyplot as plot
import matplotlib.ticker as ticker
import numpy as np
import csv
def autolabel(rects):
for rect in rects:
height = rect.get_height()
ax.text... |
{% include 'aptronics/public/js/bundling.js' %}
frappe.ui.form.on("Quotation", {
refresh: (frm) =>{
aptronics.disallow_attachment_delete(frm)
},
before_cancel: (frm) => {
aptronics.provide_cancellation_reason(frm);
}
});
|
"""aqueduct SERVICES MODULE"""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from aqueduct.services.carto_service import CartoService
from aqueduct.services.geostore_service import GeostoreService
|
"use strict";
var __extends = (this && this.__extends) || (function () {
var extendStatics = function (d, b) {
extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnPrope... |
import os
import requests
import traceback
import json
from datetime import datetime, timedelta
from requests import HTTPError
from CommonServerPython import *
import demistomock as demisto
DATE_FORMAT = '%Y-%m-%d %H:%M:%S'
EMAIL = demisto.params().get('credentials')['identifier']
API_KEY = demisto.params().get('crede... |
import app from './app';
import express from './express_config';
import LoggerClass from './logger';
import server from './server';
const logger = new LoggerClass({logDirectory: app.logDirectory});
export default {
app,
express,
logger,
server,
};
|
const { createStore, applyMiddleware } = require('redux');
const {
forwardToMain,
replayActionRenderer,
getInitialStateRenderer,
createAliasedAction,
} = require('electron-redux');
const reducers = require('../reducers');
// setup store
const initialState = getInitialStateRenderer();
const store = createStore(... |
const path = require('path');
module.exports = {
entry: './src/main.js',
mode: 'production',
output: {
filename: 'dwains-header-card.js',
path: path.resolve(__dirname)
}
};
|
import ReactDOM from 'react-dom';
import Routes from './routes';
import './index.css';
import 'material-components-web/dist/material-components-web.css';
ReactDOM.render(Routes, document.getElementById('root'));
|
/* JS Document */
/******************************
[Table of Contents]
1. Vars and Inits
2. Set Header
3. Init Menu
4. Init Header Search
5. Init Home Slider
6. Initialize Milestones
******************************/
$(document).ready(function()
{
"use strict";
/*
1. Vars and Inits
*/... |
/*
** Copyright 2007-2018 RTE
** Author: Robert Gonzalez
**
** This file is part of Sirius_Solver.
** This program and the accompanying materials are made available under the
** terms of the Eclipse Public License 2.0 which is available at
** http://www.eclipse.org/legal/epl-2.0.
**
** This Source Code may also be made... |
# --------------
# import packages
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import seaborn as sns
import re
from nltk.corpus import stopwords
from sklearn.model_selection import train_test_split
from sklearn.feature_extraction.text import CountVectorizer, TfidfVectorizer
from sklearn.naive... |
#ifndef _XMLMenu_h_
#define _XMLMenu_h_
#include "WithXMLMenu.h"
#endif
|
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
#include <sys/types.h>
#include <magick/api.h>
#include <getopt.h>
typedef struct {
int verbose;
int width;
int height;
int x;
int y;
int dx;
int dy;
int rows;
int cols;
char** argv;
} config_t;
typedef struct {
Image *... |
/* global ConfirmDialog, MocksHelper, MockIccHelper, MockLazyL10n, MockMozL10n,
MockNavigatorMozMobileConnections, MockNavigatorMozTelephony,
MockNavigatorSettings, Promise, TelephonyHelper */
'use strict';
require('/dialer/test/unit/mock_lazy_loader.js');
require('/dialer/test/unit/mock_confirm_dialog.js');
r... |
# Generated by Django 3.0.4 on 2020-05-28 16:42
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('dogs', '0001_initial'),
]
operations = [
migrations.AlterField(
... |
import unittest
class Pilha():
def __init__(self):
self._lista = []
def vazia(self):
return not bool(self._lista)
def topo(self):
if self._lista:
return self._lista[-1]
raise PilhaVaziaErro()
def empilhar(self, valor):
self._lista.append(valor)
... |
/* jshint -W097 */// jshint strict:false
/*jslint node: true */
const expect = require('chai').expect;
const klfutils = require('../lib/klfutils');
describe('Test klfutils', function() {
const oldProducts = [
{
"name": "Windows bathroom",
"category": "Window opener",
"id... |
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Copyright 2014 California Institute of Technology. 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 th... |
# Copyright (c) Facebook, Inc. and its affiliates.
import mmf.datasets.databases.readers # noqa
from .annotation_database import AnnotationDatabase
from .features_database import FeaturesDatabase
from .image_database import ImageDatabase
from .scene_graph_database import SceneGraphDatabase
__all__ = [
"Annotati... |
// ----------------------------------------------------------------------------
//
// Basecode Bootstrap Compiler
// Copyright (C) 2018 Jeff Panici
// All rights reserved.
//
// This software source file is licensed under the terms of MIT license.
// For details, please read the LICENSE file.
//
// --------------------... |
/*
Copyright (c) 2015, Potion Design LLC
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
list of conditions and the fo... |
#ifndef QZEROCONFSERVICE_H
#define QZEROCONFSERVICE_H
#include <QHostAddress>
#include <QMutexLocker>
#include <QSharedPointer>
#include "qzeroconfglobal.h"
class QZeroConfPrivate;
class Q_ZEROCONF_EXPORT QZeroConfServiceData
{
Q_GADGET
Q_PROPERTY( QString name READ name )
Q_PROPERTY( QString type READ type )
Q_... |
define(function (require) {
return function ColumnLayoutFactory(Private) {
let d3 = require('d3');
let mapSplit = Private(require('ui/vislib/lib/layout/splits/tile_map/map_split'));
/*
* Specifies the visualization layout for tile maps.
*
* This is done using an array of objects. The first... |
export default class IconEventMap {
constructor(
commander,
presenter,
persistenceInterface,
view,
buttonController
) {
this._map = new Map([
['view', () => presenter.toViewMode()],
['term', () => presenter.toTermMode()],
['block', () => presenter.toBlockMode()],
['re... |
import Ember from "ember-metal/core"; // Ember.assert, Ember.Handlebars
import ComponentTemplateDeprecation from "ember-views/mixins/component_template_deprecation";
import TargetActionSupport from "ember-runtime/mixins/target_action_support";
import View from "ember-views/views/view";
import { get } from "ember-meta... |
from PyQt5 import QtWidgets, QtGui
from game import Machine
from player import Player, HumanPlayer
import sys
import threading
import const
import view
class Presenter:
def __init__(self, _view: view.View):
self.view = _view
self.games = 0
self.isTraining = False
self.p... |
//
// TPRecordModel.h
// VideoIphone
//
// Created by 吴凯凯 on 2019/6/24.
// Copyright © 2019 com.baidu. All rights reserved.
//
#ifdef __arm64__
#import <Foundation/Foundation.h>
#import <objc/runtime.h>
NS_ASSUME_NONNULL_BEGIN
@interface TPRecordModel : NSObject <NSCopying>
@property (nonatomic, strong)Class c... |
# --------------------------------------------------------------------------
#
# Copyright (c) Microsoft Corporation. All rights reserved.
#
# The MIT License (MIT)
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the ""Software""), ... |
const fs = require('fs');
const path = require('path');
const mkdirp = require('mkdirp');
const _ = require('lodash');
const GithubAPI = require('@octokit/rest');
const fetch = {
loaders: [
{
organization: 'webpack-contrib',
suffixes: ['-loader'],
hides: ['webpack-contrib/config-loader']
},... |
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the Lic... |
var mongodb = require("../../lib/mongodb"),
ReplicaSetManager = require('../../test/tools/replica_set_manager').ReplicaSetManager;
var options = {
auto_reconnect: true,
poolSize: 4,
socketOptions: { keepAlive: 100, timeout:30000 }
};
var userObjects = [];
var counter = 0;
var counter2 = 0;
var maxUserId = 100... |
r=int(input("enter the range"))
l=[]
for i in range(r):
s=i**2
l.append(s)
print(l) |
# chessunqlitedu.py
# Copyright 2019 Roger Marsh
# Licence: See LICENCE (BSD licence)
"""Chess database update using custom deferred update for unqlite.
"""
import os
import bz2
import subprocess
import sys
from solentware_base import unqlitedu_database
from solentware_base.core.constants import FILEDESC
from solent... |
(function (window) {
"use strict";
if (!Array.prototype.indexOf) {
Array.prototype.indexOf = function (searchElement, fromIndex) {
if ( this === undefined || this === null ) {
throw new TypeError( '"this" is null or not defined' );
}
var length = this.length >>> 0; // Hack to convert... |
import torch
import torch.nn as nn
import torch.nn.functional as F
from types import MethodType
import pdb
import math
def interleave(x, size):
s = list(x.shape)
return x.reshape([-1, size] + s[1:]).transpose(0, 1).reshape([-1] + s[1:])
def de_interleave(x, size):
s = list(x.shape)
return x.reshape... |
import React from 'react'
import classnames from 'classnames'
import { useStaticQuery, graphql, Link } from 'gatsby'
import * as css from './updateslist.module.scss'
const UpdatesList = (props) => {
const data = useStaticQuery(graphql`
query IndexUpdates {
allMdx {
edges {
node {
... |
'''
from David Huard's scipy sandbox, also attached to a ticket and
in the matplotlib-user mailinglist (links ???)
Notes
=====
out of bounds interpolation raises exception and wouldn't be completely
defined ::
>>> scoreatpercentile(x, [0,25,50,100])
Traceback (most recent call last):
...
raise ValueError("A va... |
import binascii
import pytest
from unittest.mock import patch
from sqlalchemy import Integer
from sqlalchemy.ext.declarative import declarative_base
from pyramid.httpexceptions import HTTPNotFound, HTTPServerError
from pyramid_oereb.contrib.data_sources.standard.hook_methods import get_symbol
from pyramid_oereb.contri... |
import React, {useRef} from 'react'
import PropTypes from 'prop-types'
import {FiX} from 'react-icons/fi'
import {rem} from 'polished'
import theme from '../theme'
import useClickOutside from '../hooks/use-click-outside'
import {Fill, Absolute} from './position'
function Drawer({show, onHide, ...props}) {
const ref ... |
/**
* Copyright © 2016 Magento. All rights reserved.
* See COPYING.txt for license details.
*/
define([
'underscore',
'mageUtils',
'uiRegistry',
'./column',
'Magento_Ui/js/modal/confirm'
], function (_, utils, registry, Column, confirm) {
'use strict';
return Column.extend({
def... |
/**
* @author simonThiele / https://github.com/simonThiele
* @author TristanVALCKE / https://github.com/Itee
*/
/* global QUnit */
import { Object3D } from '../../../../src/core/Object3D';
import { Vector3 } from '../../../../src/math/Vector3';
import { Euler } from '../../../../src/math/Euler';
import { Quaternion... |
/*
* Copyright 2020, Data61, CSIRO (ABN 41 687 119 230)
*
* SPDX-License-Identifier: GPL-2.0-only
*/
#pragma once
#include <config.h>
#include <util.h>
#include <kernel/stack.h>
#ifdef ENABLE_SMP_SUPPORT
#define LD_EX "ldxr "
#define ST_EX "stxr "
#define OP_WIDTH "w"
ext... |
# SPDX-License-Identifier: BSD-2-Clause
import gdb # pylint: disable=import-error
from . import base_utils as bu
from . import tasks
class cmd_list_tasks(gdb.Command):
cmd_name = "list-tasks"
def __init__(self):
super(cmd_list_tasks, self).__init__(
cmd_list_tasks.cmd_name,
gdb.COMMAND... |
import argparse
def argument_parser():
parser = argparse.ArgumentParser(formatter_class=argparse.ArgumentDefaultsHelpFormatter)
# ************************************************************
# Datasets (general)
# ************************************************************
parser.add_argumen... |
/* mbed Microcontroller Library
* Copyright (c) 2013 Nordic Semiconductor
*
* 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
*
... |
///\file
/******************************************************************************
The MIT License(MIT)
Embedded Template Library.
https://github.com/ETLCPP/etl
https://www.etlcpp.com
Copyright(c) 2021 jwellbelove
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software an... |
var express = require('express');
var router = express.Router();
/* GET Backend Homepage. */
router.get('/', function(req, res, next) {
res.render('index.html');
});
module.exports = router;
|
/**
* Copyright (c) Facebook, Inc. and its affiliates.
* 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.
*/
/************************************************************************
Name: LTE-MA... |
//
// Copyright (c) 2018 Rokas Kupstys
// Copyright (c) 2017 Eugene Kozlov
//
// 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
/... |
"""
Tests for the LossFunction class.
"""
import unittest
import numpy as np
from skill.utils import LossFunctions
class LossFunctionsTestCase(unittest.TestCase):
"""
Test case for the LossFunctions() class.
"""
def test_mape_returns_correct_numbers(self):
"""
LossFunctions.mape() ret... |
import requests
# Vuln Base Info
def info():
return {
"author": "cckuailong",
"name": '''SAP NetWeaver - Remote Admin addition''',
"description": '''SAP NetWeaver AS JAVA (LM Configuration Wizard), versions - 7.30, 7.31, 7.40, 7.50, does not perform an authentication check which allows an ... |
const cheerio = require('cheerio')
const request = require('request')
const cachedRequest = require('cached-request')(request)
const url = require('../config/url')
cachedRequest.setCacheDirectory('./tmp/match')
const getMatches = (element, title) => {
const $ = cheerio.load(element)
let text... |
import sys, random
usage = "usage: python src/permute_topics.py ylt_file_with_topic_prefixes"
if len(sys.argv) < 2:
print usage
sys.exit(-1)
folder = '/'.join(sys.argv[1].split('/')[:-1])
sourcename = sys.argv[1].split('/')[-1]
if not "_topic_" in sourcename:
print usage
sys.exit(-1)
#outputname = sourc... |
export const ELEVATOR_DOOR = {
CLOSED: 'CLOSED',
OPENED: 'OPENED',
};
|
#ifndef DS18B20_H
#define DS18B20_H
#include "../../lib/debug.h"
#include "../../lib/common.h"
#include "../../lib/1wire/main.h"
#include "../../lib/1wire/common.h"
#define DS18B20_SCRATCHPAD_LENGTH 9
#define DS18B20_ADDRESS_LENGTH 8
#define DS18B20_SCRATCHPAD_CRC_INDEX 8
#define DS18B20_ADDRESS_CRC_INDEX ... |
from orkg.utils import NamespacedClient, query_params, dict_to_url_params
from orkg.out import OrkgResponse
class StatementsClient(NamespacedClient):
def by_id(self, id):
self.client.backend._append_slash = True
response = self.client.backend.statements(id).GET()
return OrkgResponse(respo... |
const { remote, ipcRenderer } = require('electron')
document.addEventListener("DOMContentLoaded", ()=> {
document.getElementById('minimize-btn').addEventListener('click', () => {
remote.getCurrentWindow().minimize()
})
document.getElementById('max-rest-btn').addEventListener('click', () => {
const curr... |
'use strict'
const { expect } = require('chai')
const { connect, destroy } = require('../index')
const nock = require('nock')
let fake, sw
describe('sw-test-mock-special', () => {
before(() => {
nock.disableNetConnect()
nock.enableNetConnect('localhost')
})
beforeEach((done) => {
fake = nock('http:... |
"""
Various accuracy metrics:
* :func:`accuracy`
* :func:`multi_label_accuracy`
"""
from typing import Optional, Sequence, Union
import numpy as np
import torch
from catalyst.utils.metrics.functional import preprocess_multi_label_metrics
from catalyst.utils.torch import get_activation_fn
def accuracy(
... |
// Our dependency section of the connection module
// -----
// Basic library dependencies
var _ = require("underscore");
var irc = require("irc");
var uuid = require("node-uuid");
var bcrypt = require('bcrypt-nodejs');
var argv = require("yargs").argv;
// Module for fetching plugins - the server can call this
// wh... |
module.exports = require('./json-mapper'); |
import torch.nn as nn
import torch
import math
import numpy as np
import torch.nn.functional as F
from torch.nn.parameter import Parameter
from lib_diago import *
class GraphConvolution_G(nn.Module):
def __init__(self, in_features, out_features, support, mode, heads, residual=False, adj=None):
super().__... |
# coding=utf-8
# Copyright 2020 The Google Research 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 applicab... |
function ULSxSy(){var o=new Object;o.ULSTeamName="Microsoft SharePoint Foundation";o.ULSFileName="init.debug.js";return o;}
// _lcid="1033" _version="14.0.4999"
// _localBinding
// Version: "14.0.4999"
// Copyright (c) Microsoft Corporation. All rights reserved.
var L_Infobar_Send_Error_Text="Failed to send JavaScript... |
import { DASHBOARD_URL } from './constants';
export default class KubernetesContainersCtrl {
/* @ngInject */
constructor(coreConfig) {
this.user = coreConfig.getUser();
this.dashboardUrl =
DASHBOARD_URL[this.user.ovhSubsidiary] || DASHBOARD_URL.DEFAULT;
}
}
|
for i in range(int(input())):
n=int(input())
l=list(map(int,input().split()))
check=0
for j in range(n):
if l[j]!=j+1:
check=1
if check==0:
print(0)
elif l[0]== n and l[-1]==1:
print(3)
elif l[0]==1 or l[-1]==n:
print(1)
else:
print(2) |