text stringlengths 3 1.05M |
|---|
// Generated by CoffeeScript 1.3.3
var fs;
fs = require('fs');
module.exports = function(responderId, config, ss) {
var code, name;
name = config && config.name || 'rpc';
code = fs.readFileSync(__dirname + '/client.' + (process.env['SS_DEV'] && 'coffee' || 'js'), 'utf8');
ss.client.send('mod', 'socketstream-r... |
""" Multilayer Perceptron.
A Multilayer Perceptron (Neural Network) implementation example using
TensorFlow library. This example is using the MNIST database of handwritten
digits (http://yann.lecun.com/exdb/mnist/).
Links:
[MNIST Dataset](http://yann.lecun.com/exdb/mnist/).
Author: Aymeric Damien
Project: https://... |
'use strict';
angular.module("ngLocale", [], ["$provide", function($provide) {
var PLURAL_CATEGORY = {ZERO: "zero", ONE: "one", TWO: "two", FEW: "few", MANY: "many", OTHER: "other"};
function getDecimals(n) {
n = n + '';
var i = n.indexOf('.');
return (i == -1) ? 0 : n.length - i - 1;
}
function getVF(n, opt_pre... |
#ifndef __LIBUSC_H__
#define __LIBUSC_H__
#ifdef _WIN32
#define USC_API_EXPORT __declspec(dllexport)
#else
#define USC_API_EXPORT /**< API export macro */
#endif
#include <sys/types.h>
#ifdef __cplusplus
extern "C" {
#endif
enum libusc_serial_mode
{
/// On the Command Port, user can send commands an... |
from django.contrib import admin
# Register your models here.
from .models import Article
from .models import Comment
from .models import Thread
admin.site.register(Article)
admin.site.register(Comment)
admin.site.register(Thread)
|
import React from "react"
import Title from "../Title"
import styles from "../../css/contact.module.css"
export default function Contact() {
return (
<section className={styles.contact}>
<Title title="contact" subtitle="us" />
<div className={styles.center}>
<form
action="https://fo... |
// All material copyright ESRI, All Rights Reserved, unless otherwise specified.
// See http://js.arcgis.com/3.15/esri/copyright.txt and http://www.arcgis.com/apps/webappbuilder/copyright.txt for details.
//>>built
define({"widgets/RelatedTableCharts/nls/strings":{_widgetLabel:"Powi\u0105zane diagramy tabelowe",searchH... |
var Matrix = (function() {
var _scriptDir = typeof document !== 'undefined' && document.currentScript ? document.currentScript.src : undefined;
if (typeof __filename !== 'undefined') _scriptDir = _scriptDir || __filename;
return (
function(Matrix) {
Matrix = Matrix || {};
var g;g||(g=typeof Matrix !== 'undef... |
# -*- coding: utf-8 -*-
# ----------------------------------------------------------------------------#
# Copyright © 2015-2016 VMware, Inc. All Rights Reserved. #
# #
# Licensed under the BSD 2-Clause License (the “License... |
#!/usr/bin/env python3
import numpy as np
from PIL import Image
import imageio
import OpenEXR
import struct
import os
def get_pointcloud(color_image,depth_image,camera_intrinsics):
""" creates 3D point cloud of rgb images by taking depth information
input : color image: numpy array[h,w,c], dtype= uint8
... |
"use strict";
module.exports = {
up: async (queryInterface, Sequelize) => {
return queryInterface.bulkInsert("Articles", [
{
num_art: "10100",
desc_art: "ticket horaire",
type: "normal",
},
{
num_art: "00104",
desc_art: "ticket illisible",
type: "... |
/*
* Copyright 2009-2017 Alibaba Cloud 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... |
# Copyright 2013-2021 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
from spack import *
class FenicsBasix(CMakePackage):
"""FEniCS element and quadrature runtime"""
homepage = "ht... |
#!/usr/bin/env python
# coding: utf-8
# ## Problem 2 - Plotting temperatures
#
# In this problem we will plot monthly mean temperatures from the Helsinki-Vantaa airpot for the past 30 years.
#
# ## Input data
#
# File `data/helsinki-vantaa.csv` monthly average temperatures from Helsinki Vantaa airport. Column des... |
# coding: utf-8
# In[75]:
#Importing Libraries
import pandas as pd
import calendar
import numpy as np
import matplotlib.pyplot as plt
import seaborn as sns
from IPython.display import display, HTML
# In[13]:
# Loading Data and working with Date Fields
BaseLocation= 'C:\Learn\'
df = pd.read_csv(BaseLocation + '... |
from aoc.year2019.intcode import Intcode, Instruction
def test_add():
i = Intcode([1, 2, 2, 0, 99])
i.next_output()
assert i.to_list() == [4, 2, 2, 0, 99]
def test_mul():
i = Intcode([2, 0, 4, 0, 99])
i.next_output()
assert i.to_list() == [198, 0, 4, 0, 99]
def test_input_output():
i =... |
'use strict';
var rp = require('request-promise');
var createObj = require(__dirname + '/../resources/callbacks.js');
var checkErrors = require(__dirname + '/../resources/errorHandling.js');
module.exports = function request(geo, cbFunc){
var obj = createObj(arguments, request);
var error = checkErrors(obj);
if(e... |
import React from 'react';
import PropTypes from 'prop-types';
import CodeRefractor from './CodeRefractor';
class Example extends React.Component {
constructor(props) {
super(props);
this.state = {
showCode: false
};
}
toggleCode(event) {
event.preventDefault();... |
with open('../input.txt','rt') as f:
acc = 0
used_lines = set()
lines = f.readlines()
cur = 0
while True:
if cur in used_lines:
print(acc)
break
used_lines.add(cur)
if lines[cur][:3]=='acc':
acc+=int(lines[cur][3:])
cur+=1
... |
var appController = angular.module('project-controller',[]);
appController.controller('project-ctrl',['$scope','$http',ctrlFunction]);
function ctrlFunction($scope,$http){
$scope.fetchDataPeople = function(){
$http.get("https://swapi.co/api/people/")
.then(function (response){
console.log(response);
$scope... |
'use strict';
var React = require('react');
var mui = require('material-ui');
var SvgIcon = mui.SvgIcon;
var createClass = require('create-react-class');
var ActionGetApp = createClass({
displayName: 'ActionGetApp',
render: function render() {
return React.createElement(
SvgIcon,
this.props,
... |
define( [
"jquery",
"ui/widgets/button"
], function( $ ) {
module( "Button: methods" );
test( "destroy", function( assert ) {
expect( 1 );
assert.domEqual( "#button", function() {
$( "#button" ).button().button( "destroy" );
} );
} );
test( "refresh: Ensure disabled state is preserved correctly.", function() ... |
let textfield = document.querySelector("#textfield")
textfield.addEventListener("text-modif", (e) => {
console.log(textfield.value)
}) |
import React from 'react';
import clsx from 'clsx';
import { makeStyles } from '@material-ui/core/styles';
import Checkbox from '@material-ui/core/Checkbox';
const useStyles = makeStyles({
root: {
'&:hover': {
backgroundColor: 'transparent',
},
},
icon: {
borderRadius: 3,
width: 16,
hei... |
import logging
import os
import sklearn
import numpy as np
from sklearn.neighbors import KNeighborsClassifier
from sklearn.neighbors import KNeighborsRegressor
from sklearn.model_selection import train_test_split
from supervised.algorithms.algorithm import BaseAlgorithm
from supervised.algorithms.sklearn import Sklear... |
import React from "react";
import Twitter from '../../components/icons/Twitter';
import Github from '../../components/icons/Github';
export default () => {
return (
<footer className="Footer">
<nav className="copyright">
<p>
Mondragon.pro | Copyright © ... |
#pragma once
// Name: S, Version: b
#ifdef _MSC_VER
#pragma pack(push, 0x01)
#endif
/*!!HELPER_DEF!!*/
/*!!DEFINE!!*/
namespace UFT
{
//---------------------------------------------------------------------------
// Script Structs
//---------------------------------------------------------------------------
// S... |
# -*- coding: utf-8 -*-
"""
Tencent is pleased to support the open source community by making 蓝鲸智云PaaS平台社区版 (BlueKing PaaS Community Edition) available.
Copyright (C) 2017-2019 THL A29 Limited, a Tencent company. All rights reserved.
Licensed under the MIT License (the "License"); you may not use this file except in co... |
/*
* Copyright 2010-2017 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" fil... |
from __future__ import absolute_import
from __future__ import print_function
import sys
import os
import os.path
import re
import codecs
from collections import defaultdict, namedtuple
import ssg.yaml
from . import build_yaml
from . import rules
from . import utils
from . import constants
from .jinja import process... |
""" Unit test for custom json encoder """
import unittest
import datetime
from .. import time_delta_json
class TestCustomDateJSONEncoder(unittest.TestCase):
""" Test DateJSONEnocder """
def test_timedelta(self):
""" Test a simple time interval """
encoder = time_delta_json.CustomDateJSONEnc... |
'use strict';
module.exports = (sequelize, DataTypes) => {
const CastAndCrewType = sequelize.define(
'CastAndCrewType',
{
name: {
allowNull: false,
type: DataTypes.STRING
}
},
{
tableName: 'cast_and_crew_types',
underscored: true
}
);
CastAndCrewType.ass... |
from nksnd.utils import words
class Node:
def __init__(self, start_pos, key, surface, deep, weight):
self.start_pos = start_pos
self.deep = deep
self.key = key
self.weight = weight
self.surface = surface
class BOS(Node):
word = u"_BOS"
def __init__(self):
No... |
import logging
from logging.handlers import TimedRotatingFileHandler
import sys
from lasso_model.config import config
# Multiple calls to logging.getLogger('someLogger') return a
# reference to the same logger object. This is true not only
# within the same module, but also across modules as long as
# it is in the s... |
/**
* Copyright (c) Microsoft. 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 applicable law or ag... |
import setuptools
with open('README.md', 'r') as f:
long_description = f.read()
setuptools.setup(
name='lxgen-provider-collection',
version='0.2.0',
author='Iverian',
author_email='41ways1ucky@gmail.com',
description='provider collection for package lxgen',
long_description=long_descriptio... |
import {
expect
} from 'chai';
import {
spec
} from 'modules/smartxBidAdapter.js';
describe('The smartx adapter', function () {
function getValidBidObject() {
return {
bidId: 123,
mediaTypes: {
video: {
// context: 'outstream',
playerSize: [
['640', '360']
... |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
# Code referenced from https://gist.github.com/gyglim/1f8dfb1b5c82627ae3efcfbbadb9f514
import os
import time
import sys
import torch
import subprocess
USE_TENSORBOARD = True
try:
import tensorboardX
print('... |
from __future__ import print_function
from __future__ import division
from __future__ import absolute_import
import os.path as osp
import sys
sys.path.append(osp.dirname(osp.dirname(osp.abspath(__file__))))
import time
import numpy as np
import argparse
import matplotlib
matplotlib.use('Agg')
from matplotlib import p... |
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
"""cmd .vtools"""
from telethon import events
from datetime import datetime
import requests
from uniborg.util import ad... |
function Item(txnId, name, sku){
var self = this;
var category = null;
var price = null; // String
var quantity = null; // String
this.txnId = null;
this.name = null;
this.sku = null;
var init = function(txnId, name, sku){
self.txnId = txnId;
self.name = name;
self.sku = sku;
};
this... |
# Authored by : gusdn3477
# Co-authored by : -
# Link : http://boj.kr/1cf1ea352dba44daa9768b67c7f109e9
import sys
from collections import deque
def input():
return sys.stdin.readline().rstrip()
queue = deque()
N = int(input())
for i in range(N):
command = input().split()
if command[0] == 'push_front':
... |
# Copyright (c) The Diem Core Contributors
# SPDX-License-Identifier: Apache-2.0
"""This module defines `PaymentCommand` class provides utils for processing `PaymentCommand` properly."""
import typing, dataclasses, uuid, warnings
from .types import (
CommandRequestObject,
ErrorCode,
PaymentObject,
Pa... |
#!/usr/bin/env python3
# Import the required modules
from .make_client import client
from database.events import Events
from flask import Blueprint, render_template, request, redirect, session, url_for, abort
from mongoengine import Q
import requests
requests.packages.urllib3.disable_warnings()
def counter():
co... |
import math
import numpy as np
import os
import time
import torch
import random
from torch.utils.tensorboard import SummaryWriter
from common.past.utils import *
class BasePGAgent(object):
"""
The base agent class for PG agents
"""
def __init__(self,
args,
env,
... |
$NetBSD: patch-include_mgba-util_math.h,v 1.1 2018/08/12 14:25:09 nia Exp $
NetBSD defines popcount32 in libc.
--- include/mgba-util/math.h.orig 2017-07-16 19:04:50.000000000 +0000
+++ include/mgba-util/math.h
@@ -10,11 +10,15 @@
CXX_GUARD_START
+#ifndef __NetBSD__
static inline uint32_t popcount32(unsigned bit... |
/**
* Different timing functions
* used for Animations
* @type {Object}
*/
var easings = (function () {
var fn = {
quad: function (p) {
return Math.pow(p, 2)
},
cubic: function (p) {
return Math.pow(p, 3)
},
quart: function (p) {
return Math.pow(p, 4)
},
quint: functi... |
var analye = require("../modules/analyse");
module.exports = (conf, client) => {
} |
/*=========================================================================
Program: ParaView
Module: vtkSMStringVectorProperty.h
Copyright (c) Kitware, Inc.
All rights reserved.
See Copyright.txt or http://www.paraview.org/HTML/Copyright.html for details.
This software is distributed WITHOUT ANY... |
import torch
import torch.distributions as distrib
from models.vae.vae import VAE
def compute_kernel(x, y):
x_size = x.size(0)
y_size = y.size(0)
dim = x.size(1)
x = x.unsqueeze(1)
y = y.unsqueeze(0)
tiled_x = x.expand(x_size, y_size, dim)
tiled_y = y.expand(x_size, y_size, dim)
kernel_... |
/* global jQuery:true */
/*
* Fuel UX Wizard
* https://github.com/ExactTarget/fuelux
*
* Copyright (c) 2014 ExactTarget
* Licensed under the BSD New license.
*/
// -- BEGIN UMD WRAPPER PREFACE --
// For more information on UMD visit:
// https://github.com/umdjs/umd/blob/master/jqueryPlugin.js
(function umdFac... |
"""
.. module:: djstripe.webhooks.
:synopsis: dj-stripe - Views related to the djstripe app.
.. moduleauthor:: @kavdev, @pydanny, @lskillen, @wahuneke, @dollydagr, @chrissmejia
"""
import logging
from django.contrib import messages
from django.contrib.auth import REDIRECT_FIELD_NAME
from django.contrib.auth import... |
import datetime
import uuid
from collections import Counter
from unittest.mock import MagicMock, patch
import pendulum
import pytest
import prefect
from prefect.client.client import Client, FlowRunInfoResult, TaskRunInfoResult
from prefect.engine.cloud import CloudFlowRunner, CloudTaskRunner
from prefect.engine.execu... |
/**
* Copyright 2020-2021 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 applicabl... |
import FWCore.ParameterSet.Config as cms
electronMcSignalHistosCfg = cms.PSet(
Nbinxyz = cms.int32(50),
Nbinp = cms.int32(50), Nbinp2D = cms.int32(50), Pmax = cms.double(300.0),
Nbinpt = cms.int32(50), Nbinpt2D = cms.int32(50), Nbinpteff = cms.int32(19),Ptmax = cms.double(100.0),
Nbinfhits = cms.int32(30), Fhi... |
function lastKNumsSequence(n, k) {
let result = [1];
for (let i = 1; i < n; i++) {
let lastK = result.slice(-k);
let sum = 0;
for (let num of lastK) {
sum += num;
}
result.push(sum);
}
console.log(result.join(' '));
}
lastKNumsSequence(6, 3)
/* Мо... |
from .test_import import *
|
# Copyright 2015-2021 The Matrix.org Foundation C.I.C.
#
# 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... |
/**
* Sample React Native App
* https://github.com/facebook/react-native
*
* @format
* @flow
* @lint-ignore-every XPLATJSCOPYRIGHT1
*/
import React, {Component} from 'react';
import {
StyleSheet,
View,
Text,
SafeAreaView,
Alert,
TouchableOpacity,
AsyncStorage,
} from 'react-native';
type Props = ... |
/*
Copyright (c) 2003-2019, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
*/
CKEDITOR.plugins.setLang( 'embedbase', 'ug', {
pathName: 'ۋاسىتە ئوبيېكتى',
title: 'سىڭدۈرمە ۋاسىتە',
button: 'سىڭدۈرمە ۋاسىتە قىستۇر',
unsupportedUrlGi... |
"""Test"""
import json
import re
from io import UnsupportedOperation
import requests
from click.testing import CliRunner
from myjwt.modify_jwt import change_payload
from myjwt.myjwt_cli import myjwt_cli
from myjwt.utils import HEADER
from myjwt.utils import jwt_to_json
from myjwt.utils import PAYLOAD
fro... |
const pick = (obj, keys) => {
return keys
.filter(key => obj.hasOwnProperty(key))
.reduce((preValue, key) => {
preValue[key] = obj[key];
return preValue;
}, {});
};
// var o = {
// a: 1,
// b: 2,
// c: 3
// };
// const result = pick(o, ["a", "c"]);
// console.log("测试pick > ", o, result)... |
/** When your routing table is too long, you can split it into small modules**/
import Layout from '@/views/layout/Layout'
const appManage = [{
path: '/appManage',
component: Layout,
redirect: 'appManage',
name: 'appManage',
meta: {
title: '应用管理',
icon: 'chart'
},
children: [
{
path: '... |
"""
pygments.formatters._mapping
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Formatter mapping definitions. This file is generated by itself. Everytime
you change something on a builtin formatter definition, run this script from
the formatters folder to update it.
Do not alter the FORMATTERS dictionary by ha... |
// Copyright 2019 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in ... |
# coding=utf-8
# ------------------------------------
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.
# ------------------------------------
# pylint:disable=protected-access
# pylint:disable=too-many-lines
from typing import (
Any,
List,
Union,
cast,
TYPE_CHECKING,
)
impo... |
#!/usr/bin/python
# wait for an android emulator / device to be ready for pushing apps (a bit more reliable than adb wait-for-device)
import os, sys, androidsdk, time
def wait_for_device(sdk, type, hard_timeout=20):
print "[DEBUG] Waiting for device to be ready ..."
t = time.time()
max_wait = 30
max_zero = 6
at... |
CKEDITOR.plugins.setLang("flash","bg",{access:"Достъп до скрипт",accessAlways:"Винаги",accessNever:"Никога",accessSameDomain:"Същият домейн",alignAbsBottom:"Най-долу",alignAbsMiddle:"Точно по средата",alignBaseline:"Базова линия",alignTextTop:"Върху текста",bgcolor:"Цвят на фона",chkFull:"Позволи на цял екран",chkLoop:... |
/*-
* Copyright (c) 2011 The University of Melbourne
* All rights reserved.
*
* This software was developed by Julien Ridoux at the University of Melbourne
* under sponsorship from the FreeBSD Foundation.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provid... |
import React, { useLayoutEffect, useContext } from 'react'
import PropTypes from 'prop-types'
// context
import ModalContext from 'components/context/ModalContext'
// local styles
import { Check, Wrapper } from './Success.styled'
const Success = ({ setOff }) => {
const { isModal } = useContext(ModalContext)
use... |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from . import __version__ as app_version
app_name = "vet_care"
app_title = "Vet Care"
app_publisher = "9T9IT"
app_description = "ERPNext App for Vet Care"
app_icon = "octicon octicon-file-directory"
app_color = "grey"
app_email = "info@9t9it.com"
app_lice... |
from weakref import WeakValueDictionary, WeakKeyDictionary, WeakSet, ref
from collections import deque, OrderedDict
from speg.peg import ParseError
import sys, os
import time
import traceback
import copy
from contextlib import contextmanager
import json
import itertools
import functools
import asyncio
from ..get_hash ... |
# -*- coding: utf-8 -*-
#
# This file is part of PyBuilder
#
# Copyright 2011-2020 PyBuilder Team
#
# 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/l... |
from django.test import TestCase
from .setup import setup_fixtures
from apps.surveys19.models import Survey, Subsidy
class SubsidyTestCase(TestCase):
@classmethod
def setUpTestData(cls):
# load fixtures
setup_fixtures()
def test_create_subsidy(self):
survey_id = Survey.objects.get... |
#ifndef DN8_BASE_MENU_H
#define DN8_BASE_MENU_H
#include <app/basemenu.h>
#include <device/display/gui.h>
namespace libesp {
class TouchNotification;
class GUIListData;
}
class DN8BaseMenu : public libesp::BaseMenu {
public:
static const char *LOGTAG;
public:
DN8BaseMenu() : libesp::BaseMenu() {}
virtual ~DN8Base... |
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the Apache 2.0 License.
#pragma once
#include "ds/json.h"
#include <string>
namespace ccf
{
struct NodeInfoNetwork_v1
{
std::string rpchost;
std::string pubhost;
std::string nodehost;
std::string nodeport;
std::st... |
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_dupnoq.c :+: :+: :+: ... |
#!/usr/bin/env python3
FILE='test.txt' # sol: 26
FILE='input.txt' # sol: 504
def parse_input(file):
out = [];
with open(file, 'r') as f:
for line in f:
digits = line.rstrip().split(" | ")[1].split(' ')
#print(f'line digits: {digits}')
out.extend(digits)
#print(f... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# SPDX-License-Identifier: Apache-2.0
# SPDX-FileCopyrightText: © 2021 Massachusetts Institute of Technology.
# SPDX-FileCopyrightText: © 2021 Lee McCuller <mcculler@mit.edu>
# NOTICE: authors should document their contributions in concisely in NOTICE
# with details inline ... |
#-------------------------------------------------------------------------------
# Copyright 2017 Cognizant Technology Solutions
#
# 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:... |
# Standard Library
import sys
try:
import stackprinter
except ImportError:
pass
else:
if sys.stdout.isatty():
_style = "darkbg2"
else:
_style = "plaintext"
stackprinter.set_excepthook(style=_style)
|
"""
A multi-dimensional ``Vector`` class, take 2
"""
from array import array
import math
import reprlib
import numbers
class Vector:
typecode = 'd'
def __init__(self, components):
self._components = array(self.typecode, components)
def __len__(self):
return len(self._components)
de... |
# Basic wsgi middleware to display pghero statistics
class PgHeroWsgi:
def __init__(self, app, mount_path='__pghero__'):
self.app = app
self.mount_path = mount_path
def __call__(self, environ, start_response):
path = environ.get('PATH_INFO', '').lstrip('/')
if path == mou... |
import React from 'react';
import MessageCard from '../Cards/MessageCard';
import styled from 'styled-components';
const List = ({ filters, data }) => {
const categories = Object.keys(filters);
// filter only that cards that meet all the selected filters
const cards = data.filter((card, i) => {
// test each... |
// Copyright (c) 2014-2017, The Silicon Project
//
// 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, thi... |
import uuid
import pytest
import stix2
from .constants import (
FAKE_TIME, INDICATOR_KWARGS, MALWARE_KWARGS, RELATIONSHIP_KWARGS,
)
# Inspired by: http://stackoverflow.com/a/24006251
@pytest.fixture
def clock(monkeypatch):
class mydatetime(stix2.utils.STIXdatetime):
@classmethod
def now(cl... |
from taurus.test.base import insertTest
from taurus.external import unittest
from sardana.pool.poolsynchronization import PoolSynchronization
from sardana.pool.pooldefs import SynchDomain, SynchParam
from sardana.pool.test import FakePool, createPoolController, \
createPoolTriggerGate, dummyPoolTGCtrlConf01, dumm... |
(function(undefined) {
var root = this;
// Weird IE shit, objects do not have hasOwn, but the prototype does...
var hasOwnProp = Object.prototype.hasOwnProperty;
// Object cloning function, uses jQuery/Underscore/Object.create depending on what's available
var clone = function (object) {
if (typeof Obj... |
import vtk
# create a rendering window and renderer
ren = vtk.vtkRenderer()
renWin = vtk.vtkRenderWindow()
renWin.AddRenderer(ren)
# create a renderwindowinteractor
iren = vtk.vtkRenderWindowInteractor()
iren.SetRenderWindow(renWin)
# Create the points fot the lines.
points = vtk.vtkPoints()
points.InsertPoint(0, 0,... |
import React from 'react'
import TestUtils from 'react-addons-test-utils'
import expect from 'expect'
import { Label, Base } from '../src'
const renderer = TestUtils.createRenderer()
describe('Label', () => {
let tree
beforeEach(() => {
renderer.render(<Label />)
tree = renderer.getRenderOutput()
})
... |
d3.gridLayout = function() {
var gridSize = [0,10];
var gridXScale = d3.scaleLinear();
var gridYScale = d3.scaleLinear();
function processGrid(data) {
var rows = Math.ceil(Math.sqrt(data.length));
var columns = rows;
gridXScale.domain([1,columns]).range([0,gridSize[0]]);
gridY... |
// @flow
import moment from 'moment'
export default function (date: Date, format: string): string {
return moment(date).format(format)
}
|
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const React = require("react");
const wrapIcon_1 = require("../utils/wrapIcon");
const rawSvg = (iconProps) => {
const { className, primaryFill } = iconProps;
return React.createElement("svg", { width: 24, height: 24, viewBox: "0 0 24 ... |
import { GET_GAME } from './actionTypes';
const parseData = (data) => {
const newElem = {
cover: data.cover ?? undefined,
year: data.year ?? undefined,
};
return { ...data, ...newElem };
};
const getGame = (data) => ({
type: GET_GAME,
payload: parseData(data),
});
export default getGame;
|
/**
*
* @file core_stsmlq_corner.c
*
* PLASMA core_blas kernel
* PLASMA is a software package provided by Univ. of Tennessee,
* Univ. of California Berkeley and Univ. of Colorado Denver
*
* @version 2.6.0
* @author Hatem Ltaief
* @author Mathieu Faverge
* @author Azzam Haidar
* @date 2010-11-15
* @gener... |
var mongoose = require('mongoose');
var Schema = mongoose.Schema;
var GenreSchema = Schema({
name: {type: String, required: true, min: 3, max: 100}
});
// Virtual for this genre instance URL
GenreSchema
.virtual('url')
.get(function () {
return '/catalog/genre/'+this._id;
});
//Export model
module.exports = m... |
/*
* Copyright 1999-2018 Alibaba Group Holding 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 applica... |
"""
The test launcher of the Ultimate-Hosts-Blacklist project.
This is the module that will provides the manage and provides the authorizations
needed for a launch.
Author:
Nissar Chababy, @funilrys, contactTATAfunilrysTODTODcom
License:
::
MIT License
Copyright (c) 2019, 2020, 2021 Ultimate-Hosts-Bla... |
var R = require('..');
var eq = require('./shared/eq');
describe('mapAccum', function() {
var add = function(a, b) {return [a + b, a + b];};
var mult = function(a, b) {return [a * b, a * b];};
var concat = function(a, b) {return [a.concat(b), a.concat(b)];};
it('map and accumulate simple functions over array... |
"""setuptools based setup script for Biopython.
This uses setuptools which is now the standard python mechanism for
installing packages. If you have downloaded and uncompressed the
Biopython source code, or fetched it from git, for the simplest
installation just type the command::
python setup.py install
However... |