text stringlengths 16 4.96k | positive stringlengths 321 2.24k | negative stringlengths 310 2.21k |
|---|---|---|
Enable KeepAlives and set timeout in http transport. | package s3gof3r
import (
"net"
"net/http"
"time"
)
type deadlineConn struct {
Timeout time.Duration
net.Conn
}
func (c *deadlineConn) Read(b []byte) (n int, err error) {
if err = c.Conn.SetDeadline(time.Now().Add(c.Timeout)); err != nil {
return
}
return c.Conn.Read(b)
}
func (c *deadlineConn) Write(b []b... | package s3gof3r
import (
"net"
"net/http"
"time"
)
type deadlineConn struct {
Timeout time.Duration
net.Conn
}
func (c *deadlineConn) Read(b []byte) (n int, err error) {
if err = c.Conn.SetDeadline(time.Now().Add(c.Timeout)); err != nil {
return
}
return c.Conn.Read(b)
}
func (c *deadlineConn) Write(b []b... |
Add the new timeline fields to the javascript that helps with entering dates. | /* Copyright 2013 the Melange 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... | /* Copyright 2013 the Melange 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... |
Change copyright in Apache 2 license to 2013 | /**
* Copyright © 2011-2013 EMBL - European Bioinformatics Institute
*
* 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 © 2011-2012 EMBL - European Bioinformatics Institute
*
* 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... |
Fix picking invalid env variable for tests | import os
import dj_database_url
import pytest
from django.conf import settings
pytest_plugins = [
"saleor.tests.fixtures",
"saleor.plugins.tests.fixtures",
"saleor.graphql.tests.fixtures",
"saleor.graphql.channel.tests.fixtures",
"saleor.graphql.account.tests.benchmark.fixtures",
"saleor.grap... | import os
import dj_database_url
import pytest
from django.conf import settings
pytest_plugins = [
"saleor.tests.fixtures",
"saleor.plugins.tests.fixtures",
"saleor.graphql.tests.fixtures",
"saleor.graphql.channel.tests.fixtures",
"saleor.graphql.account.tests.benchmark.fixtures",
"saleor.grap... |
Use headless Firefox for Protractor tests
(see https://github.com/angular/protractor/blob/master/docs/browser-setup.md) | 'use strict'
exports.config = {
directConnect: true,
allScriptsTimeout: 80000,
specs: [
'test/e2e/*.js'
],
capabilities: {
browserName: 'firefox',
'moz:firefoxOptions': {
args: [ "--headless" ]
}
},
baseUrl: 'http://localhost:3000',
framework: 'jasmine2',
jasmineNodeOpts: ... | 'use strict'
exports.config = {
directConnect: true,
allScriptsTimeout: 80000,
specs: [
'test/e2e/*.js'
],
capabilities: {
'browserName': 'chrome'
},
baseUrl: 'http://localhost:3000',
framework: 'jasmine2',
jasmineNodeOpts: {
showColors: true,
defaultTimeoutInterval: 80000
},
... |
Add a protected $finfo variable for testing. | <?php
namespace Estey\EvernoteOCR;
use Finfo;
/**
* File
*
* A simple local file class.
*/
class File
{
/**
* File path.
* @var string
*/
protected $path;
/**
* Finfo.
* @var Finfo
*/
protected $finfo;
/**
* Set the file path.
*
* @param string... | <?php
namespace Estey\EvernoteOCR;
use Finfo;
/**
* File
*
* A simple local file class.
*/
class File
{
/**
* File path.
* @var string
*/
protected $path;
/**
* Set the file path.
*
* @param string $path
* @return $this
*/
public function setPath($path)
... |
Add builtAssets to webserver-writable dirs | #!/usr/bin/env python
"""
Set the file permissions appropriately for deployment. Call with the argument
of the webserver user (e.g. 'www-data') that should have permissions to uploads
and log files.
"""
import os
import sys
import subprocess
server_writable_directories = [
"vendor/solr/apache-solr-4.0.0/example/s... | #!/usr/bin/env python
"""
Set the file permissions appropriately for deployment. Call with the argument
of the webserver user (e.g. 'www-data') that should have permissions to uploads
and log files.
"""
import os
import sys
import subprocess
server_writable_directories = [
"vendor/solr/apache-solr-4.0.0/example/s... |
Fix how `HTMLElement.prototype` is set. | /**
* @license
* Copyright (c) 2016 The Polymer Project Authors. All rights reserved.
* This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt
* The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt
* The complete set of contributors may be f... | /**
* @license
* Copyright (c) 2016 The Polymer Project Authors. All rights reserved.
* This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt
* The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt
* The complete set of contributors may be f... |
Add beat 2 video and description | module.exports = [
{
"direct": "https://d24kjznqej0s8a.cloudfront.net/2016/encryption_campaign/moz.final.3.emailpartner_1",
"social": "https://d24kjznqej0s8a.cloudfront.net/2016/encryption_campaign/moz.final.2.social_3",
"title": "Privacy Lets You Be You",
"description": "Privacy d... | module.exports = [
{
"direct": "https://d24kjznqej0s8a.cloudfront.net/2016/encryption_campaign/moz.final.3.emailpartner_1",
"social": "https://d24kjznqej0s8a.cloudfront.net/2016/encryption_campaign/moz.final.2.social_3",
"title": "Privacy Lets You Be You",
"description": "Privacy d... |
Allow use of GoogleMaps plugin without Multilingual support | from django.conf import settings
from cms.plugin_pool import plugin_pool
from cms.plugin_base import CMSPluginBase
from django.utils.translation import ugettext_lazy as _
from cms.plugins.googlemap.models import GoogleMap
from cms.plugins.googlemap.settings import GOOGLE_MAPS_API_KEY
from django.forms.widgets import Me... | from cms.plugin_pool import plugin_pool
from cms.plugin_base import CMSPluginBase
from django.utils.translation import ugettext_lazy as _
from cms.plugins.googlemap.models import GoogleMap
from cms.plugins.googlemap.settings import GOOGLE_MAPS_API_KEY
from cms.plugins.googlemap import settings
from django.forms.widgets... |
Update ptvsd version number for 2.1 RTM | #!/usr/bin/env python
#-------------------------------------------------------------------------
# Copyright (c) Microsoft. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the ... | #!/usr/bin/env python
#-------------------------------------------------------------------------
# Copyright (c) Microsoft. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the ... |
Remove the `cache` prefix from the url | var express = require('express'),
app = express(),
compress = require('compression'),
bodyParser = require('body-parser'),
redisHelper = require('./helpers/redis'),
requestHelper = require('./helpers/request');
require('colors');
app.use(bodyParser.json());
app.use(compress());
var port = process... | var express = require('express'),
app = express(),
compress = require('compression'),
bodyParser = require('body-parser'),
redisHelper = require('./helpers/redis'),
requestHelper = require('./helpers/request');
require('colors');
app.use(bodyParser.json());
app.use(compress());
var port = process... |
Add commentary explaining and/or lists | from pyparsing import *
from ...constants.math.deff import NUM, FULLNUM
from ...constants.zones.deff import TOP, BOTTOM
from ...constants.verbs.deff import *
from ...mana.deff import color
from ...types.deff import nontype, supertype
from ...functions.deff import delimitedListAnd, delimitedListOr
from decl import *
... | from pyparsing import *
from ...constants.math.deff import NUM, FULLNUM
from ...constants.zones.deff import TOP, BOTTOM
from ...constants.verbs.deff import *
from ...mana.deff import color
from ...types.deff import nontype, supertype
from ...functions.deff import delimitedListAnd, delimitedListOr
from decl import *
... |
Use ember getter/setters the correct way | var SortHeaderView = Ember.View.extend({
tagName: 'th',
classNameBindings: ['asc', 'desc', 'sorted'],
classNames: ['sortable'],
attributeBindings: ['style'],
style: "cursor: pointer",
asc: false,
desc: false,
sorted: false,
sortField: "",
init: function() {
var headerList = this.get('controller.sortHeaderLi... | var SortHeaderView = Ember.View.extend({
tagName: 'th',
classNameBindings: ['asc', 'desc', 'sorted'],
classNames: ['sortable'],
attributeBindings: ['style'],
style: "cursor: pointer",
asc: false,
desc: false,
sorted: false,
sortField: "",
init: function() {
var headerList = this.get('controller').get('sortH... |
Disable query string auth for django compressor. | from firecares.settings.base import *
INSTALLED_APPS = (
'django_statsd',
) + INSTALLED_APPS
STATSD_HOST = 'stats.garnertb.com'
STATSD_PREFIX = 'firecares'
STATSD_PATCHES = [
'django_statsd.patches.db',
'django_statsd.patches.cache',
]
MIDDLEWARE_CLASSES = (
'django_statsd.middleware.GraphiteRequest... | from firecares.settings.base import *
INSTALLED_APPS = (
'django_statsd',
) + INSTALLED_APPS
STATSD_HOST = 'stats.garnertb.com'
STATSD_PREFIX = 'firecares'
STATSD_PATCHES = [
'django_statsd.patches.db',
'django_statsd.patches.cache',
]
MIDDLEWARE_CLASSES = (
'django_statsd.middleware.GraphiteRequest... |
Add messages to rooms objects | const getRoomData = require('../db/controllers/getRoomIdsAndUserIdsGivenSelfId.js');
const getBasicInfo = require('../db/controllers/getUserBasicInfoGivenUserId.js');
const helpers = require('../db/controllers/helpers.js');
const getUsersInfoForRoom = (roomObj) =>
getBasicInfo.bulk(roomObj.users)
.then(helpers.plu... | const getRoomData = require('../db/controllers/getRoomIdsAndUserIdsGivenSelfId.js');
const getBasicInfo = require('../db/controllers/getUserBasicInfoGivenUserId.js');
const helpers = require('../db/controllers/helpers.js');
const getUsersInfoForRoom = (roomObj) =>
getBasicInfo.bulk(roomObj.users)
.then(helpers.plu... |
Add check that heartbeat timeout is integer | import os
import platform
import sys
import click
prog = os.path.basename(sys.argv[0])
@click.command('heartbeat', short_help='Send a heartbeat')
@click.option('--origin', default='{}/{}'.format(prog, platform.uname()[1]))
@click.option('--tag', '-T', 'tags', multiple=True)
@click.option('--timeout', metavar='EXPIR... | import os
import platform
import sys
import click
prog = os.path.basename(sys.argv[0])
@click.command('heartbeat', short_help='Send a heartbeat')
@click.option('--origin', default='{}/{}'.format(prog, platform.uname()[1]))
@click.option('--tag', '-T', 'tags', multiple=True)
@click.option('--timeout', metavar='EXPIR... |
Improve service and error handling a bit | function SearchService ($http, $route) {
var omdbUrl = 'http://www.omdbapi.com/';
var apiUrl = 'http://localhost:3020/';
var SearchService = {};
SearchService.loading = false;
SearchService.getMovieByTitle = function (title) {
return $http.get(omdbUrl + '?s=' + title)
.success(function (data) {
... | function SearchService ($http) {
var omdbUrl = 'http://www.omdbapi.com/';
var apiUrl = 'http://localhost:3020/';
var Search = {};
SearchService.loading = false;
SearchService.getMovieByTitle = function (title) {
return $http.get(omdbUrl + '?s=' + title)
.success(function (data) {
if (!... |
Use single Executor for all tests
... so it doesn't leak for every test. | /**
* Copyright 2014 Netflix, 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 i... | /**
* Copyright 2014 Netflix, 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 i... |
Fix typo in repository name validator errors | package repository
import (
"fmt"
"gopkg.in/asaskevich/govalidator.v6"
)
func ValidateCreate(r *Repository) error {
if err := validateName(r.Name); err != nil {
return err
}
if err := validateDescription(r.Description); err != nil {
return err
}
if err := validateWebsite(r.Website); err != nil {
retur... | package repository
import (
"fmt"
"gopkg.in/asaskevich/govalidator.v6"
)
func ValidateCreate(r *Repository) error {
if err := validateName(r.Name); err != nil {
return err
}
if err := validateDescription(r.Description); err != nil {
return err
}
if err := validateWebsite(r.Website); err != nil {
retur... |
Stop Loading... component displaying from react-komposer | import { compose, composeWithTracker } from 'react-komposer'
import { inject } from '@mindhive/di'
const Empty = () => null
export const withAsync = (asyncFunc, shouldResubscribe) =>
compose(
inject((appContext, ownProps, onData) => {
const pushProps = (props = {}) =>
onData(null, props)
as... | import { compose, composeWithTracker } from 'react-komposer'
import { inject } from '@mindhive/di'
export const withAsync = (asyncFunc, shouldResubscribe) =>
compose(
inject((appContext, ownProps, onData) => {
const pushProps = (props = {}) =>
onData(null, props)
asyncFunc(appContext, pushPr... |
Make \r in topics optional | package de.tuberlin.dima.schubotz.fse.mappers;
import eu.stratosphere.api.java.functions.FlatMapFunction;
import eu.stratosphere.util.Collector;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
/**
* Cleans main task queries. TODO find way to do this using stratosphere built in da... | package de.tuberlin.dima.schubotz.fse.mappers;
import eu.stratosphere.api.java.functions.FlatMapFunction;
import eu.stratosphere.util.Collector;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
/**
* Cleans main task queries. TODO find way to do this using stratosphere built in da... |
Use single quotes for strings | # -*- coding: utf-8; -*-
#
# The MIT License (MIT)
#
# Copyright (c) 2014 Flavien Charlon
#
# 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 t... | # -*- coding: utf-8; -*-
#
# The MIT License (MIT)
#
# Copyright (c) 2014 Flavien Charlon
#
# 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 t... |
Set optional class on map widget if class attribute passed | from django.forms import widgets
from django.utils.safestring import mark_safe
class MapWidget(widgets.HiddenInput):
"""Custom map widget for displaying interactive google map to geocode
addresses of learning centers.
This widget displays a readonly input box to store lat+lng data, an empty
help div,... | from django.forms import widgets
from django.utils.safestring import mark_safe
class MapWidget(widgets.HiddenInput):
"""Custom map widget for displaying interactive google map to geocode
addresses of learning centers.
This widget displays a readonly input box to store lat+lng data, an empty
help div,... |
ADD base location to logos as it is necesary for security rules | # -*- coding: utf-8 -*-
{
'name': 'Logos Set Up Data',
'version': '1.0',
'category': 'Accounting',
'sequence': 14,
'summary': '',
'description': """
Logos Set Up Data
=====================
""",
'author': 'Ingenieria ADHOC',
'website': 'www.ingadhoc.com',
'images': [
],
'... | # -*- coding: utf-8 -*-
{
'name': 'Logos Set Up Data',
'version': '1.0',
'category': 'Accounting',
'sequence': 14,
'summary': '',
'description': """
Logos Set Up Data
=====================
""",
'author': 'Ingenieria ADHOC',
'website': 'www.ingadhoc.com',
'images': [
],
'... |
Add eol id to expectation | <?php
namespace Tests\AppBundle\API\Details;
use Symfony\Component\HttpFoundation\ParameterBag;
use Tests\AppBundle\API\WebserviceTestCase;
class OrganismTest extends WebserviceTestCase
{
public function testExecute()
{
$default_db = $this->default_db;
$session = null;
$organisms = $... | <?php
namespace Tests\AppBundle\API\Details;
use Symfony\Component\HttpFoundation\ParameterBag;
use Tests\AppBundle\API\WebserviceTestCase;
class OrganismTest extends WebserviceTestCase
{
public function testExecute()
{
$default_db = $this->default_db;
$session = null;
$organisms = $... |
Select all when editing in angular-xeditable by default | var app = angular.module('swot', [
'ui.bootstrap',
'ui.utils',
'ui.sortable',
'focus',
'confirmExit',
'ngDebounce',
'ngAnimate',
'xeditable',
'angularBootstrapNavTree'
]);
app.config(['$httpProvider', function ($httpProvider) {
// Add support for HTTP PATCH verb for sending part... | var app = angular.module('swot', [
'ui.bootstrap',
'ui.utils',
'ui.sortable',
'focus',
'confirmExit',
'ngDebounce',
'ngAnimate',
'xeditable',
'angularBootstrapNavTree'
]);
app.config(['$httpProvider', function ($httpProvider) {
// Add support for HTTP PATCH verb for sending part... |
Update libchromiumcontent to disable zygote process | #!/usr/bin/env python
import platform
import sys
BASE_URL = 'http://gh-contractor-zcbenz.s3.amazonaws.com/libchromiumcontent'
LIBCHROMIUMCONTENT_COMMIT = 'c01b10faf0d478e48f537210ec263fabd551578d'
ARCH = {
'cygwin': '32bit',
'darwin': '64bit',
'linux2': platform.architecture()[0],
'win32': '32bit',
}... | #!/usr/bin/env python
import platform
import sys
BASE_URL = 'http://gh-contractor-zcbenz.s3.amazonaws.com/libchromiumcontent'
LIBCHROMIUMCONTENT_COMMIT = '26dd65a62e35aa98b25c10cbfc00f1a621fd4c4b'
ARCH = {
'cygwin': '32bit',
'darwin': '64bit',
'linux2': platform.architecture()[0],
'win32': '32bit',
}... |
Add helpers.js to ignore from tests | var gulp = require('gulp');
var mocha = require('gulp-mocha');
var istanbul = require('gulp-istanbul');
var eslint = require('gulp-eslint');
var coveralls = require('gulp-coveralls');
gulp.task('pre-test', function () {
return gulp.src(['lib/**/*.js', '!lib/micro-whalla.js', '!lib/helpers.js'])
.pipe(istanbul({ ... | var gulp = require('gulp');
var mocha = require('gulp-mocha');
var istanbul = require('gulp-istanbul');
var eslint = require('gulp-eslint');
var coveralls = require('gulp-coveralls');
gulp.task('pre-test', function () {
return gulp.src(['lib/**/*.js', '!lib/micro-whalla.js'])
.pipe(istanbul({ includeUntested: tr... |
Refactor magic port number into constant.
git-svn-id: c455d203a03ec41bf444183aad31e7cce55db786@1349874 13f79535-47bb-0310-9956-ffa450edef68 | /*
* 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 ... | /*
* 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 ... |
Update contact form to send email inquiries | <?php
// Check for empty fields
if(empty($_POST['name']) ||
empty($_POST['email']) ||
empty($_POST['phone']) ||
empty($_POST['message']) ||
!filter_var($_POST['email'],FILTER_VALIDATE_EMAIL))
{
echo "No arguments Provided!";
return false;
}
$name = $_POST['name'];
$email_address = $_POST['e... | <?php
// Check for empty fields
if(empty($_POST['name']) ||
empty($_POST['email']) ||
empty($_POST['phone']) ||
empty($_POST['message']) ||
!filter_var($_POST['email'],FILTER_VALIDATE_EMAIL))
{
echo "No arguments Provided!";
return false;
}
$name = $_POST['name'];
$email_address = $_POST['e... |
Implement loading of dictionary and postings list | import io
import getopt
import sys
import pickle
def usage():
print("usage: " + sys.argv[0] + " -d dictionary-file -p postings-file -q file-of-queries -o output-file-of-results")
if __name__ == '__main__':
dict_file = postings_file = query_file = output_file = None
try:
opts, args = getopt.getopt(sys.argv[1:], '... | import io
import getopt
import sys
def usage():
print("usage: " + sys.argv[0] + " -d dictionary-file -p postings-file -q file-of-queries -o output-file-of-results")
if __name__ == '__main__':
dict_file = postings_file = query_file = output_file = None
try:
opts, args = getopt.getopt(sys.argv[1:], 'd:p:q:o:')
ex... |
Update a Phabricator -> Arcanist include path for scripts in Phabricator
Summary: Ref T13395. Since there's very little code which really makes sense in "scripts/", I've moved most of it to other places.
Test Plan: Ran `bin/phd`.
Maniphest Tasks: T13395
Differential Revision: https://secure.phabricator.com/D20994 | <?php
function init_phabricator_script(array $options) {
error_reporting(E_ALL | E_STRICT);
ini_set('display_errors', 1);
$include_path = ini_get('include_path');
ini_set(
'include_path',
$include_path.PATH_SEPARATOR.dirname(__FILE__).'/../../../');
$ok = @include_once 'arcanist/support/init/init-s... | <?php
function init_phabricator_script(array $options) {
error_reporting(E_ALL | E_STRICT);
ini_set('display_errors', 1);
$include_path = ini_get('include_path');
ini_set(
'include_path',
$include_path.PATH_SEPARATOR.dirname(__FILE__).'/../../../');
$ok = @include_once 'arcanist/scripts/init/init-s... |
Fix the build to test Hudson
git-svn-id: ec6ef1d57ec0831ce4cbff3b75527511e63bfbe3@736937 13f79535-47bb-0310-9956-ffa450edef68 | /*
* 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 ... | /*
* 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 ... |
Add a state not to call the task continuously. | import sys
sys.path.append('../py')
from iroha import *
from iroha.iroha import *
d = IDesign()
mod = IModule(d, "mod")
callee_tab = ITable(mod)
task = design_tool.CreateSiblingTask(callee_tab)
entry_insn = IInsn(task)
st1 = IState(callee_tab)
st1.insns.append(entry_insn)
callee_tab.states.append(st1)
callee_tab.ini... | import sys
sys.path.append('../py')
from iroha import *
from iroha.iroha import *
d = IDesign()
mod = IModule(d, "mod")
callee_tab = ITable(mod)
task = design_tool.CreateSiblingTask(callee_tab)
entry_insn = IInsn(task)
st1 = IState(callee_tab)
st1.insns.append(entry_insn)
callee_tab.states.append(st1)
callee_tab.ini... |
Remove log call, add docs | /* globals onmessage: true, postMessage: true */
/**
* Extract the compilers used for the build.
*
* @param {Object} message
**/
onmessage = function(message) {
'use strict';
var gCompilers;
gCompilers = {};
function parseBuildData(build) {
var compiler;
var compilerArray;
... | /* globals onmessage: true, postMessage: true */
onmessage = function(message) {
'use strict';
var gCompilers;
gCompilers = {};
function parseBuildData(build) {
var compiler;
var compilerArray;
compiler = build.compiler_version_full;
if (compiler) {
if (!gC... |
Fix so you don't get banned after 5 refreshes. | var auth = require('http-auth');
var util = require('util');
var app = require('../src/app');
var ip = require('./ip');
var loginAttempts= {};
var authCallback = function(user, pass, callback) {
callback(user === app.config.admin.user && pass === app.config.admin.password);
};
var basic = auth.basic({
realm: "Ad... | var auth = require('http-auth');
var util = require('util');
var app = require('../src/app');
var ip = require('./ip');
var loginAttempts= {};
var authCallback = function(user, pass, callback) {
callback(user === app.config.admin.user && pass === app.config.admin.password);
};
var basic = auth.basic({
realm: "Ad... |
Remove dendropy from required packages
Let the users decide for themselves whether to install DendroPy and/or
BioPython. | from setuptools import setup, find_packages
from os.path import join, dirname
setup(
name='pandas-charm',
version='0.1.0',
description=(
'A small Python library for getting character matrices '
'(alignments) into and out of pandas'),
long_description=open(
join(dirname(__file__... | from setuptools import setup, find_packages
from os.path import join, dirname
setup(
name='pandas-charm',
version='0.1.0',
description=(
'A small Python library for getting character matrices '
'(alignments) into and out of pandas'),
long_description=open(
join(dirname(__file__... |
Make snippet parameters to form_output tag. | <section class="title">
<h4><?php echo sprintf(lang('snippets.edit_snippet'), $snippet->name);?></h4>
</section>
<section class="item">
<?php echo form_open_multipart($this->uri->uri_string(), 'class="crud"'); ?>
<div class="form_inputs">
<ul>
<li>
<label for="name"><?php echo lang('snippets.snippet_content'... | <section class="title">
<h4><?php echo sprintf(lang('snippets.edit_snippet'), $snippet->name);?></h4>
</section>
<section class="item">
<?php echo form_open_multipart($this->uri->uri_string(), 'class="crud"'); ?>
<div class="form_inputs">
<ul>
<li>
<label for="name"><?php echo lang('snippets.snippet_content'... |
Use single quotes for the JSON string, double quotes for the values within it | 'use strict';
var _ = require('lodash');
var Brain = require('../lib/brain');
var Configuration = require('../lib/configuration.js');
var State = require('../lib/constants/state.js');
describe('Brain', function() {
var config = null;
var brain = null;
beforeEach(function () {
var commandLine = JSON.parse('{"_... | 'use strict';
var _ = require('lodash');
var Brain = require('../lib/brain');
var Configuration = require('../lib/configuration.js');
var State = require('../lib/constants/state.js');
describe('Brain', function() {
var config = null;
var brain = null;
beforeEach(function () {
var commandLine = JSON.parse("{'_... |
Fix more spacing from merge conflict | package com.malpo.sliver.sample.ui.sample;
import com.malpo.sliver.sample.models.Message;
import java.util.concurrent.Callable;
import javax.inject.Inject;
import rx.Observable;
import timber.log.Timber;
class SampleInteractor implements SampleContract.Interactor {
private String log;
public SampleIntera... | package com.malpo.sliver.sample.ui.sample;
import com.malpo.sliver.sample.models.Message;
import java.util.concurrent.Callable;
import javax.inject.Inject;
import rx.Observable;
import timber.log.Timber;
class SampleInteractor implements SampleContract.Interactor {
private String log;
public SampleIntera... |
Add URL for checking for deleted packages |
# IATI Data Quality, tools for Data QA on IATI-formatted publications
# by Mark Brough, Martin Keegan, Ben Webb and Jennifer Smith
#
# Copyright (C) 2013 Publish What You Fund
#
# This programme is free software; you may redistribute and/or modify
# it under the terms of the GNU Affero General Public License v3... |
# IATI Data Quality, tools for Data QA on IATI-formatted publications
# by Mark Brough, Martin Keegan, Ben Webb and Jennifer Smith
#
# Copyright (C) 2013 Publish What You Fund
#
# This programme is free software; you may redistribute and/or modify
# it under the terms of the GNU Affero General Public License v3... |
Update code with new Transformation method | /*
* This file is released under terms of BSD license
* See LICENSE file for more information
*/
package cx2x.translator.transformation;
import cx2x.translator.language.base.ClawLanguage;
import cx2x.translator.transformation.ClawTransformation;
import cx2x.xcodeml.transformation.Transformation;
import cx2x.xcodeml... | /*
* This file is released under terms of BSD license
* See LICENSE file for more information
*/
package cx2x.translator.transformation;
import cx2x.translator.language.base.ClawLanguage;
import cx2x.translator.transformation.ClawTransformation;
import cx2x.xcodeml.transformation.Transformation;
import cx2x.xcodeml... |
Use shutil instead of `os.rename` | import os
import shutil
import argparse
from astropy.utils import data
from astroplan import download_IERS_A
def download_all_files(data_folder="{}/astrometry/data".format(os.getenv('PANDIR'))):
download_IERS_A()
for i in range(4214, 4219):
fn = 'index-{}.fits'.format(i)
dest = "{}/{}".format... | import os
import argparse
from astropy.utils import data
from astroplan import download_IERS_A
def download_all_files(data_folder="{}/astrometry/data".format(os.getenv('PANDIR'))):
download_IERS_A()
for i in range(4214, 4219):
fn = 'index-{}.fits'.format(i)
dest = "{}/{}".format(data_folder, ... |
Make project Java 6 compliant | package io.mkremins.whydah.interpreter;
import io.mkremins.whydah.ast.Expression;
import io.mkremins.whydah.ast.ExpressionUtils;
import java.util.HashMap;
import java.util.Map;
public class Scope {
private final Map<String, Expression> vars;
private final Scope parent;
public Scope(final Scope parent) {
vars ... | package io.mkremins.whydah.interpreter;
import io.mkremins.whydah.ast.Expression;
import io.mkremins.whydah.ast.ExpressionUtils;
import java.util.HashMap;
import java.util.Map;
public class Scope {
private final Map<String, Expression> vars;
private final Scope parent;
public Scope(final Scope parent) {
vars ... |
Allow prop file to be missing. | package io.muoncore.spring.boot;
import io.muoncore.spring.annotations.EnableMuonControllers;
import io.muoncore.spring.repository.DefaultMuonEventStoreRepository;
import io.muoncore.spring.repository.MuonEventStoreRepository;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org... | package io.muoncore.spring.boot;
import io.muoncore.spring.annotations.EnableMuonControllers;
import io.muoncore.spring.repository.DefaultMuonEventStoreRepository;
import io.muoncore.spring.repository.MuonEventStoreRepository;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org... |
Fix spacing. Update mfcc test to check columns | import numpy as np
from unittest import TestCase
from cartography.extractor import LibrosaFeatureExtractor
def gen_signal(dur, sr, freq):
return np.pi * 2 * freq * np.arange(dur * sr) / float(sr)
class TestLibrosaFeatureExtractor(TestCase):
@classmethod
def setUpClass(cls):
cls.test_dur = 2
... | import numpy as np
from unittest import TestCase
from cartography.extractor import LibrosaFeatureExtractor
def gen_signal(dur, sr, freq):
return np.pi * 2 * freq * np.arange(dur * sr) / float(sr)
class TestLibrosaFeatureExtractor(TestCase):
@classmethod
def setUpClass(cls):
cls.test_dur = 2
cls.test_fr... |
Add arg parser to balancing script | #!/usr/bin/env python
from __future__ import division, print_function
from multiprocessing import Pool
import argparse
import numpy as np
import h5py
import cooler
import cooler.ice
N_CPUS = 5
if __name__ == '__main__':
parser = argparse.ArgumentParser(
description="Compute a genome-wide balancing/bias/... | #!/usr/bin/env python
from __future__ import division, print_function
from multiprocessing import Pool
import numpy as np
import h5py
import cooler
import cooler.ice
N_CPUS = 5
if __name__ == '__main__':
# Compute a genome-wide balancing/bias/normalization vector
# *** assumes uniform binning ***
chunks... |
Make type propType of field lazy | import {PropTypes} from 'react'
function lazy(fn) {
let cachedFn
return (...args) => (cachedFn || (cachedFn = fn()))(...args)
}
let type
const field = PropTypes.shape({
name: PropTypes.string,
type: lazy(() => type)
})
type = PropTypes.shape({
name: PropTypes.string,
title: PropTypes.string,
descripti... | import {PropTypes} from 'react'
function lazy(fn) {
let cachedFn
return (...args) => (cachedFn || (cachedFn = fn()))(...args)
}
const field = PropTypes.shape({
name: PropTypes.string,
type: type
})
const type = PropTypes.shape({
name: PropTypes.string,
title: PropTypes.string,
description: PropTypes.st... |
Add crud for folder in navigation | <?php
namespace PHPOrchestra\ModelBundle\Document;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\ODM\MongoDB\Mapping\Annotations as ODM;
use Doctrine\Common\Collections\Collection;
use PHPOrchestra\ModelBundle\Model\MediaFolderInterface;
use PHPOrchestra\ModelBundle\Model\MediaInterface;
/**
* Class... | <?php
namespace PHPOrchestra\ModelBundle\Document;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\ODM\MongoDB\Mapping\Annotations as ODM;
use Doctrine\Common\Collections\Collection;
use PHPOrchestra\ModelBundle\Model\MediaFolderInterface;
use PHPOrchestra\ModelBundle\Model\MediaInterface;
/**
* Class... |
Fix the freeze functional test | """Test the ``dtool dataset create`` command."""
import os
import shutil
from click.testing import CliRunner
from dtoolcore import DataSet, ProtoDataSet
from . import chdir_fixture, tmp_dir_fixture # NOQA
from . import SAMPLE_FILES_DIR
def test_dataset_freeze_functional(chdir_fixture): # NOQA
from dtool_cre... | """Test the ``dtool dataset create`` command."""
import os
import shutil
from click.testing import CliRunner
from dtoolcore import DataSet
from . import chdir_fixture, tmp_dir_fixture # NOQA
from . import SAMPLE_FILES_DIR
def test_dataset_freeze_functional(chdir_fixture): # NOQA
from dtool_create.dataset im... |
Fix typo on add new layer button | export default {
'opacity-label': {
'tooltip': 'Видимость слоя'
},
'attributes-button': {
'tooltip': 'Показать панель атрибутов слоя'
},
'bounds-button': {
'tooltip': 'Приблизить к границам слоя'
},
'add-button': {
'tooltip': 'Добавить новый дочерний слой'
},
'copy-button': {
'tool... | export default {
'opacity-label': {
'tooltip': 'Видимость слоя'
},
'attributes-button': {
'tooltip': 'Показать панель атрибутов слоя'
},
'bounds-button': {
'tooltip': 'Приблизить к границам слоя'
},
'add-button': {
'tooltip': 'Добавить новй дочерний слой'
},
'copy-button': {
'toolt... |
Mark for completion after GameStartListener | /*
* The MIT License (MIT)
*
* Copyright (c) 2015 CrystalCraftMC
*
* 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 us... | /*
* The MIT License (MIT)
*
* Copyright (c) 2015 CrystalCraftMC
*
* 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 us... |
Make Storybook work with babel 7 | /* eslint-disable no-param-reassign, global-require */
module.exports = baseConfig => {
// Replace storybook baseConfig rule.
baseConfig.module.rules.splice(0, 1, {
test: /\.js$/,
exclude: /node_modules/,
use: [
{
loader: 'babel-loader',
options: {
presets: ['./babel.con... | /* eslint-disable no-param-reassign, global-require */
module.exports = baseConfig => {
baseConfig.module.rules.push({
test: /\.css$/,
use: [
{
loader: 'style-loader',
},
{
loader: 'css-loader',
options: {
modules: true,
localIdentName: '[name]-[l... |
Fix emoji picker on firefox :ok_hand: | /* globals Template chatMessages*/
Template.messageBox.events({
'click .emoji-picker-icon'(event) {
event.stopPropagation();
event.preventDefault();
if (RocketChat.EmojiPicker.isOpened()) {
RocketChat.EmojiPicker.close();
} else {
RocketChat.EmojiPicker.open(event.currentTarget, (emoji) => {
console.... | /* globals Template chatMessages*/
Template.messageBox.events({
'click .emoji-picker-icon'(event) {
event.stopPropagation();
event.preventDefault();
if (RocketChat.EmojiPicker.isOpened()) {
RocketChat.EmojiPicker.close();
} else {
RocketChat.EmojiPicker.open(event.currentTarget, (emoji) => {
console.... |
Use exceptionMessage for the widget error page as all other error pages | package uk.ac.ebi.atlas.widget;
import org.springframework.dao.RecoverableDataAccessException;
import org.springframework.http.HttpStatus;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.ResponseStatus;
import org.springframework.web.servlet.ModelAndView;... | package uk.ac.ebi.atlas.widget;
import org.springframework.dao.RecoverableDataAccessException;
import org.springframework.http.HttpStatus;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.ResponseStatus;
import org.springframework.web.servlet.ModelAndView;... |
[INTERNAL] Grunt: Disable proxy "secure" option for better local testing
As the "grunt serve" server is only intended to be used for local
testing it is fine to allow insecure connections.
Change-Id: I7141af5d6340340f27ce80ecc7413f50ee553408 | // configure the openui5 connect server
module.exports = function(grunt, config) {
// libraries are sorted alphabetically
var aLibraries = config.allLibraries.slice();
aLibraries.sort(function(a, b) {
return a.name.localeCompare(b.name);
});
var openui5_connect = {
options: {
contextpath: config.testsui... | // configure the openui5 connect server
module.exports = function(grunt, config) {
// libraries are sorted alphabetically
var aLibraries = config.allLibraries.slice();
aLibraries.sort(function(a, b) {
return a.name.localeCompare(b.name);
});
var openui5_connect = {
options: {
contextpath: config.testsui... |
Add latest version of PnetCDF | from spack import *
class ParallelNetcdf(Package):
"""Parallel netCDF (PnetCDF) is a library providing high-performance
parallel I/O while still maintaining file-format compatibility with
Unidata's NetCDF."""
homepage = "https://trac.mcs.anl.gov/projects/parallel-netcdf"
url = "http://cucis.e... | from spack import *
class ParallelNetcdf(Package):
"""Parallel netCDF (PnetCDF) is a library providing high-performance
parallel I/O while still maintaining file-format compatibility with
Unidata's NetCDF."""
homepage = "https://trac.mcs.anl.gov/projects/parallel-netcdf"
url = "http://cucis.e... |
Revise docstring & comment, reduce redundant for loop | from __future__ import absolute_import
from __future__ import print_function
from __future__ import division
def selection_sort(nums):
"""Selection sort algortihm.
Time complexity: O(n^2).
Space complexity: O(1).
"""
# Start from pos=n-1,..1, select next max num to swap with its num.
for i ... | from __future__ import absolute_import
from __future__ import print_function
from __future__ import division
def selection_sort(nums):
"""Selection Sort algortihm.
Time complexity: O(n^2).
Space complexity: O(1).
"""
# Start from the last num, select next max num to swap.
for i in reversed(... |
Update author to CSC - IT Center for Science Ltd. | from setuptools import setup, find_packages
version = '0.2'
setup(
name='ckanext-oaipmh',
version=version,
description="OAI-PMH harvester for CKAN",
long_description="""\
""",
classifiers=[], # Get strings from http://pypi.python.org/pypi?%3Aaction=list_classifiers
keywords='',
au... | from setuptools import setup, find_packages
version = '0.2'
setup(
name='ckanext-oaipmh',
version=version,
description="OAI-PMH harvester for CKAN",
long_description="""\
""",
classifiers=[], # Get strings from http://pypi.python.org/pypi?%3Aaction=list_classifiers
keywords='',
au... |
Load environment variable first in express app | // Load environment variables
if (process.env.NODE_ENV !== 'integration') {
require('dotenv').config({ path: './env/.env' });
}
var express = require('express');
var passport = require('passport');
var util = require('./lib/utility.js');
var app = express();
// Initial Configuration, Static Assets, & View Engine C... | var express = require('express');
var passport = require('passport');
var util = require('./lib/utility.js');
// Load environment variables
if (process.env.NODE_ENV !== 'integration') {
require('dotenv').config({ path: './env/.env' });
}
var app = express();
// Initial Configuration, Static Assets, & View Engine C... |
Support for shortcodes to transform block content | <?php
namespace WordpressLib\Editor\Block;
class Block {
public function __construct($pluginSlug, $blockSlug, $frontAssets, $editorAssets) {
$this->pluginSlug = $pluginSlug;
$this->blockSlug = $blockSlug;
$this->frontAssets = $frontAssets;
$this->editorAssets = $editorAssets;
add_action('init', [$this, 're... | <?php
namespace WordpressLib\Editor\Block;
class Block {
public function __construct($pluginSlug, $blockSlug, $frontAssets, $editorAssets) {
$this->pluginSlug = $pluginSlug;
$this->blockSlug = $blockSlug;
$this->frontAssets = $frontAssets;
$this->editorAssets = $editorAssets;
add_action('init', [$this, 're... |
Add a dependency on healpy | #!/usr/bin/env python
import os
from numpy.distutils.core import setup, Extension
# Utility function to read the README file.
def read(fname):
return open(os.path.join(os.path.dirname(__file__), fname)).read()
wrapper = Extension('fortran_routines',
sources=['src/fortran_routines.f90'],
... | #!/usr/bin/env python
import os
from numpy.distutils.core import setup, Extension
# Utility function to read the README file.
def read(fname):
return open(os.path.join(os.path.dirname(__file__), fname)).read()
wrapper = Extension('fortran_routines',
sources=['src/fortran_routines.f90'],
... |
Add option to download via SSH | # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHET... | # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHET... |
Use _super.methodName instead of bare super.
Older versions of ember-cli do not support invoking _super as an argument (yet all versions that I am aware of support this syntax). | /* jshint node: true */
'use strict';
var path = require('path');
var replace = require('broccoli-string-replace');
var mergeTrees = require('broccoli-merge-trees');
var Funnel = require('broccoli-funnel');
module.exports = {
name: 'lodash',
_shouldCompileJS: function() {
return true;
},
treeForAddon: f... | /* jshint node: true */
'use strict';
var path = require('path');
var replace = require('broccoli-string-replace');
var mergeTrees = require('broccoli-merge-trees');
var Funnel = require('broccoli-funnel');
module.exports = {
name: 'lodash',
_shouldCompileJS: function() {
return true;
},
treeForAddon: f... |
Make string example a bit less confusing | import collections
import collections.abc
def strings_have_format_map_method():
"""
As of Python 3.2 you can use the .format_map() method on a string object
to use mapping objects (not just builtin dictionaries) when formatting
a string.
"""
class Default(dict):
def __missing__(self,... | import collections
import collections.abc
def strings_have_format_map_method():
"""
As of Python 3.2 you can use the .format_map() method on a string object
to use mapping objects (not just builtin dictionaries) when formatting
a string.
"""
class Default(dict):
def __missing__(self,... |
Disable keyboard shortcuts when editing input field | window.GLOBAL_ACTIONS = {
'play': function () {
wavesurfer.playPause();
},
'back': function () {
wavesurfer.skipBackward();
},
'forth': function () {
wavesurfer.skipForward();
},
'toggle-mute': function () {
wavesurfer.toggleMute();
}
};
// Bind actions to buttons and keypresses
doc... | window.GLOBAL_ACTIONS = {
'play': function () {
wavesurfer.playPause();
},
'back': function () {
wavesurfer.skipBackward();
},
'forth': function () {
wavesurfer.skipForward();
},
'toggle-mute': function () {
wavesurfer.toggleMute();
}
};
// Bind actions to buttons and keypresses
doc... |
Change version 1.1.2 to 1.1.3 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from setuptools import setup, find_packages
__author__ = 'Takahiro Ikeuchi'
setup(
name="slackpy",
version="1.1.3",
py_modules=['slackpy'],
package_dir={'': 'slackpy'},
install_requires=open('requirements.txt').read().splitlines(),
description="S... | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from setuptools import setup, find_packages
__author__ = 'Takahiro Ikeuchi'
setup(
name="slackpy",
version="1.1.2",
py_modules=['slackpy'],
package_dir={'': 'slackpy'},
install_requires=open('requirements.txt').read().splitlines(),
description="S... |
Fix: Check if url is defined | 'use strict';
/**
* @ngdoc filter
* @name SubSnoopApp.filter:isImage
* @function
* @description
* # isContent
* Filter in the SubSnoopApp.
*/
angular.module('SubSnoopApp')
.filter('isContent', function () {
/*
Returns true if url is a format ending in png, jpg, or gif
*/
function isImage(url... | 'use strict';
/**
* @ngdoc filter
* @name SubSnoopApp.filter:isImage
* @function
* @description
* # isContent
* Filter in the SubSnoopApp.
*/
angular.module('SubSnoopApp')
.filter('isContent', function () {
/*
Returns true if url is a format ending in png, jpg, or gif
*/
function isImage(url... |
Tools: Add --list to variable tool. | #!/usr/bin/env python
import sys
sys.path.append('..')
from cli import *
from optparse import OptionParser
parse = OptionParser()
parse.add_option('-a', '--variable', dest='variables',
help='Add variable',
default=[], action='append', type=str)
parse.add_option('-r', '--random', dest=... | #!/usr/bin/env python
import sys
sys.path.append('..')
from cli import *
from optparse import OptionParser
parse = OptionParser()
parse.add_option('-a', '--variable', dest='variables',
help='Add variable',
default=[], action='append', type=str)
parse.add_option('-r', '--random', des... |
Fix the unknown entity type test
We want to check if any user-supplied entity name is unkown, not if any
of the known types are not in the user-supplied list | import argparse
from .schema import SCHEMA
def reindex(args):
known_entities = SCHEMA.keys()
if args['entities'] is not None:
entities = []
for e in args['entities']:
entities.extend(e.split(','))
unknown_entities = set(entities) - set(known_entities)
if unknown_e... | import argparse
from .schema import SCHEMA
def reindex(args):
known_entities = SCHEMA.keys()
if args['entities'] is not None:
entities = []
for e in args['entities']:
entities.extend(e.split(','))
unknown_entities = set(known_entities) - set(entities)
if unknown_e... |
Clear the operator default engines before running operator tests
Reviewed By: akyrola
Differential Revision: D5729024
fbshipit-source-id: f2850d5cf53537b22298b39a07f64dfcc2753c75 | ## @package test_util
# Module caffe2.python.test_util
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import numpy as np
from caffe2.python import core, workspace
import unittest
def rand_array(*dims):
# np.rand... | ## @package test_util
# Module caffe2.python.test_util
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import numpy as np
from caffe2.python import workspace
import unittest
def rand_array(*dims):
# np.random.ran... |
Make single post thumbnail bigger
on single post pages | <article <?php post_class(); ?>>
<header class="mt-15">
<!-- Displays the title of the post without a link -->
<h1 class="entry-title"><?php the_title(); ?></h1>
</header>
<div class="entry-content">
<!-- Displays the content of the current post -->
<?php the_content(); ?>
<!-- Displays the post thumbnail... | <article <?php post_class(); ?>>
<header class="mt-15">
<!-- Displays the title of the post without a link -->
<h1 class="entry-title"><?php the_title(); ?></h1>
</header>
<div class="entry-content">
<!-- Displays the content of the current post -->
<?php the_content(); ?>
<!-- Displays the post thumbnail... |
Replace empty list creation with Collections.emptyList() | package com.alexrnl.subtitlecorrector.correctionstrategy;
import java.util.Collections;
import java.util.List;
import java.util.Objects;
import java.util.logging.Logger;
import com.alexrnl.subtitlecorrector.service.SessionParameters;
/**
* Abstract strategy implementation.<br />
* Provide a basic body for the actu... | package com.alexrnl.subtitlecorrector.correctionstrategy;
import java.util.ArrayList;
import java.util.List;
import java.util.Objects;
import java.util.logging.Logger;
import com.alexrnl.subtitlecorrector.service.SessionParameters;
/**
* Abstract strategy implementation.<br />
* Provide a basic body for the actual... |
[API][Cart] Add token value based cart context | <?php
/*
* This file is part of the Sylius package.
*
* (c) Paweł Jędrzejewski
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
declare(strict_types=1);
namespace Sylius\Component\Order\Repository;
use Doctrine\ORM\QueryBuilder;... | <?php
/*
* This file is part of the Sylius package.
*
* (c) Paweł Jędrzejewski
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
declare(strict_types=1);
namespace Sylius\Component\Order\Repository;
use Doctrine\ORM\QueryBuilder;... |
Add new test for all classes | package org.verapdf.model.impl;
import org.junit.Assert;
import org.junit.Test;
import org.verapdf.model.ModelHelper;
import java.net.URISyntaxException;
import java.net.URL;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.List;
/**
* @author Evgeniy Muravitskiy
*/
public abstract class Ba... | package org.verapdf.model.impl;
import org.junit.Assert;
import org.junit.Test;
import org.verapdf.model.ModelHelper;
import java.net.URISyntaxException;
import java.net.URL;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.List;
/**
* @author Evgeniy Muravitskiy
*/
public abstract class Ba... |
Add service to retrieve list of Applications by team | /**
* Copyright (C) 2015 The Gravitee team (http://gravitee.io)
*
* 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 requ... | /**
* Copyright (C) 2015 The Gravitee team (http://gravitee.io)
*
* 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 requ... |
Add reminder to myself to to importlib fallback. | from django.conf import settings
from django.core.exceptions import ImproperlyConfigured
# TODO: When Python 2.7 is released this becomes a try/except falling
# back to Django's implementation.
from django.utils.importlib import import_module
def get_backend():
"""
Return an instance of the registration backe... | from django.conf import settings
from django.core.exceptions import ImproperlyConfigured
from django.utils.importlib import import_module
def get_backend():
"""
Return an instance of the registration backend for use on this
site, as determined by the ``REGISTRATION_BACKEND`` setting. Raise
``django.cor... |
Add max Memory to statitic collector | package org.csstudio.platform.statistic;
import org.csstudio.platform.logging.CentralLogger;
public class BackgroundCollectorThread extends Thread{
private int timeout = 0;
private boolean runForever = true;
final static double MB = 1024.0*1024.0;
BackgroundCollectorThread ( int timeout) {
this.timeout = t... | package org.csstudio.platform.statistic;
import org.csstudio.platform.logging.CentralLogger;
public class BackgroundCollectorThread extends Thread{
private int timeout = 0;
private boolean runForever = true;
BackgroundCollectorThread ( int timeout) {
this.timeout = timeout;
CentralLogger.getInstance().inf... |
Fix passing of params to optimizer in Softmax | from .affine import Affine
from ... import describe
from ...describe import Dimension, Synapses, Biases
@describe.attributes(
W=Synapses("Weights matrix",
lambda obj: (obj.nO, obj.nI),
lambda W, ops: None)
)
class Softmax(Affine):
name = 'softmax'
def predict(self, input__BI):
outp... | from .affine import Affine
from ... import describe
from ...describe import Dimension, Synapses, Biases
@describe.attributes(
W=Synapses("Weights matrix",
lambda obj: (obj.nO, obj.nI),
lambda W, ops: None)
)
class Softmax(Affine):
def predict(self, input__BI):
output__BO = self.ops.aff... |
Allow 'ignore' as valid vendor extension severity level | <?php
namespace webignition\CssValidatorWrapper\Configuration;
class VendorExtensionSeverityLevel {
const LEVEL_IGNORE = 'ignore';
const LEVEL_ERROR = 'error';
const LEVEL_WARN = 'warn';
/**
*
* @var array
*/
private static $validValues = array(
se... | <?php
namespace webignition\CssValidatorWrapper\Configuration;
class VendorExtensionSeverityLevel {
const LEVEL_ERROR = 'error';
const LEVEL_WARN = 'warn';
/**
*
* @var array
*/
private static $validValues = array(
self::LEVEL_ERROR,
self::LEVEL_WARN
... |
Drop unused sourcemap reset API | var fs = require('fs'),
sourceMap = require('source-map');
module.exports.create = function() {
var cache = {};
function loadSourceMap(file) {
try {
var body = fs.readFileSync(file + '.map');
return new sourceMap.SourceMapConsumer(body.toString());
} catch (err) {
/* NOP */
}
}... | var fs = require('fs'),
sourceMap = require('source-map');
module.exports.create = function() {
var cache = {};
function loadSourceMap(file) {
try {
var body = fs.readFileSync(file + '.map');
return new sourceMap.SourceMapConsumer(body.toString());
} catch (err) {
/* NOP */
}
}... |
Fix it gau! oh godgp | window.onload = function() {
d3.json("examples/data/gitstats.json", function(data) {
data.forEach(function(d) {
d.date = new Date(d.date);
d.name = d.name === "ashwinraman9" ? "aramaswamy" : d.name;
});
var dataset = {data: data, metadata: {}};
var commitSVG = d3.select("#intro-chart");
... | window.onload = function() {
d3.json("../examples/data/gitstats.json", function(data) {
data.forEach(function(d) {
d.date = new Date(d.date);
d.name = d.name === "ashwinraman9" ? "aramaswamy" : d.name;
});
var dataset = {data: data, metadata: {}};
var commitSVG = d3.select("#intro-chart")... |
Test runner infinite counter fix | new BrowserDb({
db:"saveDb",
collections:["one", "two", "three"]
}, function (error, browserDb) {
module("Save");
asyncTest("Save an object", 3, function () {
browserDb.one.save({
name:"Sri"
}, function (error, savedObject) {
ok(savedObject, "savedObject must be created");
deepEqual(... | new BrowserDb({
db:"saveDb",
collections:["one", "two", "three"]
}, function (error, browserDb) {
module("Save");
asyncTest("Save an object", 3, function () {
browserDb.one.save({
name:"Sri"
}, function (error, savedObject) {
ok(savedObject, "savedObject must be created");
deepEqual(... |
Fix error with Service Calls Wrapper | package by.bsuir.mpp.computershop.controller.exception.wrapper;
import by.bsuir.mpp.computershop.controller.exception.ControllerException;
import by.bsuir.mpp.computershop.controller.exception.ResourceNotFoundException;
import by.bsuir.mpp.computershop.service.exception.EntityNotFoundException;
import by.bsuir.mpp.com... | package by.bsuir.mpp.computershop.controller.exception.wrapper;
import by.bsuir.mpp.computershop.controller.exception.ControllerException;
import by.bsuir.mpp.computershop.controller.exception.ResourceNotFoundException;
import by.bsuir.mpp.computershop.utils.WrappedFunctions.Function;
import by.bsuir.mpp.computershop.... |
Remove some test code that got left behind | import platform
from stats_file_backend import StatsFileBackend
class StatsBackend:
"""
This is a class to manage the Stats backend.
"""
def __init__(self, options={}):
if options == {}:
if platform.system() == "Darwin": # For my local dev I need this hack
options = {"db_path":"/tmp/stats.jso... | import platform
from stats_file_backend import StatsFileBackend
class StatsBackend:
"""
This is a class to manage the Stats backend.
"""
def __init__(self, options={}):
if options == {}:
if platform.system() == "Darwin": # For my local dev I need this hack
options = {"db_path":"/tmp/stats.jso... |
Fix TestRun factory missing base_url | import factory
from fortuitus.feditor.factories import TestProjectF
from fortuitus.frunner import models
class TestRunF(factory.Factory):
FACTORY_FOR = models.TestRun
project = factory.SubFactory(TestProjectF)
base_url = 'http://api.example.com/'
class TestCaseF(factory.Factory):
FACTORY_FOR = mod... | import factory
from fortuitus.feditor.factories import TestProjectF
from fortuitus.frunner import models
class TestRunF(factory.Factory):
FACTORY_FOR = models.TestRun
project = factory.SubFactory(TestProjectF)
class TestCaseF(factory.Factory):
FACTORY_FOR = models.TestCase
testrun = factory.SubFa... |
Remove unnecessary binding of action creator | import React from 'react';
import { connect } from 'react-redux';
import EntityList from '../components/EntityList';
import { fetchEntities } from '../actions/index';
import { getEntityItems, getEntityStatus, getEntityError } from '../reducers/index';
class AllEntitiesList extends React.Component {
componentDidMou... | import React from 'react';
import { bindActionCreators } from 'redux';
import { connect } from 'react-redux';
import EntityList from '../components/EntityList';
import { fetchEntities } from '../actions/index';
import { getEntityItems, getEntityStatus, getEntityError } from '../reducers/index';
class AllEntitiesList e... |
Set the button to be at the minimum width possible. | qx.Class.define("vcms.client.widgets.WidgetList",
{
extend : qx.ui.tabview.TabView,
construct : function()
{
this.base(arguments);
for (i = 0, n = 3; i < n; i++)
{
var page = new qx.ui.tabview.Page("Page #" + i);
page.setLayout(new qx.ui.layout.VBox... | qx.Class.define("vcms.client.widgets.WidgetList",
{
extend : qx.ui.tabview.TabView,
construct : function()
{
this.base(arguments);
for (i = 0, n = 3; i < n; i++)
{
var page = new qx.ui.tabview.Page("Page #" + i);
page.setLayout(new qx.ui.layout.VBox... |
Fix breakage. The website is looking for user-agent header | #!/usr/bin/python
# Maybank Gold Investment Account price scraper
# Using BeautifulSoup package
# Developed and tested on Debian Testing (Jessie)
# Initial development 25 July 2012
# Copyright (C) 2012,2013 Sharuzzaman Ahmat Raslan (sharuzzaman@gmail.com)
#
# This program is free software: you can redistribute it an... | #!/usr/bin/python
# Maybank Gold Investment Account price scraper
# Using BeautifulSoup package
# Developed and tested on Debian Testing (Jessie)
# Initial development 25 July 2012
# Copyright (C) 2012,2013 Sharuzzaman Ahmat Raslan (sharuzzaman@gmail.com)
#
# This program is free software: you can redistribute it an... |
Update string tests to reflect new behaviour. | from protobuf3.fields.string import StringField
from protobuf3.message import Message
from unittest import TestCase
class TestStringField(TestCase):
def setUp(self):
class StringTestMessage(Message):
b = StringField(field_number=2)
self.msg_cls = StringTestMessage
def test_get(se... | from protobuf3.fields.string import StringField
from protobuf3.message import Message
from unittest import TestCase
class TestStringField(TestCase):
def setUp(self):
class StringTestMessage(Message):
b = StringField(field_number=2)
self.msg_cls = StringTestMessage
def test_get(se... |
Increment version after making parser properties non-private | import subprocess
import sys
from setuptools import Command, setup
class RunTests(Command):
user_options = []
def initialize_options(self):
pass
def finalize_options(self):
pass
def run(self):
errno = subprocess.call([sys.executable, '-m', 'unittest', 'gis_metadata.tests.te... | import subprocess
import sys
from setuptools import Command, setup
class RunTests(Command):
user_options = []
def initialize_options(self):
pass
def finalize_options(self):
pass
def run(self):
errno = subprocess.call([sys.executable, '-m', 'unittest', 'gis_metadata.tests.te... |
Add test for withdraw exception response | #!/usr/bin/env python
# coding=utf-8
from binance.client import Client
from binance.exceptions import BinanceAPIException, BinanceRequestException, BinanceWithdrawException
import pytest
import requests_mock
client = Client('api_key', 'api_secret')
def test_invalid_json():
"""Test Invalid response Exception"""... | #!/usr/bin/env python
# coding=utf-8
from binance.client import Client
from binance.exceptions import BinanceAPIException, BinanceRequestException
import pytest
import requests_mock
client = Client('api_key', 'api_secret')
def test_invalid_json():
"""Test Invalid response Exception"""
with pytest.raises(B... |
Fix polygon handler to show correct label text | L.Polygon.Draw = L.Polyline.Draw.extend({
Poly: L.Polygon,
options: {
shapeOptions: {
stroke: true,
color: '#f06eaa',
weight: 4,
opacity: 0.5,
fill: true,
fillColor: null, //same as color by default
fillOpacity: 0.2,
clickable: true
}
},
_updateMarkerHandler: function () {
// The fir... | L.Polygon.Draw = L.Polyline.Draw.extend({
Poly: L.Polygon,
options: {
shapeOptions: {
stroke: true,
color: '#f06eaa',
weight: 4,
opacity: 0.5,
fill: true,
fillColor: null, //same as color by default
fillOpacity: 0.2,
clickable: true
}
},
_updateMarkerHandler: function () {
// The fir... |
Make code more self documenting and remove (* title). | <?php
header('Content-Type: application/json');
header('Content-type: text/html; charset=UTF-8');
include_once("config/config.php");
include_once("inc/params.php");
include_once("inc/contact.php");
$lines = file($markdownPath);
$faqs = array();
$currentTitle = "";
$currentContent = "";
foreach ($lines as $line) {
... | <?php
header('Content-Type: application/json');
header('Content-type: text/html; charset=UTF-8');
include_once("config/config.php");
include_once("inc/params.php");
include_once("inc/contact.php");
$lines = file($markdownPath);
$faqs = array();
$currentTitle = "";
$currentContent = "";
foreach ($lines as $line) {
... |
Raise error when plugin is not configured | 'use strict';
const path = require('path');
const jade = require('jade');
const _ = require('lodash');
module.exports = function(env, callback) {
class Sitemap extends env.plugins.Page {
getFilename() {
return 'sitemap.xml';
}
getView() {
// jshint maxparams: 5
return (env, locals, c... | 'use strict';
const path = require('path');
const jade = require('jade');
const _ = require('lodash');
module.exports = function(env, callback) {
class Sitemap extends env.plugins.Page {
getFilename() {
return 'sitemap.xml';
}
getView() {
// jshint maxparams: 5
return (env, locals, c... |
Add a comment to CreateUserInfo | package zoom // Use this file for /user endpoints
// CreateUserPath - v2 path for creating a user
const CreateUserPath = "/users"
// CreateUserInfo are details about a user to create
type CreateUserInfo struct {
Email string `json:"email"`
Type UserType `json:"type"`
FirstName string `json:"first_name... | package zoom // Use this file for /user endpoints
// CreateUserPath - v2 path for creating a user
const CreateUserPath = "/users"
type CreateUserInfo struct {
Email string `json:"email"`
Type UserType `json:"type"`
FirstName string `json:"first_name,omitempty"`
LastName string `json:"last_name,omi... |
Make treebuilder configuration backwards compatible with older Symfony versions | <?php
namespace AshleyDawson\GlideBundle\DependencyInjection;
use Symfony\Component\Config\Definition\ConfigurationInterface;
use Symfony\Component\Config\Definition\Builder\TreeBuilder;
/**
* Class Configuration
*
* @package AshleyDawson\GlideBundle\DependencyInjection
*/
class Configuration implements Configur... | <?php
namespace AshleyDawson\GlideBundle\DependencyInjection;
use Symfony\Component\Config\Definition\ConfigurationInterface;
use Symfony\Component\Config\Definition\Builder\TreeBuilder;
/**
* Class Configuration
*
* @package AshleyDawson\GlideBundle\DependencyInjection
*/
class Configuration implements Configur... |
Use experimental object observers for mocking. only works in chromium for now. | // ==UserScript==
// @name Kill nrcQ restrictions
// @namespace http://use.i.E.your.homepage/
// @version 0.2
// @description When browsing nrcq with more than 10 views you need to sign in to view the content, this plugin disables the lay-over.
// @match http://www.nrcq.nl/*
// @copyright 2015+, You
//... | // ==UserScript==
// @name Kill nrcQ restrictions
// @namespace http://use.i.E.your.homepage/
// @version 0.1
// @description When browsing nrcq with more than 10 views you need to sign in to view the content, this plugin disables the lay-over.
// @match http://www.nrcq.nl/*
// @copyright 2015+, You
//... |
Allow props proxy on Text | import React from 'react';
import PropTypes from 'prop-types';
import { primaryFontStyle, secondaryFontStyle } from 'styles/font';
/**
* Text component with automatic typeface formatting.
*/
const Text = (props) => {
const {
secondary,
size,
color,
bold,
inline,
uppercase,
style: overri... | import React from 'react';
import PropTypes from 'prop-types';
import { primaryFontStyle, secondaryFontStyle } from 'styles/font';
/**
* Text component with automatic typeface formatting.
*/
const Text = (props) => {
const { secondary, size, color, bold, inline, uppercase, style: overrides, children } = props;
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.