text stringlengths 3 1.05M |
|---|
const express = require('express');
const router = express.Router();
const validUrl = require('valid-url');
const shortid = require('shortid');
const Url = require('../models/urlModel');
// @route POST /api/shorten
// @desc Create short URL
router.post('/shorten', async (req, res) => {
const { longUr... |
import Ember from 'ember';
import ENV from '../config/environment';
export default Ember.Service.extend({
hasLiquidFire: Ember.computed('', function() {
return ENV['ember-collapsible-panel'].hasLiquidFire;
})
});
|
//////////////////////////////////////////////////////////////////////////////////////
// This file is distributed under the University of Illinois/NCSA Open Source License.
// See LICENSE file in top directory for details.
//
// Copyright (c) 2020 QMCPACK developers.
//
// File developed by: Cody A. Melton, cmelton@sa... |
#pragma once
#include <string>
#include <tdme/gui/nodes/fwd-tdme.h>
#include <tdme/utils/Enum.h>
using std::string;
using tdme::utils::Enum;
using tdme::gui::nodes::GUINode_AlignmentHorizontal;
using tdme::gui::nodes::GUINode_Alignments;
using tdme::gui::nodes::GUINode_Border;
using tdme::gui::nodes::GUINode_Comput... |
/* -*- mode: c; c-file-style:"stroustrup"; -*- */
/*
* Copyright (c) 2018 Mastercard
*
* 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
... |
#!/usr/bin/env python
#
# (c) Copyright 2019-2020 Hewlett Packard Enterprise Development LP
#
# 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
... |
/*
* Copyright (c) 2005 Apple Computer, Inc. All rights reserved.
*
* @APPLE_LICENSE_HEADER_START@
*
* This file contains Original Code and/or Modifications of Original Code
* as defined in and that are subject to the Apple Public Source License
* Version 2.0 (the 'License'). You may not use this file except in... |
/* -*- 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... |
/*
* This combined file was created by the DataTables downloader builder:
* https://datatables.net/download
*
* To rebuild or modify this file with the latest versions of the included
* software please visit:
* https://datatables.net/download/#bs4/dt-1.10.23/af-2.3.5/cr-1.5.3/r-2.2.7
*
* Included libraries:... |
const DataBase_Connection = require('./DataBase_Connection');
ObjectID = require('mongodb').ObjectID,
module.exports = (req , res)=>{
db = DataBase_Connection.db;
req.on('data', function (data) {
var body = JSON.parse(data);
var profileImage = {"profileImage" : body.profileImage}
... |
var objTab = null;
addEvent(window, "load", load, false);
function load() {
document.form.afterRestore = function() {
$('.tabs').tabs('select', 0);
};
}
function LOOKUP_LIMITEAPROVACAO_select(id, desc) {
document.form.restore({
idLimiteAprovacao: id
});
}
var seqValor = '';
incluirValor = function() {
G... |
module( "Incoming Call", {
setup: function() {
TestWebrtc.Helpers.mockWebRTC();
TestWebrtc.Helpers.mockSound();
WebRTC.Sound.prototype.enableLocalAudio = function(enable) {console.log("enableLocalAudio : "+enable);}
}, teardown: function() {
}
});
test('window.onbeforeunload', function() {
client =... |
const { createProxyMiddleware } = require("http-proxy-middleware");
module.exports = function(app) {
app.use(
"/api",
createProxyMiddleware({
target: "http://backend:8080",
pathRewrite: { "^/api": "" }
})
);
};
|
/*============================================================================
This C source file is part of the SoftFloat IEEE Floating-Point Arithmetic
Package, Release 3e, by John R. Hauser.
Copyright 2011, 2012, 2013, 2014, 2015, 2017 The Regents of the University of
California. All rights reserved.
Redistribu... |
import numpy as np
import matplotlib.pyplot as plt
from sklearn import svm, grid_search, cross_validation
from sklearn.metrics import classification_report
import utilities
# Load input data
input_file = 'data_multivar.txt'
X, y = utilities.load_data(input_file)
###############################################
# Trai... |
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports["default"] = void 0;
var _default = {
key: 'F',
suffix: 'm7',
positions: [{
frets: '1x111x',
fingers: '203330'
}, {
frets: 'dxdddx',
fingers: '203330'
}, {
frets: '131111',
fingers: '131111',
ba... |
/**
* Created by kiettv on 01/12/2015.
*/
'use strict';
const gulp = require('gulp');
const sourcemaps = require('gulp-sourcemaps');
const babel = require('gulp-babel');
const del = require('del');
const zip = require('gulp-zip');
const jEditor = require('gulp-json-editor');
const bump = require('gulp-bump');
// Rem... |
import React, { Component } from 'react'
import {
View,
StyleSheet,
Platform,
Image,
TouchableHighlight,
Text,
TextInput,
} from 'react-native'
import {
Card,
Avatar,
Icon,
Badge
} from 'react-native-elements'
import HeartButton from './HeartButton'
import HeartButtonVertical from './HeartButtonVe... |
import { h } from 'vue'
export default {
name: "FoodHalal",
vendor: "Mdi",
type: "",
tags: ["food","halal"],
render() {
return h(
"svg",
{"xmlns":"http://www.w3.org/2000/svg","width":"24","height":"24","viewBox":"0 0 24 24","class":"v-icon","fill":"currentColor","data-name":"mdi-food-halal","i... |
"""
Base class for generic `p`-adic polynomials
This provides common functionality for all `p`-adic polynomials, such
as printing and factoring.
AUTHORS:
- Jeroen Demeyer (2013-11-22): initial version, split off from other
files, made Polynomial_padic the common base class for all p-adic
polynomials.
"""
#****... |
/*
* Copyright (c) 2015-2018 Nicholas Fraser
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of
* this software and associated documentation files (the "Software"), to deal in
* the Software without restriction, including without limitation the rights to
* use, copy, modify, merg... |
import unittest
from data import runner_util
from data import test_util
from router import runner as router_runner
class CityVisitRouterRunnerTest(unittest.TestCase):
def testGeneral(self):
points_dict = test_util.GetPointsInput('data', 'test_sf_1.csv')
points_keys = test_util.GetPointsKeys('router', 't... |
import React from 'react'
import { useStaticQuery, graphql, Link } from 'gatsby'
import _ from 'lodash'
const Categories = props => {
const data = useStaticQuery(graphql`
query {
allMarkdownRemark(limit: 2000) {
group(field: frontmatter___categories) {
fieldValue
totalCount
... |
import bpy
from bpy.props import PointerProperty, BoolProperty, \
EnumProperty, FloatProperty, StringProperty
from ... import rman_bl_nodes
from ... import rman_config
from ...rman_config import RmanBasePropertyGroup
class RendermanCameraSettings(RmanBasePropertyGroup, bpy.types.PropertyGroup):
bl_label = "Ren... |
// All material copyright ESRI, All Rights Reserved, unless otherwise specified.
// See https://js.arcgis.com/4.10/esri/copyright.txt for details.
//>>built
define("require exports @dojo/framework/shim/Set ../../../core/Error ../../../core/ItemCache ../../../core/sql/WhereClause".split(" "),function(w,c,u,f,r,n){functi... |
import { useLayoutEffect } from 'react';
export default () => {
useLayoutEffect(() => {
window.scrollTo(0, 0);
}, []);
};
|
//-----------------------------------------------------------------------------
//
// main.c
//
// Swallowtail LACK Enclosure Temperature Sensor Firmware
// AVR (ATmega328P) LACK Enclosure Temperature Sensor Firmware
//
// Copyright (c) 2021 Swallowtail Electronics
//
// Permission is hereby granted, free of charg... |
'use strict';
// Namespace a4p
var a4p;
if (!a4p) a4p = {};
a4p.TaskReceiver = (function()
{
// Constructor
function TaskReceiver(receiverName, http, localStorage)
{
this.version = "0.1";
// Unique name of this instance == key to find all its data in Local and File storages
this.re... |
from .queue import Queue
class Node:
"""create a Node"""
def __init__(self, val):
self.val = val
self.left = None
self.right = None
def __repr__(self):
return 'Node Val: {}'.format(self.val)
def __str__(self):
return str(self.val)
class BST:
"""create a ... |
#!/usr/bin/env python
# Copyright 2016 gRPC 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 ... |
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.RiotRateLimiter = exports.PlatformId = exports.HOST = exports.METHODS = exports.extractRegion = exports.extractMethod = void 0;
const _types_1 = require("./@types");
Object.defineProperty(exports, "PlatformId", { enumerable: true, get:... |
import React, { Component } from 'react';
import Blocks from './Blocks';
import logo from './logo.svg';
import './App.css';
class App extends Component {
render() {
return (
<div className="App">
<div className="App-header">
<img src={logo} className="App-logo" alt="logo" />
<h2... |
import pickle
import scanpy as sc
import pandas as pd
# with open('BICCN2_rna_gene_id_order_gene__all_scanpy_obj.pyn', 'rb') as f:
# a = pickle.load(f)
# dict = []
# for c in a.obs.cluster.unique():
# celltype = a.obs.loc[a.obs.cluster == c,'celltype'].astype(str)
# u_cell = celltype.unique()
# assert... |
from daops import utils
from ._common import CMIP5_ARCHIVE_BASE
import xarray as xr
CMIP5_IDS = [
'cmip5.output1.INM.inmcm4.rcp45.mon.ocean.Omon.r1i1p1.latest.zostoga',
'cmip5.output1.MOHC.HadGEM2-ES.rcp85.mon.atmos.Amon.r1i1p1.latest.tas',
'cmip5.output1.MOHC.HadGEM2-ES.historical.mon.land.Lmon.r1i1p1.la... |
import FWCore.ParameterSet.Config as cms
from DQM.BeamMonitor.AlcaBeamMonitor_cfi import *
AlcaBeamMonitor.PrimaryVertexLabel = 'hiSelectedVertex'
AlcaBeamMonitor.TrackLabel = 'hiGeneralTracks'
AlcaBeamMonitor.BeamFitter.TrackCollection = 'hiGeneralTracks'
AlcaBeamMonitor.BeamFitter.TrackQuality = ['highPu... |
define([
'jquery',
'./base',
'../utils',
'../keys'
], function ($, BaseSelection, Utils, KEYS) {
function SingleSelection () {
SingleSelection.__super__.constructor.apply(this, arguments);
}
Utils.Extend(SingleSelection, BaseSelection);
SingleSelection.prototype.render = function () {
var $sel... |
from rest_framework import status
from rest_framework.decorators import api_view
from rest_framework.response import Response
from .engine import searchByFlightNumber
# Create your views here.
@api_view(['GET'])
def FlightInfo(request):
print("in flight info view")
print(request.GET)
if request... |
import time
def generate_mock_c(file_name, include_path, fun_data):
mock_c = top_comment_generate(file_name)
mock_c += includes_generate(file_name, include_path)
for fun in fun_data:
mock_c += struct_params_generate(file_name, fun[0], fun[1])
mock_c += struct_internal_generate(file_name, ... |
/* Arduino Library for the PCA9685 16-Channel PWM Driver Module.
Copyright (c) 2016 NachtRaveVL <nachtravevl@gmail.com>
Copyright (C) 2012 Kasper Skårhøj <kasperskaarhoj@gmail.com>
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public ... |
# -*- coding: utf-8 -*-
"""
:author: Grey Li (李辉)
:url: http://greyli.com
:copyright: © 2018 Grey Li <withlihui@gmail.com>
:license: MIT, see LICENSE for more details.
"""
from flask import render_template, flash, redirect, url_for, current_app, request, Blueprint
from flask_login import login_required,... |
const Discord = require('discord.js');
const moment = require('moment');
exports.run = async (client, message, args) => {
//let user = message.mentions.members.first() || message.guild.members.cache.get(args[0]) || message.guild.member(message.author)
const user = message.mentions.users.first() || message.aut... |
# 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 writing, software
# d... |
from django.contrib import admin
from .models import (
IstochnikiFinansirovaniya,
Napravleniya,
TubesRegistration,
Issledovaniya,
Result,
FrequencyOfUseResearches,
CustomResearchOrdering,
RMISOrgs,
RMISServiceInactive,
Diagnoses,
TypeJob,
EmployeeJob,
KeyValue,
P... |
#encoding: utf-8
from __future__ import unicode_literals
from django.conf.urls import patterns, url
urlpatterns = patterns("mezzanine_advanced_admin.views",
url("^page_update_status/$", "admin_page_update_status", name="admin_page_update_status"),
)
|
import numpy as np
import streamlit as st
import tensorflow as tf
from tensorflow.python.keras.models import load_model
from tensorflow.python.keras.preprocessing.image import img_to_array
from tensorflow.python.keras.preprocessing import image
from PIL import Image
tf.flags.DEFINE_string('model_path', "mode... |
"""
Author: CaptCorpMURICA
Project: 100DaysPython
File: module1_day11_augAssign.py
Creation Date: 6/2/2019, 8:55 AM
Description: Learn about augmented assignments in python.
+= : Addition
-= : Subtraction
*= ... |
(function() {
window.WallTime || (window.WallTime = {});
window.WallTime.data = {
rules: {"RussiaAsia":[{"name":"RussiaAsia","_from":"1981","_to":"1984","type":"-","in":"Apr","on":"1","at":"0:00","_save":"1:00","letter":"S"},{"name":"RussiaAsia","_from":"1981","_to":"1983","type":"-","in":"Oct","on":"1"... |
"""ST Interface module."""
from espnet_pytorch_library.asr_interface import ASRInterface
from espnet.utils.dynamic_import import dynamic_import
class STInterface(ASRInterface):
"""ST Interface for ESPnet model implementation.
NOTE: This class is inherited from ASRInterface to enable joint translation
an... |
// The Cloud Functions for Firebase SDK to create Cloud Functions and setup triggers.
const functions = require('firebase-functions');
// The Firebase Admin SDK to access the Database.
const admin = require('firebase-admin');
admin.initializeApp();
const firestore = admin.firestore();
// const settings = { timestamps... |
import PropTypes from 'prop-types';
import React, { Component, PureComponent } from 'react';
class Option extends (PureComponent || Component) {
constructor(props) {
super(props);
this.optionClickHandler = this.optionClickHandler.bind(this);
}
optionClickHandler(ev) {
this.props.onClick(ev, this.pro... |
import {
NURSE_LOGIN_SUCCESS,
NURSE_LOGIN_FAIL,
NURSE_LOADED,
NURSE_AUTH_ERROR,
NURSE_LOGOUT
} from './types'
import axios from 'axios'
import { toast } from 'react-toastify'
import setAuthToken from '../../../utils/setAuthToken'
export const loadNurse = () => async dispatch => {
if (localStorage.nurseAu... |
#!/usr/bin/python3
import SortFunctions as SFunc
file = open('nums.txt', 'r')
file_list = file.read().split(':')
file.close()
num_list = list(map(lambda str_in_list: int(str_in_list), file_list))
def test_sort_functions(functions: list):
def sort_test(original_list: list, sorted_list: list):
"""
... |
/* Copyright 2012 Mozilla Foundation
*
* 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... |
// All material copyright ESRI, All Rights Reserved, unless otherwise specified.
// See https://js.arcgis.com/3.38/esri/copyright.txt for details.
//>>built
require({cache:{"url:esri/dijit/metadata/types/arcgis/metadata/templates/MetadataLanguage.html":'\x3cdiv data-dojo-attach-point\x3d"containerNode"\x3e\r\n\r\n \x3... |
import { MongoClient } from "mongodb"
async function handler(req, res) {
if (req.method === 'POST') {
const data = req.body;
// const { title, image, address, description } = data;
const client = await MongoClient.connect("mongodb+srv://new-user:Chotu2929@cluster0.pqa3i.mongodb.net/myMeetup... |
var grobjects = grobjects || [];
var mountain = undefined;
(function () {
"use strict";
var shaderProgram = undefined;
var buffers = undefined;
// constructor for Mountain
mountain = function mountain(name, position, size, color) {
this.name = name;
this.position = ... |
class FBTAConfigConstant:
DIR_DETAIL_NEW_ALL_RUN = 'DIR_DETAIL_NEW_ALL_RUN'
DIR_DETAIL_NEW_ON_DAY = 'DIR_DETAIL_NEW_ON_DAY'
|
'use strict'
var path = require('path')
var util = require('util')
var chalk = require('chalk')
var table = require('text-table')
exports.reporter = function reporter (grunt, data) {
var total = 0
var errorCount = data.errorCount
var warningCount = data.warningCount
var output = '\n'
var isVerbose = grunt.... |
/*
* 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 writing, software
* distributed u... |
from PyQt4.QtGui import *
from PyQt4.QtCore import *
import PyQt4.QtGui as QtGui
import os
import qrcode
import electrum_rubycoin
from electrum_rubycoin.i18n import _
from util import WindowModalDialog
class QRCodeWidget(QWidget):
def __init__(self, data = None, fixedSize=False):
QWidget.__init__(self)... |
"""
Copyright (c) 2018 NSF Center for Space, High-performance, and Resilient Computing (SHREC)
University of Pittsburgh. 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 ... |
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
// IMPORTANT: Before updating this file
// please read react-native-windows repo:
// vnext/Microsoft.ReactNative.Cxx/README.md
#pragma once
#ifndef MICROSOFT_REACTNATIVE_JSVALUETREEREADER
#define MICROSOFT_REACTNATIVE_JSVALUETREEREADER
... |
//
// SPDX-FileCopyrightText: 2021 SAP SE or an SAP affiliate company and Gardener contributors
//
// SPDX-License-Identifier: Apache-2.0
//
import Vue from 'vue'
import store from '@/store'
import createRouter from '@/router'
Vue.config.productionTip = false
const App = Vue.extend({
name: 'app',
created () {
... |
/*
* Copyright 2016 Google Inc.
*
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
#ifndef SKSL_COMPILER
#define SKSL_COMPILER
#include <map>
#include <set>
#include <unordered_set>
#include <vector>
#include "src/sksl/SkSLASTFile.h"
#include "src/sksl/SkSL... |
# -*- coding: utf-8 -*-
#------------------------------------------------------------------------------
# Name: beam.py
# Purpose: music21 classes for representing notes
#
# Authors: Michael Scott Cuthbert
# Christopher Ariza
#
# Copyright: Copyright © 2009-2012 Michael Scott Cuthbert... |
import axios from "axios";
import Feedparser from "feedparser";
import stringToStream from "string-to-stream";
export default class feedParseUtil {
feedparser = new Feedparser();
feedParse(url) {
return axios({ method: "get", url: url, timeout: 3000 })
.then(res => {
stringToStream(res.data).pip... |
class PhysicsHandler {
constructor(table, muek, g) {
this.table = table;
this.balls = table.balls;
this.movingBalls = new LinkedList();
this.movingBallsIds = [];
for (let i = 0; i < this.balls.length; i++) {
this.movingBallsIds.push(false);
}
this.... |
# Configuration file for the Sphinx documentation builder.
#
# This file only contains a selection of the most common options. For a full
# list see the documentation:
# https://www.sphinx-doc.org/en/master/usage/configuration.html
# -- Path setup --------------------------------------------------------------
# If ex... |
import os
import pytest
import pandas as pd
import sys
from zarnitsa.nlp import DataAugmenterNLP
@pytest.fixture
def dataug_nlp():
return DataAugmenterNLP()
@pytest.fixture
def empty_text():
return ""
@pytest.fixture
def filled_text():
t = (
"This is an awesome text I have to augment here "
... |
#!/usr/bin/python3
from pn532.api import PN532
if __name__== "__main__":
nfc = PN532()
# setup the device
nfc.setup(enable_logging=True)
# keep reading until a value is returned
while True:
read = nfc.read()
print(read)
|
/*! jQuery v2.1.1 | (c) 2005, 2014 jQuery Foundation, Inc. | jquery.org/license */
!function(a,b){"object"==typeof module&&"object"==typeof module.exports?module.exports=a.document?b(a,!0):function(a){if(!a.document)throw new Error("jQuery requires a window with a document");return b(a)}:b(a)}("undefined"!=typeof windo... |
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved
import contextlib
import copy
import io
import itertools
import json
import logging
import numpy as np
import os
import pickle
from collections import OrderedDict
import pycocotools.mask as mask_util
import torch
from fvcore.common.file_io import Pa... |
import contextlib
import py
import sys, os
from rpython.rlib import exports
from rpython.rtyper.lltypesystem.lltype import getfunctionptr
from rpython.rtyper.lltypesystem import lltype
from rpython.tool import runsubprocess
from rpython.tool.nullpath import NullPyPathLocal
from rpython.tool.udir import udir
from rpytho... |
import { DataAccessType } from '../models/Transaction'
const DATA_ACCESS_TYPE = {
[DataAccessType.SIGN_DOCUMENT]: 'Sign Document',
[DataAccessType.VIEW_ONLY]: 'View Only',
// [DataAccessType.RECEIVE_COPY]: 'Receive Copy'
[DataAccessType.REVIEW_DOCUMENT]: 'Review Document'
}
export const getDataAccessType = ac... |
import os
import unittest
import six
from conans.paths import BUILD_INFO, CONANFILE
from conans.test.utils.tools import TestClient
from conans.util.files import mkdir
class SourceTest(unittest.TestCase):
def test_conanfile_removed(self):
# https://github.com/conan-io/conan/issues/4013
conanfile... |
/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve.
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 ... |
/* cpexcel.js (C) 2013-2014 SheetJS -- http://sheetjs.com */
/*jshint -W100 */
var cptable = {};
cptable[874] = (function(){ var d = "\u0000\u0001\u0002\u0003\u0004\u0005\u0006\u0007\b\t\n\u000b\f\r\u000e\u000f\u0010\u0011\u0012\u0013\u0014\u0015\u0016\u0017\u0018\u0019\u001a\u001b\u001c\u001d\u001e\u001f !\"#$%&'()*+,... |
$(function(){$('form').submit(function(){$('div.error').fadeOut(200);$('div.ok').fadeOut(200);$.blockUI();$(this).ajaxSubmit({url:this.action,dataType:'json',success:function(data){$.unblockUI();if(data.error){$('div.error').html(data.error).fadeIn(200)}else if(data.ok){$('div.ok').html(data.ok).fadeIn(200)}},error:fun... |
import os
import torch
from fairseq.data import FairseqDataset
from torch.utils.data.dataloader import default_collate
class SignDataset(FairseqDataset):
def __init__(self, dataset, sizes, feat_roots):
super().__init__()
self.dataset = dataset
self.all_sizes = sizes
... |
from cosmosim.core.universe import Universe
import cosmosim.util.functions as F
import math
# Create the universe
universe = Universe()
# Create some planets
NUM_PLANETS = 1000
omega = 0.03 # angular velocity
for i in range(NUM_PLANETS):
# Create random planet
planet = universe.random_planet()
# Spin it... |
#ifndef SOLVER_H
#define SOLVER_H
#include <vector>
#include "types.h"
class Particle;
class Solver {
public:
explicit Solver(double mEpsilon);
std::vector<Particle> solve(const std::vector<Particle> &particles) const;
private:
std::vector<Particle> calculateAcceleration(const std::vector<Particle> &pa... |
import asyncio
cond = None
p_list = []
# 生产者
async def producer(n):
for i in range(5):
async with cond:
p_list.append(f"{n}-{i}")
print(f"[生产者{n}]生产商品{n}-{i}")
# 通知任意一个消费者
cond.notify() # 通知全部消费者:cond.notify_all()
# 摸拟一个耗时操作
await asyncio.s... |
"""
Validation errors, and some surrounding helpers.
"""
from collections import defaultdict, deque
import itertools
import pprint
import textwrap
import attr
from jsonschema import _utils
from jsonschema.compat import PY3, iteritems
WEAK_MATCHES = frozenset(["anyOf", "oneOf"])
STRONG_MATCHES = frozenset()
_unset ... |
#ifndef RDESTL_FIXED_VECTOR_H
#define RDESTL_FIXED_VECTOR_H
#include "alignment.h"
#include "vector.h"
#define RDESTL_RECORD_WATERMARKS 0
// @TODO Wont work on 64-bit!
namespace rde
{
//=============================================================================
template<typename T, class TAllocator... |
# Lint as: python3
# Copyright 2019 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 ... |
# Copyright (c) 2013 Alan McIntyre
from HTMLParser import HTMLParser
import datetime
import warnings
from btceapi.common import BTCEConnection, all_pairs
class BTCEScraper(HTMLParser):
def __init__(self):
HTMLParser.__init__(self)
self.messageId = None
self.messageTime = None
self... |
"""
Base class for CIME system tests that involve doing two runs and comparing their
output.
In the __init__ method for your test, you MUST call
SystemTestsCompareTwo.__init__
See the documentation of that method for details.
Classes that inherit from this are REQUIRED to implement the following methods:
(1) _ca... |
import React, {useState, useCallback, useContext} from 'react';
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
import { fetchGeneSummary } from '../../../actions';
import { PlotContext } from "../Context";
const OptionsGroup = () => {
const plotContext = useContext(PlotContext);
cons... |
def rock_paper():
def win():
print("you win")
def lose():
print("you lose")
p=input("enter the p :")
c=input("enter the c :")
if p=="rock" and c=="scissors":
win()
elif p=="rock" and c=="paper":
lose()
elif p=="paper" and c=="scissors":
los... |
"""Provides form rendering and validation for the simple search feature."""
from wtforms import Form, StringField, SelectField, validators, RadioField
from search.controllers.util import (
does_not_start_with_wildcard,
has_balanced_quotes,
strip_white_space,
)
from search.domain import Query
class Simpl... |
import numpy as np
from .ReadCDF import ReadCDF
from ..Tools.PSpecCls import PSpecCls
import DateTimeTools as TT
from ..Tools.ListDates import ListDates
def ReadOmni(Date):
'''
Reads the level 2 omniflux data product for a given date.
Inputs
======
Date : int
Integer date in the format yyyymmdd
If Date is a... |
import * as React from 'react';
import { storiesOf } from '@storybook/react';
import
{
Api,
Customization,
AutoResize,
} from './Examples';
import { propsDesc, validationPropsDesc } from './propsDescription';
import { ApiStory } from '../../../components/ApiStory';
import { Story } from '../../../components/Stor... |
import Tab_ from './tab';
import React from 'react';
import Component from '../component';
import { decorate, getTabProps } from '../utils/plugins';
const Tab = decorate(Tab_, 'Tab');
export default class Tabs extends Component {
template (css) {
const {
tabs = [],
borderColor,
onChange,
... |
import pytest
from pybind11_tests import smart_ptr as m
from pybind11_tests import ConstructorStats
def test_smart_ptr(capture):
# Object1
for i, o in enumerate([m.make_object_1(), m.make_object_2(), m.MyObject1(3)], start=1):
assert o.getRefCount() == 1
with capture:
m.print_objec... |
/**
* index.js
* It exports all routes created, in order to import it in a cleaner way
*/
export const HOME = '/'
export const HELLO = '/hello' |
# Copyright (c) 2011 AOL Inc. All Rights Reserved.
#
# Permission is hereby granted, free of charge, to any person
# obtaining a copy of this software and associated documentation files
# (the "Software"), to deal in the Software without restriction,
# including without limitation the rights to use, copy, modify, merg... |
export const STATES = [
{ label: 'Acre', value: 'AC' },
{ label: 'Alagoas', value: 'AL' },
{ label: 'Amapá', value: 'AP' },
{ label: 'Amazonas', value: 'AM' },
{ label: 'Bahia', value: 'BA' },
{ label: 'Ceará', value: 'CE' },
{ label: 'Distrito Federal', value: 'DF' },
{ label: 'Espírito... |
#ifndef DEEPGRIND_CGCONVOLUTIONNODE_H
#define DEEPGRIND_CGCONVOLUTIONNODE_H
#include "Utils.h"
#include "Conv2DFilterShape.h"
#include "CompGraph/CGTensorOutput.h"
//Just because i don't understand Tensors
namespace NumGrind {
namespace CompGraph{
class CGConv2DNode : public CGTensorOutput{
public... |
import React, { useEffect, useState } from 'react';
import twitterLogo from './assets/twitter-logo.svg';
import './App.css';
import idl from './idl.json'
import kp from './keypair.json'
import { Connection, PublicKey, clusterApiUrl } from '@solana/web3.js';
import { Program, Provider, web3 } from '@project-serum/anchor... |
#!/usr/bin/python
# coding=utf-8
###############################################################################
import urllib2
try:
from xml.etree import ElementTree
ElementTree # workaround for pyflakes issue #13
except ImportError:
ElementTree = None
from test import CollectorTestCase
from test import... |