text stringlengths 17 1.47k | positive stringlengths 673 4.43k | negative stringlengths 677 2.81k |
|---|---|---|
feat: Update regex. Add file write-out.
Regex is bugged, however. Need to fix regex pattern. | """
Copyright 2016 Dee Reddy
"""
import sys
import re
args = sys.argv[1:]
def minify(input_path, output_path, comments=False):
""" Minifies/uglifies file
args:
input_path: input file path
output_path: write-out file path
comments: Boolean. If False, deletes comments during output... | """
Copyright 2016 Dee Reddy
"""
import sys
import re
args = sys.argv[1:]
def minify(filepath, comments=False):
""" Minifies/uglifies file
:param
file_:
comments: Boolean. If False, deletes comments during output.
:return:
Minified string.
"""
pattern = re.compile(r"... |
Change debug flag to match module name | var Busboy = require('busboy'),
bytes = require('bytes'),
concat = require('concat-stream'),
debug = require('debug')('busboy-body-parser');
module.exports = function (settings) {
settings = settings || {};
settings.limit = settings.limit || Math.Infinity;
if (typeof settings.limit === 'strin... | var Busboy = require('busboy'),
bytes = require('bytes'),
concat = require('concat-stream'),
debug = require('debug')('busboy-bodyparser');
module.exports = function (settings) {
settings = settings || {};
settings.limit = settings.limit || Math.Infinity;
if (typeof settings.limit === 'string... |
Add the explanation for the autoloading of doctrine entities | <?php
namespace Backend\DependencyInjection;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\Extension\PrependExtensionInterface;
use Symfony\Component\Filesystem\Filesystem;
use Symfony\Component\HttpKernel\DependencyInjection\Extension;
class BackendExtension e... | <?php
namespace Backend\DependencyInjection;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\Extension\PrependExtensionInterface;
use Symfony\Component\Filesystem\Filesystem;
use Symfony\Component\HttpKernel\DependencyInjection\Extension;
class BackendExtension e... |
Work on fixing a regression | package io.disassemble.asm.visitor.flow;
import org.objectweb.asm.tree.AbstractInsnNode;
/**
* @author Tyler Sedlar
* @since 4/8/16
*/
public class BasicInstruction {
public final BasicBlock block;
public final AbstractInsnNode insn;
protected BasicInstruction previous;
public BasicInstruction(B... | package io.disassemble.asm.visitor.flow;
import org.objectweb.asm.tree.AbstractInsnNode;
/**
* @author Tyler Sedlar
* @since 4/8/16
*/
public class BasicInstruction {
public final BasicBlock block;
public final AbstractInsnNode insn;
protected BasicInstruction previous;
public BasicInstruction(B... |
Add check to verify if model is in config callback state. | import importlib
import logging
from volttron.platform.agent import utils
_log = logging.getLogger(__name__)
utils.setup_logging()
__version__ = "0.1"
__all__ = ['Model']
class Model(object):
def __init__(self, config, **kwargs):
self.model = None
config = self.store_model_config(config)
... | import importlib
import logging
from volttron.platform.agent import utils
_log = logging.getLogger(__name__)
utils.setup_logging()
__version__ = "0.1"
__all__ = ['Model']
class Model(object):
def __init__(self, config, **kwargs):
self.model = None
config = self.store_model_config(config)
... |
Use cycle instead of counting an index ourselves | from itertools import cycle
from psycopg2.extras import register_hstore, register_json
import psycopg2
import threading
import ujson
class DBAffinityConnectionsNoLimit(object):
# Similar to the db affinity pool, but without keeping track of
# the connections. It's the caller's responsibility to call us
#... | from itertools import cycle
from psycopg2.extras import register_hstore, register_json
import psycopg2
import threading
import ujson
class DBAffinityConnectionsNoLimit(object):
# Similar to the db affinity pool, but without keeping track of
# the connections. It's the caller's responsibility to call us
#... |
Remove makeweatherfiles, add template for Windows version file | #!/usr/bin/python
#
source_files = ['check_siren.py', 'colours', 'credits', 'dataview', 'dijkstra_4',
'displayobject', 'displaytable', 'editini', 'flexiplot', 'floaters',
'getmap', 'getmerra2', 'getmodels', 'grid', 'indexweather', 'inisyntax',
'makegrid', 'makeweatherfile... | #!/usr/bin/python
#
source_files = ['check_siren.py', 'colours', 'credits', 'dataview', 'dijkstra_4',
'displayobject', 'displaytable', 'editini', 'flexiplot', 'floaters',
'getmap', 'getmerra2', 'getmodels', 'grid', 'indexweather', 'inisyntax',
'makegrid', 'makeweatherfile... |
Put a bunch of stars together, and you can see that they twinkle at the same rate. | var TwinklingStar = new Class({
Extends: Star,
initialize: function(options) {
this.parent(options);
if (this.brightness < 4) this.brightness = 4;
this.color = "#eeeeee";
this.stepSeed = Math.random() * Math.PI;
this.stepScale = Math.random() / 3;
},
draw: functio... | var TwinklingStar = new Class({
Extends: Star,
initialize: function(options) {
this.parent(options);
if (this.brightness < 4) this.brightness = 4;
this.color = "#eeeeee";
this.stepSeed = Math.random() * Math.PI;
},
draw: function() {
var x = cx(this.pos.x);
... |
Allow param exception to trickle up. | /* Copyright 2013 University of North Carolina at Chapel Hill. All rights reserved. */
package abra;
import java.io.IOException;
import joptsimple.OptionParser;
import joptsimple.OptionSet;
/**
* Abstract base class for helping with options parsing.
*
* @author Lisle E. Mose (lmose at unc dot edu)
*/
public ab... | /* Copyright 2013 University of North Carolina at Chapel Hill. All rights reserved. */
package abra;
import java.io.IOException;
import joptsimple.OptionParser;
import joptsimple.OptionSet;
/**
* Abstract base class for helping with options parsing.
*
* @author Lisle E. Mose (lmose at unc dot edu)
*/
public ab... |
Add a timeout to the delta detector
Make it so that the detector doesn't beep more than
once per second. It would be even better if the beeping
occurred in another thread... | import numpy as N
import gobject
import gtk.gdk
class DeltaDetector(object):
def __init__(self, active=False, threshold=20.0):
self._previous_frame = None
self._frame = None
self.active = active
self.threshold = threshold
self._timed_out = False
def send_frame(self... | import numpy as N
import gtk.gdk
class DeltaDetector(object):
def __init__(self, active=False, threshold=20.0):
self._previous_frame = None
self._frame = None
self.active = active
self.threshold = threshold
def send_frame(self, frame):
self._previous_frame = self._... |
Make compatible with CentOS 8 | #!/usr/bin/python3
import re
import sys
import xml.etree.ElementTree as ET
valid_gnd = re.compile('[0-9\-X]+')
def Main():
if len(sys.argv) != 2:
print("Usage: " + sys.argv[0] + " kalliope_originator_record_file")
exit(1)
root = ET.parse(sys.argv[1]).getroot()
gnds_and_type = {}
for re... | #!/usr/bin/python3
import re
import sys
import xml.etree.ElementTree as ET
valid_gnd = re.compile('[0-9\-X]+')
def Main():
if len(sys.argv) != 2:
print("Usage: " + sys.argv[0] + " kalliope_originator_record_file")
exit(1)
root = ET.parse(sys.argv[1]).getroot()
gnds_and_type = {}
for re... |
Remove Shepway election id (waiting on feedback) | from data_collection.morph_importer import BaseMorphApiImporter
class Command(BaseMorphApiImporter):
srid = 4326
districts_srid = 4326
council_id = 'E07000112'
#elections = ['parl.2017-06-08']
scraper_name = 'wdiv-scrapers/DC-PollingStations-Shepway'
geom_type = 'geojson'
def district_re... | from data_collection.morph_importer import BaseMorphApiImporter
class Command(BaseMorphApiImporter):
srid = 4326
districts_srid = 4326
council_id = 'E07000112'
elections = ['parl.2017-06-08']
scraper_name = 'wdiv-scrapers/DC-PollingStations-Shepway'
geom_type = 'geojson'
def district_rec... |
Fix >> to create a new file | /*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package org.aesh.command.impl.operator;
import java.io.BufferedWriter;
import java.io.File;
import java.io.IOException;
import java.ni... | /*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package org.aesh.command.impl.operator;
import java.io.BufferedWriter;
import java.io.File;
import java.io.IOException;
import java.ni... |
Update convention and add variables to core-cron task.
Signed-off-by: Karl Hepworth <c14c6f041bb80410635ef9142e07c8627a565b5a@gmail.com> | import React from 'react';
import { Mutation } from 'react-apollo';
import gql from 'graphql-tag';
import ReactSelect from 'react-select';
import Button from 'components/Button';
import { bp, color, fontSize } from 'lib/variables';
const taskDrushCron = gql`
mutation taskDrushCron($environment: Int!) {
taskDrush... | import React from 'react';
import { Mutation } from 'react-apollo';
import gql from 'graphql-tag';
import ReactSelect from 'react-select';
import Button from 'components/Button';
import { bp, color, fontSize } from 'lib/variables';
const taskDrushCron = gql`
mutation taskDrushCron(
$environment: Int!
) {
t... |
Use the error string if we have one for malformed json | import queryString from "query-string";
class Api {
static get(url, data = {}) {
return this.request(url + (Object.keys(data).length > 0 ? ('?' + queryString.stringify(data)) : '' ), undefined, "GET");
}
static post(url, data = {}) {
return this.request(url, data, "POST");
}
stati... | import queryString from "query-string";
class Api {
static get(url, data = {}) {
return this.request(url + (Object.keys(data).length > 0 ? ('?' + queryString.stringify(data)) : '' ), undefined, "GET");
}
static post(url, data = {}) {
return this.request(url, data, "POST");
}
stati... |
Change a comment to mention the organism taxonomy ID from NCBI. | from django.db import models
from django.utils import timezone
class TimeTrackedModel(models.Model):
created_at = models.DateTimeField(editable=False)
updated_at = models.DateTimeField()
def save(self, *args, **kwargs):
''' On save, update timestamps '''
if not self.id:
self.c... | from django.db import models
from django.utils import timezone
class TimeTrackedModel(models.Model):
created_at = models.DateTimeField(editable=False)
updated_at = models.DateTimeField()
def save(self, *args, **kwargs):
''' On save, update timestamps '''
if not self.id:
self.c... |
Reformat and normalize messages, include -h and --help parameters | <?php
/**
* Script to validate cfdi files and show all the errors found
*/
require_once __DIR__ . '/../vendor/autoload.php';
use CFDIReader\CFDIFactory;
$script = array_shift($argv);
if ($argc == 1 || in_array('-h', $argv) || in_array('--help', $argv)) {
echo "Set the file of the file to validate\n";
echo ... | <?php
/**
* Script to validate a cfdi and show all the errors found
*/
require_once __DIR__ . '/../vendor/autoload.php';
use CFDIReader\CFDIFactory;
call_user_func(function() use($argv, $argc) {
$script = array_shift($argv);
if ($argc == 1) {
echo "Set the file of the file to validate\n";
... |
fix: Use date_created for "My Builds" sort | from sqlalchemy.orm import contains_eager, joinedload, subqueryload_all
from zeus import auth
from zeus.config import db
from zeus.models import Author, Build, Email, Source, User
from .base import Resource
from ..schemas import BuildSchema
builds_schema = BuildSchema(many=True, strict=True)
class UserBuildsResour... | from sqlalchemy.orm import contains_eager, joinedload, subqueryload_all
from zeus import auth
from zeus.config import db
from zeus.models import Author, Build, Email, Source, User
from .base import Resource
from ..schemas import BuildSchema
builds_schema = BuildSchema(many=True, strict=True)
class UserBuildsResour... |
Add second set of pages to test | <?php
use Codeception\Util\Fixtures;
use Codeception\Util\Stub;
use Grav\Common\Grav;
use Grav\Common\Page\Pages;
use Grav\Common\Page\Page;
use RocketTheme\Toolbox\ResourceLocator\UniformResourceLocator;
/**
* Class PagesTest
*/
class PagesTest extends \Codeception\TestCase\Test
{
/** @var Grav $grav */
pr... | <?php
use Codeception\Util\Fixtures;
use Codeception\Util\Stub;
use Grav\Common\Grav;
use Grav\Common\Page\Pages;
use Grav\Common\Page\Page;
use RocketTheme\Toolbox\ResourceLocator\UniformResourceLocator;
/**
* Class PagesTest
*/
class PagesTest extends \Codeception\TestCase\Test
{
/** @var Grav $grav */
pr... |
Add path to theme attributes | <?php namespace Pingpong\Themes;
use Illuminate\Filesystem\Filesystem;
use Pingpong\Modules\Json;
use Symfony\Component\Finder\Finder as SymfonyFinder;
class Finder {
/**
* The symfony finder instance.
*
* @var SymfonyFinder
*/
protected $finder;
/**
* The constructor.
*
... | <?php namespace Pingpong\Themes;
use Illuminate\Filesystem\Filesystem;
use Pingpong\Modules\Json;
use Symfony\Component\Finder\Finder as SymfonyFinder;
class Finder {
/**
* The symfony finder instance.
*
* @var SymfonyFinder
*/
protected $finder;
/**
* The constructor.
*
... |
Change 1s to 2 ms | <?php namespace Tests\Unit;
use Performance\Performance;
use Performance\Config;
class ConfigLtirmRtrimTest extends \PHPUnit_Framework_TestCase
{
protected function setUp()
{
Config::reset();
}
public function testStaticFunctionPoint()
{
// You can specify the characters you want... | <?php namespace Tests\Unit;
use Performance\Performance;
use Performance\Config;
class ConfigLtirmRtrimTest extends \PHPUnit_Framework_TestCase
{
protected function setUp()
{
Config::reset();
}
public function testStaticFunctionPoint()
{
// You can specify the characters you want... |
Remove test bundle from app kernel | <?php
use Tomahawk\HttpKernel\Kernel;
class AppKernel extends Kernel
{
/**
* Register bundles
*
* @return array
*/
public function registerBundles()
{
$bundles = [
new \Tomahawk\Bundle\FrameworkBundle\FrameworkBundle(),
new \Tomahawk\Bundle\MonologBundle... | <?php
use Tomahawk\HttpKernel\Kernel;
class AppKernel extends Kernel
{
/**
* Register bundles
*
* @return array
*/
public function registerBundles()
{
$bundles = [
new \Tomahawk\Bundle\FrameworkBundle\FrameworkBundle(),
new \Tomahawk\Bundle\MonologBundle... |
Add path to theme attributes | <?php namespace Pingpong\Themes;
use Illuminate\Filesystem\Filesystem;
use Pingpong\Modules\Json;
use Symfony\Component\Finder\Finder as SymfonyFinder;
class Finder {
/**
* The symfony finder instance.
*
* @var SymfonyFinder
*/
protected $finder;
/**
* The constructor.
*
... | <?php namespace Pingpong\Themes;
use Illuminate\Filesystem\Filesystem;
use Pingpong\Modules\Json;
use Symfony\Component\Finder\Finder as SymfonyFinder;
class Finder {
/**
* The symfony finder instance.
*
* @var SymfonyFinder
*/
protected $finder;
/**
* The constructor.
*
... |
Modify the condition for selection of longest patterns | from marisa_trie import RecordTrie
from .trie import TrieSearch
class RecordTrieSearch(RecordTrie, TrieSearch):
def __init__(self, record_format, records=None, filepath=None):
super(RecordTrieSearch, self).__init__(record_format, records)
if filepath:
self.load(filepath)
def searc... | from marisa_trie import RecordTrie
from .trie import TrieSearch
class RecordTrieSearch(RecordTrie, TrieSearch):
def __init__(self, record_format, records=None, filepath=None):
super(RecordTrieSearch, self).__init__(record_format, records)
if filepath:
self.load(filepath)
def searc... |
Set correct service-name in command | package com.opera.core.systems.scope;
import com.opera.core.systems.model.ICommand;
import java.util.EnumSet;
import java.util.HashMap;
import java.util.Map;
/**
* This enum maps the commands for the <a href=
* "http://dragonfly.opera.com/app/scope-interface/services/DesktopWindowManager/DesktopWindowManager_2_0.ht... | package com.opera.core.systems.scope;
import com.opera.core.systems.model.ICommand;
import java.util.EnumSet;
import java.util.HashMap;
import java.util.Map;
/**
* This enum maps the commands for the <a href=
* "http://dragonfly.opera.com/app/scope-interface/services/DesktopWindowManager/DesktopWindowManager_2_0.ht... |
Check both key and value, throw error only if values differ | package io.quarkus.deployment.steps;
import java.io.File;
import java.io.FileOutputStream;
import java.io.OutputStreamWriter;
import java.nio.charset.StandardCharsets;
import java.util.List;
import java.util.Properties;
import io.quarkus.deployment.annotations.BuildStep;
import io.quarkus.deployment.builditem.Archive... | package io.quarkus.deployment.steps;
import java.io.File;
import java.io.FileOutputStream;
import java.io.OutputStreamWriter;
import java.nio.charset.StandardCharsets;
import java.util.List;
import java.util.Properties;
import io.quarkus.deployment.annotations.BuildStep;
import io.quarkus.deployment.builditem.Archive... |
Remove required fields from address state | <?php
namespace PatternSeek\ECommerce\ViewState;
use PatternSeek\ComponentView\ViewState\ViewState;
use Symfony\Component\Validator\Constraints as Assert;
/**
* Class AddressState
* @package PatternSeek\ECommerce
*/
class AddressState extends ViewState
{
/**
* @var string
*
* @Assert\Type(type... | <?php
namespace PatternSeek\ECommerce\ViewState;
use PatternSeek\ComponentView\ViewState\ViewState;
use Symfony\Component\Validator\Constraints as Assert;
/**
* Class AddressState
* @package PatternSeek\ECommerce
*/
class AddressState extends ViewState
{
/**
* @var string
*
* @Assert\Type(type... |
Fix for bug introduced with r510. Only make the removeChild call if the parentNode is properly set. This way we can zap the grid div contents quickly with the div.innerHTML = "" but still have a valid good destroy() function.
git-svn-id: 86a4f41f9d0383640198789122b520d4105b319a@511 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf | // @require: OpenLayers/Tile.js
/**
* @class
*/
OpenLayers.Tile.Image = Class.create();
OpenLayers.Tile.Image.prototype =
Object.extend( new OpenLayers.Tile(), {
/** @type DOMElement img */
img:null,
/**
* @constructor
*
* @param {OpenLayers.Grid} layer
* @param {OpenLayers.Pixel} ... | // @require: OpenLayers/Tile.js
/**
* @class
*/
OpenLayers.Tile.Image = Class.create();
OpenLayers.Tile.Image.prototype =
Object.extend( new OpenLayers.Tile(), {
/** @type DOMElement img */
img:null,
/**
* @constructor
*
* @param {OpenLayers.Grid} layer
* @param {OpenLayers.Pixel} ... |
Return the newly created control
This enables code like:
var button = L.easyButton(...);
map.removeControl(button); | L.Control.EasyButtons = L.Control.extend({
options: {
position: 'topleft',
title: '',
intentedIcon: 'fa-circle-o'
},
onAdd: function () {
var container = L.DomUtil.create('div', 'leaflet-bar leaflet-control');
this.link = L.DomUtil.create('a', 'leaflet-bar-part', co... | L.Control.EasyButtons = L.Control.extend({
options: {
position: 'topleft',
title: '',
intentedIcon: 'fa-circle-o'
},
onAdd: function () {
var container = L.DomUtil.create('div', 'leaflet-bar leaflet-control');
this.link = L.DomUtil.create('a', 'leaflet-bar-part', co... |
Fix length calculation in the exception path | /*
Copyright 2011 Frederic Langlet
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 writi... | /*
Copyright 2011 Frederic Langlet
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 writi... |
FIX - No such file or directory: 'README.md' | # coding=utf-8
from setuptools import setup, find_packages
VERSION = "0.1.11"
setup(
name="PyTrustNFe",
version=VERSION,
author="Danimar Ribeiro",
author_email='danimaribeiro@gmail.com',
keywords=['nfe', 'mdf-e'],
classifiers=[
'Development Status :: 3 - Alpha',
'Environment ::... | # coding=utf-8
from setuptools import setup, find_packages
long_description = open('README.md').read()
VERSION = "0.1.10"
setup(
name="PyTrustNFe",
version=VERSION,
author="Danimar Ribeiro",
author_email='danimaribeiro@gmail.com',
keywords=['nfe', 'mdf-e'],
classifiers=[
'Development ... |
Fix invalid statement for SubjectAlternativeName in self signed cert. | import datetime
from cryptography.hazmat.backends import default_backend
from cryptography.hazmat.primitives import hashes
from cryptography.hazmat.primitives.asymmetric import rsa
from cryptography import x509
from cryptography.x509 import NameOID, DNSName
def generate_self_signed_certificate(cn: str) -> (rsa.RSAPri... | import datetime
from cryptography.hazmat.backends import default_backend
from cryptography.hazmat.primitives import hashes
from cryptography.hazmat.primitives.asymmetric import rsa
from cryptography import x509
from cryptography.x509 import NameOID, DNSName
def generate_self_signed_certificate(cn: str) -> (rsa.RSAPri... |
Fix wrong created_at field type | <?php
use yii\db\Schema;
use yii\db\Migration;
class m140703_123104_page extends Migration
{
public function up()
{
$tableOptions = null;
if ($this->db->driverName === 'mysql') {
$tableOptions = 'CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE=InnoDB';
}
$this->c... | <?php
use yii\db\Schema;
use yii\db\Migration;
class m140703_123104_page extends Migration
{
public function up()
{
$tableOptions = null;
if ($this->db->driverName === 'mysql') {
$tableOptions = 'CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE=InnoDB';
}
$this->c... |
Add a class for a known error that prevents implementation.
Signed-off-by: mulhern <7b51bcf507bcd7afb72bf8663752c0ddbeb517f6@redhat.com> | """
Error heirarchy for stratis cli.
"""
class StratisCliError(Exception):
"""
Top-level stratis cli error.
"""
pass
class StratisCliValueError(StratisCliError):
""" Raised when a parameter has an unacceptable value.
May also be raised when the parameter has an unacceptable type.
"""... | """
Error heirarchy for stratis cli.
"""
class StratisCliError(Exception):
"""
Top-level stratis cli error.
"""
pass
class StratisCliValueError(StratisCliError):
""" Raised when a parameter has an unacceptable value.
May also be raised when the parameter has an unacceptable type.
"""... |
:bug: Fix test completion, check for bash completion file before running | import os
import subprocess
import sys
from pathlib import Path
import typer
from typer.testing import CliRunner
from first_steps import tutorial001 as mod
runner = CliRunner()
app = typer.Typer()
app.command()(mod.main)
def test_show_completion():
result = subprocess.run(
[
"bash",
... | import os
import subprocess
import sys
from pathlib import Path
import typer
from typer.testing import CliRunner
from first_steps import tutorial001 as mod
runner = CliRunner()
app = typer.Typer()
app.command()(mod.main)
def test_show_completion():
result = subprocess.run(
[
"bash",
... |
Use ternary operator in image loader method | 'use strict';
import $ from 'jquery';
export default class ImageLoader {
constructor(dataSrcAttr) {
this.dataSrcAttr = dataSrcAttr || 'data-preload-src';
}
isInlineImage($el) {
return $el.is('img');
}
getDataSrc($el) {
return $el.attr(this.dataSrcAttr);
}
setInl... | 'use strict';
import $ from 'jquery';
export default class ImageLoader {
constructor(dataSrcAttr) {
this.dataSrcAttr = dataSrcAttr || 'data-preload-src';
}
isInlineImage($el) {
return $el.is('img');
}
getDataSrc($el) {
return $el.attr(this.dataSrcAttr);
}
setInl... |
Bump version number for next release | import codecs
from os import path
from setuptools import find_packages, setup
def read(*parts):
filename = path.join(path.dirname(__file__), *parts)
with codecs.open(filename, encoding="utf-8") as fp:
return fp.read()
setup(
author="Pinax Team",
author_email="team@pinaxproject.com",
des... | import codecs
from os import path
from setuptools import find_packages, setup
def read(*parts):
filename = path.join(path.dirname(__file__), *parts)
with codecs.open(filename, encoding="utf-8") as fp:
return fp.read()
setup(
author="Pinax Team",
author_email="team@pinaxproject.com",
des... |
Update admin area queries to use new `filter` parameter
refs #6005
- updates use of the query params removed in #6005 to use new `filter` param | import Ember from 'ember';
export default Ember.Controller.extend({
notifications: Ember.inject.service(),
userPostCount: Ember.computed('model.id', function () {
var promise,
query = {
filter: `author:${this.get('model.slug')}`,
status: 'all'
};... | import Ember from 'ember';
export default Ember.Controller.extend({
notifications: Ember.inject.service(),
userPostCount: Ember.computed('model.id', function () {
var promise,
query = {
author: this.get('model.slug'),
status: 'all'
};
pr... |
Clone api options to avoid always injecting a `headers` key | // @ts-check
import { assign, clone, get, defaults, compact } from "lodash"
import request from "request"
import config from "config"
import HTTPError from "lib/http_error"
export default (url, options = {}) => {
return new Promise((resolve, reject) => {
const opts = clone(
defaults(options, {
met... | // @ts-check
import { assign, get, defaults, compact } from "lodash"
import request from "request"
import config from "config"
import HTTPError from "lib/http_error"
export default (url, options = {}) => {
return new Promise((resolve, reject) => {
const opts = defaults(options, {
method: "GET",
time... |
Fix for wrong test: create_semester_accounts
refs #448 | # Copyright (c) 2013 The Pycroft Authors. See the AUTHORS file.
# This file is part of the Pycroft project and licensed under the terms of
# the Apache License, Version 2.0. See the LICENSE file for details.
from tests import OldPythonTestCase
__author__ = 'felix_kluge'
from pycroft.lib.finance import create_semester... | # Copyright (c) 2013 The Pycroft Authors. See the AUTHORS file.
# This file is part of the Pycroft project and licensed under the terms of
# the Apache License, Version 2.0. See the LICENSE file for details.
from tests import OldPythonTestCase
__author__ = 'felix_kluge'
from pycroft.lib.finance import create_semester... |
Use -platform:anycpu while compiling .NET assemblies | import os.path
import SCons.Builder
import SCons.Node.FS
import SCons.Util
csccom = "$CSC $CSCFLAGS $_CSCLIBPATH -r:$_CSCLIBS -out:${TARGET.abspath} $SOURCES"
csclibcom = "$CSC -t:library $CSCLIBFLAGS $_CSCLIBPATH $_CSCLIBS -out:${TARGET.abspath} $SOURCES"
McsBuilder = SCons.Builder.Builder(action = '$CSCCOM',
... | import os.path
import SCons.Builder
import SCons.Node.FS
import SCons.Util
csccom = "$CSC $CSCFLAGS $_CSCLIBPATH -r:$_CSCLIBS -out:${TARGET.abspath} $SOURCES"
csclibcom = "$CSC -t:library $CSCLIBFLAGS $_CSCLIBPATH $_CSCLIBS -out:${TARGET.abspath} $SOURCES"
McsBuilder = SCons.Builder.Builder(action = '$CSCCOM',
... |
Use built in functionality for calling Promise.all on an object of promises | (function(angular, window) {
'use strict';
angular
.module('mwl.bluebird', [])
.constant('Bluebird', window.P.noConflict())
.config(function($provide, Bluebird) {
//Make bluebird API compatible with angular's subset of $q
//Adapted from: https://gist.github.com/petkaantonov/8363789
... | (function(angular, window) {
'use strict';
angular
.module('mwl.bluebird', [])
.constant('Bluebird', window.P.noConflict())
.config(function($provide, Bluebird) {
//Make bluebird API compatible with angular's subset of $q
//Adapted from: https://gist.github.com/petkaantonov/8363789
... |
Add configurable path to hosts file for HostLookup()
Required for unit testing so that tests don't have to rely on
/etc/hosts file. | from .. import idiokit
from ._iputils import parse_ip
from ._conf import hosts
from ._dns import DNSError, a, aaaa
def _filter_ips(potential_ips):
results = []
for ip in potential_ips:
try:
family, ip = parse_ip(ip)
except ValueError:
continue
else:
... | from .. import idiokit
from ._iputils import parse_ip
from ._conf import hosts
from ._dns import DNSError, a, aaaa
def _filter_ips(potential_ips):
results = []
for ip in potential_ips:
try:
family, ip = parse_ip(ip)
except ValueError:
continue
else:
... |
:sparkles: Set Application as a static class in IoC | <?php
namespace Tapestry\Providers;
use Tapestry\Tapestry;
use Tapestry\Console\Application;
use Tapestry\Console\Commands\InitCommand;
use Tapestry\Console\Commands\BuildCommand;
use Tapestry\Console\Commands\SelfUpdateCommand;
use League\Container\ServiceProvider\AbstractServiceProvider;
class CommandServiceProvid... | <?php
namespace Tapestry\Providers;
use Tapestry\Tapestry;
use Tapestry\Console\Application;
use Tapestry\Console\Commands\InitCommand;
use Tapestry\Console\Commands\BuildCommand;
use Tapestry\Console\Commands\SelfUpdateCommand;
use League\Container\ServiceProvider\AbstractServiceProvider;
class CommandServiceProvid... |
Correct import behavior to prevent Runtime error | """
sentry.utils.imports
~~~~~~~~~~~~~~~~~~~~
:copyright: (c) 2010-2014 by the Sentry Team, see AUTHORS for more details.
:license: BSD, see LICENSE for more details.
"""
from __future__ import absolute_import
import pkgutil
import six
class ModuleProxyCache(dict):
def __missing__(self, key):
if '.' not... | """
sentry.utils.imports
~~~~~~~~~~~~~~~~~~~~
:copyright: (c) 2010-2014 by the Sentry Team, see AUTHORS for more details.
:license: BSD, see LICENSE for more details.
"""
from __future__ import absolute_import
import pkgutil
import six
class ModuleProxyCache(dict):
def __missing__(self, key):
if '.' not... |
Use conditional validation on contact info only if user has intention | <?php
namespace App\Http\Requests;
use Illuminate\Foundation\Http\FormRequest;
class FeedbackRequest extends FormRequest
{
/**
* Determine if the user is authorized to make this request.
*
* @return bool
*/
public function authorize()
{
return true;
}
/**
* Get t... | <?php
namespace App\Http\Requests;
use Illuminate\Foundation\Http\FormRequest;
class FeedbackRequest extends FormRequest
{
/**
* Determine if the user is authorized to make this request.
*
* @return bool
*/
public function authorize()
{
return true;
}
/**
* Get t... |
Remove useless object manager property | <?php
namespace Natso\Piraeus\Block\Payment;
class Redirect extends \Magento\Framework\View\Element\Template
{
public $customerSession;
public $logger;
protected $_helper;
public function __construct(
\Magento\Framework\View\Element\Template\Context $context,
\Magento\Cust... | <?php
namespace Natso\Piraeus\Block\Payment;
class Redirect extends \Magento\Framework\View\Element\Template
{
public $customerSession;
public $logger;
protected $_objectManager;
protected $_helper;
public function __construct(
\Magento\Framework\View\Element\Template\Context ... |
Disable APC cache clearing on SaaS | <?php
class Cache
{
private function createCacheKey($key, $isUserValue, $userId = null) {
$CC_CONFIG = Config::getConfig();
$a = $CC_CONFIG["apiKey"][0];
if ($isUserValue) {
$cacheKey = "{$key}{$userId}{$a}";
}
else {
$c... | <?php
class Cache
{
private function createCacheKey($key, $isUserValue, $userId = null) {
$CC_CONFIG = Config::getConfig();
$a = $CC_CONFIG["apiKey"][0];
if ($isUserValue) {
$cacheKey = "{$key}{$userId}{$a}";
}
else {
$c... |
Add python-dateutil as a project dependency. We need its handy "parse" function. | #!/usr/bin/env python3
import os
from setuptools import setup, find_packages
def get_readme():
return open(os.path.join(os.path.dirname(__file__), 'README.rst')).read()
setup(
author="Julio Gonzalez Altamirano",
author_email='devjga@gmail.com',
classifiers=[
'Intended Audience :: Developers',... | #!/usr/bin/env python3
import os
from setuptools import setup, find_packages
def get_readme():
return open(os.path.join(os.path.dirname(__file__), 'README.rst')).read()
setup(
author="Julio Gonzalez Altamirano",
author_email='devjga@gmail.com',
classifiers=[
'Intended Audience :: Developers',... |
Add condition to handle the case when `number` is 0 | class NumberToWords(object):
"""
Class for converting positive integer values to a textual representation
of the submitted number for value of 0 up to 999999999.
"""
MAX = 999999999
SMALL_NUMBERS = ['', 'one', 'two', 'three', 'four', 'five', 'six',
'seven', 'eight', 'nine',... | class NumberToWords(object):
"""
Class for converting positive integer values to a textual representation
of the submitted number for value of 0 up to 999999999.
"""
MAX = 999999999
SMALL_NUMBERS = ['', 'one', 'two', 'three', 'four', 'five', 'six',
'seven', 'eight', 'nine',... |
Fix test failures in Python 3.3b2
The fromlist argument of __import__ was being called as [''], which is
meaningless. Because we need fromlist to be non-empty to get the submodule
returned, this was changed to ['*']. | """
This module adds several functions for interactive source code inspection.
"""
import inspect
from sympy.core.compatibility import callable
def source(object):
"""
Prints the source code of a given object.
"""
print 'In file: %s' % inspect.getsourcefile(object)
print inspect.getsource(object)
... | """
This module adds several functions for interactive source code inspection.
"""
import inspect
from sympy.core.compatibility import callable
def source(object):
"""
Prints the source code of a given object.
"""
print 'In file: %s' % inspect.getsourcefile(object)
print inspect.getsource(object)
... |
Add an option to show a personalised block to everyone | from __future__ import absolute_import, unicode_literals
from django.utils.translation import ugettext_lazy as _
from wagtail.core import blocks
from wagtail_personalisation.adapters import get_segment_adapter
from wagtail_personalisation.models import Segment
def list_segment_choices():
yield -1, ("Show to eve... | from __future__ import absolute_import, unicode_literals
from django.utils.translation import ugettext_lazy as _
from wagtail.core import blocks
from wagtail_personalisation.adapters import get_segment_adapter
from wagtail_personalisation.models import Segment
def list_segment_choices():
for pk, name in Segment... |
Change to minify-plugin from babili | const path = require('path');
const webpack = require('webpack');
const MinifyPlugin = require("babel-minify-webpack-plugin");
const isProd = process.env.NODE_ENV === 'PRODUCTION';
const outputFilename = isProd ? 'react-layout-transition.min.js' : 'react-layout-transition.js';
module.exports = {
devtool: !isProd... | const path = require('path');
const webpack = require('webpack');
const BabiliPlugin = require('babili-webpack-plugin');
const isProd = process.env.NODE_ENV === 'PRODUCTION';
const outputFilename = isProd ? 'react-layout-transition.min.js' : 'react-layout-transition.js';
module.exports = {
devtool: !isProd ? 'so... |
Add more helpful error message
Should provide more detailed error message for diagnosing #57 | <?php
namespace PivotLibre\Tideman;
use \InvalidArgumentException;
class MarginRegistry
{
private $registry = array();
protected function makeKey(Candidate $winner, Candidate $loser) : string
{
$winnerId = $winner->getId();
$loserId = $loser->getId();
$key = $winnerId . $loserId;
... | <?php
namespace PivotLibre\Tideman;
use \InvalidArgumentException;
class MarginRegistry
{
private $registry = array();
protected function makeKey(Candidate $winner, Candidate $loser) : string
{
$winnerId = $winner->getId();
$loserId = $loser->getId();
$key = $winnerId . $loserId;
... |
Load external firebird or sybase dialect if available
Fixes: #5318
Extension of I1660abb11c02656fbf388f2f9c4257075111be58
Change-Id: I32b678430497327f9b08f821bd345a2557e34b1f | # dialects/__init__.py
# Copyright (C) 2005-2020 the SQLAlchemy authors and contributors
# <see AUTHORS file>
#
# This module is part of SQLAlchemy and is released under
# the MIT License: http://www.opensource.org/licenses/mit-license.php
__all__ = (
"firebird",
"mssql",
"mysql",
"oracle",
"postgr... | # dialects/__init__.py
# Copyright (C) 2005-2020 the SQLAlchemy authors and contributors
# <see AUTHORS file>
#
# This module is part of SQLAlchemy and is released under
# the MIT License: http://www.opensource.org/licenses/mit-license.php
__all__ = (
"firebird",
"mssql",
"mysql",
"oracle",
"postgr... |
Change EventDispatcher use to EventDispatcherInterface
This change makes code more testable and decoupled of the
EventDispatcher Component | <?php
namespace Scarlett;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Routing\Matcher\UrlMatcherInterface;
use Symfony\Component\Routing\Exception\ResourceNotFoundException;
use Symfony\Component\HttpKernel\Controller\ControllerResolverInterface;
... | <?php
namespace Scarlett;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Routing\Matcher\UrlMatcherInterface;
use Symfony\Component\Routing\Exception\ResourceNotFoundException;
use Symfony\Component\HttpKernel\Controller\ControllerResolverInterface;
... |
Disable typescript instrument on tests | "use strict";
const Task = require('../Task'),
gulp = require('gulp'),
mocha = require('gulp-mocha'),
istanbul = require('gulp-istanbul'),
isparta = require('isparta'),
Promise = require('bluebird');
class TestTask extends Task {
constructor(buildManager) {
super(buildManager);
... | "use strict";
const Task = require('../Task'),
gulp = require('gulp'),
mocha = require('gulp-mocha'),
istanbul = require('gulp-istanbul'),
isparta = require('isparta');
class TestTask extends Task {
constructor(buildManager) {
super(buildManager);
this.command = "test";
le... |
Add cormoran to vendor script | import path from 'path';
import webpack from 'webpack'
let config = {
entry: {
main: './src/main.js',
vendor: [ 'react', 'react-dom', 'cormoran' ]
},
output: {
path: path.resolve(__dirname, './dist'),
publicPath: '/dist/',
filename: 'main.js'
},
module: {
loaders: [
{
te... | import path from 'path';
import webpack from 'webpack'
let config = {
entry: {
main: './src/main.js',
vendor: [ 'react', 'react-dom' ]
},
output: {
path: path.resolve(__dirname, './dist'),
publicPath: '/dist/',
filename: 'main.js'
},
module: {
loaders: [
{
test: /\.js$/,... |
Raise ValueError if n < 1 | from collections import Counter
from functools import (
lru_cache,
reduce,
)
from itertools import combinations
from prime import Prime
@lru_cache(maxsize=None)
def get_prime_factors(n):
""" Returns the counts of each prime factor of n
"""
if n < 1:
raise ValueError
if n == 1:
... | from collections import Counter
from functools import (
lru_cache,
reduce,
)
from itertools import combinations
from prime import Prime
@lru_cache(maxsize=None)
def get_prime_factors(n):
""" Returns the counts of each prime factor of n
"""
if n == 1:
return Counter()
divisor = 2
wh... |
Remove an incorrect documentation URL
Fixes #9. | """
Py-Tree-sitter
"""
import platform
from setuptools import setup, Extension
setup(
name = "tree_sitter",
version = "0.0.8",
maintainer = "Max Brunsfeld",
maintainer_email = "maxbrunsfeld@gmail.com",
author = "Max Brunsfeld",
author_email = "maxbrunsfeld@gmail.com",
url = "https://gith... | """
Py-Tree-sitter
"""
import platform
from setuptools import setup, Extension
setup(
name = "tree_sitter",
version = "0.0.8",
maintainer = "Max Brunsfeld",
maintainer_email = "maxbrunsfeld@gmail.com",
author = "Max Brunsfeld",
author_email = "maxbrunsfeld@gmail.com",
url = "https://gith... |
Fix no run_run icon in old pycharm version. | package com.iselsoft.ptest.runLineMarker;
import com.intellij.execution.lineMarker.RunLineMarkerContributor;
import com.intellij.icons.AllIcons;
import com.intellij.psi.PsiElement;
import com.intellij.util.Function;
import com.iselsoft.ptest.runConfiguration.PTestConfigurationProducer;
import com.jetbrains.python.psi.... | package com.iselsoft.ptest.runLineMarker;
import com.intellij.execution.lineMarker.RunLineMarkerContributor;
import com.intellij.icons.AllIcons;
import com.intellij.psi.PsiElement;
import com.intellij.util.Function;
import com.iselsoft.ptest.runConfiguration.PTestConfigurationProducer;
import com.jetbrains.python.psi.... |
Add FormErrors decorator in a better way
Thanks to lubs in IRC for pointing this out. | <?php
namespace EdpUser\Form;
use Zend\Form\Form,
EdpCommon\Form\ProvidesEventsForm,
EdpUser\Module;
class Login extends ProvidesEventsForm
{
public function init()
{
$this->setMethod('post')
->loadDefaultDecorators()
->setDecorators(array('FormErrors') + $this->getD... | <?php
namespace EdpUser\Form;
use Zend\Form\Form,
EdpCommon\Form\ProvidesEventsForm,
EdpUser\Module;
class Login extends ProvidesEventsForm
{
public function init()
{
$this->setMethod('post');
$this->addDecorator('FormErrors')
->addDecorator('FormElements')
... |
Move append out of if/else block | # -*- coding: utf-8 -*-
'''
Beacon to manage and report the status of
one or more salt proxy processes
.. versionadded:: 2015.8.3
'''
# Import python libs
from __future__ import absolute_import
import logging
log = logging.getLogger(__name__)
def _run_proxy_processes(proxies):
'''
Iterate over ... | # -*- coding: utf-8 -*-
'''
Beacon to manage and report the status of
one or more salt proxy processes
.. versionadded:: 2015.8.3
'''
# Import python libs
from __future__ import absolute_import
import logging
log = logging.getLogger(__name__)
def _run_proxy_processes(proxies):
'''
Iterate over ... |
Enable non-standard imports and indexing in `bulk:all` | <?php
namespace App\Console\Commands\Bulk;
use Aic\Hub\Foundation\AbstractCommand as BaseCommand;
class BulkAll extends BaseCommand
{
protected $signature = 'bulk:all {skip?}';
protected $description = "Reset database and import everything";
public function handle()
{
$shouldSkipTo = $this... | <?php
namespace App\Console\Commands\Bulk;
use Aic\Hub\Foundation\AbstractCommand as BaseCommand;
class BulkAll extends BaseCommand
{
protected $signature = 'bulk:all {skip?}';
protected $description = "Reset database and import everything";
public function handle()
{
$shouldSkipTo = $this... |
Fix problem with Soundcloud API bug | <?php
namespace App\Service;
use App\Model\SongRecord;
class SoundcloudApiService extends AbstractApiService
{
public function getSongRecords(array $filters): array
{
$data = [];
foreach($this->licenses as $license) {
// because of this:
// https://stackoverflow.com... | <?php
namespace App\Service;
use App\Model\SongRecord;
class SoundcloudApiService extends AbstractApiService
{
public function getSongRecords(array $filters): array
{
$data = [];
foreach($this->licenses as $license) {
$uri = '?client_id=' . $this->apiKey .
'&limi... |
Rename the PyPI package to td-watson | from setuptools import setup
with open('README.md') as f:
readme = f.read()
setup(
name='td-watson',
version='1.0.0',
packages=['watson'],
author='TailorDev',
author_email='contact@tailordev.com',
license='MIT',
long_description=readme,
install_requires=[
'Click',
... | from setuptools import setup
with open('README.md') as f:
readme = f.read()
setup(
name='watson',
version='1.0.0',
packages=['watson'],
author='TailorDev',
author_email='contact@tailordev.com',
license='MIT',
long_description=readme,
install_requires=[
'Click',
'ar... |
Remove click handler from document when scope is destroyed | angular.module('offClick',[])
.directive('offClick', ['$document', function ($document) {
function targetInFilter(target,filter){
if(!target || !filter) return false;
var elms = angular.element(filter);
var elmsLen = elms.length;
for (var i = 0; i< elmsLen; ++i)
... | angular.module('offClick',[])
.directive('offClick', ['$document', function ($document) {
function targetInFilter(target,filter){
if(!target || !filter) return false;
var elms = angular.element(filter);
var elmsLen = elms.length;
for (var i = 0; i< elmsLen; ++i)
... |
Update package version to 0.1.1 | from distutils.core import setup, Extension
setup(
name = 'iMX233_GPIO',
version = '0.1.1',
author = 'Stefan Mavrodiev',
author_email = 'support@olimex.com',
url = 'https://www.olimex.com/',
license = 'MIT',
descrip... | from distutils.core import setup, Extension
setup(
name = 'iMX233_GPIO',
version = '0.1.0',
author = 'Stefan Mavrodiev',
author_email = 'support@olimex.com',
url = 'https://www.olimex.com/',
license = 'MIT',
descrip... |
Fix unit test python3 compatibility. | import base64
import os
from distutils.core import Command
class TestCommand(Command):
description = "Launch all tests under fusion_tables app"
user_options = []
def initialize_options(self):
pass
def finalize_options(self):
pass
def create_client_secret_file(self):
clie... | import base64
import os
from distutils.core import Command
class TestCommand(Command):
description = "Launch all tests under fusion_tables app"
user_options = []
def initialize_options(self):
pass
def finalize_options(self):
pass
def create_client_secret_file(self):
clie... |
Fix displaying the sub query name if not available |
import { isString, isEmpty } from 'lodash'
import Expression from './base'
/**
* @class SubQueryExpression
*/
export default class SubQuery extends Expression {
/**
*
* @param {Query|Literal} query
* @constructor
*/
constructor(query) {
super()
this.columns = []
this.query = que... |
import { isString, isEmpty } from 'lodash'
import Expression from './base'
/**
* @class SubQueryExpression
*/
export default class SubQuery extends Expression {
/**
*
* @param {Query|Literal} query
* @constructor
*/
constructor(query) {
super()
this.columns = []
this.query = que... |
Move ESI url prefix to variable | import module from '../../module'
import command from '../../components/command'
import loader from '../../components/loader'
import axios from 'axios'
import humanize from '../../utils/humanize'
export default module(
loader(() => {
console.log('test')
}),
command('getprice', 'Gets the Jita price ... | import module from '../../module'
import command from '../../components/command'
import loader from '../../components/loader'
import axios from 'axios'
import humanize from '../../utils/humanize'
export default module(
loader(() => {
console.log('test')
}),
command('getprice', 'Gets the Jita price ... |
Make the ASCII keyCode unique for the Signature object | $(document).ready(function() {
$(document).keyup(function(e) {
var tag = e.target.tagName.toLowerCase();
if (tag != 'input' && tag != 'textarea' && tag != 'select' && !e.ctrlKey) {
if (e.keyCode==78 || e.keyCode==77) {
$('.nav-menu-icon').trigger('click');
} e... | $(document).ready(function() {
$(document).keyup(function(e) {
var tag = e.target.tagName.toLowerCase();
if (tag != 'input' && tag != 'textarea' && tag != 'select' && !e.ctrlKey) {
if (e.keyCode==78 || e.keyCode==77) {
$('.nav-menu-icon').trigger('click');
} e... |
Fix one more missing reference | <?php
return [
'method' => 'post',
'elements' => [
'is_enabled' => [
'radio',
[
'label' => __('Enable Automated Assignment'),
'description' => __('Allow the system to periodically automatically assign songs to playlists based on their performance... | <?php
return [
'method' => 'post',
'elements' => [
'is_enabled' => [
'radio',
[
'label' => __('Enable Automated Assignment'),
'description' => __('Allow the system to periodically automatically assign songs to playlists based on their performance... |
Print 16 bit per line | #!/usr/bin/env python2
"""
Analyze superblock in ext2 filesystem.
Usage:
superblock.py <filename>
"""
import sys
import string
from binascii import hexlify
BLOCKSIZE = 512
def nonprintable_replace(char):
if char not in string.printable:
return '.'
if char in '\n\r\t\x0b\x0c':
return '.'... | #!/usr/bin/env python2
"""
Analyze superblock in ext2 filesystem.
Usage:
superblock.py <filename>
"""
import sys
import string
from binascii import hexlify
BLOCKSIZE = 512
def block_printer(filename, offset, block_count):
def nonprintable_replace(char):
if char not in string.printable:
... |
Fix trl controller fuer directories | <?php
class Vpc_Directories_Item_Directory_Trl_Controller extends Vps_Controller_Action_Auto_Vpc_Grid
{
protected $_buttons = array(
'save',
'reload',
);
protected $_editDialog = array(
'width' => 500,
'height' => 400
);
protected $_hasComponentId = false; //compon... | <?php
class Vpc_Directories_Item_Directory_Trl_Controller extends Vps_Controller_Action_Auto_Vpc_Grid
{
protected $_buttons = array(
'save',
'reload',
);
protected $_editDialog = array(
'width' => 500,
'height' => 400
);
protected $_paging = 25;
public functi... |
Handle the case where there is no search object in the store | import { SET_BODY } from '../actions/Search'
import { RESULT_CLICKED } from '../actions/Analytics'
import { SEARCH_REQUEST_SUCCESS } from '../../api/actions/query'
let data = {
analyticsEnabled: false,
body: ''
}
const events = (analytics) => {
window.addEventListener('beforeunload', () => {
if (data.analyt... | import { SET_BODY } from '../actions/Search'
import { RESULT_CLICKED } from '../actions/Analytics'
import { SEARCH_REQUEST_SUCCESS } from '../../api/actions/query'
let data = {
analyticsEnabled: false,
body: ''
}
const events = (analytics) => {
window.addEventListener('beforeunload', () => {
if (data.analyt... |
Remove render of header and footer on dashboard | import React, { Component } from 'react'
import {BrowserRouter as Router, Route, Link} from 'react-router-dom'
import Auth from './Auth'
import Dashboard from './Dashboard'
import Data from './Data'
import Home from './Home'
import LanguageBar from './shared/LanguageBar'
import Footer from './shared/Footer'
import Styl... | import React, { Component } from 'react'
import {BrowserRouter as Router, Route, Link} from 'react-router-dom'
import Auth from './Auth'
import Dashboard from './Dashboard'
import Data from './Data'
import Home from './Home'
import LanguageBar from './shared/LanguageBar'
import Footer from './shared/Footer'
import Styl... |
Fix time calculation for TryLater in PeriodicTasks | from ..vtask import VTask, TryLater
import time
from ..sparts import option, counter, samples, SampleType
from threading import Event
class PeriodicTask(VTask):
INTERVAL = None
execute_duration = samples(windows=[60, 240],
types=[SampleType.AVG, SampleType.MAX, SampleType.MIN])
n_iterations = coun... | from ..vtask import VTask, TryLater
import time
from ..sparts import option, counter, samples, SampleType
from threading import Event
class PeriodicTask(VTask):
INTERVAL = None
execute_duration = samples(windows=[60, 240],
types=[SampleType.AVG, SampleType.MAX, SampleType.MIN])
n_iterations = coun... |
Allow custon io loops for ConnectionPools | from __future__ import absolute_import
import celery
from tornado import ioloop
from .connection import ConnectionPool
from .producer import NonBlockingTaskProducer
from .result import AsyncResult
VERSION = (0, 3, 0)
__version__ = '.'.join(map(str, VERSION)) + '-dev'
def setup_nonblocking_producer(celery_app=None... | from __future__ import absolute_import
import celery
from tornado import ioloop
from .connection import ConnectionPool
from .producer import NonBlockingTaskProducer
from .result import AsyncResult
VERSION = (0, 3, 0)
__version__ = '.'.join(map(str, VERSION)) + '-dev'
def setup_nonblocking_producer(celery_app=None... |
Mark dirty on placement too | package refinedstorage.apiimpl.network;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
import refinedstorage.api.network.INetworkMaster;
import java.util.HashMap;
import java.util.Map;
public class NetworkMasterRegistry {
public static final Map<Integer, Map<BlockPos, INetworkMaster>>... | package refinedstorage.apiimpl.network;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
import refinedstorage.api.network.INetworkMaster;
import java.util.HashMap;
import java.util.Map;
public class NetworkMasterRegistry {
public static final Map<Integer, Map<BlockPos, INetworkMaster>>... |
Add yellow color for services | #coding=utf-8
from __future__ import absolute_import
from fabric.api import local, run, sudo, task
from fabric.contrib.console import confirm
from fabric.state import env
from fabric.context_managers import cd, lcd, hide, settings
from fabric.colors import red, green, yellow
from .utils import repl_root
from .projec... | #coding=utf-8
from __future__ import absolute_import
from fabric.api import local, run, sudo, task
from fabric.contrib.console import confirm
from fabric.state import env
from fabric.context_managers import cd, lcd, hide, settings
from fabric.colors import red, green
from .utils import repl_root
from .project import... |
Add __bool__ redirect to buttondebounce | import wpilib
class ButtonDebouncer:
'''Useful utility class for debouncing buttons'''
def __init__(self, joystick, buttonnum, period=0.5):
'''
:param joystick: Joystick object
:type joystick: :class:`wpilib.Joystick`
:param buttonnum: Number of button to retrieve
... | import wpilib
class ButtonDebouncer:
'''Useful utility class for debouncing buttons'''
def __init__(self, joystick, buttonnum, period=0.5):
'''
:param joystick: Joystick object
:type joystick: :class:`wpilib.Joystick`
:param buttonnum: Number of button to retrieve
... |
Add `getMailers` to get all of the created swift mailer instances | <?php
namespace KVZ\Laravel\SwitchableMail;
use Illuminate\Mail\TransportManager;
use Illuminate\Support\Manager;
use Swift_Mailer;
class SwiftMailerManager extends Manager
{
/**
* The mail transport manager.
*
* @var \Illuminate\Mail\TransportManager
*/
protected $transportManager;
... | <?php
namespace KVZ\Laravel\SwitchableMail;
use Illuminate\Mail\TransportManager;
use Illuminate\Support\Manager;
use Swift_Mailer;
class SwiftMailerManager extends Manager
{
/**
* The mail transport manager.
*
* @var \Illuminate\Mail\TransportManager
*/
protected $transportManager;
... |
Increase timeout to 10 hours (temporarily).
The job is expected to take 3-4 hours, but was intermittently
timing out at 6 hours. Increase to 10 hours while profiling and
debugging the job. | from airflow import DAG
from datetime import datetime, timedelta
from operators.emr_spark_operator import EMRSparkOperator
from airflow.operators import BashOperator
default_args = {
'owner': 'mreid@mozilla.com',
'depends_on_past': False,
'start_date': datetime(2016, 6, 27),
'email': ['telemetry-alerts... | from airflow import DAG
from datetime import datetime, timedelta
from operators.emr_spark_operator import EMRSparkOperator
from airflow.operators import BashOperator
default_args = {
'owner': 'mreid@mozilla.com',
'depends_on_past': False,
'start_date': datetime(2016, 6, 27),
'email': ['telemetry-alerts... |
Add some braces around an if guard | package com.yammer.tenacity.core.properties;
import com.netflix.config.ConfigurationManager;
import com.netflix.config.DynamicConfiguration;
import com.netflix.config.FixedDelayPollingScheduler;
import com.netflix.config.PolledConfigurationSource;
import com.netflix.config.sources.URLConfigurationSource;
import com.ya... | package com.yammer.tenacity.core.properties;
import com.netflix.config.ConfigurationManager;
import com.netflix.config.DynamicConfiguration;
import com.netflix.config.FixedDelayPollingScheduler;
import com.netflix.config.PolledConfigurationSource;
import com.netflix.config.sources.URLConfigurationSource;
import com.ya... |
Add a test for RelativeTimer send() to make sure it sends metrics | <?php
namespace Test\Statsd\Client;
use Statsd\Client\RelativeTimer;
use Statsd\Client;
class RelativeTimerTest extends \PHPUnit_Framework_TestCase
{
public function testGetters()
{
$client = new Client();
$timer = new RelativeTimer($client, 1500);
$this->assertSame($client, $timer->ge... | <?php
namespace Test\Statsd\Client;
use Statsd\Client\RelativeTimer;
use Statsd\Client;
class RelativeTimerTest extends \PHPUnit_Framework_TestCase
{
public function testGetters()
{
$client = new Client();
$timer = new RelativeTimer($client, 1500);
$this->assertSame($client, $timer->ge... |
Add routing to 404 component | import React from 'react';
import { BrowserRouter, Match, Miss } from 'react-router'
import Header from './components/Header';
import CTA from './components/CTA';
import Footer from './components/Footer';
import routes from './config/routes';
import FourOhFour from './components/404';
const App = () => (
// <Browser... | import React from 'react';
import { BrowserRouter, Match } from 'react-router'
import Header from './components/Header';
import CTA from './components/CTA';
import Footer from './components/Footer';
import routes from './config/routes';
const App = () => (
// <BrowserRouter history={history}>
<BrowserRouter>
<... |
Call `cb` immediately if `pending` is zero | 'use strict';
var tape = require('tape');
var through = require('through2');
var PluginError = require('gulp-util').PluginError;
var requireUncached = require('require-uncached');
var PLUGIN_NAME = 'gulp-tape';
var gulpTape = function(opts) {
opts = opts || {};
var outputStream = opts.outputStream || process.st... | 'use strict';
var tape = require('tape');
var through = require('through2');
var PluginError = require('gulp-util').PluginError;
var requireUncached = require('require-uncached');
var PLUGIN_NAME = 'gulp-tape';
var gulpTape = function(opts) {
opts = opts || {};
var outputStream = opts.outputStream || process.st... |
Remove helper dependency in observer class | <?php
/**
* MinTotalQty observer model
*
* @category Jvs
* @package Jvs_MinTotalQty
* @author Javier Villanueva <javiervd@gmail.com>
*/
class Jvs_MinTotalQty_Model_Observer
{
/**
* Check minimun order totals
*
* @param Varien_Event_Observer $observer
* @return void
*/
public f... | <?php
/**
* MinTotalQty observer model
*
* @category Jvs
* @package Jvs_MinTotalQty
* @author Javier Villanueva <javiervd@gmail.com>
*/
class Jvs_MinTotalQty_Model_Observer extends Mage_CatalogInventory_Helper_Minsaleqty
{
/**
* Check minimun order totals
*
* @param Varien_Event_Observer $o... |
Fix bug in call to get default swimlane | Meteor.methods({
moveSwimlane(swimlaneId, toBoardId) {
check(swimlaneId, String);
check(toBoardId, String);
const swimlane = Swimlanes.findOne(swimlaneId);
const fromBoard = Boards.findOne(swimlane.boardId);
const toBoard = Boards.findOne(toBoardId);
if (swimlane && toBoard) {
swimlane... | Meteor.methods({
moveSwimlane(swimlaneId, toBoardId) {
check(swimlaneId, String);
check(toBoardId, String);
const swimlane = Swimlanes.findOne(swimlaneId);
const board = Boards.findOne(toBoardId);
if (swimlane && board) {
swimlane.lists().forEach(list => {
const boardList = Lists.f... |
Fix default empty configuration acceptance tests. | <?php
use Centreon\Test\Behat\CentreonContext;
/**
* Defines application features from the specific context.
*/
class EmptyDefaultConfigurationContext extends CentreonContext
{
/**
* @When I list the :arg1
*/
public function iListThe($arg1)
{
switch ($arg1) {
case 'host temp... | <?php
use Centreon\Test\Behat\CentreonContext;
/**
* Defines application features from the specific context.
*/
class EmptyDefaultConfigurationContext extends CentreonContext
{
/**
* @When I list the :arg1
*/
public function iListThe($arg1)
{
switch ($arg1) {
case 'host temp... |
Replace string substitution with string formatting | # -*- coding: utf-8 -*-
'''
Manage launchd plist files
'''
# Import python libs
import os
import sys
def write_launchd_plist(program):
'''
Write a launchd plist for managing salt-master or salt-minion
CLI Example:
.. code-block:: bash
salt-run launchd.write_launchd_plist salt-master
''... | # -*- coding: utf-8 -*-
'''
Manage launchd plist files
'''
# Import python libs
import os
import sys
def write_launchd_plist(program):
'''
Write a launchd plist for managing salt-master or salt-minion
CLI Example:
.. code-block:: bash
salt-run launchd.write_launchd_plist salt-master
''... |
Fix Apollo Client subscription test | /* eslint-disable prefer-arrow-callback, func-names */
/* eslint-env mocha */
import chai from 'chai';
import gql from 'graphql-tag';
import { Promise } from 'meteor/promise';
import { ApolloClient } from 'apollo-client';
import { InMemoryCache } from 'apollo-cache-inmemory';
import { getDDPLink } from '../../lib/clien... | /* eslint-disable prefer-arrow-callback, func-names */
/* eslint-env mocha */
import chai from 'chai';
import gql from 'graphql-tag';
import { Promise } from 'meteor/promise';
import { ApolloClient } from 'apollo-client';
import { InMemoryCache } from 'apollo-cache-inmemory';
import { getDDPLink } from '../../lib/clien... |
Add name when creating Target | import django
import os
import yaml
from backend.settings import BASE_DIR
from django.db import IntegrityError
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'backend.settings')
django.setup()
from breach.models import Target
def create_target(target):
t = Target(
name=target['name'],
endpoint=... | import django
import os
import yaml
from backend.settings import BASE_DIR
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'backend.settings')
django.setup()
from breach.models import Target
def create_target(target):
t = Target(
endpoint=target['endpoint'],
prefix=target['prefix'],
alpha... |
Put file created by the gtts on tmp folder | import time
import os
from tempfile import NamedTemporaryFile
from sys import platform as _platform
from gtts import gTTS
from pygame import mixer
from .playsound import playsound
from ..components import _BaseComponent
class TextToSpeech(_BaseComponent):
def __init__(self, queues):
super().__init__(q... | import time
import os
from tempfile import NamedTemporaryFile
from sys import platform as _platform
from gtts import gTTS
from pygame import mixer
from .playsound import playsound
from ..components import _BaseComponent
class TextToSpeech(_BaseComponent):
def __init__(self, queues):
super().__init__(q... |
Maintain Java 6 compatibility for now | /*
* Copyright (C) 2011 Information Management Services, Inc.
*/
package com.imsweb.seerapi.client.cs;
import java.util.ArrayList;
import java.util.List;
import org.codehaus.jackson.annotate.JsonProperty;
/**
* Simple Java object that contains all of the schemas relevant information.
*/
public class CsSchema {
... | /*
* Copyright (C) 2011 Information Management Services, Inc.
*/
package com.imsweb.seerapi.client.cs;
import java.util.ArrayList;
import java.util.List;
import org.codehaus.jackson.annotate.JsonProperty;
/**
* Simple Java object that contains all of the schemas relevant information.
*/
public class CsSchema {
... |
Fix problem in help plugin | const Promise = require('bluebird');
const Plugin = require('../plugin');
module.exports = Plugin.define('help', ['commands'], {
defaultConfig: {
'commands': ['help'],
'parse_mode': 'markdown',
'disable_web_page_preview': true,
'disable_notification': false,
},
whitelistC... | const Promise = require('bluebird');
const Plugin = require('../plugin');
module.exports = Plugin.define('help', ['commands'], {
defaultConfig: {
'commands': ['help'],
'parse_mode': 'markdown',
'disable_web_page_preview': true,
'disable_notification': false,
},
whitelistC... |
:white_check_mark: Update completion tests, checking for printed message | import os
import subprocess
import sys
from pathlib import Path
import typer
from typer.testing import CliRunner
from first_steps import tutorial001 as mod
runner = CliRunner()
app = typer.Typer()
app.command()(mod.main)
def test_show_completion():
result = subprocess.run(
[
"bash",
... | import os
import subprocess
import sys
from pathlib import Path
import typer
from typer.testing import CliRunner
from first_steps import tutorial001 as mod
runner = CliRunner()
app = typer.Typer()
app.command()(mod.main)
def test_show_completion():
result = subprocess.run(
[
"bash",
... |
Remove order as the tests are independent of the order. | package com.telecomsys.cmc.model;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonRootName;
/**
* The schedule message model which encapsulates the request and response sent when the client requests detail... | package com.telecomsys.cmc.model;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonPropertyOrder;
import com.fasterxml.jackson.annotation.JsonRootName;
/**
* The schedule message model which encapsulates th... |
Change stream test to not require additional dependency | var fs = require('fs');
describe('Writeable Stream Input API', function () {
var feedPath = __dirname + '/feeds/rss2sample.xml';
describe('.pipe()', function () {
it('works', function (done) {
var events = [];
fs.createReadStream(feedPath).pipe(FeedParser())
.on('error', function (err) {... | var fs = require('fs');
var endpoint = require('endpoint');
describe('Writeable Stream Input API', function () {
var feedPath = __dirname + '/feeds/rss2sample.xml';
describe('.pipe()', function () {
it('works', function (done) {
var events = [];
fs.createReadStream(feedPath).pipe(FeedParser())
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.