text stringlengths 3 1.05M |
|---|
var chai = require('chai'),
path = require('path'),
chaiAsPromised = require("chai-as-promised"),
AngularModule = require('../lib/angularModule');
require("mocha-as-promised")();
chai.use(chaiAsPromised);
chai.should();
describe('AngularModule', function() {
describe('load', function() {
it('... |
#!/usr/bin/env python
import sys
import bed
import argparse
from operator import add
parser = argparse.ArgumentParser(description='converts binned bed file into total count per window')
parser.add_argument('-i', nargs='?', type=argparse.FileType('r'), default=sys.stdin, help='input')
parser.add_argument('-o', nargs='?... |
# Python modules
import xml.etree.cElementTree as ElementTree
import zlib
import base64
import datetime
import sys
import io
# 3rd party modules
import numpy as np
# Our modules
import vespa.common.constants as constants
import vespa.common.util.fileio as util_fileio
from functools import reduce
# ENCODING_ATTR is... |
CKEDITOR.plugins.setLang("preview", "gu", {preview: "પૂર્વદર્શન"}); |
import falcon
import simplejson as json
import mysql.connector
import config
from datetime import datetime, timedelta, timezone
from core import utilities
from decimal import Decimal
import excelexporters.offlinemetercost
class Reporting:
@staticmethod
def __init__():
""""Initializes Reporting"""
... |
from .helpers import *
from .preinstanced import *
from .utils import *
__all__ = (
*helpers.__all__,
*preinstanced.__all__,
*utils.__all__,
)
|
"""
Django settings for django_project project.
Generated by 'django-admin startproject' using Django 1.11.1.
For more information on this file, see
https://docs.djangoproject.com/en/1.11/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.11/ref/settings/
"""
im... |
import datetime
import time
from django.core.urlresolvers import reverse
from django.conf import settings
from django.db import models
from django.db.models import Avg, Sum
from django.template.defaultfilters import slugify
from manual.utils import moon_position
import fitbit
BUMPER_STATUS_GOOD = "green"
BUMPER_STATU... |
//
// VoiceAnnouncementViewController.h
// Demo
//
// Created by apple on 2019/4/17.
// Copyright © 2019 SRT. All rights reserved.
//
#import "BaseViewController.h"
NS_ASSUME_NONNULL_BEGIN
@interface VoiceAnnouncementViewController : BaseViewController
@end
NS_ASSUME_NONNULL_END
|
import { html, css, LitElement } from 'lit';
export class KemetCarousel extends LitElement {
static get styles() {
return css`
:host,
*,
*::before,
*::after {
box-sizing: border-box;
}
:host {
position: relative;
display: block;
width: var(--ke... |
import React from 'react'
import PropTypes from 'prop-types'<% if (!includeRedux) { %>
import { SuspenseWithPerf } from 'reactfire'
import NavbarWithoutAuth from 'containers/Navbar/NavbarWithoutAuth'<% } %>
import Navbar from 'containers/Navbar'<% if (includeRedux) { %>
import { Notifications } from 'modules/notificati... |
#ifndef _PARAMETERGROUPLABEL_H_
#define _PARAMETERGROUPLABEL_H_
#include <QWidget>
#include <QString>
namespace Ui
{
class ParameterGroupLabel;
}
namespace MainWidget
{
class ParameterGroupLabel : public QWidget
{
public:
ParameterGroupLabel();
~ParameterGroupLabel();
void setIcon(QString icon);
void s... |
import reportWebVitals from './reportWebVitals';
import './index.css';
import * as theme from './theme/theme.json';
import { setToLS } from './theme/storage.js';
import '../node_modules/bootstrap/dist/css/bootstrap.min.css';
import { BrowserRouter, Routes, Route } from "react-router-dom";
import React fro... |
import React, { Component } from 'react'
import { Link } from 'react-router'
import { PageHeader } from '../components'
import Page from './Page'
import styles from '../styles'
const containerStyle = {
display: 'flex',
flexDirection: 'row',
}
const contentStyle = {
paddingRight: '30px',
marginTop: '-15px',
}... |
# Airy function Ai(x), Ai'(x) and int_0^x Ai(t) dt on the real line
f = airyai
f_diff = lambda z: airyai(z, derivative=1)
f_int = lambda z: airyai(z, derivative=-1)
plot([f, f_diff, f_int], [-10,5]) |
# -*- coding: utf-8 -*-
# Filter parser
# See the accompanying LICENSE Apache V2.0 file.
# (C) 2021 Engie Digital
#
# vim: set ts=4 sts=4 et tw=78 sw=4 si:
"""
Parse the filter syntax to produce a FilterAST.
See https://www.project-haystack.org/doc/Filters
"""
from datetime import datetime, time
from functools import ... |
/*!
=========================================================
* Argon Dashboard React - v1.1.0
=========================================================
* Product Page: https://www.creative-tim.com/product/argon-dashboard-react
* Copyright 2019 Creative Tim (https://www.creative-tim.com)
* Licensed under MIT ... |
# -*- coding: utf-8 -*-
# -----------------------------------------------------------------------------
# (C) British Crown Copyright 2017-2021 Met Office.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions a... |
const mongoose = require('mongoose');
const env = require('../config/environment');
const Place = require('../models/place');
const User = require('../models/user');
mongoose.connect(env.dbURI);
const userData = [{
username: 'Dave',
email: 'dave@dave.com',
password: 'pass'
// passwordConfirmation: 'pass'
}];
... |
const uuidv4 = require('uuid/v4');
module.exports = (sequelize, DataTypes) => {
const network_replies = sequelize.define('network_replies', {
id: {
type: DataTypes.UUID,
defaultValue: () => uuidv4(),
primaryKey: true,
},
data: DataTypes.JSON,
rece... |
# Copyright 2017 The TensorFlow 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 applica... |
/* What output do the following calls of printf produce? */
#include <stdio.h>
int main() {
printf("|%6.4d|%-5d|\n", 86, 1040);
// | 0086|1040 |
printf("|%15.5e|\n", 30.253);
// | 3.02530e+001|
printf("|%.4f|\n", 83.162);
// |83.1620|
printf("|%-8.2g|\n", .0000009979);
// |1e-006 |... |
# -*- coding: utf-8 -*-
from flask import Flask
from flask_restful import Api
config = None
web_app = None
api = None
def get_web_app() -> Flask:
global web_app
if not web_app:
web_app = Flask(__name__)
web_app.config.from_object(config)
return web_app
def get_api() -> Api:
glob... |
from .gen_toeplitz_Rmat import MatrixGenerator
__all__ = ['MatrixGenerator']
|
#suma params: sumando1->num sumando2->num
def Suma(sumando1:int,sumando2:int):
resultado=sumando1+sumando2
return resultado
#resta params: minuendo->num sustraendo->num
def Resta(minuendo:int,sustraendo:int):
resultado=minuendo-sustraendo
return resultado
#multiplicacion params: factor1->num fa... |
"use strict";
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
Object.defineProperty(exports, "__esModule", {
value: true
});
exports["default"] = void 0;
var _Alert = _interopRequireDefault(require("./Alert"));
var _default = _Alert["default"];
exports["default"] = _default; |
import React from 'react';
import { graphql } from 'gatsby';
import PropTypes from 'prop-types';
import Layout from '../components/layout';
import SEO from '../components/seo';
import Project from '../components/Project';
const About = ({ data, location }) => {
const HeaderData = data.allDataJson.edges[0].node.heade... |
"""
To understand why this file is here, please read:
http://cookiecutter-django.readthedocs.io/en/latest/faq.html#why-is-there-a-django-contrib-sites-directory-in-cookiecutter-django
"""
from django.conf import settings
from django.db import migrations
def update_site_forward(apps, schema_editor):
"""Set site d... |
/*
* SPDX-License-Identifier: Apache-2.0
*/
'use strict';
const { FileSystemWallet, Gateway } = require('fabric-network');
const path = require('path');
const ccpPath = path.resolve(__dirname, '..', '..', 'evidentia-network', 'connection-mc.json');
const services = ["cbmc"]
async function main() {
var args =... |
"""
Core File of Maze Env
"""
import os
import numpy
import pygame
import random
from collections import namedtuple
from numpy import random as npyrnd
from numpy.linalg import norm
# Configurations that decides a specific task
TaskConfig = namedtuple("TaskConfig", ["start", "goal", "cell_walls", "cell_texts", "cell_si... |
# -*- encoding:utf-8 -*-
from mako import runtime, filters, cache
UNDEFINED = runtime.UNDEFINED
__M_dict_builtin = dict
__M_locals_builtin = locals
_magic_number = 5
_modified_time = 1320650871.534734
_template_filename='/home/tonycai/workspace/ops_repos/dev/pyfisheyes/pyfisheyes/templates/derived/homepage/home.html'
_... |
from __init__ import db
from helper import helper
import time
class ColorData:
def __init__(self, userid):
self.__userid = userid
exist = db.Exist("colors", "id", self.__userid)
if not exist:
self.add_color("default")
def get_id(self):
return self.... |
__author__ = 'Arseniy'
from model.contact import Contact
from random import randrange
import re
def test_phones_on_home_page(app, db):
if len(db.get_contact_list()) == 0:
app.contact.create(Contact(firstname="John", lastname="Snow", address="Hollywood, 11", email2="john@ya.ru",
... |
/**
* Given a string, return its encoding version.
*
* @param {String} str
* @return {String}
*
* @example
* For aabbbc should return 2a3bc
*
*/
function encodeLine(str) {
const d = str.split('');
let prefiks = 2;
d.forEach((bukva, indeks) => {
prefiks = 2;
while (d.indexOf(bukva, indeks + 1) ===... |
// 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... |
# Copyright 2013-2022 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 PyTypingExtensions(PythonPackage):
"""The typing_extensions module contains both backports... |
import os
from conans.util.log import logger
def is_multi_configuration(generator):
if not generator:
return False
return "Visual" in generator or "Xcode" in generator
def architecture_flag(settings):
"""
returns flags specific to the target architecture and compiler
"""
compiler = ... |
/**
* @file: k_msg.c
* @brief: kernel message passing routines
* @author: Yiqing Huang
* @date: 2020/10/09
*/
#include "k_msg.h"
#include "printf.h"
#ifdef DEBUG_0
#endif /* ! DEBUG_0 */
extern TCB *gp_current_task;
extern TCB g_tcbs[MAX_TASKS];
//extern TMB t_mailbox[MAX_TASKS];
int k_mbx_create(size_t s... |
"""General-purpose training script for image-to-image translation.
This script works for various models (with option '--model': e.g., pix2pix, cyclegan, colorization) and
different datasets (with option '--dataset_mode': e.g., aligned, unaligned, single, colorization).
You need to specify the dataset ('--dataroot'), e... |
# This file is part of Indico.
# Copyright (C) 2002 - 2020 CERN
#
# Indico is free software; you can redistribute it and/or
# modify it under the terms of the MIT License; see the
# LICENSE file for more details.
from uuid import UUID
from babel.numbers import format_currency
from flask import session
from sqlalchemy... |
#!/usr/bin/env python3
import argparse
import logging
import sys
import json
from collections import Counter, defaultdict
parser = argparse.ArgumentParser()
parser.add_argument('--wasm', '-w', metavar='<file>', required=True)
parser.add_argument('--types', '-t', metavar='<file>', required=True)
parser.add_argument('... |
import setuptools
with open("README.md", "r") as fh:
long_description = fh.read()
setuptools.setup(
name="btc_cj",
version="1.0.2",
author="Wen",
author_email="wenqinchao@gmail.com",
description="A package interact with bitcoin node",
long_description=long_description,
long... |
# flake8: noqa: F401
from pathlib import Path
# Project root
BASE_DIR = Path(__file__).resolve().parent.parent.parent
# Django project directory
PROJECT_PATH = BASE_DIR / "backend"
# SECURITY WARNING: keep the secret key used in production secret!
SECRET_KEY = "x4z1p1_e=vm^swmnt6m83-m@1bi=3j9jx0_@zzkm7mj-msj%rq"
# ... |
/*
* Initialization script for Animated sparkles
*/
jQuery(function($){
"use strict";
/*--------------------------------------------------------------------------------------------------
Sparkles
--------------------------------------------------------------------------------------------------*/
var Spark = fun... |
const mongoose = require('mongoose')
const schema = new mongoose.Schema({
title: {
type: String
},
cardImg: {
type: String
},
icon: {
type: String
},
categories: {
// 根据id 关联Category
type: mongoose.SchemaTypes.ObjectId,
ref: 'Category'
},... |
/**
* Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH
* under one or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information regarding copyright
* ownership.
*
* Camunda licenses this file to you under the MIT; you may not use this ... |
var $ = require('../../core/renderer'),
noop = require('../../core/utils/common').noop,
Class = require('../../core/class'),
Callbacks = require('../../core/utils/callbacks'),
extend = require('../../core/utils/extend').extend,
eventUtils = require('../utils');
var Emitter = Class.inherit({
ct... |
# Copyright 2021 The Kubeflow 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 or agreed to in... |
/*----------------------------------------------------------------------------*/
/* Big Brother webpage generator tool. */
/* */
/* This is a replacement for the "mkbb.sh" and "mkbb2.sh" scripts from the ... |
/**
@license
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions.
"License" shall mean the terms and conditions for use, reproductio... |
'''
O(nlogn) time / worst case, O(n) space (result is stable)
'''
def mergesort(arr):
if len(arr) <= 1:
return arr
# divide
mid = len(arr) // 2
left = mergesort(arr[:mid])
right = mergesort(arr[mid:])
# conquer
return merge(left, right)
def merge(left, right):
merged = []
... |
#!/usr/bin/env python
import os
from setuptools import setup, find_packages
import django_uuid_pk as app
NAME = app.NAME
RELEASE = app.get_version()
def fread(fname):
return open(os.path.join(os.path.dirname(__file__), fname)).read()
setup(
name=NAME,
version=RELEASE,
url='https://github.com/saxix/d... |
import { mat4 } from 'gl-matrix';
import * as macro from 'vtk.js/Sources/macros';
import vtkViewNode from 'vtk.js/Sources/Rendering/SceneGraph/ViewNode';
import { registerOverride } from 'vtk.js/Sources/Rendering/OpenGL/ViewNodeFactory';
// ----------------------------------------------------------------------------... |
#!/usr/bin/env python3
# Copyright (c) 2014-2018 The TheBurningSavage Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
"""Test the -alertnotify, -blocknotify and -walletnotify options."""
import os
from test_framewo... |
import torch
import torch.nn as nn
import torch.nn.functional as F
from typing import Tuple
class RgbToYuv(nn.Module):
r"""Convert image from RGB to YUV
The image data is assumed to be in the range of (0, 1).
args:
image (torch.Tensor): RGB image to be converted to YUV.
returns:
torc... |
var test = require('tape');
var strcmp = require('../');
var opts = {
algorithm: 'jaro',
precision: 3
};
test('compare strings that are EXACTLY equal', function(t) {
t.plan(4);
t.equal(strcmp('abc', 'abc', opts), 1);
t.equal(strcmp('abba', 'abba', opts), 1);
t.equal(strcmp('a b c', 'a b c', opts), 1);
... |
var express = require('express');
var router = express.Router();
/* GET home page. */
router.get('/', function(req, res, next) {
res.render('index', { title: 'Oyun' });
});
module.exports = router;
|
# base_source.py
# description: class used in PriceApi.py
from .source_config import urls
class BaseSource:
def __init__(self):
self.urls = urls
def _bundle_ouput(self, source:str, price:str) -> dict:
return {
"source": source,
"price": float(price),
}
... |
# -*- coding: utf-8 -*-
"""
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 t... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# @Date : Feb-03-20 23:44
# @Update : Nov-24-20 20:52
# @Author : Kelly Hwong (you@example.org)
# @Link : http://example.org
from tensorflow.keras.callbacks import EarlyStopping, LearningRateScheduler, ModelCheckpoint, ReduceLROnPlateau, CSVLogger
def ... |
import siliconcompiler
############################################################################
# DOCS
############################################################################
def make_docs():
'''
Demonstration target for compiling ASICs with FreePDK45 and the open-source
asicflow.
'''
ch... |
const plugin = require("tailwindcss/plugin");
// const defaultTheme = require('tailwindcss/defaultTheme')
function withOpacityValue(variable) {
return ({ opacityValue }) => {
console.log("opacityValue", opacityValue);
if (opacityValue === undefined) {
return `rgb(var(${variable}))`;
}
return `r... |
# coding: utf-8
import re
import six
from huaweicloudsdkcore.sdk_response import SdkResponse
from huaweicloudsdkcore.utils.http_utils import sanitize_for_serialization
class UpdateFirewallResponse(SdkResponse):
"""
Attributes:
openapi_types (dict): The key is attribute name
... |
/** @flow */
import type { CellMeasurerCache, Positioner } from "./Masonry";
type createCellPositionerParams = {
cellMeasurerCache: CellMeasurerCache,
columnCount: number,
columnWidth: number,
spacer?: number
};
type resetParams = {
columnCount: number,
columnWidth: number,
spacer?: number
};
export de... |
"""
Tests of condos
"""
import pytest
from graphene.test import Client
from django.test import TestCase, Client
from django.contrib.auth import get_user_model
from condos.models import Apartment, Block
from alohomora.schema import schema
from graphql_jwt.testcases import JSONWebTokenTestCase
class GraphQLTestCase(JSON... |
#!/usr/bin/env python
# encoding: utf-8
"""
@module : LocationContext
@author : Rinkako
@time : 2018/6/1
"""
URL_Domain_GetAll = "http://127.0.0.1:10234/auth/domain/getall"
URL_Domain_Get = "http://127.0.0.1:10234/auth/domain/get"
URL_Domain_Add = "http://127.0.0.1:10234/auth/domain/add"
URL_Domain_Contain = "http://... |
import json
import logging
import re
from django.conf import settings
from django.contrib.auth.mixins import UserPassesTestMixin
from django.core.exceptions import PermissionDenied
from django.db import transaction
from django.http import JsonResponse
from django.shortcuts import redirect
from django.urls import (
... |
# USAGE
# python detect_drowsiness.py --shape-predictor shape_predictor_68_face_landmarks.dat
# python detect_drowsiness.py --shape-predictor shape_predictor_68_face_landmarks.dat --alarm alarm.wav
# import the necessary packages
from scipy.spatial import distance as dist
from imutils.video import VideoStream
f... |
// Copyright (C) 2017 André Bargull. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
description: >
Including isConstructor.js will expose one function:
isConstructor
includes: [isConstructor.js]
features: [Reflect.construct]
---*/
assert.sameValue(typeof ... |
var manager = require('thoughtpad-plugin-manager');
var initModules = function (config, mode) {
var i = 0,
len = config.modules[mode].length,
modules = [];
for (i; i < len; i++) {
modules.push(require('thoughtpad-plugin-' + config.modules[mode][i]));
}
return manager.registerPlugins(modules, config);
};
m... |
module.exports = {
devServer: {
proxy: process.env.VUE_APP_LEDGER_URL
},
publicPath: process.env.NODE_ENV === 'production'
? '/o_beer_dist/'
: '/',
configureWebpack: {
module: {
rules: [
{
enforce: 'pre',
test: /\.js$/,
exclude: /node_modules/,
loader: 'eslint-loader... |
/*
* Copyright (c) 2018, ARM Limited and Contributors. All rights reserved.
*
* SPDX-License-Identifier: BSD-3-Clause
*/
#ifndef __MMC_H__
#define __MMC_H__
#include <stdint.h>
#include <utils_def.h>
#define MMC_BLOCK_SIZE U(512)
#define MMC_BLOCK_MASK (MMC_BLOCK_SIZE - U(1))
#define MMC_BOOT_CLK_RATE (400 ... |
import unittest
from shexer.shaper import Shaper
from test.const import BASE_FILES, default_namespaces
from test.t_utils import file_vs_str_tunned_comparison
import os.path as pth
from shexer.consts import TURTLE
_BASE_DIR = BASE_FILES + "keep_less_specific" + pth.sep
_G1_SEV_NAMES = _BASE_DIR + "g1_several_na... |
import time
from multiprocessing import Pool
import numpy
import numpy as np
import torch
from torch import nn as nn
import torch.nn.functional as F
import math
import matplotlib.pyplot as plt
from scipy.stats import wasserstein_distance
def a_norm(Q, K):
m = torch.matmul(Q, K.transpose(2, 1))
m /= torch.sqr... |
'use strict';
const sendRequest = require('../../lib/requestwrapper').sendRequest;
const formatError = require('../../lib/requestwrapper').formatErrorIfExists;
const isStream = require('isstream');
const watson = require('../../index');
const pjson = require('../../package.json');
describe('requestwrapper', () => {
... |
import * as tslib_1 from "tslib";
import * as React from 'react';
import { StyledIconBase } from '../../StyledIconBase';
export var DotCircle = React.forwardRef(function (props, ref) {
var attrs = {
"fill": "currentColor",
};
return (React.createElement(StyledIconBase, tslib_1.__assign({ iconAttrs: ... |
/* $NetBSD$ */
/*-
* Copyright (c) 2019 The NetBSD Foundation, Inc.
* All rights reserved.
*
* This code is derived from software contributed to The NetBSD Foundation
* by Kamil Rytarowski.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the fo... |
import click
from .. import shared
@shared.cli.command()
@click.pass_context
def status(ctx):
"""Print info about current setup."""
yew = ctx.obj["YEW"]
click.echo("Version : %s" % shared.__version__)
click.echo("User : %s" % yew.store.username)
click.echo("Storage : %s" % yew.store.yew_dir... |
#!/usr/bin/env python
import gi
gi.require_version('Geoclue', '2.0')
from gi.repository import Geoclue
clue = Geoclue.Simple.new_sync('something',Geoclue.AccuracyLevel.EXACT,None)
location = clue.get_location()
lat=location.get_property('latitude')
lon=location.get_property('longitude')
print(lat,lon)
|
const prompt = [
{
name: "main",
type: "list",
message: "What would you like to do?",
choices: [
"View All Employees",
"View Employees by Department",
"View Employees by Role",
"View Employees by Manager",
"View Utilized Budget Per Dep... |
# -*- coding: utf-8 -*-
# Generated by Django 1.10.5 on 2017-03-14 11:20
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('UserManagement', '0023_auto_20170314_1139'),
('SessionManagement', '0003_auto_201703... |
/*
ESP8266WiFiGeneric.h - esp8266 Wifi support.
Based on WiFi.h from Ardiono WiFi shield library.
Copyright (c) 2011-2014 Arduino. All right reserved.
Modified by Ivan Grokhotkov, December 2014
Reworked by Markus Sattler, December 2015
This library is free software; you can redistribute it and/or
modify it und... |
import { fromJS } from 'immutable'
import configReducer from './configReducer'
// 将多个reducer合并成一个,并将state合并
import reduceReducers from 'reduce-reducers'
const initialState = fromJS({
error: null,
dataLoading: true,
data: null
})
const reducer = reduceReducers(
(state = initialState, action) => configReducer(st... |
import numpy as np
def floodfill_cluster(points, compare, min_size=1):
raise NotImplementedError("TODO: test this function")
N = len(points)
visited = [False] * N
clusters = []
for seed_idx in xrange(N):
if visited[seed_idx]:
continue
visited[seed_idx] = True
... |
// File: prPlane.h
/**
* Copyright 2014 Paul Michael McNab
*
* 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 b... |
################################################################
# Load and unpack CIFAR-10 python version #
# from https://www.cs.toronto.edu/~kriz/cifar-10-python.tar.gz #
# #
# !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!... |
"use strict";
function _instanceof(left, right) { if (right != null && typeof Symbol !== "undefined" && right[Symbol.hasInstance]) { return !!right[Symbol.hasInstance](left); } else { return left instanceof right; } }
function _classCallCheck(instance, Constructor) { if (!_instanceof(instance, Constructor)) { throw n... |
"""inst URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/2.0/topics/http/urls/
Examples:
Function views
1. Add an import: from my_app import views
2. Add a URL to urlpatterns: path('', views.home, name='home')
Class-based vi... |
import React from "react";
import CodeSlide from "../../spectacle-code-slide";
import code from "./code.example";
export default (
<CodeSlide
transition={[]}
lang="js"
code={code}
ranges={[
{ loc: [0, 20], title: "Polymer 2", subtitle: "hello-world.html" },
{ loc: [0, 1] },
{ loc: [... |
# Copyright 2018 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 in writing, ... |
from libqtile.manager import Key, Click, Drag, Screen, Group
from libqtile.command import lazy
from libqtile import layout, bar, widget
mod = 'mod4'
keys = [
Key(
[mod], "h", lazy.group.prevgroup(),
),
Key(
[mod], "l", lazy.group.nextgroup(),
),
Key(
[mod], "k",
lazy... |
import React, { Component } from 'react';
import 'whatwg-fetch';
import { Link } from 'react-router-dom';
class EditorHome extends Component {
constructor(props) {
super(props);
this.state = {
};
}
render() {
return (
<div>
<h2>Home</h2>
<Link className="btn btn-dan... |
#!/usr/bin/env python
# coding=utf-8
'''
..author:: coffeemakr
'''
from __future__ import print_function
import sys
from scapy.all import *
def send_dhcp_request(hostname):
'''
Send one dhcp request and wait for an answer.
:param hostname: The hostname to send
'''
conf.checkIPaddr = False
fam... |
from pandas import Timestamp, DatetimeIndex
from typing import Dict, List, Tuple, Optional, Union
__all__ = [
"timestamp_tzaware",
"timestamp_now",
"timestamp_epoch",
"daterange_from_str",
"daterange_to_str",
"create_daterange_str",
"create_daterange",
"daterange_overlap",
"combine_... |
#!/usr/bin/env python
"""Django's command-line utility for administrative tasks."""
import os
import sys
def main():
"""Run administrative tasks."""
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'ecommerce_website.settings')
try:
from django.core.management import execute_from_command_line
e... |
"""
Module plot provides useful functions for plots.
"""
from collections import OrderedDict
import matplotlib as mpl
import matplotlib.pyplot as plt
import matplotlib.cm as cmx
import matplotlib.colors as colors
# DEFAULT VARIABLES
_markers = mpl.markers.MarkerStyle.filled_markers # default markers list
_linesty... |
/*
* Copyright (c) AXA Group Operations Spain S.A.
*
* 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,... |
import datetime
import math
tday = datetime.datetime.now()
def get_julian_datetime(date):
"""
Convert a datetime object into julian float.
Args:
date: datetime-object of date in question
Returns: float - Julian calculated datetime.
Raises:
TypeError : Incorrect parameter type
... |
# pylint: disable=g-bad-file-header
# Copyright 2021 DeepMind Technologies Limited. 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/... |
import React from 'react'
import { RichText } from 'prismic-reactjs'
import { linkResolver } from '../../utils/linkResolver'
import SyntaxHighlighter from 'react-syntax-highlighter'
import { monokaiSublime } from 'react-syntax-highlighter/dist/esm/styles/hljs'
//import htmlSerializer from '../../utils/htmlSerializer'
... |