text stringlengths 3 1.05M |
|---|
import cv2
import numpy as np
def check_colour(img):
height, width, dim = img.shape
## convert to hsv
hsv = cv2.cvtColor(img, cv2.COLOR_BGR2HSV)
red_low = cv2.inRange(hsv,(0, 0, 50), (10, 255, 255))
red_high = cv2.inRange(hsv,(170, 0, 50), (180, 255, 255))
purple = cv2.inRange(hsv,(140,... |
# Solution for day1 of advent of code 2019
import math
lines = [line.rstrip('\n') for line in open('day1/input.txt')]
# part1
fuel = 0
for line in lines:
fuelForModule = math.floor(int(line) / 3) - 2
fuel += fuelForModule
print("Fuel needed: " + str(fuel))
# part2
def calculateFuelForMass(mass):
"""cal... |
/* Copyright 2015 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 applicable law or a... |
#!/usr/bin/env python
# -*- coding:utf-8 -*-
# Author:Speciallan
from pycocotools.coco import COCO
import numpy as np
import skimage.io as io
import matplotlib.pyplot as plt
import pylab
import cv2
pylab.rcParams['figure.figsize'] = (8.0, 10.0)
dataDir='../../data/coco'
dataType='val2017'
annFile='{}/annotations/inst... |
import { createRouter, createWebHistory } from 'vue-router'
import HomeView from '../views/HomeView.vue'
const routes = [
{
path: '/',
name: 'home',
component: HomeView
},
{
path: '/about',
name: 'about',
// route level code-splitting
// this generates a separate chunk (about.[hash].j... |
# coding: utf-8
# Copyright (C) 2018 Orange
#
# This software is distributed under the terms and conditions of the 'Apache-2.0'
# license which can be found in the 'LICENSE.md' file
# or at 'http://www.apache.org/licenses/LICENSE-2.0'.
"""Functions for the REPOSITORIES REST API Methods category."""
from .tools impor... |
import subprocess
import sys
import setup_util
def start(args, logfile, errfile):
setup_util.replace_text("spark/src/main/webapp/WEB-INF/resin-web.xml", "mysql:\/\/.*:3306", "mysql://" + args.database_host + ":3306")
try:
subprocess.check_call("mvn clean package", shell=True, cwd="spark", stderr=errfile, s... |
import argparse
import asyncio
import logging
from pathlib import Path
from typing import Any
from aiohttp import web
log = logging.getLogger(__name__)
class AlertServer:
shut_down: bool
shut_down_event: asyncio.Event
log: Any
app: Any
alert_file_path: Path
port: int
@staticmethod
a... |
"""
Created on April 9 2021
@author: Olivier Telle
"""
from rptools.rpreport.rp_report import run_report
__all__ = ['run_report']
|
# -*- coding: utf-8 -*-
# Generated by the protocol buffer compiler. DO NOT EDIT!
# source: transit-extensions.proto
"""Generated protocol buffer code."""
from google.protobuf import descriptor as _descriptor
from google.protobuf import message as _message
from google.protobuf import reflection as _reflection
from goo... |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright (c) 2011 OpenStack, LLC.
# 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... |
define(["lib-build/css!lib-app/bootstrap/css/bootstrap.min",
"lib-build/css!./Core",
"lib-app/jquery",
"./utils/Polyfills",
"esri/map",
"esri/arcgis/Portal",
"esri/arcgis/utils",
"./utils/CommonHelper",
"esri/urlUtils",
// Builder
"./builder/BuilderHelper",
// Utils
"dojo/has",
"esri/IdentityM... |
# Modify the program from the Second Dictionary challenge of lecture 56
# to use shelves instead of dictionaries.
#
# Do this by creating two programs. cave_initialise.py should create the two
# shelves (locations and vocabulary) with the appropriate keys and values.
#
# cave_game.py will then use the two shelves inste... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import simplejson as json
from alipay.aop.api.response.AlipayResponse import AlipayResponse
class AlipayIserviceCognitiveOcrDriverlicenseQueryResponse(AlipayResponse):
def __init__(self):
super(AlipayIserviceCognitiveOcrDriverlicenseQueryResponse, self).__in... |
load("bf4b12814bc95f34eeb130127d8438ab.js");
load("93fae755edd261212639eed30afa2ca4.js");
load("352fc54052b657308832185e13cd17c9.js");
// Copyright (C) 2016 the V8 project authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-%typedarray%.prototype.findinde... |
module.exports = {
TEMPERATURE_TOPIC: 'Sonic-Labs-Incubator-Temperature',
HUMIDITY_TOPIC: 'Sonic-Labs-Incubator-Humidity'
}; |
const tableName = 'Receipts'
const columnName = 'template_type'
const defaultValue = 'stone_mais'
module.exports = {
up: (queryInterface, Sequelize) => queryInterface
.describeTable(tableName)
.then((tableDefinition) => {
if (tableDefinition[columnName]) return Promise.resolve()
return queryInte... |
imports = ["../dataset.py", "../io.py"]
nl_query_feature_size = 768 # bert-base
params = {
"token_threshold": 5,
"node_type_embedding_size": 64,
"embedding_size": 128,
"hidden_size": 256,
"attr_hidden_size": 50,
"dropout": 0.2,
"batch_size": 32,
"n_iteration": 10000,
"eval_int... |
const Webpack = require("webpack");
const CopyWebpackPlugin = require('copy-webpack-plugin');
module.exports = {
entry: {
vendor: "./src/vendor.js",
main: "./src/index.js"
},
module: {
rules: [
{
test: /\.html$/,
use: ["html-loader"]
},
{
test: /\.(jpg|jpeg|p... |
function parseObsStMsg(data) {
let TEMP = data.weatherElement[3].elementValue == '-99' ? '因故無資料' : data.weatherElement[3].elementValue;
let HUMD = data.weatherElement[4].elementValue == '-99' ? '因故無資料' : data.weatherElement[4].elementValue;
let PRES = data.weatherElement[5].elementValue == '-99' ? '因故無資料' :... |
import psycopg2
from flask import render_template, session, flash, redirect, url_for
from app import app
from storage import conn
from utils.decorators import login_required
@app.route("/offers")
@login_required
def show_offers():
"""
Pokazuje listę dostępnych ofert dla użytkownika, ze szczegółami
"""
... |
/*
* Copyright (c) Microsoft. All rights reserved. Licensed under the MIT license.
* See LICENSE in the project root for license information.
*/
var express = require('express');
var path = require('path');
var favicon = require('serve-favicon');
var logger = require('morgan');
var bodyParser = require('body-parser'... |
Bridge.assembly("unity-script-converter", function ($asm, globals) {
"use strict";
Bridge.define("MiniGameAdaptor.Animation.Enumerator", function () { return {
inherits: [System.Collections.IEnumerator],
$kind: "nested struct",
statics: {
methods: {
getDefault... |
/* eslint-disable consistent-return */
import virtual from '@rollup/plugin-virtual';
import { walk } from 'estree-walker';
import MagicString from 'magic-string';
/** @typedef {{ [key:string]: string }} FederatedRemotes */
/**
* @typedef {object} FederationOptions
* @property {FederatedRemotes} remotes
* @propert... |
#include<stdio.h>
int main()
{
int a[3][4]={{67,77,87,90},{88,89,80,98},{87,76,60,99}};
int * search(int (*p1)[4],int j);
int n,i;
int *p;
printf("please enter the number of student:");
scanf("%d",&n);
p=search(a,n);
printf("the scores of No.%d are:\n",n);
for(i=0;i<4;i++)
printf("%4d",p[i]);
}... |
import json
from common.helpers.collections import find_first
from common.models.tags import Tag
from common.helpers.date_helpers import parse_front_end_datetime
from distutils.util import strtobool
from django.contrib.gis.geos import Point
from django.forms import ModelForm
def is_json_string(string):
return str... |
"""Implement the command line 'lnt' tool."""
from __future__ import print_function
from .common import init_logger
from .common import submit_options
from .convert import action_convert
from .create import action_create
from .import_data import action_import
from .import_report import action_importreport
from .updatedb... |
#
# 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 us... |
# 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... |
// PWA Common
import commonApp from '@shopgate/pwa-common/subscriptions/app';
import commonUser from '@shopgate/pwa-common/subscriptions/user';
import commonHistory from '@shopgate/pwa-common/subscriptions/history';
import commonMenu from '@shopgate/pwa-common/subscriptions/menu';
import commonRouter from '@shopgate/pw... |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
import ralph.lib.mixins.fields
class Migration(migrations.Migration):
dependencies = [
('assets', '0010_auto_20160405_1531'),
('data_center', '0008_datacenter_show_on_dashboard'),
]
... |
//
// MHWaterpurifierFilterStatusViewController.h
// MiHome
//
// Created by wayne on 15/7/6.
// Copyright (c) 2015年 小米移动软件. All rights reserved.
//
#import "MHViewController.h"
#import "MHWaterFilterObject.h"
@interface MHWaterpurifierFilterStatusViewController : MHViewController
@property (nonatomic, retain) M... |
//
// ObjectNode-Private.h
// CommonViewControllers
//
// Created by Lessica <82flex@gmail.com> on 2022/1/20.
// Copyright © 2022 Zheng Wu. All rights reserved.
//
#import <Foundation/Foundation.h>
#import "ObjectNode.h"
@interface ObjectNode ()
+ (ObjectNodeType)_typeForObject:(id)obj;
+ (NSString *)stringForTy... |
/**
* 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... |
import React from "react";
import { Query } from "react-apollo";
import { gql } from "apollo-boost";
import Spinner from "../Global_components/loading";
const ALL_USERS = gql`
query userCheck {
userloggins {
id
username
status
firstName
lastName
mailingAddress
students {... |
# Copyright 2013 IBM Corp.
#
# 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, so... |
import Vue from 'vue';
import iView from 'iview';
import VueRouter from 'vue-router';
import {routers, otherRouter, appRouter} from './router';
import Vuex from 'vuex';
import Util from './libs/util';
import App from './app.vue';
import Cookies from 'js-cookie';
import 'iview/dist/styles/iview.css';
import VueI18n fro... |
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
#
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes ... |
module.exports=function(y){function M(n){if(e[n])return e[n].exports;var s=e[n]={exports:{},id:n,loaded:!1};return y[n].call(s.exports,s,s.exports,M),s.loaded=!0,s.exports}var e={};return M.m=y,M.c=e,M.p="",M(0)}({0:function(y,M,e){e(795),y.exports=e(795)},795:function(y,M){!function(y,M){kendo.cultures.th={name:"th",n... |
import Vue from 'vue'
import Router from 'vue-router'
import Home from '../pages/tabbar/Home'
import Vip from '../pages/tabbar/Vip'
import Shopping from '../pages/tabbar/Shopping'
import Search from '../pages/tabbar/Search'
import NewsList from '../pages/news/NewsList'
import NewsInfo from '../pages/news/NewsInfo'
impo... |
from __future__ import absolute_import, division, unicode_literals
from pip9._vendor.six import with_metaclass, viewkeys, PY3
import types
try:
from collections import OrderedDict
except ImportError:
from pip9._vendor.ordereddict import OrderedDict
from . import _inputstream
from . import _tokenizer
from . ... |
from datetime import datetime
from typing import Sequence, Union
from deck import CardDeck, Hand
class Game:
def __init__(self, players: Union[int, Sequence[str]] = 2, initial_hand_size=0, sep=None, player_sep=', '):
self.__game_log = []
self.round_count = 0
self.winner = None
sel... |
import { GET_HOME_ARTICLE_SUCCESS, GET_HOME_ARTICLE_FAILURE } from "../types";
const initialState = {
loading: true,
posts : [],
error : null,
};
export default (state = initialState, action) => {
switch (action.type) {
case GET_HOME_ARTICLE_SUCCESS:
return {
...s... |
import Vue from 'vue'
import VueRouter from 'vue-router'
// layout
import MainLayout from "./layouts/MainLayout";
// Screens
import HousesFilterScreen from './screens/HousesFilterScreen.vue'
Vue.use(VueRouter)
const routes = [{
path: '/',
name: 'MainLayout',
component: MainLayout,
children: [
... |
import enterpriseService from '../../../services/enterprise/EnterpriseService';
const state = {
enterprises: null,
hash: null,
enterprise: null,
};
// getters
const getters = {
enterprises: (state) =>
state.enterprises ? JSON.parse(state.enterprises) : [],
enterprise: (state) =>
state.enterprise ? J... |
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
/**
* \file hostthread.h
*
* This file defines threading primitives used by the host.
*
*/
#ifndef _HOSTTHREAD_H
#define _HOSTTHREAD_H
#include <openenclave/bits/defs.h>
#include <openenclave/bits/types.h>
#if __GNUC... |
#!/usr/bin/python3
from oligo import Iber
from datetime import date, timedelta
import paho.mqtt.publish as mqttpublish
import json
consumo = []
connection = Iber()
connection.login("user-iberdrola", "password-iberdrola")
from_date = date.today() - timedelta(days=1)
until_date = date.today() - timedelta... |
const loggingEnabled = true;
const noop = () => {};
const logger = {
/* eslint-disable no-console */
debug: loggingEnabled ? console.log : noop,
log: loggingEnabled ? console.log : noop,
warn: loggingEnabled ? console.log : noop,
/* eslint-disable no-console */
};
export default logger;
|
def _custom_jvm_impl(ctx):
print(ctx.label)
transitive_compile_jars = _collect(ctx.attr.deps)
return struct(
providers = [
java_common.create_provider(
transitive_compile_time_jars = transitive_compile_jars,
),
],
)
def _collect(deps):
transit... |
/**************************************************************************
*
* Copyright 2013-2014 RAD Game Tools and Valve Software
* Copyright 2010-2014 Rich Geldreich and Tenacious Software LLC
* All Rights Reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this s... |
Number.prototype.toDegrees = function () {
return this * (180 / Math.PI);
}
Number.prototype.toRadians = function () {
return this * (Math.PI / 180);
}
function getWorldPosition(mapPosition, tileSize) {
var worldPosition = {
x: mapPosition.x * tileSize,
z: mapPosition.z * tileSize
};
... |
# Copyright 2021 The Brax 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 wri... |
from setuptools import setup
setup(
name='qsh',
version='0.6.1',
url='https://github.com/nethask/qsh',
author='Artyom Knyazev',
author_email='nethask@gmail.com',
license='MIT',
install_requires=['python-dateutil']
)
|
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# Copyright (c) 2015 Jérémie DECOCK (http://www.jdhp.org)
# 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 witho... |
/**
* Created by pi on 7/21/16.
*/
var modelBase = require('../ModelBase');
var User = require('./User');
var AccessRight = require('./AccessRight');
var GroupUser = require('./GroupUser');
var properties = {
ident: modelBase.Sequelize.STRING,
name: modelBase.Sequelize.STRING
};
var UserGroup = modelBase.def... |
from .area_interpolate import _area_interpolate_binning as area_interpolate
from .area_interpolate import _area_interpolate as _slow_area_interpolate
from .area_interpolate import _area_tables, _area_tables_binning, _area_tables_raster
from .area_interpolate import _check_presence_of_crs |
'use strict';
module.exports = function (app) {
// User Routes
var quizapp = require('../controllers/quizapp.server.controller');
// Setting up the quizapp api
app.route('/api/quizapp/sendemail').post(quizapp.sendemail);
};
|
/*
* driver/irq-pl190.c
*
* Copyright(c) 2007-2022 Jianjun Jiang <8192542@qq.com>
* Official site: http://xboot.org
* Mobile phone: +86-18665388956
* QQ: 8192542
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software... |
from fabric.api import env
from fabric.api import prompt
from fabric.api import run
import sys
def git_clone(url, path):
""" Utility method to clone git repositories. """
cmd = 'git clone %s %s' % (url, path)
run(cmd)
def git_checkout(branch):
""" Utility method to change branches. """
cmd = 'g... |
from dataclasses import replace
from test.pycardano.test_key import SK
from test.pycardano.util import chain_context
from unittest.mock import patch
import pytest
from pycardano.address import Address
from pycardano.certificate import StakeCredential, StakeDelegation, StakeRegistration
from pycardano.coinselection im... |
import pytest
from mock import patch
# from redis.client import Redis
# @patch('redis.Redis', mock_redis_client)
# def test_make_client(client):
# conn = make_client(host='test-redis')
# assert issubclass(type(conn), Redis)
def test_hello_redis(client):
client.lpush("hello", "world")
actual = clie... |
/*
* IDxDiagProvider Implementation
*
* Copyright 2004-2005 Raphael Junqueira
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your ... |
import React from "react";
import ReactDOM from "react-dom";
import { Router, Link, Route, hashHistory } from "react-router-dom";
import createBrowserHistory from "history/createBrowserHistory";
import CommonHeader from "../common-component/common-header/index";
import AllInfoHomePage from "./component/all-info-home-p... |
#pragma once
#ifdef _WIN32
#include <Winsock2.h>
#else
#include <sys/socket.h>
#include <sys/types.h>
#include <unistd.h>
#include <netinet/in.h>
#include <fcntl.h>
#define closesocket close
#endif
|
// Spaceship Builder - Gwennaël Arbona
#pragma once
#include "UI/NovaUI.h"
#include "UI/Widget/NovaTabView.h"
#include "UI/Widget/NovaModalListView.h"
class SNovaMainMenuSettings
: public SNovaTabPanel
, public INovaGameMenu
{
/*----------------------------------------------------
Slate arguments
---------... |
# New England Mad: a function for obtaining tweets
# Author: Heikal Badrulhisham <heikal93@gmail.com>
# Year: 2018
"""
Define the get_tweets() function for loading and saving tweets through Twitter's search page in a browser. The method
opens a twitter search page with a search query and scrolls down the page repeatedl... |
# Impacket - Collection of Python classes for working with network protocols.
#
# SECUREAUTH LABS. Copyright (C) 2018 SecureAuth Corporation. All rights reserved.
#
# This software is provided under a slightly modified version
# of the Apache Software License. See the accompanying LICENSE file
# for more information.
#... |
// Generated by gencpp from file cartographer_ros_msgs/SubmapList.msg
// DO NOT EDIT!
#ifndef CARTOGRAPHER_ROS_MSGS_MESSAGE_SUBMAPLIST_H
#define CARTOGRAPHER_ROS_MSGS_MESSAGE_SUBMAPLIST_H
#include <string>
#include <vector>
#include <map>
#include <ros/types.h>
#include <ros/serialization.h>
#include <ros/builtin_... |
/*global query,delegateBoundListener,isDescendant,isInQuery */
/*
Description:
Relies on `jessie.delegateBoundListener`, `jessie.query`, `jessie.isInQuery` and `jessie.isDecendant`
*/
/*
Author:
Adam Silver
*/
var delegateBoundQueryListener;
if(delegateBoundListener && query && isDescendant) {
delegateBoundQueryLi... |
"""
Django settings for fluendo project.
Generated by 'django-admin startproject' using Django 3.1.11.
For more information on this file, see
https://docs.djangoproject.com/en/3.1/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/3.1/ref/settings/
"""
import os
f... |
#include "__noos_cortexm3_l1xx_md.h"
uintptr
main$SizeByte() {
return sizeof(byte);
}
uintptr
main$SizeInt() {
return sizeof(int_);
}
uintptr
main$SizeInt16() {
return sizeof(int16);
}
uintptr
main$SizeInt32() {
return sizeof(int32);
}
uintptr
main$SizeInt64() {
return sizeof(int64);
}
uintptr
main$SizeS16()... |
##
# Copyright (c) 2012-2017 Apple Inc. 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 l... |
export { default } from '@zestia/ember-dragula/services/dragula';
|
'use strict';
var db = require('../models/sequelize');
var PSW_RESET_TOKEN_VALID_FOR = 3; //hours
var ONE_HOUR = 3600000;
var repo = {};
function getEmailFromGithubProfile(profile) {
var email;
if(profile.emails && profile.emails.length > 0 && profile.emails[0].value)
email = profile.emails[0].value;
else... |
/*
* Atheros AR71xx built-in ethernet mac driver
*
* Copyright (C) 2008-2010 Gabor Juhos <juhosg@openwrt.org>
* Copyright (C) 2008 Imre Kaloz <kaloz@openwrt.org>
*
* Based on Atheros' AG7100 driver
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU Ge... |
// Auto-generated file. Do not edit!
// Template: src/f32-vbinary/vopc-wasmsimd.c.in
// Generator: tools/xngen
//
// Copyright 2020 Google LLC
//
// This source code is licensed under the BSD-style license found in the
// LICENSE file in the root directory of this source tree.
#include <assert.h>
#include <wasm_s... |
var search_term = "{{ term|escapejs }}";
$(document).ready(function() {
args = {'apikey' : '191d24f81e61c107bca103f7d6a9ca10',
'db' : 'pubmed',
'term' : search_term};
$.getJSON('http://{{ host }}/espell?callback=?', args, function(data) {
if(data.result.CorrectedQuery.length) {
var result = da... |
# testcase 3: Add v1 on one node, remove v1 on other node, lookup v1 on first node
# expected true, after waiting false, false
import requests
import time
newVertex = {"vertexName": "v1"}
url = "http://localhost:"
node1_port = "8080"
node2_port = "8081"
node3_port = "8082"
addvertex_endpoint = "/addvertex"
lookupver... |
"""Utilities for saving/loading Checkpointable objects."""
# 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.apa... |
import itertools
def calculate_LRU(accessPattern, accessPatternLen):
ways = [' ', ' ']
index = 0
for i in range(accessPatternLen):
# If no way has the address
if (ways[0] != accessPattern[i] and
ways[1] != accessPattern[i] ):
# Write address to the indexed way, and change the... |
"""
To solve the linear optimization problem the following software is used:
- Python > 3.0: www.python.org
- Pyomo: http://www.pyomo.org/
- The linear solver CBC: https://projects.coin-or.org/Cbc
Note: The installation folders of Python and the CBC solver have to be added to PATH (environmental variables)... |
from datetime import datetime
from django.db import models, IntegrityError
def valida_dia_agenda(data):
from datetime import datetime
from django.core.exceptions import ValidationError
if data < datetime.now().date():
raise ValidationError('Não é possível criar agenda para um dia anterior a hoje... |
"""Test a fetch from a repo over an ICN forwarder"""
import abc
import os
import shutil
import time
import unittest
from PiCN.ProgramLibs.Fetch import Fetch
from PiCN.ProgramLibs.ICNForwarder import ICNForwarder
from PiCN.Mgmt import MgmtClient
from PiCN.Packets import Name, NackReason
from PiCN.Layers.PacketEncodin... |
''''
splits the big background image into smaller images size 2000x2000px.
Look also at https://stackoverflow.com/questions/10853119/chop-image-into-tiles-using-vips-command-line/15293104
for an alternative (and probably better way)
It also creates the pyramid tiles for the viewer
'''
import pyvips
import shutil
impor... |
//metadoc CairoPSSurface copyright Daniel Rosengren, 2007
//metadoc CairoPSSurface license BSD revised
//metadoc CairoPSSurface category API
#include "IoCairoPSSurface.h"
#if CAIRO_HAS_PS_SURFACE
#include "IoCairoSurface.h"
#include "IoCairoSurface_inline.h"
#include <cairo/cairo-ps.h>
static const char *protoId = "... |
# coding: utf-8
"""
Pure Storage FlashBlade REST 1.9 Python SDK
Pure Storage FlashBlade REST 1.9 Python SDK. Compatible with REST API versions 1.0 - 1.9. Developed by [Pure Storage, Inc](http://www.purestorage.com/). Documentations can be found at [purity-fb.readthedocs.io](http://purity-fb.readthedocs.io/).
... |
const Contacts = require('../models/ContactsModel');
exports.index = (req, res) => {
res.render('contacts');
}
exports.register = async (req, res) => {
try {
const contacts = new Contacts(req.body,req.session.user);
await contacts.register();
if (contacts.errors.length > 0) {
... |
import numpy as np
import som.reader as rd
from som.class_som import Som
"""
读取整理好的事故点poi向量数据
运行SOM聚类算法
获得类群,类所代表的特征向量,属于该类的事故点id
"""
read_path = "./testdata.json"
id_list,vector_list = rd.read_vector_json(read_path)
vectors = np.mat(vector_list)
vectors_old = vectors.copy()
som = Som(vectors,(6,6),1,3)
clusters = s... |
const { NotImplementedError } = require('../extensions/index.js');
/**
* Implement chainMaker object according to task description
*
*/
const chainMaker = {
preChain: [],
getLength() {
return this.preChain.length
},
addLink(value) {
this.preChain.push(value)
return this
},
removeLink(positio... |
# -*- coding: utf-8 -*-
# PLEASE DO NOT EDIT THIS FILE, IT IS GENERATED AND WILL BE OVERWRITTEN:
# https://github.com/ccxt/ccxt/blob/master/CONTRIBUTING.md#how-to-contribute-code
from ccxt.async_support.base.exchange import Exchange
import hashlib
import math
from ccxt.base.errors import ExchangeError
from ccxt.base.... |
import discord
import psutil
import os
from datetime import datetime
from discord.ext import commands
from discord.ext.commands import errors
from utils import default
class Events(commands.Cog):
def __init__(self, bot):
self.bot = bot
self.config = default.get("config.json")
self.process... |
Ext.define('KeanBooks.classes.Credentials', {
statics: {
OATH2_CLIENT_ID : 'get your own .........jmu.apps.googleusercontent.com',
APP_SERVER_BASE_URL : 'http://localhost:8888/'
}
}); |
# -*- coding: utf-8 -*-
#
# Copyright (C) 2004-2013 Edgewall Software
# All rights reserved.
#
# This software is licensed as described in the file COPYING, which
# you should have received as part of this distribution. The terms
# are also available at http://trac.edgewall.org/wiki/TracLicense.
#
# This software consi... |
# -*- coding: utf-8 -*-
"""
@description:
@author:XuMing
"""
from __future__ import print_function
from __future__ import unicode_literals
# 导入numpy
# 很多其他科学计算的第三方库都是以Numpy为基础建立的。
# Numpy的一个重要特性是它的数组计算。
from numpy import *
# 使用前一定要先导入 Numpy 包,导入的方法有以下几种:
# import numpy
# import numpy as np
# from numpy import *
# fro... |
'use strict';
moduloAfiliado.controller('AfiliadoPListController', ['$scope', '$routeParams', 'serverService', '$location',
function ($scope, $routeParams, serverService, $location) {
$scope.visibles={};
$scope.visibles.id = true;
$scope.visibles.dni = true;
$scope.visibl... |
"""
MIT License
Copyright (c) 2020 Hyeonki Hong <hhk7734@gmail.com>
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, modi... |
from textwrap import dedent
import numpy as np
import pandas as pd
import pytest
import dask.array as da
import dask.dataframe as dd
style = """<style scoped>
.dataframe tbody tr th:only-of-type {
vertical-align: middle;
}
.dataframe tbody tr th {
vertical-align: top;
}
.datafra... |
import React from "react";
import store from "../redux/store";
import ContextWrapper from "./wrapper";
let { PropTypes } = React;
const ContextMenu = React.createClass({
displayName: "ContextMenu",
propTypes: {
identifier: PropTypes.string.isRequired
},
getInitialState() {
return store... |
# -*- coding: utf-8 -*-
__author__ = ["chrisholder", "TonyBagnall"]
from typing import Callable
import numpy as np
def mean_average(X: np.ndarray) -> np.ndarray:
"""Compute the mean average of time series.
Parameters
----------
X : np.ndarray (3d array of shape (n_instances, n_dimensions, series_le... |
import random
import string
class StringGenerator:
@staticmethod
def get_random_message(length: int) -> str:
"""
Returns a random message based on the length requested
:param length: The length of the random message
:return:
"""
return ''.join(random.choice(stri... |