text stringlengths 3 1.05M |
|---|
export { default } from './positionElement';
|
import pandas as pd
import numpy as np
import dgl
import torch
from sklearn.preprocessing import StandardScaler, QuantileTransformer
class MacroDataset():
def __init__(self, DF_PATH, SEED, TASK, LABELNAME, MODEL, NX_GRAPHS, NORM=None):
'''
Initializes a MacroDataset object
Args:... |
const authController = {};
authController.getAccessToken = (req, res, next) => {
const { accessToken } = req.cookies;
res.locals.accessToken = accessToken;
next();
};
authController.saveAccessToken = (req, res, next) => {
const { user } = req;
res.cookie('accessToken', user.accessToken, { maxAge: 36000000 ... |
/*-
* Copyright (c) 2012 Stephan Arts. 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 condi... |
import os
from socket import socket
import testinfra.utils.ansible_runner
testinfra_hosts = testinfra.utils.ansible_runner.AnsibleRunner(
os.environ['MOLECULE_INVENTORY_FILE']).get_hosts('all')
# check if MongoDB is enabled and running
def test_mongo_running_and_enabled(host):
mongo = host.service("mongod")
... |
require('./bootstrap');
import Vue from 'vue';
import VueRouter from 'vue-router';
Vue.use(VueRouter);
const routes = [
{ path: '/users', component: require('./components/UsersComponent.vue').default },
{ path: '/edit/:id', component: require('./components/EditComponent.vue').default ,name: 'edit' },
... |
# Copyright (c) 2017-present, Facebook, Inc.
# All rights reserved.
#
# This source code is licensed under the 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.
import torch.optim
from . import ... |
/**
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @emails oncall+metro_bundler
* @format
*/
'use strict';
const {
addModuleIdsToModuleWrapper,
inlineModuleIds,
createIdF... |
class Solution:
def findMinArrowShots(self, points: List[List[int]]) -> int:
if points == []:
return 0
points.sort(key = lambda x: x[0])
start = points[0][0]
end = points[0][1]
ans = len(points)
for i in range(1, len(points)):
if start <= point... |
/**
* Copyright (c) 2013-present, Facebook, Inc.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
if (process.env.NODE_ENV !== 'production') {
var REACT_ELEMENT_TYPE = (typeof Symbol === 'function' &&
Symbol.for &&
Symbol.fo... |
//
// MessageUtil.h
// GoBots
//
// Created by Rax on 9/3/17.
// Copyright © 2017 The Tech Time. All rights reserved.
//
#import <Foundation/Foundation.h>
@interface MessageUtil : NSObject
+(NSString*) getRandomVictoryMessage;
@end
|
import assign from 'lodash/assign';
import includes from 'lodash/includes';
import isEmpty from 'lodash/isEmpty';
import isString from 'lodash/isString';
import pick from 'lodash/pick';
angular.module('controllers').controller(
'controllers.Domain.Redirection.edit',
class RedirectionEdit {
/**
* @construc... |
cordova.define('cordova/plugin_list', function(require, exports, module) {
module.exports = [
{
"file": "plugins/cordova-plugin-battery-status/www/battery.js",
"id": "cordova-plugin-battery-status.battery",
"pluginId": "cordova-plugin-battery-status",
"clobbers": [
"navig... |
import * as Three from 'three';
import React from 'react';
var WIDTH = 80;
var DEPTH = 80;
var HEIGHT = 200;
var textureLoader = new Three.TextureLoader();
var woodMaterial = textureLoader.load(null);
var bookTexture1 = textureLoader.load(null);
var bookTexture2 = textureLoader.load(null);
var bookTexture3 = textureL... |
import * as actionType from '../actionType';
import utils from '@app/utils';
import { fromJS, List } from 'immutable';
let defaultState = utils.lastRecord && utils.lastRecord.redoPathList && utils.lastRecord.redoPathList.length !== 0 ?
List(utils.lastRecord.redoPathList) : List([]);
export default (state = defaultS... |
import React from 'react';
import { configure, setAddon, addDecorator } from '@storybook/react';
import infoAddon from '@storybook/addon-info';
import Container from './Container';
// addDecorator(checkA11y);
addDecorator(story => <Container story={story} />);
setAddon(infoAddon);
function loadStories() {
const req... |
#!/usr/bin/env python
# coding: utf-8
# # Publications markdown generator for academicpages
#
# Takes a set of bibtex of publications and converts them for use with [academicpages.github.io](academicpages.github.io). This is an interactive Jupyter notebook ([see more info here](http://jupyter-notebook-beginner-guide.... |
"""
Class Features
Name: cpl_hmc_finalizer
Author(s): Fabio Delogu (fabio.delogu@cimafoundation.org)
Date: '20200401'
Version: '3.0.0'
"""
#######################################################################################
# Library
import logging
import os
from hmc.algorithm.default.... |
(xui.Locale.en||(xui.Locale.en={})).inline={
$_$:1,
ok:'O K',
cancel:'Cancel',
set:'SET',
today:'Today',
now:'Now',
yes:'Yes',
no:'No',
noFlash:'No Flash PlugIn!',
transparent:'transparent',
required:'Required field',
required2:'There is required field need to be filled o... |
const base = require('./jest.config.base.js')
module.exports = {
...base,
projects:
[
'<rootDir>/packages/**/jest.config.js'
],
coverageDirectory: '<rootDir>/coverage/'
}
|
import Vue from 'vue'
export const eventBus = new Vue()
export const EVENT_UPDATE_CONFIG = 'updateConfig'
export const EVENT_UPDATE_SERIES_LIST = 'update series list'
export const EVENT_UPDATE_SIZE = 'update size'
export const EVENT_UPDATE_THEME = 'update theme'
export const EVENT_RE_RENDER = 're-render'
export const... |
import pull from "lodash/pull";
import { types as t } from "@babel/core";
export default function() {
function isProtoKey(node) {
return t.isLiteral(t.toComputedKey(node, node.key), { value: "__proto__" });
}
function isProtoAssignmentExpression(node) {
const left = node.left;
return (
t.isMem... |
import React from 'react'
import ReactDOM from 'react-dom'
import './styles/index.scss'
import App from './App'
import * as serviceWorker from './serviceWorker'
ReactDOM.render(
<React.StrictMode>
<App />
</React.StrictMode>,
document.getElementById('root')
)
serviceWorker.unregister()
|
import torch
import numpy as np
import torch.nn.functional as F
from torch_utils.ops.upfirdn2d import upfirdn2d
dic = {}
batch_size = 2
for batch_idx in range(8):
x_shape = [1, 512, 9, 9]
f_shape = [4, 4]
up = 1
down = 1
padding = [1, 1, 1, 1]
flip_filter = False
gain = 4
# x_shape ... |
"""
Copyright (c) Contributors to the Open 3D Engine Project.
For complete copyright and license terms please see the LICENSE at the root of this distribution.
SPDX-License-Identifier: Apache-2.0 OR MIT
"""
class Tests:
viewport_config_updated = (
"Viewport is now configured for test",
"Failed to... |
// 参数配置
export default {
lang: 'lang', // 本地存储语言
timeout: 1000 * 60 * 10, // 接口超时时间
warningDay: 7, // 报警中心获取最近多长时间的数据 默认为7天
timeInterval: 300000, // 默认5分钟更新下数据(包括报警中心数据、图表数据、土壤检测、环境监测、设备运行情况部分)
historyInterval: 60000, // 默认1分钟更新一次历史数据列表
measurementTnterval: 60000, // 默认1分钟切换一个测量类型的图表数据
historyLen... |
/* This file is generated by createIcons.js any changes will be lost. */
import createIcon from '../createIcon';
var OutlinedBuildingIcon = createIcon({
name: 'OutlinedBuildingIcon',
height: 512,
width: 448,
svgPath: 'M128 148v-40c0-6.6 5.4-12 12-12h40c6.6 0 12 5.4 12 12v40c0 6.6-5.4 12-12 12h-40c-6.6 0-12-5.4... |
var {
GraphQLSchema,
GraphQLObjectType,
GraphQLString,
GraphQLList,
GraphQLInt,
GraphQLFloat
} = require('graphql');
var search = require('../../API/fbAPI').search;
const fbQueryType = module.exports = new GraphQLObjectType({
name:'fbQuery',
description:'Query user, page, event, group, place, placetopic.',
f... |
import ScatterView from './Scatter';
import BarView from './Bar';
import TableView from './Table';
import ParCoordsView from './ParCoordsView';
import HistView from './Hist';
import RFFeatureView from './RFFeature';
import ClusteringView from './Clustering';
import RegressionView from './Regression';
import Classificat... |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('reviewers', '0003_auto_20150727_1017'),
]
operations = [
migrations.RemoveField(
model_name='editorsubscription'... |
"""
pghoard
Copyright (c) 2015 Ohmu Ltd
See LICENSE for details
"""
# pylint: disable=attribute-defined-outside-init
from .base import CONSTANT_TEST_RSA_PUBLIC_KEY, CONSTANT_TEST_RSA_PRIVATE_KEY
from .test_wal import wal_header_for_file
from http.client import HTTPConnection
from pghoard import postgres_command, wal
f... |
const path = require('path');
const MiniCssExtractPlugin = require("mini-css-extract-plugin");
const HtmlWebpackPlugin = require('html-webpack-plugin');
module.exports = {
name: 'my-app',
// target: ['web', 'es2015'], // デフォルトはbrowserslistがあれば、それが設定が使用される
entry: {
index: './src/index.js',
about: './src/a... |
const mongoose = require('mongoose');
const Schema = mongoose.Schema;
const mySchema = new Schema({
chat: {
type: Schema.ObjectId,
ref: 'Chat,'
},
user: {
type: Schema.ObjectId,
ref: 'User'
},
message: {
type: String,
required: true
},
date: D... |
const textProps = {
image: require("../../../assets/img/faces/team-1.jpg").default,
text: "Ray Tompson",
};
export default textProps;
|
#ifndef __PERF_CACHE_H
#define __PERF_CACHE_H
#include <stdbool.h>
#include "util.h"
#include "strbuf.h"
#include "../perf.h"
#define CMD_EXEC_PATH "--exec-path"
#define CMD_PERF_DIR "--perf-dir="
#define CMD_WORK_TREE "--work-tree="
#define CMD_DEBUGFS_DIR "--debugfs-dir="
#define PERF_DIR_ENVIRONMENT "PERF_DIR"
#d... |
/**
* @overview In a SAML application customize the mapping between the Auth0 user and the SAML attributes
* @gallery true
* @category enrich profile
*
* SAML Attributes mapping
*
* If the application the user is logging in to is SAML (like Salesforce for instance), you can customize the mapping between the Auth... |
#################################################################################
#
# Project Title: Send emails to yourself when execution is done
# Author: Sam Showalter
# Date: 2021-08-12
#
########################################################################... |
const bcrypt = require('bcryptjs');
// I thought of declaring these constants outside and in one separate file
// But casually tempering with these variables might lead to lose of all the information
// in the database or a drastic performance drop.
// Most of the time, you do not want to change these variables
const ... |
import torch as t
from torch import nn
from torch.utils.data import Dataset, DataLoader, random_split
from torch.optim import Adam
import numpy as np
import cv2
import os
batch_size = 16
n_epochs = 1000
img_size = np.array((1088, 1700)) # Size of the incoming images
channels = 4 # Number of images in each event
lr... |
// Copyright 2014 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 UI_OZONE_PLATFORM_DRM_GPU_DRM_SURFACE_H_
#define UI_OZONE_PLATFORM_DRM_GPU_DRM_SURFACE_H_
#include "base/memory/ref_counted.h"
#include "base/mem... |
# -*- coding: utf-8 -*-
"""
Created on Sun Sep 8 14:56:22 2019
@author: positiveoutlier
An element is a leader if it is greater than the sum of all the elments to
its right side. Given an input list with integers, returns a list with leaders.
Expected input: list with integers
Expected output: list with integers
""... |
let fs = require('fs');
let arraynum = fs.readFileSync('data.txt').toString().split(",");
/*sorting array asc by using built-in function*/
let numbers= arraynum.sort();
let file= fs.createWriteStream('output.txt')
for (i=0 ; i< numbers.length; i++)
{
if(i == numbers.length-1)
{
file.write(numbers[i]... |
const express = require('express')
const router = express.Router()
router.get('/', (req, res) => {
res.send({
session:req.session
})
})
module.exports = router |
import numpy as np
import torch
import torch.nn as nn
import torch.nn.functional as F
import copy
import math
import utils
from encoder import make_encoder
from decoder import make_decoder
LOG_FREQ = 10000
def gaussian_logprob(noise, log_std):
"""Compute Gaussian log probability."""
residual = (-0.5 * noise... |
var callbackArguments = [];
var argument1 = function() {
callbackArguments.push(arguments)
return undefined; };
var argument2 = false;
var argument3 = {"213":"","9.655439531837537e+307":"","1.4558911257947117e+308":1.4400994143766396e+308,"C2":627,"":1.4451062225792429e+308,",":"^VrZ"};
var argument4 = functio... |
import os
from config import config as config_
config = config_.GetConfig(os.path.join('config', 'runner.config'))
import datetime
from data import city_visit
from data import point
start_end_coordinates = point.Coordinates(40.763582, -73.988470)
day1 = city_visit.DayVisitParameters(
start_datetime=datetime.date... |
// Copyright The OpenTelemetry Authors
// SPDX-License-Identifier: Apache-2.0
#pragma once
#include <algorithm>
#include <atomic>
#include <cstdint>
#include <cstdio>
#include <cstdlib>
#include <fstream>
#include <iomanip>
#include <iostream>
#include <map>
#include <memory>
#include <mutex>
#include <sstream>
#in... |
import 'bootstrap/js/src/tooltip'
import $ from 'jquery'
import { DateTime } from 'luxon'
import { observeRemoveJq } from './mutation-observer'
window.DateTime = DateTime
class TimeActualizer {
constructor(options) {
this.options = options
this.updateTime()
this.instanceMap = new Map()
this.strings ... |
// Copyright (c) 2016, KomputerKult Research Labs
//
// Author: Shen Noether <shen.noether@gmx.com>
//
// 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 m... |
#-*- coding: utf-8 -*-
"""
Copyright (c) 2012 University of Oxford
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... |
var path = '/tmp/test-level-master'
var path2 = '/tmp/test-level-slave'
require('rimraf').sync(path)
require('rimraf').sync(path2)
var levelup = require('levelup')
var SubLevel = require('level-sublevel')
var db = SubLevel(levelup(path))
var _db = SubLevel(levelup(path2))
var Master = require('../')
var pull =... |
import styled from 'styled-components';
const Wrapper = styled.li`
width: 100%;
height: max-content;
min-height: 3rem;
display: flex;
align-items: center;
position: relative;
border-top: 1px solid #eee;
&:first-child {
border-top: none;
}
`;
export default Wrapper;
|
/*
* blootuoth.h
*
* Created on: 3 авг. 2020 г.
* Author: User
*/
#ifndef INC_BLOOTUOTH_H_
#define INC_BLOOTUOTH_H_
#include "ringbuffer_dma.h"
#define BUF_SIZE_BT 1024
#define CMD_SIZE 128
#define QNH 1014
RingBuffer_DMA rx_bt;
char cmd_bt[CMD... |
var osmose = require('../');
var test = require('tape');
test('valid request', function (t) {
t.plan(2);
var callback = function (err, url) {
t.notOk(err instanceof Error);
t.ok(url.indexOf("data:") > -1);
};
osmose.generateConfig(validConfig, callback);
});
test('no longer valid req... |
/**
* 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
* "License"); you... |
import React from 'react';
import createSvgIcon from './utils/createSvgIcon';
export default createSvgIcon(
<React.Fragment><path d="M20 2H8c-1.1 0-2 .9-2 2v12c0 1.1.9 2 2 2h12c1.1 0 2-.9 2-2V4c0-1.1-.9-2-2-2zm-2 5h-3v5.5a2.5 2.5 0 0 1-5 0 2.5 2.5 0 0 1 2.5-2.5c.57 0 1.08.19 1.5.51V5h4v2zM4 6H2v14c0 1.1.9 2 2 2h14v-... |
#ifndef PHPSCI_EXT_CARRAY_H
#define PHPSCI_EXT_CARRAY_H
#include "php.h"
#include "common/exceptions.h"
#define CArray_PRIORITY 0.0
typedef struct CArray CArray;
static const int CARRAY_ARRAY_WARN_ON_WRITE = (1 << 31);
#define TYPE_INT_STRING "int"
#define TYPE_INT32_STRING "int32"
#define TYPE_INT64_STRING ... |
import asyncio
import atexit
import signal
import sqlite3
from secrets import token_bytes
from typing import Dict, List, Optional
from chives.consensus.constants import ConsensusConstants
from chives.daemon.server import WebSocketServer, create_server_for_daemon, daemon_launch_lock_path, singleton
from chives.full_no... |
const PlotCard = require('../../plotcard.js');
class MarchedToTheWall extends PlotCard {
setupCardAbilities() {
this.whenRevealed({
handler: () => {
this.remainingPlayers = this.game.getPlayersInFirstPlayerOrder();
this.selections = [];
this.proce... |
# -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'h:\projects\jukebox-core\src\jukeboxcore\gui\widgets\guerilla\seqcreator.ui'
#
# Created: Tue Jan 13 18:54:58 2015
# by: pyside-uic 0.2.15 running on PySide 1.2.2
#
# WARNING! All changes made in this file will be lost!
from PySide imp... |
import math
def primes(n:int) -> list:
factors = []
if n < 0:
factors.append(-1)
factors.append(1)
n *= -1
more = False
i = 2
while i <= math.sqrt(n):
while n % i == 0:
if not more:
factors.append(i)
factors.append(1)
more = True
else:
factors[-1] += 1
n /= i
more = False
... |
var $ = require('cheerio');
// TODO: support gallery: http://hyderphoto.smugmug.com/Daily-Photos/Daily-Photos/27429648_7XP8jg#!i=4106742422&k=zsmTVn9
module.exports = {
mixins: [
"*"
],
highestPriority: true,
getMeta: function (oembed) {
return {
media: 'player'
... |
import axios from "axios";
const yo = {
userdata: function () {
return axios.get("https://randomuser.me/api/?results=50");
},
};
export default yo;
|
#!/usr/bin/env python3
import os
import sys
import logging
import argparse
import platform
import subprocess
import hashlib
os.environ["PYTHONUNBUFFERED"] = "y"
ZULIP_PATH = os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
sys.path.append(ZULIP_PATH)
from scripts.lib.zulip_tools import ru... |
print(bin(25))
print(0b0101)
print(oct(25))
print(hex(10))
print(0xf)
|
/*eslint-env node */
var http = require('http');
var db = require('./db');
db.initDB();
var USE_FASTCACHE = false;
/*
* To enable the load generator and 'improved' cache mechanism below:
* 1. remove the 'res.json({"success": 0, "fail": 0, "time": 0});' line
* 2. uncomment the remaining method body
*/
exports.loadT... |
/* TEMPLATE GENERATED TESTCASE FILE
Filename: CWE78_OS_Command_Injection__wchar_t_environment_w32spawnl_09.c
Label Definition File: CWE78_OS_Command_Injection.strings.label.xml
Template File: sources-sink-09.tmpl.c
*/
/*
* @description
* CWE: 78 OS Command Injection
* BadSource: environment Read input from a... |
const Color = "RANDOM", Random = require("srod-v2");
const Discord = require("discord.js");
module.exports = {
name: "panda",
aliases: [],
category: "Image",
description: "Return A Random Panda!",
usage: "Panda",
run: async (client, message, args) => {
const Data = await Random.GetAnimalImage({ A... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
__author__ = 'valerio cosentino'
from git import *
import re
from datetime import datetime
import string
from util.date_util import DateUtil
import time
class GitQuerier():
"""
This class collects the data available on Git by using Git python library
"""
... |
import { useEffect, useState } from "react";
import Style from "../styles/myModal.module.css";
function Edit(props) {
const closeModal = () => {
props.setEditable(false);
document.getElementById("restForm").reset();
};
return (
<div>
<div id={Style.myModal} class={Style.modal}>
<div clas... |
from __future__ import annotations
import pytest
from testing.runner import and_exit
def test_search_wraps(run, ten_lines):
with run(str(ten_lines)) as h, and_exit(h):
h.press("Down")
h.press("Down")
h.await_cursor_position(x=0, y=3)
h.press("^W")
h.await_text("search:")
... |
import networkx as nx
from pymnet import *
import random
import matplotlib
import cascade as cas
import statistics
import math
import time
import csv
matplotlib.use('TkAgg')
nodes = 500
layers = 3
intra_thres = 0.2
inter_thres = 0.2
attack_size = 10
attack_point = (0.5, 0.5)
attack_type = "spatial_number" #... |
// @flow
import * as React from 'react';
import {Button} from 'baseui/button';
import {StatefulPopover} from 'baseui/popover';
import {Paragraph3} from 'baseui/typography';
export default function Example() {
return (
<StatefulPopover
content={
<Paragraph3 padding="scale500">
Server-side ... |
# -*- coding: utf-8 -*-
#
# Cyclopts documentation build configuration file, created by
# sphinx-quickstart on Mon Jun 2 14:15:20 2014.
#
# 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 file.
#
# ... |
let quoteSample = "The quick brown fox jumps over the lazy dog.";
let alphabetRegex = /[a-z]/gi; // Change this line
let result = quoteSample.match(alphabetRegex); // Change this line
console.log(result,result.length);
|
describe('Application main view', function () {
beforeEach(function () {
browser.get('/');
});
it('should have a title', function () {
expect(browser.getTitle()).toEqual("Star Wars UI proto");
});
it('should have header', function () {
expect(element(by.css('dng-app dng-he... |
# Copyright 2019 Amazon.com, Inc. or its affiliates. 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. A copy of
# the License is located at
#
# http://aws.amazon.com/apache2.0/
#
# or in the 'license' file acc... |
var structvteprec__arp__sources__remote =
[
[ "header_", "structvteprec__arp__sources__remote.html#a79acbcd5a74adf1d9017ad2ccce0a426", null ],
[ "locator", "structvteprec__arp__sources__remote.html#a607e4c058e128f701ead418d5fc623f7", null ],
[ "src_mac", "structvteprec__arp__sources__remote.html#ac9effbe92d... |
# 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
# "License"); you may not u... |
class Box {
constructor(x, y, width, height) {
var options = {
'restitution':0.8,
'friction':1.0,
'density':0.04,
}
this.body = Bodies.rectangle(x, y, width, height, options);
this.width = width;
this.height = height;
this.image= loadImage("box.png");
World.add... |
import React from 'react';
import { connect } from 'react-redux';
// import 'react-dates/initialize';
import { DateRangePicker } from 'react-dates';
// import 'react-dates/lib/css/_datepicker.css';
import { setTextFilter, sortByDate, sortByAmount, setStartDate, setEndDate } from '../actions/filters';
export class Exp... |
# -*- coding: utf-8 -*-
from django.conf import settings
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
]
operations = [
migrations.CreateModel(
name='UserProfile',
... |
import torch
import copy
from spirl.modules.variational_inference import MultivariateGaussian, mc_kl_divergence
from spirl.rl.components.agent import BaseAgent
from spirl.rl.components.policy import Policy
from spirl.rl.policies.mlp_policies import SplitObsMLPPolicy, MLPPolicy, HybridConvMLPPolicy
from spirl.utils.gen... |
#ifdef __OBJC__
#import <UIKit/UIKit.h>
#else
#ifndef FOUNDATION_EXPORT
#if defined(__cplusplus)
#define FOUNDATION_EXPORT extern "C"
#else
#define FOUNDATION_EXPORT extern
#endif
#endif
#endif
FOUNDATION_EXPORT double Pods_cocoaIGODemo_TestsVersionNumber;
FOUNDATION_EXPORT const unsigned char Pods_cocoaIGODemo_Tests... |
// 解除右键限制
window.addEventListener("contextmenu",function(t) {
t.stopImmediatePropagation();
},true);
// 鼠标按下事件:点击右键时保存光标下的当前元素
var clickedEl;
$(document).on('mousedown', (event)=>{
// 右键为 3
if (3 == event.which) clickedEl = mouseMoveTarget; // mouseMoveTarget 在 keyBind 中获取到
});
// 鼠标按下事件:点击右键后更新标注
$(document).on('... |
# coding: utf-8
# Copyright (c) 2008-2011 Volvox Development Team
#
# 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... |
class Node {
constructor(element) {
this.element = element;
this.next = null;
this.prev = null;
}
}
class DoublyLinkedList {
constructor() {
this.head = new Node('head');
}
// 查找一个节点
find(item) {
let currentNode = this.head;
while (currentNode.element !== item) {
currentNode... |
# -*- coding: utf-8 -*-
import unittest
import phandim
import phantom
class TestPhantom(unittest.TestCase):
"""
Unit tests to check phantom dimensions
"""
def test_constructor1(self):
bx = [1,2,3,4,5]
by = [3,2,5,1,6]
bz = [8,5,23,9,4,3]
ph = phantom.phant... |
const degToRad = (angle) => ((angle * Math.PI) / 180)
class Snake {
constructor(x, y, angle, length, ctx) {
this.x = x
this.y = y
this.angle = angle
this.length = length
this.ctx = ctx
this.coordinates = []
}
draw() {
this.ctx.beginPath()
this.ctx.fillStyle = Snake.COLOR
this... |
describe("triangleChecker", function() {
it("compares the length of 3 sides and returns false if it's not a valid triangle", function() {
expect(triangleChecker(2, 2, 8)).to.equal(false);
});
it("returns the number of equal sides", function() {
expect(triangleChecker(5, 5, 8)).to.equal(2);
});
});
|
import { getTimeInRaster } from "./utilTime.js";
/**
* A custom server object providing commonly used information.
*/
export class MyServer {
/**
* Create a custom server object for the given server name.
* @param {import("..").NS} ns
* @param {string} name - The name of the server.
* @param {number} m... |
from django.test import TestCase, Client
from django.core.urlresolvers import reverse
def redirect_url(url_name, next_url_name=None, *args, **kwargs):
url = reverse(url_name) + "?next=" + reverse(next_url_name, kwargs=kwargs)
return url
class GradingsLoginRequiredTests(TestCase):
def setUp(self):
... |
"""
HVAC channels module for Zigbee Home Automation.
For more details about this component, please refer to the documentation at
https://home-assistant.io/integrations/zha/
"""
import asyncio
from collections import namedtuple
from typing import Any, Dict, List, Optional, Tuple, Union
from zigpy.exceptions import Zig... |
"use strict";
import React from "react";
import Wprr from "wprr";
import Layout from "wprr/elements/layout/Layout";
// import LoadAdditionalItems from "./LoadAdditionalItems";
export default class LoadAdditionalItems extends Layout {
/**
* Constructor
*/
constructor() {
//console.log("LoadAdditionalItems::c... |
# Copyright 2021 Intel Corporation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in wr... |
import functools
import json
from kubernetes import client, config
from datetime import timedelta
from flask import Blueprint, current_app, flash, g, redirect, render_template, request, session, url_for, jsonify
from flask_jwt_extended import JWTManager, jwt_required, jwt_optional, create_access_token, get_jwt_identity... |
function countChar(string, ch) {
var counted = 0;
for (var i = 0; i < string.length; i++)
if (string.charAt(i) == ch)
counted += 1;
return counted;
}
function countBs(string) {
return countChar(string, "B");
}
console.log(countBs("BBC"));
// → 2
console.log(countChar("kakkerlak", "k"));
// → 4
|
/* Copyright (c) 2016, 2017, Oracle and/or its affiliates. All rights reserved.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License, version 2.0,
as published by the Free Software Foundation.
This program is also distributed with c... |
/**
* Provides drag and drop functionality for blocks.
*
* @module moodle-core-blockdraganddrop
*/
var AJAXURL = '/lib/ajax/blocks.php',
CSS = {
BLOCK: 'block',
BLOCKREGION: 'block-region',
BLOCKADMINBLOCK: 'block_adminblock',
EDITINGMOVE: 'editing_move',
HEADER: 'header',
LIGHTBOX: 'lightb... |
//initDraw(document.getElementById('imagearea'));
console.log('loading highlight');
function radialDraw(img_id, canvas_id, mode) {
console.log('init radial draw');
var mouse = {
x: 0,
y: 0,
startX: 0,
startY: 0
};
var points = [];
var polygons = [];
var mode = 'r... |