text stringlengths 3 1.05M |
|---|
import re
with open("test.txt") as f:
bags = {}
for line in f.readlines():
key = re.findall(r"[a-z]+ [a-z]+", line)[0]
bags[key] = {}
subs = re.findall(r"([1-9]+) ([a-z]+ [a-z]+)", line)
for count, sub in subs:
bags[key][sub] = int(count)
print(bags)
def find(key... |
# Copyright (c) 2011 OpenStack Foundation
# Copyright (c) 2012 Justin Santa Barbara
#
# 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.ap... |
//
// Many thanks to Andris Reissman
// <https://gist.github.com/andris9/94e73deef71640322c422b27cded5add>
//
const { Transform } = require('stream');
const { Headers } = require('mailsplit');
/**
* MessageSplitter instance is a transform stream that separates message headers
* from the rest of the body. Headers ar... |
# Generated by Django 2.2.17 on 2021-03-26 09:56
import django.db.models.deletion
from django.db import migrations, models
class Migration(migrations.Migration):
initial = True
dependencies = [
("environments", "0015_auto_20200916_1441"),
]
operations = [
migrations.CreateModel(
... |
<<<<<<< HEAD
# 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 requir... |
# model settings
model = dict(
type='Recognizer3D',
backbone=dict(
type='ResNet3d',
pretrained2d=False,
pretrained=None,
depth=50,
conv_cfg=dict(type='Conv3d'),
norm_eval=False,
inflate=((1, 1, 1), (1, 0, 1, 0), (1, 0, 1, 0, 1, 0), (0, 1, 0)),
zero... |
from neorl import JAYA
#Define the fitness function
def FIT(individual):
"""Sphere test objective function.
F(x) = sum_{i=1}^d xi^2
d=1,2,3,...
Range: [-100,100]
Minima: 0
"""
y=sum(x**2 for x in individual)
retu... |
#!/usr/bin/env python
"""
from a collection of files written over time, gather and plot their data
"""
import h5py
from pathlib import Path
from matplotlib.pyplot import figure, show
stem = "~/data/ec463/"
def main():
path = Path(stem).expanduser()
flist = sorted(path.glob("count*.h5"))
N = []
i = [... |
import numpy as np
import pandas as pd
from stockstats import StockDataFrame as Sdf
from finrl.config import config
class FeatureEngineer:
"""Provides methods for preprocessing the stock price data
Attributes
----------
use_technical_indicator : boolean
we technical indicator or not
... |
#!/usr/bin/env python
import os
import sys
try:
from setuptools import setup, find_packages
except ImportError:
from distutils.core import setup
if sys.argv[-1] == 'publish':
os.system('python setup.py sdist upload')
sys.exit()
readme = open('README.rst').read()
doclink = """
Documentation
--------... |
/**
* Obliterator Split Function
* ===========================
*
* Function returning an iterator over the pieces of a regex split.
*/
var Iterator = require('./iterator.js');
/**
* Function used to make the given pattern global.
*
* @param {RegExp} pattern - Regular expression to make global.
* @return {Reg... |
//
// MCOOperation.h
// mailcore2
//
// Created by Matt Ronge on 01/31/13.
// Copyright (c) 2013 __MyCompanyName__. All rights reserved.
//
#ifndef MAILCORE_MCOOPERATION_H
#define MAILCORE_MCOOPERATION_H
#import <Foundation/Foundation.h>
@interface MCOOperation : NSObject
/** Returns whether the operation is c... |
# nuScenes dev-kit.
# Code written by Holger Caesar & Oscar Beijbom, 2018.
# Licensed under the Creative Commons [see licence.txt]
import argparse
import json
import os
import random
import time
from typing import Tuple, Dict, Any
import numpy as np
import sys
sys.path.append('/home/lichao/Projects/second.pytorch')
f... |
#!/usr/bin/env python
# Generated with: /cluster/home/fabianw/bin/configJob.py --euler -N 1 -n 1 --fullnode 36 -J euler-div-kernel-512 -W 00:30
import argparse
import sys
import os
import json
import subprocess
import datetime
def parseArgs():
parser = argparse.ArgumentParser()
# strings args
parser.add_a... |
/*
+----------------------------------------------------------------------+
| Zend Engine |
+----------------------------------------------------------------------+
| Copyright (c) Zend Technologies Ltd. (http://www.zend.com) |
+---------... |
/*! jQuery v2.1.1 -ajax,-ajax/jsonp,-ajax/load,-ajax/parseJSON,-ajax/parseXML,-ajax/script,-ajax/var/nonce,-ajax/var/rquery,-ajax/xhr,-manipulation/_evalUrl,-event-alias,-offset | (c) 2005, 2014 jQuery Foundation, Inc. | jquery.org/license */
!function(a,b){"object"==typeof module&&"object"==typeof module.exports?modul... |
// The oembed module provides an oembed query service for embedding
// third-party website content, such as YouTube videos. The service includes
// enhancements and substitutes for several services that do not support
// oembed or do not support it well, and it is possible to add more by
// extending the `enhanceOembet... |
function initButtons(){
resizeButtons();
}
function checkButtons(evt){
if(bigData.registeringEvents){
for(let i=0;i<bigData.frequencyButtons.length;i++){
let butt=bigData.frequencyButtons[i];
if(evt.x>butt.x && evt.x<butt.x+butt.w){
if(evt.y>butt.y && evt.y<but... |
# Copyright 2020 PerfKitBenchmarker 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 appli... |
# Copyright 2018 The Google AI Language Team Authors and
# The HuggingFace Inc. team.
# Copyright (c) 2020, NVIDIA CORPORATION. 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 Lice... |
// const path = require('path');
// const express = require('express');
// const exphbs = require('express-handlebars');
// const app = express();
// const PORT = process.env.PORT || 3003;
// const sequelize = require('./config/connection');
// const hbs = exphbs.create({});
// app.engine('handlebars', hbs.engine);... |
import React from "react";
import "./portfolio.css";
import Gallery from "../../components/Gallery";
import CategoryList from "../../components/CategoryList";
import { useSpring, animated } from "react-spring";
function Portfolio() {
const propsMove = useSpring({
opacity: 1,
from: { opacity: 0 },
config:... |
var assert = require('assert');
var debug = require('debug')('supervisor:test');
var dgram = require('dgram');
var send = require('../lib/metrics');
var logger = {
info: debug.bind(null, 'INFO'),
warn: debug.bind(null, 'WARN'),
};
var metrics = {
send: send,
logger: logger,
};
describe('metrics', function() ... |
function Subject() {
this.observers = [];
}
Subject.prototype = {
subscribe: function(fn) {
this.observers.push(fn);
},
unsubscribe: function(fn) {
this.observers = this.observers.filter(f => f !== fn);
},
emit: function(msg) {
this.observers.forEach(function(fn) {
... |
import os
import signal
import asyncio
import math
from nats.aio.client import Client as Nats
import datetime
import time
import edgefarm_application as ef
from edgefarm_application.base.schema import schema_load_builtin
from edgefarm_application.base.avro import schemaless_encode
nc = None
nats_topic = "service.acc... |
const Sync = require('../sync');
describe('Testing class first method - .compress()', () => {
metil = new Sync();
beforeEach(() => {
arrayTestData = ['str', '', 1, false, NaN, false, null];
});
afterAll(() => {
metil = new Sync();
});
test('working array must be editable', () => {
arrayTestD... |
"""
Based on conv_resmlp, remove conv before large Conv.
"""
import torch
import numpy as np
from torch import nn
from einops.layers.torch import Rearrange
class Aff(nn.Module):
def __init__(self, dim):
super().__init__()
self.alpha = nn.Parameter(torch.ones([1, 1, dim]))
self.beta = nn.Pa... |
from django.urls import path
from . import views
# routed from e/macid/userauthapp/
urlpatterns = [
path('adduser/', views.add_user , name = 'userauth-add_user') ,
path('loginuser/', views.login_user , name = 'userauth-login_user') ,
path('isauth/', views.is_auth , name = 'userauth-is_auth') ,
path('lo... |
# -*- coding: utf-8 -*-
import logging
import time
from typing import Dict
from typing import Hashable
from typing import List
from typing import Optional
from typing import Union
from .constraint import Constraint
from .failure import SolverFailure
from .incompatibility import Incompatibility
from .incompatibility_c... |
import React from 'react';
import _ from 'lodash';
import moment from 'moment-strftime';
import {graphql} from 'gatsby';
import {Layout} from '../components/index';
import {toStyleObj, withPrefix, getPages, Link} from '../utils';
// this minimal GraphQL query ensures that when 'gatsby develop' is running,
// any chan... |
# Factorial, works!!
def fact(x):
if x <=0:
print 'Answer not found'
return
ans = 1
while x > 1:
ans = ans*x
x -= 1
return ans
print ans
|
import React from "react"
import styled from "styled-components"
import { useStaticQuery, graphql } from "gatsby"
const Preview = () => {
const data = useStaticQuery(graphql`
{
allMarkdownRemark(
filter: {
frontmatter: {
templateKey: { eq: "page" }
slug: { eq: "hom... |
import octiconChevronDown from '../../public/img/svg/octicon-chevron-down.svg';
import octiconChevronRight from '../../public/img/svg/octicon-chevron-right.svg';
import octiconGitMerge from '../../public/img/svg/octicon-git-merge.svg';
import octiconGitPullRequest from '../../public/img/svg/octicon-git-pull-request.svg... |
function submitForm() {
var ajaxRequest = new XMLHttpRequest();
ajaxRequest.onreadystatechange = function () {
var successContent = document.getElementById('shortLink');
var errorContent = document.getElementById('errorContainer');
// Clear previous output
successContent.inner... |
# Copyright 2021 AI Singapore
#
# 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... |
const mongoose = require("mongoose");
const chalk = require("chalk");
const connectDBMongoose = async () => {
try {
await mongoose.connect(
`mongodb+srv://${process.env.USER}:${process.env.PASSWORD}@cluster.hblwp.mongodb.net/MatchingApp?retryWrites=true&w=majority`,
{
... |
//
// MMChatsTableCellView+hook.h
// WeChatPlugin
//
// Created by TK on 2017/9/15.
// Copyright © 2017年 tk. All rights reserved.
//
#import <Cocoa/Cocoa.h>
@interface NSObject (MMChatsTableCellViewHook)
+ (void)hookMMChatsTableCellView;
@end
|
#!/usr/bin/env python
__author__ = 'Minglong Li'
import sys
sys.path.append("~/catkin_ws/src/multi_robot_patrol/scripts/basic_support")
from robot_patrol_area_0 import RobotPatrolArea0
from robot_patrol_area_1 import RobotPatrolArea1
from robot_patrol_area_2 import RobotPatrolArea2
ob1 = RobotPatrolArea0()
ob2 = Ro... |
from pymedphys._imports import numpy as np
def running_mean(x, N):
out = np.zeros_like(x, dtype=np.float64)
dim_len = x.shape[0]
for i in range(dim_len):
if N % 2 == 0:
a, b = i - (N - 1) // 2, i + (N - 1) // 2 + 2
else:
a, b = i - (N - 1) // 2, i + (N - 1... |
# encoding: utf-8
from libs.template import st
_q_exports = []
def _q_index(request):
t_shirts = [
['1994842254', 'normal系'],
['1994842218', '黑色系'],
['1994842153', '粉色系'],
['1994842093', '低调系'],
]
return st('shop.html', **locals())
|
from tools import bracketting, score, op_map
def solve_greedy(inp=[10, 11, 12, 13], goal=24):
inp.sort(reverse=True)
expr = str(inp[0])
size = len(inp)
for i in range(1, size):
candidate = []
candidate.append(('+' + str(inp[i]), 5))
candidate.append(('-' + str(inp[i]), 4))
... |
Ext.define('Ext.locale.zh_CN.data.validator.Currency', {
override: 'Ext.data.validator.Currency',
config: {
message: '不是有效的货币金额'
}
});
|
#pragma once
#include "Common.h"
#include <iostream>
class GA :public Solver {
using Individual = Solution;
using Population = std::vector<Individual>;
public:
GA(std::shared_ptr<GraphT> graph, size_t iterationSize, size_t populationSize)
:Solver(graph), m_iterationCount(iterationSize), m_populationSize(popula... |
from setuptools import setup, find_packages
import pathlib
import os
here = pathlib.Path(__file__).parent.resolve()
long_description = (here / 'README_pypi.md').read_text(encoding='utf-8')
setup(
name='graphnet',
version=os.environ['GRAPHNET_VERSION'],
description='A python library for graph manipulati... |
sales_group = """
with sales_result as (select s.invoiceno,
strftime("%Y-%m-%d", julianday(s.invoicedate, 'start of month')) as month_sale,
s.customerid,
s.amount,
c.month_cohort
... |
# coding: utf-8
"""
Copyright 2016 SmartBear Software
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... |
from .config import sample_data
from .context import pandas_ta
from unittest import TestCase
from pandas import DataFrame
class TestMomentumExtension(TestCase):
@classmethod
def setUpClass(cls):
cls.data = sample_data
@classmethod
def tearDownClass(cls):
del cls.data
def setUp... |
const options = {
dragging: false,
touchZoom: false,
doubleClickZoom: false,
scrollWheelZoom: false,
zoomControl: false
}
//Pegar valores de latitude e longitude do html
const lat = document.querySelector('span[data-lat]').dataset.lat;
const lng = document.querySelector('span[data-lng]').dataset.ln... |
#!/usr/bin/python
'''Script that creates a graph for the classification accuracy vs. data processed.
'''
usage='PlotDataProcessedGraph.py'
import roslib; roslib.load_manifest('hima_experiment')
import rospy
from pylab import *
import numpy as np
from optparse import OptionParser
import math
import re
import os.path
im... |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# (c) 2012, Jeroen Hoekx <jeroen@hoekx.be>
#
# This file is part of Ansible
#
# Ansible is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the Licens... |
"""
Copyright (C) 2018 NVIDIA Corporation. All rights reserved.
Licensed under the CC BY-NC-SA 4.0 license (https://creativecommons.org/licenses/by-nc-sa/4.0/legalcode).
"""
from torch import nn
from torch.autograd import Variable
import torch
import torch.nn.functional as F
try:
from itertools import izip as zip
... |
const { gql } = require('apollo-server-express');
// GraphQL schema language로 schema를 구성
module.exports = gql`
scalar DateTime
type Note {
id: ID!
content: String!
author: User!
favoriteCount: Int!
favoritedBy: [User]
createdAt: DateTime!
updatedAt: Date... |
// 2
'use strict';
module.exports = {
async up(queryInterface, Sequelize) {
await queryInterface.createTable('tipoSangre', {
id: {
allowNull: false,
autoIncrement: true,
primaryKey: true,
unique: true,
type: Sequeliz... |
#!/usr/bin/env python
# Currently using raw requests, but could potentially switch to using
# the AGPLv3 https://github.com/jpmml/openscoring-python
# convenience wrapper instead
import requests
import json
# For the OpenShift demo instance, models are uploaded via the
# git repo, rather than via
base_url = "http://o... |
import React, { Component } from 'react';
import ReactDOM from 'react-dom';
import {Link} from 'react-router-dom'
export default class Navbar_guest extends Component {
render() {
return (
<ul className="nav navbar-nav navbar-right">
<li><a href="#">Link</a></li>
... |
import matplotlib.pyplot as plt
import pandas as pd
MARKERS = ["o", "D"]
CLASS = {0: 'Negative', 1: 'Positive'}
CLASS2 = {'Negative': 0, 'Positive': 1}
def normalize_data(X, type='rescale'):
# Normalizing data
if type == 'rescale':
# Rescale data (between 0 and 1)
from sklearn.preprocessing i... |
# coding: utf-8
"""
Kubernetes
No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) # noqa: E501
The version of the OpenAPI document: release-1.16
Generated by: https://openapi-generator.tech
"""
import pprint
import re # noqa: F401
import si... |
import re
import string
import os.path
punctuations = string.punctuation
locPath = os.path.abspath(os.path.dirname(__file__))
curPath2 = os.path.join(locPath, "data/redmed_phrases.txt")
class textHandler():
def __init__(self, phrasePath=curPath2):
self.phrases = set()
with open(
phr... |
const path = require('path');
const rcNodeBack = require('cli-rc');
const denodeify = require('denodeify');
const entries = require('core-js/fn/object/entries');
const merge = require('lodash').merge;
const rc = denodeify(rcNodeBack);
const loaders = [
{
name: '.jsonlintrc',
process: config => config
},
{
na... |
const core = require('@actions/core')
const yaml = require('js-yaml')
const fs = require('fs')
const os = require('os')
const exec = require('@actions/exec').exec
const path = require('path')
const process = require('process')
async function executeNoCatch (command) {
await exec('bash', ['-c', command])
}
async fun... |
/*
* This header is generated by classdump-dyld 1.5
* on Wednesday, October 27, 2021 at 3:23:28 PM Mountain Standard Time
* Operating System: Version 13.5.1 (Build 17F80)
* Image Source: /System/Library/PrivateFrameworks/NanoTim... |
const people = ['Kookla','Fran','Ollie'];
const stuff = {
tv: 'huge',
radio: 'old',
toothbrush: 'frayed',
cars: ['Toyota','Mazda']
}
let state = {people, stuff};
let newPeople = ['Odie', ...people, 'Garfield'];
const newStuff = {...stuff, cars:[...stuff.cars, 'Thing']};
let newState = {people:['Odie', ...peo... |
/*
Copyright (c) 2003-2013, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.html or http://ckeditor.com/license
*/
CKEDITOR.plugins.setLang( 'pagebreak', 'km', {
alt: 'Page Break', // MISSING
toolbar: 'បន្ថែម ការផ្តាច់ទំព័រ'
});
|
/*
* Components - Loader
*/
import when from '../../_snowpack/pkg/once-defined.js'
when('uce-lib').then(({ define, render, html, svg, css }) => {
define('c-loader', {
styles: css`
:host {
--loader-color-bg: var(--color-bg);
}
:host,
::slotted(*) {
... |
"""
Copyright 2016 Google Inc.
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
di... |
"""
Checks raw dataset volume
"""
import os
import unittest
import pytest
from constants import ASSETS_PATH
class VolumeBasicCheckTest(unittest.TestCase):
"""
Checks folder volume is appropriate
"""
@pytest.mark.mark4
@pytest.mark.mark6
@pytest.mark.mark8
@pytest.mark.mark10
@pytes... |
require("dotenv").config();
let defaultConfig = {
host: process.env.REDIS_HOST,
port: process.env.REDIS_PORT
};
if (process.env.REDISCLOUD_URL) {
defaultConfig = process.env.REDISCLOUD_URL;
}
module.exports = defaultConfig; |
# -*- coding: utf-8 -*-
# Copyright 2015, 2016 OpenMarket 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... |
import cv2
from PIL import Image
import torch
from torch.autograd import Variable
from networks import *
import numpy as np
from preprocess import *
from pathlib import Path
# from .postprocess import *
class Spinny_Shadow:
def __init__(self):
self.preprocess=Preprocess()
# self.postprocess=Postpr... |
import math
import torch
import numpy as np
import torch.nn as nn
import torch.nn.functional as F
from torch.nn import init
from collections import OrderedDict
import time
from . import model_utils
import logging
BatchNorm2d = nn.BatchNorm2d
bn_mom = 0.1
def conv3x3(in_planes, out_planes, stride=1):
"""3x3 c... |
import keras
from webdnn.frontend.keras.converter import KerasConverter
from webdnn.graph.variables.attributes.input import Input
from webdnn.graph.variables.attributes.output import Output
@KerasConverter.register_handler("Model")
@KerasConverter.register_handler("Sequential")
def _convert_model(converter: KerasCon... |
import pytest
import parse_vcf as pv
####################
### get_file() ###
####################
def test_get_file():
# There is a list of files to parse in the main script
# test to make sure a file is opened and returns a list
# Doesn't test any error handling, there isn't any
asse... |
import moment from 'moment';
import momentJalali from 'moment-jalali-date';
import toMomentObject from './toMomentObject';
import {ISO_MONTH_FORMAT} from '../../constants';
export default function toISOMonthString(date, currentFormat) {
var dateObj;
if (moment.locale() == 'fa')
dateObj = momentJalali.... |
// SPDX-License-Identifier: GPL-2.0
//
// Copyright 2011 Freescale Semiconductor, Inc. All Rights Reserved.
//
// Refer to drivers/dma/imx-sdma.c
#include <linux/init.h>
#include <linux/types.h>
#include <linux/mm.h>
#include <linux/interrupt.h>
#include <linux/clk.h>
#include <linux/wait.h>
#include <linux/sched.h>
#... |
export { default, camelize } from 'bitbird-core-ember-helpers/helpers/camelize';
|
__all__ = [
'base',
'agency',
'fare_attribute',
'fare_rule',
'feed_info',
'frequency',
'route',
'service',
'service_update',
'point',
'stop',
'stop_time',
'transfer',
'trip',
]
from gtfs_util.static.models import (
base,
agency,
fare_attribute,
fa... |
n1 = float(input("Digite um número:" ))
n2 = float(input("Digite um número: "))
print("O resultado da soma é: ", n1 + n2) |
class HaltException {
}
export default HaltException
|
import reqwest from 'reqwest';
import getFeedInstance from '../utils/singleton';
const feedInstance = getFeedInstance();
const getPagingData = url => reqwest({ url });
const iterateData = (data, type) => data.forEach(item => feedInstance.add({ user: item.from || item, type }));
export async function collectDataWith... |
from tests import ScraperTest
from recipe_scrapers.ohsheglows import OhSheGlows
class TestOhSheGlowsScraper(ScraperTest):
scraper_class = OhSheGlows
def test_host(self):
self.assertEqual(
'ohsheglows.com',
self.harvester_class.host()
)
def test_image(self):
... |
from .base import * # noqa
from .base import env
# GENERAL
# ------------------------------------------------------------------------------
# https://docs.djangoproject.com/en/dev/ref/settings/#secret-key
SECRET_KEY = env('DJANGO_SECRET_KEY')
# https://docs.djangoproject.com/en/dev/ref/settings/#allowed-hosts
ALLOWED... |
/*
* Licensed to Elasticsearch B.V. under one or more contributor
* license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright
* ownership. Elasticsearch B.V. licenses this file to you under
* the Apache License, Version 2.0 (the "License"); you may
* not u... |
import { mount } from '@vue/test-utils';
import { cloneDeep } from 'lodash';
import { format } from 'timeago.js';
import DeleteComponent from '~/environments/components/environment_delete.vue';
import EnvironmentItem from '~/environments/components/environment_item.vue';
import PinComponent from '~/environments/compone... |
import {Map} from "immutable";
export const ERROR_CONST_MISMATCH = 'const-mismatch';
/**
*
* @param type
* @param _const
* @param value
* @return {boolean|boolean}
*/
export const validateConst = (type, _const, value) => {
return typeof _const === 'undefined' || typeof value === 'undefined' || (
(t... |
# Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
"""Data loader."""
import os
from xcom.core.config import cfg
from xcom.datasets.cifar10 import xcom_Cifar10
from xcom.datasets.imagenet imp... |
'''
Train GAN, Pre-CNN, and DRE. Generate synthetic data.
'''
print("\n ===================================================================================================")
#----------------------------------------
import argparse
import os
import timeit
import torch
import torchvision
import torchvision.transform... |
# -*- coding: utf-8 -*-
__version__ = '0.7.2'
|
import os
import numpy as np
import pytest
import torch
import torchani
from torch import nn
from ael import constants, loaders, models, utils
np.random.seed(42)
torch.manual_seed(42)
device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
# Radial coefficients
RcR = 5.2
EtaR = torch.tensor([16.0], d... |
# -*- coding: utf-8 -*-
'''
The module used to execute states in salt. A state is unlike a module
execution in that instead of just executing a command it ensure that a
certain state is present on the system.
The data sent to the state calls is as follows:
{ 'state': '<state module name>',
'fun': '<state fun... |
""" Test for the core code of the method module
"""
import numpy as np
import adafdr.method as md
import adafdr.data_loader as dl
def test_method_init():
""" test for md.method_init
"""
p, x, h, n_full, _ = dl.load_2d_bump_slope(n_sample=20000)
a, mu, sigma, w = md.method_init(p, x, 2, alpha=0.1, n_ful... |
var module = angular.module('ui.select.pages', ['plunkr']);
|
# Copyright (c) LinkedIn Corporation. All rights reserved. Licensed under the BSD-2 Clause license.
# See LICENSE in the project root for license information.
def init(application, config):
from . import teams, team, team_summary, team_oncall, team_changes
application.add_route('/api/v0/teams', teams)
app... |
from unittest.mock import patch
from django.core.management import call_command
from django.db.utils import OperationalError
from django.test import TestCase
class CommandTests(TestCase):
def tet_wait_for_db_ready(self):
"""Test waiting for db is available"""
with patch('django.db.utils.Connecti... |
page('/', ArticleObj.checkLocal, control.viewArticle);
page('/about', control.viewAbout, gitControl.getRepo, control.renderRepos);
page('*', function() {
console.error('Page Cannot Be Found.');
});
page();
|
from django.db import models
from zebra import mixins
from zebra.conf import options
class StripeCustomer(models.Model, mixins.StripeMixin, mixins.StripeCustomerMixin):
stripe_customer_id = models.CharField(max_length=50, blank=True, null=True)
class Meta:
abstract = True
def __unicode__(self):... |
import sys
sys.path.append('gen')
from dataclasses import dataclass
from datetime import datetime
from google.protobuf.timestamp_pb2 import Timestamp
from models import constants
from models.base_classes import InstrumentType, Currency, Money
from datetime import datetime
import instruments_pb2
import instruments_pb2_... |
let htmlArr2 = [
"./DS-n-Algos/Arrays/all/all.html",
"./DS-n-Algos/Arrays/all/Array.prototype.every().html",
"./DS-n-Algos/Arrays/all/boolean-constructor.html",
"./DS-n-Algos/Arrays/AllUnique/test/scrap.html",
"./DS-n-Algos/Arrays/flatten/flatten1.html",
"./DS-n-Algos/Arrays/flatten/flatten2.html",
"./DS-... |
import torch
from torch import nn as nn
from ove.utils.arch import default_init_weights, make_layer
from ove.utils.modeling import Sequential
class ResidualDenseBlock(nn.Module):
def __init__(self, num_feat=64, num_grow_ch=32):
super().__init__()
relu = nn.LeakyReLU(negative_slope=0.2, inplace=Tr... |
"""
File : init_test_db.py
Date : April, 2017
Author : eugene liyai
Desc : initialize test database
"""
# ============================================================================
# necessary imports
# ============================================================================
import os
from buc... |
# -*- coding: utf-8 -*-
# Copyright 2011 Takeshi KOMIYA
#
# 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... |