text stringlengths 16 4.96k | positive stringlengths 321 2.24k | negative stringlengths 310 2.21k |
|---|---|---|
Use StandardCharsets instead of string value | /*
* 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 ... |
Fix scraper skipping an entry at start. | from Database import Database
from Nyaa import Nyaa, NyaaEntry
import getopt
import os
import sys
script_dir = os.path.dirname(os.path.realpath(__file__))
nt = Nyaa()
db = Database(script_dir)
arguments = sys.argv[1:]
optlist, args = getopt.getopt(arguments, '', ['start='])
if len(optlist) > 0:
for opt, arg in optli... | from Database import Database
from Nyaa import Nyaa, NyaaEntry
import getopt
import os
import sys
script_dir = os.path.dirname(os.path.realpath(__file__))
nt = Nyaa()
db = Database(script_dir)
arguments = sys.argv[1:]
optlist, args = getopt.getopt(arguments, '', ['start='])
if len(optlist) > 0:
for opt, arg in optli... |
Fix api starting with auth set | import importlib
import pecan
from joulupukki.api.controllers.v3.users import UsersController
from joulupukki.api.controllers.v3.projects import ProjectsController
from joulupukki.api.controllers.v3.stats import StatsController
from joulupukki.api.controllers.v3.auth import AuthController
class V3Controller(object):... | import importlib
import pecan
from joulupukki.api.controllers.v3.users import UsersController
from joulupukki.api.controllers.v3.projects import ProjectsController
from joulupukki.api.controllers.v3.stats import StatsController
from joulupukki.api.controllers.v3.auth import AuthController
authcontroller = importlib.... |
Fix int float setting issue. | import os
from django.core.management import BaseCommand
from django.conf import settings
def dump_attrs(obj_instance):
for attr in dir(obj_instance):
if attr != attr.upper():
continue
yield attr, getattr(obj_instance, attr)
class Command(BaseCommand):
args = ''
help = 'Crea... | import os
from django.core.management import BaseCommand
from django.conf import settings
def dump_attrs(obj_instance):
for attr in dir(obj_instance):
if attr != attr.upper():
continue
yield attr, getattr(obj_instance, attr)
class Command(BaseCommand):
args = ''
help = 'Crea... |
Update login form clean method to return full cleaned data. | #! coding: utf-8
from django import forms
from django.utils.translation import ugettext_lazy as _
from django.contrib.auth import authenticate
class LoginForm(forms.Form):
username = forms.CharField(label=_('Naudotojo vardas'), max_length=100,
help_text=_('VU MIF uosis.mif.vu.lt ser... | #! coding: utf-8
from django import forms
from django.utils.translation import ugettext_lazy as _
from django.contrib.auth import authenticate
class LoginForm(forms.Form):
username = forms.CharField(label=_('Naudotojo vardas'), max_length=100,
help_text=_('VU MIF uosis.mif.vu.lt ser... |
fix(AnnotationBuilder): Remove objective flag from the defaut set of field of an annotation |
import { generateUUID } from '../UUID';
import SelectionBuilder from '../SelectionBuilder';
// ----------------------------------------------------------------------------
// Internal helpers
// ----------------------------------------------------------------------------
let generation = 0;
function setInitialGener... |
import { generateUUID } from '../UUID';
import SelectionBuilder from '../SelectionBuilder';
// ----------------------------------------------------------------------------
// Internal helpers
// ----------------------------------------------------------------------------
let generation = 0;
function setInitialGener... |
Raise NotImplementedError if pandas is not installed | """ Tablib - DataFrame Support.
"""
import sys
if sys.version_info[0] > 2:
from io import BytesIO
else:
from cStringIO import StringIO as BytesIO
try:
from pandas import DataFrame
except ImportError:
DataFrame = None
import tablib
from tablib.compat import unicode
title = 'df'
extensions = ('df'... | """ Tablib - DataFrame Support.
"""
import sys
if sys.version_info[0] > 2:
from io import BytesIO
else:
from cStringIO import StringIO as BytesIO
from pandas import DataFrame
import tablib
from tablib.compat import unicode
title = 'df'
extensions = ('df', )
def detect(stream):
"""Returns True if gi... |
Update script to use new way of calling class. | #!/usr/bin/env python
# -*- coding: utf8 -*-
import sys, os
import argparse
from deepharvest.deepharvest_nuxeo import DeepHarvestNuxeo
def main(argv=None):
parser = argparse.ArgumentParser(description='Print count of objects for a given collection.')
parser.add_argument('path', help="Nuxeo path to collection... | #!/usr/bin/env python
# -*- coding: utf8 -*-
import sys, os
import argparse
from deepharvest.deepharvest_nuxeo import DeepHarvestNuxeo
def main(argv=None):
parser = argparse.ArgumentParser(description='Print count of objects for a given collection.')
parser.add_argument('path', help="Nuxeo path to collection... |
Use const instead of var | const data = require("sdk/self").data;
const tabs = require("sdk/tabs");
const { ToggleButton } = require("sdk/ui/button/toggle");
var btn_config = {};
var btn;
function tabToggle(tab) {
if (btn.state('window').checked) {
tab.attach({
contentScriptFile: data.url('embed.js')
});
} else {
tab.attac... | var data = require("sdk/self").data;
var tabs = require("sdk/tabs");
var { ToggleButton } = require("sdk/ui/button/toggle");
var btn_config = {};
var btn;
function tabToggle(tab) {
if (btn.state('window').checked) {
tab.attach({
contentScriptFile: data.url('embed.js')
});
} else {
tab.attach({
... |
Fix promise implementation in connection tests. Assert on result length as well. | import dbConfig from '../src/databaseConfig';
import MssqlSnapshot from '../src/MssqlSnapshot';
import {killConnections, createConnection} from './testUtilities';
describe('when retrieving active connections to a db', function() {
let target = null;
beforeEach(() => {
target = new MssqlSnapshot(dbConfig());
ret... | import dbConfig from '../src/databaseConfig';
import MssqlSnapshot from '../src/MssqlSnapshot';
import * as utility from './testUtilities';
describe('when retrieving active connections to a db', function() {
let target = null;
beforeEach(() => {
return utility.killConnections()
.then(utility.createConnection)
... |
Demo: Put radio buttons within <label> element | 'use strict'
class HelloMessage2 extends Cape.Component {
constructor(name) {
super()
this.names = [ 'alice', 'bob', 'charlie' ]
this.name = name
}
render(m) {
m.h1('Greeting')
m.p('Who are you?')
m.div(m => {
this.names.forEach(name => {
m.label(m => {
m.checked(... | 'use strict'
class HelloMessage2 extends Cape.Component {
constructor(name) {
super()
this.names = [ 'alice', 'bob', 'charlie' ]
this.name = name
}
render(m) {
m.h1('Greeting')
m.p('Who are you?')
m.div(m => {
this.names.forEach(name => {
m.checked(name === this.name)
... |
Add results to environment parameters RESULT_M, RESULT_B | #/usr/bin/python
""" Baseline example that needs to be beaten """
import os
import numpy as np
import matplotlib.pyplot as plt
x, y, yerr = np.loadtxt("data/data.txt", unpack=True)
A = np.vstack((np.ones_like(x), x)).T
C = np.diag(yerr * yerr)
cov = np.linalg.inv(np.dot(A.T, np.linalg.solve(C, A)))
b_ls, m_ls = np.... | #/usr/bin/python
""" Baseline example that needs to be beaten """
import numpy as np
import matplotlib.pyplot as plt
x, y, yerr = np.loadtxt("data/data.txt", unpack=True)
A = np.vstack((np.ones_like(x), x)).T
C = np.diag(yerr * yerr)
cov = np.linalg.inv(np.dot(A.T, np.linalg.solve(C, A)))
b_ls, m_ls = np.dot(cov, n... |
Add support for reading snapshots for program audit reader | # Copyright (C) 2017 Google Inc.
# Licensed under http://www.apache.org/licenses/LICENSE-2.0 <see LICENSE file>
scope = "AuditImplied"
description = """
A user with the ProgramReader role for a private program will also have this
role in the audit context for any audit created for that program.
"""
permissions =... | # Copyright (C) 2017 Google Inc.
# Licensed under http://www.apache.org/licenses/LICENSE-2.0 <see LICENSE file>
scope = "AuditImplied"
description = """
A user with the ProgramReader role for a private program will also have this
role in the audit context for any audit created for that program.
"""
permissions =... |
Test now fails properly without feature. | #!/usr/bin/env python
# -*- coding: UTF-8 -*-
from rollyourown.seo.admin import register_seo_admin, get_inline
from django.contrib import admin
from userapp.seo import Coverage, WithSites
register_seo_admin(admin.site, Coverage)
register_seo_admin(admin.site, WithSites)
from userapp.models import Product, Page, Cate... | #!/usr/bin/env python
# -*- coding: UTF-8 -*-
from rollyourown.seo.admin import register_seo_admin, get_inline
from django.contrib import admin
from userapp.seo import Coverage, WithSites
register_seo_admin(admin.site, Coverage)
register_seo_admin(admin.site, WithSites)
from userapp.models import Product, Page, Cate... |
Fix returned value from ternary operation | <?php
namespace Fulfillment\Postage\Api;
use Fulfillment\Postage\Models\Request\Contracts\Postage as PostageContract;
use Fulfillment\Postage\Exceptions\ValidationFailureException;
use Fulfillment\Postage\Models\Response\Postage as ResponsePostage;
use Fulfillment\Postage\Models\Request\Postage as RequestPostage;
cl... | <?php
namespace Fulfillment\Postage\Api;
use Fulfillment\Postage\Models\Request\Contracts\Postage as PostageContract;
use Fulfillment\Postage\Exceptions\ValidationFailureException;
use Fulfillment\Postage\Models\Request\Postage;
class PostageApi extends ApiRequestBase
{
/**
* @param PostageContract|array $p... |
Add a symlink to downloaded manifest. | #!/usr/bin/python
import json
import os
import sys
import tempfile
import urllib2
import zipfile
# Get the manifest urls.
req = urllib2.Request(
"https://www.bungie.net//platform/Destiny/Manifest/",
headers={'X-API-Key': sys.argv[1]},
)
resp = json.loads(urllib2.urlopen(req).read())
if resp['ErrorCode'] != 1:... | #!/usr/bin/python
import json
import os
import sys
import tempfile
import urllib2
import zipfile
# Get the manifest urls.
req = urllib2.Request(
"https://www.bungie.net//platform/Destiny/Manifest/",
headers={'X-API-Key': sys.argv[1]},
)
resp = json.loads(urllib2.urlopen(req).read())
if resp['ErrorCode'] != 1:... |
Make code compatible with no user agent | import copy
from django import template
from django.conf import settings
from games import models
register = template.Library()
def get_links(user_agent):
systems = ['ubuntu', 'fedora', 'linux']
downloads = copy.copy(settings.DOWNLOADS)
main_download = None
for system in systems:
if system ... | import copy
from django import template
from django.conf import settings
from games import models
register = template.Library()
def get_links(user_agent):
systems = ['ubuntu', 'fedora', 'linux']
downloads = copy.copy(settings.DOWNLOADS)
main_download = None
for system in systems:
if system ... |
Set logging level higher so we don't spam tests with debug messages | """
Tests of neo.rawio.examplerawio
Note for dev:
if you write a new RawIO class your need to put some file
to be tested at g-node portal, Ask neuralensemble list for that.
The file need to be small.
Then you have to copy/paste/renamed the TestExampleRawIO
class and a full test will be done to test if the new coded I... | """
Tests of neo.rawio.examplerawio
Note for dev:
if you write a new RawIO class your need to put some file
to be tested at g-node portal, Ask neuralensemble list for that.
The file need to be small.
Then you have to copy/paste/renamed the TestExampleRawIO
class and a full test will be done to test if the new coded I... |
Make assertion message use same var as test
Ensure that the assertion message correctly shows the value used by
the assertion test. | from collections import OrderedDict
from itertools import chain
from ..utils.orderedtype import OrderedType
from .structures import NonNull
class Argument(OrderedType):
def __init__(self, type, default_value=None, description=None, name=None, required=False, _creation_counter=None):
super(Argument, self... | from collections import OrderedDict
from itertools import chain
from ..utils.orderedtype import OrderedType
from .structures import NonNull
class Argument(OrderedType):
def __init__(self, type, default_value=None, description=None, name=None, required=False, _creation_counter=None):
super(Argument, self... |
Add renderer for Composite_Cc getTemplateVars
fixes Cc html component (which needs renderer) | <?php
class Kwc_Abstract_Composite_Cc_Component extends Kwc_Chained_Cc_Component
{
public function getTemplateVars(Kwf_Component_Renderer_Abstract $renderer = null)
{
$ret = parent::getTemplateVars($renderer);
foreach ($this->getData()->getChildComponents(array('generator' => 'child')) as $c) {
... | <?php
class Kwc_Abstract_Composite_Cc_Component extends Kwc_Chained_Cc_Component
{
public function getTemplateVars()
{
$ret = parent::getTemplateVars();
foreach ($this->getData()->getChildComponents(array('generator' => 'child')) as $c) {
if ($ret[$c->id]) $ret[$c->id] = $c; // Bei T... |
Fix modifications of Composer\Util\RemoteFilesystem (constructor) | <?php
/*
* This file is part of Composer.
*
* (c) Nils Adermann <naderman@naderman.de>
* Jordi Boggiano <j.boggiano@seld.be>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Naderman\Composer\AWS;
use Composer\Composer;... | <?php
/*
* This file is part of Composer.
*
* (c) Nils Adermann <naderman@naderman.de>
* Jordi Boggiano <j.boggiano@seld.be>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Naderman\Composer\AWS;
use Composer\Composer;... |
Remove mildly useful but highly dangerous debug feature. | <?php
class Config {
public function __construct() {
$raw_config = file_get_contents(__DIR__ . '/../config.json');
if (!$raw_config) {
throw new FileNotFoundException('Unable to load config.');
}
$vars = json_decode($raw_config, true /* as array */);
$this->vars = [];
foreach ($vars as ... | <?php
class Config {
public function __construct() {
$raw_config = file_get_contents(__DIR__ . '/../config.json');
if (!$raw_config) {
throw new FileNotFoundException('Unable to load config.');
}
$vars = json_decode($raw_config, true /* as array */);
$this->vars = [];
foreach ($vars as ... |
Mark this test as xfail | # TestREPLThrowReturn.py
#
# This source file is part of the Swift.org open source project
#
# Copyright (c) 2014 - 2015 Apple Inc. and the Swift project authors
# Licensed under Apache License v2.0 with Runtime Library Exception
#
# See http://swift.org/LICENSE.txt for license information
# See http://swift.org/CONTRI... | # TestREPLThrowReturn.py
#
# This source file is part of the Swift.org open source project
#
# Copyright (c) 2014 - 2015 Apple Inc. and the Swift project authors
# Licensed under Apache License v2.0 with Runtime Library Exception
#
# See http://swift.org/LICENSE.txt for license information
# See http://swift.org/CONTRI... |
Add page keywords for new 5.6.1 page
Former-commit-id: 4b8c1dd1a20b6d0fb8229ef8a29adf8ba92807f4 | <?
defined('C5_EXECUTE') or die("Access Denied.");
class ConcreteUpgradeVersion561Helper {
public $dbRefreshTables = array(
'Blocks',
'CollectionVersionBlocksOutputCache',
'PermissionAccessList'
);
public function run() {
$sp = Page::getByPath('/dashboard/system/seo/excluded');
if (!is_object($sp) || ... | <?
defined('C5_EXECUTE') or die("Access Denied.");
class ConcreteUpgradeVersion561Helper {
public $dbRefreshTables = array(
'Blocks',
'CollectionVersionBlocksOutputCache',
'PermissionAccessList'
);
public function run() {
$sp = Page::getByPath('/dashboard/system/seo/excluded');
if (!is_object($sp) || ... |
Use pyramid.paster instad of paste.deploy
--HG--
extra : convert_revision : g.bagnoli%40asidev.com-20110509152058-7sd3ek2lvqrdksuw | import os
import logging
import pyramid.paster
from paste.script.util.logging_config import fileConfig
log = logging.getLogger(__name__)
def get_pylons_app(global_conf):
pyramid_config = os.path.realpath(global_conf['__file__'])
dir_, conf = os.path.split(pyramid_config)
config_file = os.path.join(dir_, ... | import os
import logging
from paste.deploy import loadapp
from paste.script.util.logging_config import fileConfig
log = logging.getLogger(__name__)
def get_pylons_app(global_conf):
pyramid_config = os.path.realpath(global_conf['__file__'])
dir_, conf = os.path.split(pyramid_config)
config_file = os.path.... |
Fix the tile entity type (just push out null. We don't need this here) | package info.u_team.u_team_core.util.registry;
import java.util.function.Supplier;
import net.minecraft.tileentity.*;
import net.minecraft.tileentity.TileEntityType.Builder;
import net.minecraftforge.eventbus.api.IEventBus;
import net.minecraftforge.fml.RegistryObject;
import net.minecraftforge.registries.ForgeRegist... | package info.u_team.u_team_core.util.registry;
import java.util.function.Supplier;
import com.mojang.datafixers.DataFixUtils;
import net.minecraft.tileentity.*;
import net.minecraft.tileentity.TileEntityType.Builder;
import net.minecraft.util.SharedConstants;
import net.minecraft.util.datafix.*;
import net.minecraft... |
fix(analysis): Set date to YYYY-MM-DD format
fix #873 | import React from 'react'
import DateTime from 'react-datetime'
let datePickerCount = 0
export default function DatePicker(p) {
// Run once on mount and cleanup on unmount
React.useEffect(() => {
datePickerCount++
return () => datePickerCount--
}, [])
function onChange(date) {
// If the date hasju... | import React from 'react'
import DateTime from 'react-datetime'
let datePickerCount = 0
export default function DatePicker(p) {
// Run once on mount and cleanup on unmount
React.useEffect(() => {
datePickerCount++
return () => datePickerCount--
}, [])
function onChange(date) {
// If the date hasju... |
Revert "Revert "[HOTFIX] Remove replaces line on 0001_squashed"" | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
]
operations = [
migrations.CreateModel(
name='Channel',
fields=[
('id', models.AutoField(verb... | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
replaces = [(b'chat', '0001_squashed_0008_auto_20150702_1437'), (b'chat', '0002_auto_20150707_1647')]
dependencies = [
]
operations = [
migrations... |
Add default BUFFER_SIZE for feeds | # -*- coding: utf-8 -*-
from collections import deque
from logbook import Logger
log = Logger('pyFxTrader')
class Strategy(object):
TIMEFRAMES = [] # e.g. ['M30', 'H2']
BUFFER_SIZE = 500
feeds = {}
def __init__(self, instrument):
self.instrument = instrument
if not self.TIMEFRAM... | # -*- coding: utf-8 -*-
class Strategy(object):
TIMEFRAMES = [] # e.g. ['M30', 'H2']
def __init__(self, instrument):
self.instrument = instrument
if not self.TIMEFRAMES:
raise ValueError('Please define TIMEFRAMES variable.')
def start(self):
"""Called on strategy star... |
Add callback to url_callbacks so url module doesn't query it | from willie import web
from willie import module
import time
import json
import re
regex = re.compile('(play.spotify.com\/track\/)([\w-]+)')
def setup(bot):
if not bot.memory.contains('url_callbacks'):
bot.memory['url_callbacks'] = tools.WillieMemory()
bot.memory['url_callbacks'][regex] = spotify
def... | from willie import web
from willie import module
import time
import json
import urllib
@module.rule('.*(play.spotify.com\/track\/)([\w-]+).*')
def spotify(bot, trigger, found_match=None):
match = found_match or trigger
resp = web.get('https://api.spotify.com/v1/tracks/%s' % match.group(2))
result = json... |
Make local site debug easier | <?php
require_once __DIR__ . '/vendor/autoload.php';
if (is_dir("/home/gettauru")) {
$level = \PWE\Core\PWELogger::WARNING;
$tempdir = "/home/gettauru/tmp";
$logfile = "/home/gettauru/logs/pwe.".date('Ym');
} else { // our real website settings
// local debugging settings
$level = \PWE\Core\PWELogg... | <?php
require_once __DIR__ . '/vendor/autoload.php';
if ($_SERVER['SERVER_ADDR'] == $_SERVER['REMOTE_ADDR']) {
// local debugging settings
$level = \PWE\Core\PWELogger::DEBUG;
$tempdir = sys_get_temp_dir();
$logfile = "/tmp/taurus-pwe.log";
} else { // our real website settings
$level = \PWE\Core\P... |
Update the resource controller instance. The class has changed.
Signed-off-by: Clement Escoffier <6397137e57d1f87002962a37058f2a1c76fca9db@gmail.com> | package site;
import org.apache.felix.ipojo.configuration.Configuration;
import org.apache.felix.ipojo.configuration.Instance;
/**
* Declares an instance of the asset controller to server $basedir/documentation.
* The goal is to have the external documentation (reference, mojo and javadoc) structured as follows:
*... | package site;
import org.apache.felix.ipojo.configuration.Configuration;
import org.apache.felix.ipojo.configuration.Instance;
/**
* Declares an instance of the asset controller to server $basedir/documentation.
* The goal is to have the external documentation (reference, mojo and javadoc) structured as follows:
*... |
Add functionality in order to reload in-place | <?php
namespace atk4\ui;
/**
* This class generates action, that will be able to loop-back to the callback method.
*/
class jsReload implements jsExpressionable
{
public $view = null;
public $cb = null;
public function __construct($view)
{
$this->view = $view;
$this->cb = $this->v... | <?php
namespace atk4\ui;
/**
* This class generates action, that will be able to loop-back to the callback method.
*/
class jsReload implements jsExpressionable
{
public $view = null;
public $cb = null;
public function __construct($view)
{
$this->view = $view;
$this->cb = $this->v... |
Add Serializable interface for PrepareStatementParameterHeader. | /*
* Copyright 2016-2018 shardingsphere.io.
* <p>
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable l... | /*
* Copyright 2016-2018 shardingsphere.io.
* <p>
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable l... |
Fix Select2 width to 100% | import React from 'react';
import { FormGroup, ControlLabel, Col } from 'react-bootstrap';
import Select2 from 'react-select2-wrapper';
import { cloneObject } from '../../utils';
import 'react-select2-wrapper/css/select2.css';
class SelectGroup extends React.Component {
render() {
let selectProps = clo... | import React from 'react';
import { FormGroup, ControlLabel, Col } from 'react-bootstrap';
import Select2 from 'react-select2-wrapper';
import { cloneObject } from '../../utils';
import 'react-select2-wrapper/css/select2.css';
class SelectGroup extends React.Component {
render() {
let selectProps = clo... |
Add input data to assignment's name. | <?php
require_once(__DIR__ . '/Assignment.class.php');
/**
* Grader for JFlap programs.
*
* @author Marco Aurélio Graciotto Silva
*/
class CmdlineInputOutputAssignment extends Assignment
{
private $input;
private $output;
public function setInput($input) {
$this->input = $input;
}
public function getInp... | <?php
require_once(__DIR__ . '/Assignment.class.php');
/**
* Grader for JFlap programs.
*
* @author Marco Aurélio Graciotto Silva
*/
class CmdlineInputOutputAssignment extends Assignment
{
private $input;
private $output;
public function setInput($input) {
$this->input = $input;
}
public function getInp... |
Remove invalid arg in influxdb test.
Copy paste bug from graphite. Namespace doesn't apply to InfuxDb. | 'use strict';
const DataGenerator = require('../lib/plugins/influxdb/data-generator'),
expect = require('chai').expect;
describe('influxdb', function() {
describe('dataGenerator', function() {
it('should generate data for gpsi.pageSummary', function() {
const message = {
"type": "gpsi.pageSummar... | 'use strict';
const DataGenerator = require('../lib/plugins/influxdb/data-generator'),
expect = require('chai').expect;
describe('influxdb', function() {
describe('dataGenerator', function() {
it('should generate data for gpsi.pageSummary', function() {
const message = {
"type": "gpsi.pageSummar... |
Send XpayMessageEntity to process() method | <?php
namespace Hicoria\Xpay;
use Nette\Object;
class XpaySmsDispatcher extends Object {
/**
* @var IMessageProcessor[]
*/
private $processors;
public function register($regex, IMessageProcessor $processor) {
$this->processors[$regex] = $processor;
}
public function process... | <?php
namespace Hicoria\Xpay;
use Nette\Object;
class XpaySmsDispatcher extends Object {
/**
* @var IMessageProcessor[]
*/
private $processors;
public function register($regex, IMessageProcessor $processor) {
$this->processors[$regex] = $processor;
}
public function process... |
Increase limit for display of affiliations. | /* eslint-disable prefer-arrow-callback */
import { Meteor } from 'meteor/meteor';
import { check } from 'meteor/check';
import { Affiliations } from '../affiliations.js';
Meteor.publish('affiliations.byParent', function affiliationsbyEvent(id) {
check(id, String);
return Affiliations.find({ parentId: id }, {
... | /* eslint-disable prefer-arrow-callback */
import { Meteor } from 'meteor/meteor';
import { check } from 'meteor/check';
import { Affiliations } from '../affiliations.js';
Meteor.publish('affiliations.byParent', function affiliationsbyEvent(id) {
check(id, String);
return Affiliations.find({ parentId: id }, {
... |
Update for plug-in : GitHub | var hoverZoomPlugins = hoverZoomPlugins || [];
hoverZoomPlugins.push({
name:'GitHub',
version:'0.3',
prepareImgLinks:function (callback) {
var res = [];
$('a > img[data-canonical-src]').each(function () {
var img = $(this);
img.data('hoverZoomSrc', [img.attr... | var hoverZoomPlugins = hoverZoomPlugins || [];
hoverZoomPlugins.push({
name:'GitHub',
prepareImgLinks:function (callback) {
var res = [];
$('a > img[data-canonical-src]').each(function () {
var img = $(this);
img.data('hoverZoomSrc', [img.attr('data-canonical-src')]);
... |
Make sender address name field optional | """
byceps.services.email.transfer.models
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
:Copyright: 2006-2021 Jochen Kupperschmidt
:License: Revised BSD (see `LICENSE` file for details)
"""
from __future__ import annotations
from dataclasses import dataclass
from email.utils import formataddr
from typing import Optional
fro... | """
byceps.services.email.transfer.models
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
:Copyright: 2006-2021 Jochen Kupperschmidt
:License: Revised BSD (see `LICENSE` file for details)
"""
from __future__ import annotations
from dataclasses import dataclass
from email.utils import formataddr
from ....typing import BrandID
... |
FIX forgot debug dump (!) | <?php
class Default_Model_MovieMapper extends Default_Model_AbstractMapper
{
public function find($id)
{
$result = $this->getDbTable()->find($id);
return $result->current();
}
public function fetchAll()
{
$resultSet = $this->getDbTable()->fetchAll();
... | <?php
class Default_Model_MovieMapper extends Default_Model_AbstractMapper
{
public function find($id)
{
$result = $this->getDbTable()->find($id);
return $result->current();
}
public function fetchAll()
{
$resultSet = $this->getDbTable()->fetchAll();
... |
Comment so it can compile for testing | package info.u_team.u_team_test.data.provider;
import info.u_team.u_team_core.data.*;
import info.u_team.u_team_test.init.*;
public class TestItemModelsProvider extends CommonItemModelsProvider {
public TestItemModelsProvider(GenerationData data) {
super(data);
}
@Override
protected void registerModels() {
... | package info.u_team.u_team_test.data.provider;
import info.u_team.u_team_core.data.*;
import info.u_team.u_team_test.init.*;
public class TestItemModelsProvider extends CommonItemModelsProvider {
public TestItemModelsProvider(GenerationData data) {
super(data);
}
@Override
protected void registerModels() {
... |
Add an option to enable/disable JSON parsing | import xhr from 'xhr'
function isString (obj) { return (typeof (obj) === 'string') }
function isSuccess (code) { return (code >= 200 && code <= 399) }
async function get (url, deserialize = true) {
return request(url, 'GET', deserialize)
}
async function post (url, payload) {
return request(url, 'POST', true, pa... | import xhr from 'xhr'
function isString (obj) { return (typeof (obj) === 'string') }
function isSuccess (code) { return (code >= 200 && code <= 399) }
async function get (url) {
return request(url, 'GET')
}
async function post (url, payload) {
return request(url, 'POST', payload)
}
async function request (url, ... |
Use "Aptible Legacy Infrastructure" everywhere | import Ember from 'ember';
import ajax from 'diesel/utils/ajax';
import config from 'diesel/config/environment';
function errorToMessage(e) {
switch(e.status) {
case 0:
return "Metrics server is unavailable; please try again later";
case 400:
return "Metrics server declined to serve the request";... | import Ember from 'ember';
import ajax from 'diesel/utils/ajax';
import config from 'diesel/config/environment';
function errorToMessage(e) {
switch(e.status) {
case 0:
return "Metrics server is unavailable; please try again later";
case 400:
return "Metrics server declined to serve the request";... |
Update ioc storage path for the raw tiffs. | from ophyd.controls.area_detector import (AreaDetectorFileStoreHDF5,
AreaDetectorFileStoreTIFF,
AreaDetectorFileStoreTIFFSquashing)
# from shutter import sh1
shctl1 = EpicsSignal('XF:28IDC-ES:1{Det:PE1}cam1:ShutterMode', name='shctl1'... | from ophyd.controls.area_detector import (AreaDetectorFileStoreHDF5,
AreaDetectorFileStoreTIFF,
AreaDetectorFileStoreTIFFSquashing)
# from shutter import sh1
shctl1 = EpicsSignal('XF:28IDC-ES:1{Det:PE1}cam1:ShutterMode', name='shctl1'... |
Convert url param values to unicode before encoding. | import hashlib
import hmac
import urllib, urllib2
API_OPERATING_STATUSES = (
(1, 'Normal'),
(2, 'Degraded Service'),
(3, 'Service Disruption'),
(4, 'Undergoing Maintenance')
)
API_STATUSES = (
(1, 'Active'),
(2, 'Deprecated'),
(3, 'Disabled')
)
KEY_STATUSES = (
('U', 'Unactivated'),
... | import hashlib
import hmac
import urllib, urllib2
API_OPERATING_STATUSES = (
(1, 'Normal'),
(2, 'Degraded Service'),
(3, 'Service Disruption'),
(4, 'Undergoing Maintenance')
)
API_STATUSES = (
(1, 'Active'),
(2, 'Deprecated'),
(3, 'Disabled')
)
KEY_STATUSES = (
('U', 'Unactivated'),
... |
Fix NO TESTS FOUND IN TESTCASE error
Ref:
http://nickhayden.com/blog/laravel-5-no-tests-found-in-testcase-error/ | <?php
abstract class TestCase extends Illuminate\Foundation\Testing\TestCase
{
protected $baseUrl = 'http://localhost:8000';
/**
* Creates the application.
*
* @return \Illuminate\Foundation\Application
*/
public function createApplication()
{
$app = require __DIR__.'/../bo... | <?php
class TestCase extends Illuminate\Foundation\Testing\TestCase
{
protected $baseUrl = 'http://localhost:8000';
/**
* Creates the application.
*
* @return \Illuminate\Foundation\Application
*/
public function createApplication()
{
$app = require __DIR__.'/../bootstrap/a... |
Add option to print debug statements at regular intervals
Useful to track the progress of the load. This was a change copied from the
production server. | import json
import bson.json_util as bju
import emission.core.get_database as edb
import argparse
import emission.core.wrapper.user as ecwu
if __name__ == '__main__':
parser = argparse.ArgumentParser()
parser.add_argument("timeline_filename",
help="the name of the file that contains the json representa... | import json
import bson.json_util as bju
import emission.core.get_database as edb
import argparse
import emission.core.wrapper.user as ecwu
if __name__ == '__main__':
parser = argparse.ArgumentParser()
parser.add_argument("timeline_filename",
help="the name of the file that contains the json representa... |
Fix NPE with nullable expressions in custom syntax | package com.btk5h.skriptmirror.skript.custom;
import org.bukkit.event.Event;
import ch.njol.skript.lang.Expression;
import ch.njol.skript.lang.SkriptParser;
import ch.njol.skript.lang.util.SimpleExpression;
import ch.njol.util.Kleenean;
public class CustomSyntaxExpression extends SimpleExpression<Object> {
private... | package com.btk5h.skriptmirror.skript.custom;
import org.bukkit.event.Event;
import ch.njol.skript.lang.Expression;
import ch.njol.skript.lang.SkriptParser;
import ch.njol.skript.lang.util.SimpleExpression;
import ch.njol.util.Kleenean;
public class CustomSyntaxExpression extends SimpleExpression<Object> {
private... |
Set Sentry log level to warning
To prevent every damn thing from being logged... | #
# Centralized logging setup
#
import os
import logging
from .utils import getLogger
l = getLogger('backend')
logging.basicConfig(
level=logging.DEBUG,
format='[%(asctime)s][%(levelname)s] %(name)s '
'%(filename)s:%(funcName)s:%(lineno)d | %(message)s',
datefmt='%Y-%m-%d %H:%M:%S'
)
sentry_d... | #
# Centralized logging setup
#
import os
import logging
from .utils import getLogger
l = getLogger('backend')
logging.basicConfig(
level=logging.DEBUG,
format='[%(asctime)s][%(levelname)s] %(name)s '
'%(filename)s:%(funcName)s:%(lineno)d | %(message)s',
datefmt='%Y-%m-%d %H:%M:%S'
)
sentry_d... |
FIX augmentSQL func to be compatible with 3.2 method signature | <?php
class ForumSpamPostExtension extends DataExtension {
public function augmentSQL(SQLQuery &$query) {
if (Config::inst()->forClass('Post')->allow_reading_spam) return;
$member = Member::currentUser();
$forum = $this->owner->Forum();
// Do Status filtering
if($member && is_numeric($forum->ID) && $memb... | <?php
class ForumSpamPostExtension extends DataExtension {
public function augmentSQL(SQLSelect $query) {
if (Config::inst()->forClass('Post')->allow_reading_spam) return;
$member = Member::currentUser();
$forum = $this->owner->Forum();
// Do Status filtering
if($member && is_numeric($forum->ID) && $memb... |
Move redirect setting to correct location. | <?php
/**
* Application Settings
* @author John Kloor <kloor@bgsu.edu>
* @copyright 2017 Bowling Green State University Libraries
* @license MIT
*/
use Symfony\Component\Yaml\Yaml;
// Setup the default settings for the application.
$settings = [
// Application settings.
'app' => [
// Whether to e... | <?php
/**
* Application Settings
* @author John Kloor <kloor@bgsu.edu>
* @copyright 2017 Bowling Green State University Libraries
* @license MIT
*/
use Symfony\Component\Yaml\Yaml;
// Setup the default settings for the application.
$settings = [
// Application settings.
'app' => [
// Whether to e... |
Comment out tests that fail intentionally (for testing purposes). | package water.cookbook;
import org.junit.*;
import water.*;
import water.fvec.*;
import water.util.Log;
import water.util.RemoveAllKeysTask;
public class Cookbook extends TestUtil {
@Before
public void removeAllKeys() {
Log.info("Removing all keys...");
RemoveAllKeysTask collector = new RemoveAllKeysTask(... | package water.cookbook;
import org.junit.*;
import water.*;
import water.fvec.*;
import water.util.Log;
import water.util.RemoveAllKeysTask;
public class Cookbook extends TestUtil {
@Before
public void removeAllKeys() {
Log.info("Removing all keys...");
RemoveAllKeysTask collector = new RemoveAllKeysTask(... |
Fix for PHP 7 exceptions (throwables) | <?php namespace App\Exceptions;
use Exception;
use Illuminate\Foundation\Exceptions\Handler as ExceptionHandler;
class Handler extends \Neonbug\Common\Exceptions\Handler {
/**
* A list of the exception types that should not be reported.
*
* @var array
*/
protected $dontReport = [
'Symfony\Component\HttpK... | <?php namespace App\Exceptions;
use Exception;
use Illuminate\Foundation\Exceptions\Handler as ExceptionHandler;
class Handler extends ExceptionHandler {
/**
* A list of the exception types that should not be reported.
*
* @var array
*/
protected $dontReport = [
'Symfony\Component\HttpKernel\Exception\Ht... |
db: Use stdout and stderr, not console | #!/usr/bin/env node
var Neo4j = require("node-neo4j");
var utils = require("./utils");
var stdin = process.openStdin();
var stdout = process.stdout;
var stderr = process.stderr;
utils.validateEnvironment("node db-admin.js");
stderr.write("=> Connecting to " + process.env.DATABASE_URL + "\n");
(function runAdminInte... | #!/usr/bin/env node
var Neo4j = require("node-neo4j");
var utils = require("./utils");
var stdin = process.openStdin();
utils.validateEnvironment("node db-admin.js");
console.log("=> Connecting to " + process.env.DATABASE_URL);
(function runAdminInterface() {
var connectionString = utils.createConnectionString();... |
Set download_url to pypi directory.
git-svn-id: c8188841f5432f3fe42d04dee4f87e556eb5cf84@23 99efc558-b41a-11dd-8714-116ca565c52f | #!/usr/bin/env python
from ez_setup import use_setuptools
use_setuptools()
import os
from setuptools import setup, find_packages
here = os.path.dirname(__file__)
version_file = os.path.join(here, 'src/iptools/__init__.py')
d = {}
execfile(version_file, d)
version = d['__version__']
setup(
name = 'iptools',
... | #!/usr/bin/env python
from ez_setup import use_setuptools
use_setuptools()
import os
from setuptools import setup, find_packages
here = os.path.dirname(__file__)
version_file = os.path.join(here, 'src/iptools/__init__.py')
d = {}
execfile(version_file, d)
version = d['__version__']
setup(
name = 'iptools',
... |
Update to comply with last release of jsgraph | 'use strict';
var wavelengthToColor = require('./wavelengthToColor');
function getAnnotation(pixel, color, height) {
return {
"fillColor": color,
"type": "rect",
"position": [{
"y": "0px",
"x": pixel+2
},{
"y": height+"px",
"x": pixe... | 'use strict';
var wavelengthToColor = require('./wavelengthToColor');
function getAnnotation(pixel, color, height) {
return {
"pos2": {
"y": height+"px",
"x": pixel-1
},
"fillColor": color,
"type": "rect",
"pos": {
"y": "0px",
... |
Fix adding pattern to actually use the pattern text. | import React, { Component } from 'react'
import { connect } from 'react-redux'
import { addPattern } from '../actions'
import TextField from 'material-ui/TextField'
import RaisedButton from 'material-ui/RaisedButton'
import Subheader from 'material-ui/Subheader'
import Paper from 'material-ui/Paper'
import * as styles ... | import React, { Component } from 'react'
import { connect } from 'react-redux'
import { addPattern } from '../actions'
import TextField from 'material-ui/TextField'
import RaisedButton from 'material-ui/RaisedButton'
import Subheader from 'material-ui/Subheader'
import Paper from 'material-ui/Paper'
import * as styles ... |
Fix table name error in sale_stock column renames | # -*- coding: utf-8 -*-
##############################################################################
#
# Odoo, a suite of business apps
# This module Copyright (C) 2014 Therp BV (<http://therp.nl>).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Af... | # -*- coding: utf-8 -*-
##############################################################################
#
# Odoo, a suite of business apps
# This module Copyright (C) 2014 Therp BV (<http://therp.nl>).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Af... |
Add redirectTo - user -> user/profile | <?php
use Rudolf\Component\Routing\Route;
$collection->add('user/login', new Route(
'user/login(/redirect-to/<page>)?',
'Rudolf\Modules\Users\Login\Controller::login',
['page' => '.*$'],
['page' => 'dashboard']
));
$collection->add('user', new Route(
'user([\/])?',
'Rudolf\Modules\Users\Profi... | <?php
use Rudolf\Component\Routing;
use Rudolf\Component\Modules;
$module = new Modules\Module('dashboard');
$config = $module->getConfig();
$collection->add('user/login', new Routing\Route(
'user/login(/redirect-to/<page>)?',
'Rudolf\Modules\Users\Login\Controller::login',
array( // wyrazenia regularne ... |
[LIB-387] Change param name in APNS device model | import stampit from 'stampit';
import {Meta, Model} from './base';
const APNSDeviceMeta = Meta({
name: 'apnsdevice',
pluralName: 'apnsdevices',
endpoints: {
'detail': {
'methods': ['delete', 'patch', 'put', 'get'],
'path': '/v1/instances/{instanceName}/push_notifications/apns/devices/{registratio... | import stampit from 'stampit';
import {Meta, Model} from './base';
const APNSDeviceMeta = Meta({
name: 'apnsdevice',
pluralName: 'apnsdevices',
endpoints: {
'detail': {
'methods': ['delete', 'patch', 'put', 'get'],
'path': '/v1/instances/{instanceName}/push_notifications/apns/devices/{id}'
},... |
Add serializer for png assets | import jpegThumbnail from './jpeg-thumbnail';
import storage from '../storage';
const costumePayload = costume => {
// TODO is it ok to base64 encode SVGs? What about unicode text inside them?
const assetDataUrl = storage.get(costume.assetId).encodeDataURI();
const assetDataFormat = costume.dataFormat;
... | import jpegThumbnail from './jpeg-thumbnail';
import storage from '../storage';
const costumePayload = costume => {
// TODO is it ok to base64 encode SVGs? What about unicode text inside them?
const assetDataUrl = storage.get(costume.assetId).encodeDataURI();
const assetDataFormat = costume.dataFormat;
... |
Update with reference to global nav partial | var _ = require('lodash')
var fs = require('fs')
var gzip = require('gzip-size')
var filesize = require('filesize')
var cssstats = require('cssstats')
var module = require('tachyons-borders/package.json')
var moduleCss = fs.readFileSync('node_modules/tachyons-borders/tachyons-borders.min.css', 'utf8')
var moduleObj = ... | var _ = require('lodash')
var fs = require('fs')
var gzip = require('gzip-size')
var filesize = require('filesize')
var cssstats = require('cssstats')
var module = require('tachyons-borders/package.json')
var moduleCss = fs.readFileSync('node_modules/tachyons-borders/tachyons-borders.min.css', 'utf8')
var moduleObj = ... |
Fix GNOME keymap missing shortcuts. | /*
* Copyright 2000-2009 JetBrains s.r.o.
*
* 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 agre... | /*
* Copyright 2000-2009 JetBrains s.r.o.
*
* 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 agre... |
Drop max-concurrency for update in refresh pipeline (invalid arg) | from setuptools import find_packages, setup
setup(
name="redshift-etl",
version="0.27.1",
author="Harry's Data Engineering and Contributors",
description="ETL code to ferry data from PostgreSQL databases (or S3 files) to Redshift cluster",
license="MIT",
keywords="redshift postgresql etl extra... | from setuptools import find_packages, setup
setup(
name="redshift-etl",
version="0.27.0",
author="Harry's Data Engineering and Contributors",
description="ETL code to ferry data from PostgreSQL databases (or S3 files) to Redshift cluster",
license="MIT",
keywords="redshift postgresql etl extra... |
Disable nsinit tests in travis.
Signed-off-by: Eric Myhre <2346ad27d7568ba9896f1b7da6b5991251debdf2@exultant.us> | package nsinit
import (
"os"
"testing"
. "github.com/smartystreets/goconvey/convey"
"polydawn.net/repeatr/executor/tests"
"polydawn.net/repeatr/testutil"
)
func Test(t *testing.T) {
Convey("Spec Compliance: nsinit Executor", t,
testutil.Requires(
testutil.RequiresRoot,
testutil.RequiresNamespaces,
t... | package nsinit
import (
"os"
"testing"
. "github.com/smartystreets/goconvey/convey"
"polydawn.net/repeatr/executor/tests"
"polydawn.net/repeatr/testutil"
)
func Test(t *testing.T) {
Convey("Spec Compliance: nsinit Executor", t,
testutil.Requires(
testutil.RequiresRoot,
testutil.WithTmpdir(func() {
... |
Fix a bug in bug reporting when not joined to a game. | <?
$steps = $_REQUEST['steps'];
$subject = $_REQUEST['subject'];
$error_msg = $_REQUEST['error_msg'];
$description = $_REQUEST['description'];
$new_sub = '[Bug] '.$subject;
$message = 'Login: '.$account->login.EOL.EOL.'-----------'.EOL.EOL.
'Account ID: '.$account->account_id.EOL.EOL.'-----------'.EOL.EOL.
'Descr... | <?
$steps = $_REQUEST['steps'];
$subject = $_REQUEST['subject'];
$error_msg = $_REQUEST['error_msg'];
$description = $_REQUEST['description'];
$new_sub = '[Bug] '.$subject;
$message = 'Login: '.$account->login.EOL.EOL.'-----------'.EOL.EOL.
'Account ID: '.$account->account_id.EOL.EOL.'-----------'.EOL.EOL.
'Descr... |
Add breadcrumb components to entry script | export { Badge, BadgeColors } from './components/badge';
export { Button, Link, ButtonSizes, ButtonColors } from './components/button';
export { ButtonGroup, ButtonGroupSizes, ButtonGroupColors } from './components/button-group';
export { Breadcrumbs, BreadcrumbItem } from './components/breadcrumbs';
export { Callout, ... | export { Badge, BadgeColors } from './components/badge';
export { Button, Link, ButtonSizes, ButtonColors } from './components/button';
export { ButtonGroup, ButtonGroupSizes, ButtonGroupColors } from './components/button-group';
export { Callout, CalloutColors, CalloutSizes } from './components/callout';
export { Clos... |
Update to handle modal window submits. | /* ajax_windows.js. Support for modal popup windows in Umlaut items. */
jQuery(document).ready(function($) {
var populate_modal = function(data, textStatus, jqXHR) {
data = $(data);
var heading = data.find("h1, h2, h3, h4, h5, h6").eq(0).remove();
if (heading) $("#modal .modal-header h3").text(heading.te... | /* ajax_windows.js. Support for modal popup windows in Umlaut items. */
jQuery(document).ready(function($) {
var populate_modal = function(data, textStatus, jqXHR) {
data = $(data);
var heading = data.find("h1, h2, h3, h4, h5, h6").eq(0).remove();
$("#modal .modal-header h3").text(heading.text());
va... |
Fix uncaught exception if minecraft server is offline when the bot starts | 'use strict';
module.exports = function(config, ircbot) {
const Rcon = require('rcon');
const client = new Rcon(config.rcon.host, config.rcon.port, config.rcon.password);
client.on('auth', function() {
console.log('RCON authentication successful');
}).on('response', function(str) {
console.log('RCON got respo... | 'use strict';
module.exports = function(config, ircbot) {
const Rcon = require('rcon');
const client = new Rcon(config.rcon.host, config.rcon.port, config.rcon.password);
client.on('auth', function() {
console.log('RCON authentication successful');
}).on('response', function(str) {
console.log('RCON got resp... |
Make helper class final and non-instantiable | package fr.tvbarthel.apps.devredpe2014.ui;
import android.app.ActionBar;
import android.content.Context;
import android.text.SpannableString;
import android.text.Spanned;
import android.text.style.ForegroundColorSpan;
import android.text.style.TypefaceSpan;
import fr.tvbarthel.apps.devredpe2014.R;
public final clas... | package fr.tvbarthel.apps.devredpe2014.ui;
import android.app.ActionBar;
import android.content.Context;
import android.text.SpannableString;
import android.text.Spanned;
import android.text.style.ForegroundColorSpan;
import android.text.style.TypefaceSpan;
import fr.tvbarthel.apps.devredpe2014.R;
public class Acti... |
Add exception when mysql is not support for fulltext index | <?php namespace Octommerce\Octommerce\Updates;
use DB;
use Schema;
use Exception;
use October\Rain\Database\Updates\Migration;
class AddFulltextIndexToProductsTable extends Migration
{
public function up()
{
try {
DB::statement('ALTER TABLE octommerce_octommerce_products ADD FULLTEXT (nam... | <?php namespace Octommerce\Octommerce\Updates;
use DB;
use Schema;
use October\Rain\Database\Updates\Migration;
class AddFulltextIndexToProductsTable extends Migration
{
public function up()
{
DB::statement('ALTER TABLE octommerce_octommerce_products ADD FULLTEXT (name)');
DB::statement('ALTE... |
Change tilt series type to float in manual background sub. | def transform_scalars(dataset):
from tomviz import utils
import numpy as np
#----USER SPECIFIED VARIABLES-----#
###XRANGE###
###YRANGE###
###ZRANGE###
#---------------------------------#
data_bs = utils.get_array(dataset) #get data as numpy array
data_bs = data_bs.astype(np.float3... | def transform_scalars(dataset):
from tomviz import utils
import numpy as np
#----USER SPECIFIED VARIABLES-----#
###XRANGE###
###YRANGE###
###ZRANGE###
#---------------------------------#
data_bs = utils.get_array(dataset) #get data as numpy array
if data_bs is None: #Check if ... |
Correct a workaround for PyPy | from array import array
from typing import Any, ByteString, Collection, Iterable, Mapping, Text, ValuesView
__all__ = ["is_collection", "is_iterable"]
collection_types: Any = [Collection]
if not isinstance({}.values(), Collection): # Python < 3.7.2
collection_types.append(ValuesView)
if not issubclass(array, Co... | from array import array
from typing import Any, ByteString, Collection, Iterable, Mapping, Text, ValuesView
__all__ = ["is_collection", "is_iterable"]
collection_types: Any = [Collection]
if not isinstance({}.values(), Collection): # Python < 3.7.2
collection_types.append(ValuesView)
if not isinstance(array, Co... |
Add slash to initiative submit url | from django.conf.urls import url
from bluebottle.initiatives.views import (
InitiativeList, InitiativeDetail, InitiativeImage,
InitiativeReviewTransitionList
)
urlpatterns = [
url(
r'^/transitions$',
InitiativeReviewTransitionList.as_view(),
name='initiative-review-transition-list... | from django.conf.urls import url
from bluebottle.initiatives.views import (
InitiativeList, InitiativeDetail, InitiativeImage,
InitiativeReviewTransitionList
)
urlpatterns = [
url(
r'^transitions$',
InitiativeReviewTransitionList.as_view(),
name='initiative-review-transition-list'... |
Check for permission only in external calls | const auth = require('@feathersjs/authentication');
const globalHooks = require('../../../hooks');
const { ScopeService } = require('./ScopeService');
const { lookupScope, checkScopePermissions } = require('./hooks');
/**
* Implements retrieving a list of all users who are associated with a scope.
* @class ScopeMemb... | const auth = require('@feathersjs/authentication');
const globalHooks = require('../../../hooks');
const { ScopeService } = require('./ScopeService');
const { lookupScope, checkScopePermissions } = require('./hooks');
/**
* Implements retrieving a list of all users who are associated with a scope.
* @class ScopeMemb... |
Fix title for desktop notification | # coding: utf-8
import platform
if platform.system() == 'Darwin':
from Foundation import NSUserNotificationDefaultSoundName
import objc
NSUserNotification = objc.lookUpClass('NSUserNotification')
NSUserNotificationCenter = objc.lookUpClass('NSUserNotificationCenter')
def desktop_notify(text, titl... | # coding: utf-8
import platform
if platform.system() == 'Darwin':
from Foundation import NSUserNotificationDefaultSoundName
import objc
NSUserNotification = objc.lookUpClass('NSUserNotification')
NSUserNotificationCenter = objc.lookUpClass('NSUserNotificationCenter')
def desktop_notify(text, titl... |
Fix typo causing fatal error. | <?php
use Cake\Core\Plugin;
use Cake\Routing\Router;
Router::scope('/', function($routes) {
/**
* Here, we are connecting '/' (base path) to controller called 'Pages',
* its action called 'display', and we pass a param to select the view file
* to use (in this case, /app/View/Pages/home.ctp)...
*/
$routes->conn... | <?php
use Cake\Core\Plugin;
use Cake\Routing\Router;
Router::scope('/', function($routes) {
/**
* Here, we are connecting '/' (base path) to controller called 'Pages',
* its action called 'display', and we pass a param to select the view file
* to use (in this case, /app/View/Pages/home.ctp)...
*/
$routes->conn... |
Add students app url configuration | """halaqat URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/1.8/topics/http/urls/
Examples:
Function views
1. Add an import: from my_app import views
2. Add a URL to urlpatterns: url(r'^$', views.home, name='home')
Class-bas... | """halaqat URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/1.8/topics/http/urls/
Examples:
Function views
1. Add an import: from my_app import views
2. Add a URL to urlpatterns: url(r'^$', views.home, name='home')
Class-bas... |
Fix public fields from Event | from django.forms import ModelForm, widgets
from .models import Fellow, Event, Expense, Blog
class FellowForm(ModelForm):
class Meta:
model = Fellow
fields = '__all__'
class EventForm(ModelForm):
class Meta:
model = Event
exclude = [
"status",
... | from django.forms import ModelForm, widgets
from .models import Fellow, Event, Expense, Blog
class FellowForm(ModelForm):
class Meta:
model = Fellow
fields = '__all__'
class EventForm(ModelForm):
class Meta:
model = Event
exclude = [
"status",
... |
Fix user collection pass by ref. | package models
import (
"github.com/UserStack/ustackd/backends"
)
type UserCollection struct {
}
func (this *UserCollection) All() []User {
return []User{
User{&backends.User{Uid: 1, Email: "foo"}},
User{&backends.User{Uid: 2, Email: "admin"}},
User{&backends.User{Uid: 3, Email: "abc"}},
User{&backends.Use... | package models
import (
"github.com/UserStack/ustackd/backends"
)
type UserCollection struct {
}
func (this UserCollection) All() []User {
return []User{
User{&backends.User{Uid: 1, Email: "foo"}},
User{&backends.User{Uid: 2, Email: "admin"}},
User{&backends.User{Uid: 3, Email: "abc"}},
User{&backends.User... |
Add call to make login default | #!/usr/bin/env node
'use strict'
var program = require('commander')
var winston = require('winston')
var exec = require('./lib/exec')
program
.version(require('./package.json').version)
.description('Ensure default login keychain exists')
.parse(process.argv)
exec('security list-keychains -d user').then(func... | #!/usr/bin/env node
'use strict'
var program = require('commander')
var winston = require('winston')
var exec = require('./lib/exec')
program
.version(require('./package.json').version)
.description('Ensure default login keychain exists')
.parse(process.argv)
exec('security list-keychains -d user').then(func... |
Remove default route for serving static files from URL map. | # -*- coding: utf-8 -*-
"""
Gewebehaken
~~~~~~~~~~~
The WSGI application
:Copyright: 2015 `Jochen Kupperschmidt <http://homework.nwsnet.de/>`_
:License: MIT, see LICENSE for details.
"""
import logging
from logging import FileHandler, Formatter
from flask import Flask
from .hooks.twitter import blueprint as twitt... | # -*- coding: utf-8 -*-
"""
Gewebehaken
~~~~~~~~~~~
The WSGI application
:Copyright: 2015 `Jochen Kupperschmidt <http://homework.nwsnet.de/>`_
:License: MIT, see LICENSE for details.
"""
import logging
from logging import FileHandler, Formatter
from flask import Flask
from .hooks.twitter import blueprint as twitt... |
Update for cards package refactoring | package jcrib;
import java.util.ArrayList;
import java.util.List;
import jcrib.cards.Card;
import jcrib.cards.Hand;
public class Player {
private String name;
private int points;
private Hand hand;
private Card cut;
private List<List<Score>> scores = new ArrayList<>();
public Player(String n... | package jcrib;
import java.util.ArrayList;
import java.util.List;
public class Player {
private String name;
private int points;
private Hand hand;
private Card cut;
private List<List<Score>> scores = new ArrayList<>();
public Player(String name) {
this.name = name;
this.hand ... |
Fix tab spacing from 2 to 4 spaces | #!/usr/local/bin/python3.6
# read nginx access log
# parse and get the ip addresses and times
# match ip addresses to geoip
# possibly ignore bots
import re
def get_log_lines(path):
"""Return a list of regex matched log lines from the passed nginx access log path"""
lines = []
with open(path) as f:
... | #!/usr/local/bin/python3.6
# read nginx access log
# parse and get the ip addresses and times
# match ip addresses to geoip
# possibly ignore bots
import re
def get_log_lines(path):
"""Return a list of regex matched log lines from the passed nginx access log path"""
lines = []
with open(path) as f:
r = re... |
Fix issue of count down latch example2 didn't shutdown | package com.hzh.corejava.concurrent;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.Executor;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
/**
* Created by huangzehai on 2017/2/20.
*/
class CountDownLatchExample2 { // ...
private static final int N... | package com.hzh.corejava.concurrent;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.Executor;
import java.util.concurrent.Executors;
/**
* Created by huangzehai on 2017/2/20.
*/
class CountDownLatchExample2 { // ...
private static final int N = 3;
public static void main(String[] a... |
Include the eslint react defaults so it behaves as expected for React JSX files | module.exports = {
'parser': 'babel-eslint',
'env': {
'browser': true,
'es6': true,
'node': true,
},
'extends': [
'eslint:recommended',
'plugin:react/recommended',
],
'installedESLint': true,
'parserOptions': {
'ecmaFeatures': {
'experimentalObjectRestSpread': true,
'js... | module.exports = {
'parser': 'babel-eslint',
'env': {
'browser': true,
'es6': true,
'node': true,
},
'extends': 'eslint:recommended',
'installedESLint': true,
'parserOptions': {
'ecmaFeatures': {
'experimentalObjectRestSpread': true,
'jsx': true,
},
'sourceType': 'module'... |
Rework shared options to share values | module.exports = function shareOptionValues(commands) {
let providedOptionsById = {}
commands.forEach(({ options }) => {
if (options && options.length) {
options.forEach((option) => {
if (option.config) {
providedOptionsById[option.config.id] = option
}
})
}
})
re... | module.exports = function shareOptionValues(commands) {
let providedOptionsById = {}
commands.forEach(({ options }) => {
if (options) {
options.forEach((option) => {
if (option.config) {
providedOptionsById[option.config.id] = option
}
})
}
})
return commands.map(... |
Change DSLR description - so it doesn't look like a duplicate | package org.drools.workbench.screens.guided.rule.type;
import javax.enterprise.context.ApplicationScoped;
import org.uberfire.backend.vfs.Path;
import org.uberfire.workbench.type.ResourceTypeDefinition;
@ApplicationScoped
public class GuidedRuleDSLRResourceTypeDefinition
implements ResourceTypeDefinition {
... | package org.drools.workbench.screens.guided.rule.type;
import javax.enterprise.context.ApplicationScoped;
import org.uberfire.backend.vfs.Path;
import org.uberfire.workbench.type.ResourceTypeDefinition;
@ApplicationScoped
public class GuidedRuleDSLRResourceTypeDefinition
implements ResourceTypeDefinition {
... |
FIX Ensure only those with perms to datachanges can view published state | <?php
/**
* Add to Pages you want changes recorded for
*
* @author stephen@silverstripe.com.au
* @license BSD License http://silverstripe.org/bsd-license/
*/
class SiteTreeChangeRecordable extends ChangeRecordable {
public function onAfterPublish(&$original) {
$this->dataChangeTrackService->track($this->owner... | <?php
/**
* Add to Pages you want changes recorded for
*
* @author stephen@silverstripe.com.au
* @license BSD License http://silverstripe.org/bsd-license/
*/
class SiteTreeChangeRecordable extends ChangeRecordable {
public function onAfterPublish(&$original) {
$this->dataChangeTrackService->track($this->owner... |
Add speech prefixes - still required in 2012, so should be left in due to reader issues | "use strict";
/**
* Properties to prefix.
*/
var postcss = require("postcss"),
props = [
// text
"hyphens",
"line-break",
"text-align-last",
"text-emphasis",
"text-emphasis-color",
"text-emphasis-style",
"word-break",
// writing modes
"writing-mode",
"text-orientation",
"text-co... | "use strict";
/**
* Properties to prefix.
*/
var postcss = require("postcss"),
props = [
"hyphens",
"line-break",
"text-align-last",
"text-emphasis",
"text-emphasis-color",
"text-emphasis-style",
"word-break",
// writing modes
"writing-mode",
"text-orientation",
"text-combine-uprig... |
Update gunicorn timeout after gunicorn issue was answered. | # This file contains gunicorn configuration setttings, as described at
# http://docs.gunicorn.org/en/latest/settings.html
# The file is loaded via the -c ichnaea.gunicorn_config command line option
# Be explicit about the worker class
worker_class = "sync"
# Set timeout to the same value as the default one from Amazo... | # This file contains gunicorn configuration setttings, as described at
# http://docs.gunicorn.org/en/latest/settings.html
# The file is loaded via the -c ichnaea.gunicorn_config command line option
# Be explicit about the worker class
worker_class = "sync"
# Set timeout to the same value as the default one from Amazo... |
Print Preview: Hook up the cancel button.
BUG=57895
TEST=manual
Review URL: http://codereview.chromium.org/5151009
git-svn-id: http://src.chromium.org/svn/trunk/src@66822 4ff67af0-8c30-449e-8e8b-ad334ec8d88c
Former-commit-id: b25a2a4aa82aa8107b7f95d2e4a61633652024d7 | // Copyright (c) 2010 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
var localStrings = new LocalStrings();
/**
* Window onload handler, sets up the page.
*/
function load() {
$('cancel-button').addEventListener('c... | // Copyright (c) 2010 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
var localStrings = new LocalStrings();
/**
* Window onload handler, sets up the page.
*/
function load() {
chrome.send('getPrinters');
};
/**
*... |
Revert "Fix headless unit test running"
This reverts commit d2652f66c5cd09730a789373fe1cc0f51d357b7d.
That commit just made us not run the unit tests from Gulp any more. | /*
Copyright 2014 Spotify AB
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
dist... | /*
Copyright 2014 Spotify AB
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
dist... |
Rename distributable name to avoid conflicts with releases from the
parent project
Since this is a fork we need to diferentiate between our project and
parent project releases. If we rely only on the version we won't be able
to avoid conflicts with oficial releases on pypi. | from setuptools import setup, find_packages
setup(
name='django-robots-pbs',
version=__import__('robots').__version__,
description='Robots exclusion application for Django, complementing Sitemaps.',
long_description=open('docs/overview.txt').read(),
author='Jannis Leidel',
author_email='jannis@... | from setuptools import setup, find_packages
setup(
name='django-robots',
version=__import__('robots').__version__,
description='Robots exclusion application for Django, complementing Sitemaps.',
long_description=open('docs/overview.txt').read(),
author='Jannis Leidel',
author_email='jannis@leid... |
Update: Debug log task dependencies to allow them to be silenced | 'use strict';
var log = require('gulplog');
var chalk = require('chalk');
var prettyTime = require('pretty-hrtime');
var formatError = require('../formatError');
// Wire up logging events
function logEvents(gulpInst) {
var loggedErrors = [];
gulpInst.on('start', function(evt) {
// TODO: batch these
// s... | 'use strict';
var log = require('gulplog');
var chalk = require('chalk');
var prettyTime = require('pretty-hrtime');
var formatError = require('../formatError');
// Wire up logging events
function logEvents(gulpInst) {
var loggedErrors = [];
gulpInst.on('start', function(evt) {
// TODO: batch these
// s... |
Fix bug : index out of bound on making cover img | const fs = require('fs');
const mm = require('musicmetadata');
// var iconv = require('iconv-lite');
class Music {
constructor(path = '', coverPath = ''){
let read_stream = fs.createReadStream(path);
let parser = mm(read_stream,{duration : true}, (err, data) => {
if(err){
this.valid = false;
throw err... | const fs = require('fs');
const mm = require('musicmetadata');
// var iconv = require('iconv-lite');
class Music {
constructor(path = '', coverPath = ''){
let read_stream = fs.createReadStream(path);
let parser = mm(read_stream,{duration : true}, (err, data) => {
if(err){
this.valid = false;
throw err... |
Change log message and only calculate max age once | const logger = require('../config/logger')
const STS_MAX_AGE = 180 * 24 * 60 * 60
module.exports = function headers(req, res, next) {
if (
req.url.indexOf('/css') === -1 &&
req.url.indexOf('/javascripts') === -1 &&
req.url.indexOf('/images') === -1
) {
logger.debug('Headers middleware -> Adding re... | const logger = require('../config/logger')
module.exports = function headers(req, res, next) {
if (
req.url.indexOf('/css') === -1 &&
req.url.indexOf('/javascripts') === -1 &&
req.url.indexOf('/images') === -1
) {
logger.debug('adding headers')
const STS_MAX_AGE = 180 * 24 * 60 * 60
res.s... |
Fix some grammatical gender constants
Summary: Ref T5267. I missed these in the variable types conversion.
Test Plan: `arc unit --everything`
Reviewers: chad
Reviewed By: chad
Maniphest Tasks: T5267
Differential Revision: https://secure.phabricator.com/D16824 | <?php
final class PhabricatorPronounSetting
extends PhabricatorSelectSetting {
const SETTINGKEY = 'pronoun';
public function getSettingName() {
return pht('Pronoun');
}
public function getSettingPanelKey() {
return PhabricatorAccountSettingsPanel::PANELKEY;
}
protected function getSettingOrde... | <?php
final class PhabricatorPronounSetting
extends PhabricatorSelectSetting {
const SETTINGKEY = 'pronoun';
public function getSettingName() {
return pht('Pronoun');
}
public function getSettingPanelKey() {
return PhabricatorAccountSettingsPanel::PANELKEY;
}
protected function getSettingOrde... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.