text stringlengths 16 4.96k | positive stringlengths 321 2.24k | negative stringlengths 310 2.21k |
|---|---|---|
Make get_signature support unicode characters by encoding to utf-8 instead of ascii. | import hashlib
import hmac
import urllib, urllib2
KEY_STATUSES = (
('U', 'Unactivated'),
('A', 'Active'),
('S', 'Suspended')
)
UNPUBLISHED, PUBLISHED, NEEDS_UPDATE = range(3)
PUB_STATUSES = (
(UNPUBLISHED, 'Unpublished'),
(PUBLISHED, 'Published'),
(NEEDS_UPDATE, 'Needs Update'),
)
def get_sig... | import hashlib
import hmac
import urllib, urllib2
KEY_STATUSES = (
('U', 'Unactivated'),
('A', 'Active'),
('S', 'Suspended')
)
UNPUBLISHED, PUBLISHED, NEEDS_UPDATE = range(3)
PUB_STATUSES = (
(UNPUBLISHED, 'Unpublished'),
(PUBLISHED, 'Published'),
(NEEDS_UPDATE, 'Needs Update'),
)
def get_si... |
Revert URL redirect (didn't work) | from django.conf.urls.defaults import *
from django.views.generic.simple import redirect_to
urlpatterns = patterns('',
# filebrowser urls
url(r'^browse/$', 'filebrowser.views.browse', name="fb_browse"),
url(r'^mkdir/', 'filebrowser.views.mkdir', name="fb_mkdir"),
url(r'^upload/', 'filebrowser.view... | from django.conf.urls.defaults import *
from django.views.generic.simple import redirect_to
urlpatterns = patterns('',
# filebrowser urls
url(r'^browse/$', redirect_to, {'url': '/admin/business/photo/?_popup=1'}, name="fb_browse"),
url(r'^mkdir/', 'filebrowser.views.mkdir', name="fb_mkdir"),
url(r... |
Put in correct jelly DXS paths | package com.walkertribe.ian.enums;
import com.walkertribe.ian.Context;
import com.walkertribe.ian.model.Model;
/**
* The types of creatures. Note: For some reason, wrecks count as creatures.
* @author rwalker
*/
public enum CreatureType {
TYPHON(null),
WHALE("dat/whale.dxs"),
SHARK("dat/monster-sha.dxs"),
DRAG... | package com.walkertribe.ian.enums;
import com.walkertribe.ian.Context;
import com.walkertribe.ian.model.Model;
/**
* The types of creatures. Note: For some reason, wrecks count as creatures.
* @author rwalker
*/
public enum CreatureType {
TYPHON(null),
WHALE("dat/whale.dxs"),
SHARK("dat/monster-sha.dxs"),
DRAG... |
Add `delimiter` and `html_map` to HTML formatter and do not register it by default | from django.template import defaultfilters as filters
from avocado.formatters import Formatter
class HTMLFormatter(Formatter):
delimiter = u' '
html_map = {
None: '<em>n/a</em>'
}
def to_html(self, values, **context):
toks = []
for value in values.values():
# Chec... | from django.template import defaultfilters as filters
from avocado.formatters import Formatter, registry
class HTMLFormatter(Formatter):
def to_html(self, values, fields=None, **context):
toks = []
for value in values.values():
if value is None:
continue
if ... |
Fix data serialization causing app not to receive data when launched from notification | package se.hyperlab.tigcm;
import android.content.Intent;
import android.app.Activity;
import android.os.Bundle;
import org.appcelerator.kroll.common.Log;
import org.appcelerator.titanium.TiApplication;
import org.appcelerator.kroll.KrollDict;
import java.util.HashMap;
public class NotificationActivity extends Acti... | package se.hyperlab.tigcm;
import android.content.Intent;
import android.app.Activity;
import android.os.Bundle;
import org.appcelerator.kroll.common.Log;
import org.appcelerator.titanium.TiApplication;
import java.util.HashMap;
public class NotificationActivity extends Activity {
private static final String T... |
Remove one more obsolete match | // Documents list and user data
'use strict';
var renderDocumentsList = require('./components/business-process-documents-list')
, renderCertificateList = require('./components/business-process-certificates-list')
, renderPaymentList = require('./components/business-process-payments-list');
exports._parent ... | // Documents list and user data
'use strict';
var renderDocumentsList = require('./components/business-process-documents-list')
, renderCertificateList = require('./components/business-process-certificates-list')
, renderPaymentList = require('./components/business-process-payments-list');
exports._parent ... |
Allow disabling password and token auth on jupyter notebooks | # Copyright 2015 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... | # Copyright 2015 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... |
Add fallback to api-usage example | import React from 'react'
import ReactDOM from 'react-dom'
import ReactSVG from 'react-svg'
ReactDOM.render(
<ReactSVG
// Required props.
src="svg.svg"
// Optional props.
evalScripts="always"
fallback={<span>Error!</span>}
onInjected={(error, svg) => {
if (error) {
console.error... | import React from 'react'
import ReactDOM from 'react-dom'
import ReactSVG from 'react-svg'
ReactDOM.render(
<ReactSVG
// Required props.
src="svg.svg"
// Optional props.
evalScripts="always"
onInjected={(error, svg) => {
if (error) {
console.error(error)
return
}
... |
Fix & cleanup profile genesis tests | from pprint import pprint
import pytest
from ethereum import blocks
from ethereum.db import DB
from ethereum.config import Env
from pyethapp.utils import merge_dict
from pyethapp.utils import update_config_from_genesis_json
import pyethapp.config as konfig
from pyethapp.profiles import PROFILES
@pytest.mark.parametri... | import pytest
from ethereum import blocks
from ethereum.db import DB
from ethereum.config import Env
from pyethapp.utils import merge_dict
from pyethapp.utils import update_config_from_genesis_json
import pyethapp.config as konfig
from pyethapp.profiles import PROFILES
def check_genesis(profile):
config = dict(et... |
Add hooks for element add and remove. | define(['dib',
'events',
'class'],
function(Dib, Emitter, clazz) {
function Controller() {
Emitter.call(this);
this._init();
}
clazz.inherits(Controller, Emitter);
Controller.prototype._init = function() {
var dib = new Dib(this.template)
, locals = this.willLoadDib()
... | define(['dib',
'events',
'class'],
function(Dib, Emitter, clazz) {
function Controller() {
Emitter.call(this);
this._init();
}
clazz.inherits(Controller, Emitter);
Controller.prototype._init = function() {
var dib = new Dib(this.template)
, locals = this.willLoadDib()
... |
Modify initialization to be more properly for CsvTableWriter class | from typing import List
import typepy
from ._text_writer import TextTableWriter
class CsvTableWriter(TextTableWriter):
"""
A table writer class for character separated values format.
The default separated character is a comma (``","``).
:Example:
:ref:`example-csv-table-writer`
... | from typing import List
import typepy
from ._text_writer import TextTableWriter
class CsvTableWriter(TextTableWriter):
"""
A table writer class for character separated values format.
The default separated character is a comma (``","``).
:Example:
:ref:`example-csv-table-writer`
... |
:tada: Add optional dependency for collation | # -*- coding: utf-8 -*-
import sys
from setuptools import setup, find_packages
IS_PY3 = sys.version_info > (3,)
install_requires = [
'jinja2',
'lxml',
]
collation_requires = [
'cnx-easybake',
]
tests_require = [
]
tests_require.extend(collation_requires)
extras_require = {
'collation': c... | # -*- coding: utf-8 -*-
import sys
from setuptools import setup, find_packages
IS_PY3 = sys.version_info > (3,)
install_requires = [
'jinja2',
'lxml',
]
tests_require = [
]
extras_require = {
'test': tests_require,
}
description = "Library for building and paring Connexions' EPUBs."
if not ... |
Check and create the tests file folder using an absolute path | from os import mkdir
from os.path import abspath, dirname, exists, join
from shutil import rmtree
from tvrenamr.config import Config
from tvrenamr.main import TvRenamr
from tvrenamr.tests import mock_requests
# make pyflakes STFU
assert mock_requests
class BaseTest(object):
files = 'tests/files'
organised = ... | from os import mkdir
from os.path import abspath, dirname, exists, join
from shutil import rmtree
from tvrenamr.config import Config
from tvrenamr.main import TvRenamr
from tvrenamr.tests import mock_requests
# make pyflakes STFU
assert mock_requests
class BaseTest(object):
files = 'tests/files'
organised = ... |
Speed up test runs in `WaitForResult` | package testutil
import (
"time"
"testing"
"github.com/hashicorp/consul/consul/structs"
)
type testFn func() (bool, error)
type errorFn func(error)
func WaitForResult(test testFn, error errorFn) {
retries := 1000
for retries > 0 {
time.Sleep(10 * time.Millisecond)
retries--
success, err := test()
if s... | package testutil
import (
"time"
"testing"
"github.com/hashicorp/consul/consul/structs"
)
type testFn func() (bool, error)
type errorFn func(error)
func WaitForResult(test testFn, error errorFn) {
retries := 100
for retries > 0 {
time.Sleep(100 * time.Millisecond)
retries--
success, err := test()
if s... |
Switch to new spec update command. | <?php
namespace App\Console\Commands;
use Illuminate\Console\Command;
class SetupCommand extends Command
{
protected $signature = 'setup';
protected $description = 'Runs all commands necessary for initial setup of the application.';
public function handle()
{
$this->info('Setting up the appl... | <?php
namespace App\Console\Commands;
use Illuminate\Console\Command;
class SetupCommand extends Command
{
protected $signature = 'setup';
protected $description = 'Runs all commands necessary for initial setup of the application.';
public function handle()
{
$this->info('Setting up the appl... |
Fix Lexer [else with subject] exception | <?php
namespace Phug\Lexer\Scanner;
use Phug\Lexer\State;
use Phug\Lexer\Token\ConditionalToken;
class ConditionalScanner extends ControlStatementScanner
{
public function __construct()
{
parent::__construct(
ConditionalToken::class,
['if', 'unless', 'else[ \t]*if', 'else']
... | <?php
namespace Phug\Lexer\Scanner;
use Phug\Lexer\State;
use Phug\Lexer\Token\ConditionalToken;
class ConditionalScanner extends ControlStatementScanner
{
public function __construct()
{
parent::__construct(
ConditionalToken::class,
['if', 'unless', 'else[ \t]*if', 'else']
... |
Make use of auto generated table classes. | from cruditor.contrib.collection import CollectionViewMixin
from cruditor.views import CruditorAddView, CruditorChangeView, CruditorDeleteView, CruditorListView
from django.urls import reverse, reverse_lazy
from examples.mixins import ExamplesMixin
from store.models import Person
from .filters import PersonFilter
fro... | from cruditor.contrib.collection import CollectionViewMixin
from cruditor.views import CruditorAddView, CruditorChangeView, CruditorDeleteView, CruditorListView
from django.urls import reverse, reverse_lazy
from examples.mixins import ExamplesMixin
from store.models import Person
from .filters import PersonFilter
fro... |
Add missing requirement to example app | import os
import dj_database_url
BASE_DIR = os.path.dirname(os.path.dirname(__file__))
DEBUG = TEMPLATE_DEBUG = True
SECRET_KEY = 'example-app!'
ROOT_URLCONF = 'example.urls'
STATIC_URL = '/static/'
DATABASES = {'default': dj_database_url.config(
default='postgres://localhost/conman_example',
)}
DATABASES['d... | import os
import dj_database_url
BASE_DIR = os.path.dirname(os.path.dirname(__file__))
DEBUG = TEMPLATE_DEBUG = True
SECRET_KEY = 'example-app!'
ROOT_URLCONF = 'example.urls'
STATIC_URL = '/static/'
DATABASES = {'default': dj_database_url.config(
default='postgres://localhost/conman_example',
)}
DATABASES['d... |
Change old IETF reference link
Old link will throw 404, so it could be replaced with new working one | /*
* Copyright (C) 2013 Square, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agre... | /*
* Copyright (C) 2013 Square, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agre... |
Include recommended on eslint config | // https://eslint.org/docs/user-guide/configuring
module.exports = {
root: true,
parserOptions: {
parser: 'babel-eslint'
},
env: {
browser: true,
},
extends: [
// https://github.com/vuejs/eslint-plugin-vue#priority-a-essential-error-prevention
// consider switching to `plugin:vue/strongly-r... | // https://eslint.org/docs/user-guide/configuring
module.exports = {
root: true,
parserOptions: {
parser: 'babel-eslint'
},
env: {
browser: true,
},
extends: [
// https://github.com/vuejs/eslint-plugin-vue#priority-a-essential-error-prevention
// consider switching to `plugin:vue/strongly-r... |
Change to the Stripes test fixture to supply the new init-param ActionResolver.Packages
git-svn-id: eee8cf2eb4cac5fd9f9d7b672efb1c285d99a606@436 d471f07e-d8fc-0310-a67b-dd4c8ff0e7cd | package net.sourceforge.stripes;
import net.sourceforge.stripes.mock.MockServletContext;
import net.sourceforge.stripes.controller.StripesFilter;
import net.sourceforge.stripes.controller.DispatcherServlet;
import java.util.Map;
import java.util.HashMap;
/**
* Test fixture that sets up a MockServletContext in a way... | package net.sourceforge.stripes;
import net.sourceforge.stripes.mock.MockServletContext;
import net.sourceforge.stripes.controller.StripesFilter;
import net.sourceforge.stripes.controller.DispatcherServlet;
import java.util.Map;
import java.util.HashMap;
/**
* Test fixture that sets up a MockServletContext in a way... |
Drop alpha tag from package | #!/usr/bin/env python
"""
Raven
======
Raven is a Python client for `Sentry <http://aboutsentry.com/>`_. It provides
full out-of-the-box support for many of the popular frameworks, including
Django, and Flask. Raven also includes drop-in support for any WSGI-compatible
web application.
"""
from setuptools import setu... | #!/usr/bin/env python
"""
Raven
======
Raven is a Python client for `Sentry <http://aboutsentry.com/>`_. It provides
full out-of-the-box support for many of the popular frameworks, including
Django, and Flask. Raven also includes drop-in support for any WSGI-compatible
web application.
"""
from setuptools import setu... |
fix: Remove misleading and unnecessary comments | angular.module('snap')
.factory('snapRemote', ['$q', function($q) {
'use strict';
// Provide direct access to the snapper object and a few convenience methods
// for our directives.
var deferred = $q.defer()
, exports;
exports = {
get: function() {
return deferred.promise;... | angular.module('snap')
.factory('snapRemote', ['$q', function($q) {
'use strict';
// Provide direct access to the snapper object and a few convenience methods
// for our directives.
var deferred = $q.defer()
, exports;
exports = {
// Returns null until our `snap-content` initializ... |
fs: Add MimeTypeDirEntry to return the MimeType of a DirEntry | package fs
import (
"mime"
"path"
"strings"
)
// MimeTypeFromName returns a guess at the mime type from the name
func MimeTypeFromName(remote string) (mimeType string) {
mimeType = mime.TypeByExtension(path.Ext(remote))
if !strings.ContainsRune(mimeType, '/') {
mimeType = "application/octet-stream"
}
return ... | package fs
import (
"mime"
"path"
"strings"
)
// MimeTypeFromName returns a guess at the mime type from the name
func MimeTypeFromName(remote string) (mimeType string) {
mimeType = mime.TypeByExtension(path.Ext(remote))
if !strings.ContainsRune(mimeType, '/') {
mimeType = "application/octet-stream"
}
return ... |
social/handler: Delete endpoint is added for notification setting | package notificationsettings
import (
"socialapi/workers/common/handler"
"socialapi/workers/common/mux"
)
func AddHandlers(m *mux.Mux) {
m.AddHandler(
handler.Request{
Handler: Create,
Name: "notification-settings-create",
Type: handler.PostRequest,
Endpoint: "/channel/{id}/notificationsett... | package notificationsettings
import (
"socialapi/workers/common/handler"
"socialapi/workers/common/mux"
)
func AddHandlers(m *mux.Mux) {
m.AddHandler(
handler.Request{
Handler: Create,
Name: "notification-settings-create",
Type: handler.PostRequest,
Endpoint: "/channel/{id}/notificationsett... |
:shirt: Fix lint issue for spec | 'use babel'
import { React, TestUtils } from 'react-for-atom'
import TagsComponent from '../../../lib/react/cells/tags-component'
describe('react/cells/tags-component', function () {
let renderer, r, tags
beforeEach(function () {
renderer = TestUtils.createRenderer()
tags = 'a b c'
})
it('renders ta... | 'use babel'
import { React, TestUtils } from 'react-for-atom'
import TagsComponent from '../../../lib/react/cells/tags-component'
describe('react/cells/tags-component', function () {
let renderer, r, tags
beforeEach(function () {
renderer = TestUtils.createRenderer()
tags = 'a b c'
})
it('renders ta... |
Add godoc to Persist method. | // Copyright 2015, David Howden
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package index
import (
"encoding/json"
"io"
"os"
)
// PersistStore is a type which defines a simple persistence store.
type PersistStore string
// NewPersistStore creates a new ... | // Copyright 2015, David Howden
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package index
import (
"encoding/json"
"io"
"os"
)
// PersistStore is a type which defines a simple persistence store.
type PersistStore string
// NewPersistStore creates a new ... |
Logs: Set stdout log level to trace | /**
* This file sets up the logging system and also sets up the
* external logs system if enabled in the config.
*
* The log module will be called by the whole application a lot
* during its lifetime and is expected to implement the following methods:
* child(), trace(), debug(), info(), warn(), error(), fatal(),... | /**
* This file sets up the logging system and also sets up the
* external logs system if enabled in the config.
*
* The log module will be called by the whole application a lot
* during its lifetime and is expected to implement the following methods:
* child(), trace(), debug(), info(), warn(), error(), fatal(),... |
Remove mocked dependencies for readthedocs | import os
import re
from setuptools import find_packages, setup
from dichalcogenides import __version__
with open('README.rst', 'r') as f:
long_description = f.read()
if os.environ.get('READTHEDOCS') == 'True':
mocked = ['numpy', 'scipy']
mock_filter = lambda x: re.sub(r'>.+', '', x) not in mocked
else:
... | from setuptools import find_packages, setup
from dichalcogenides import __version__
with open('README.rst', 'r') as f:
long_description = f.read()
setup(
name='dichalcogenides',
version=__version__,
author='Evan Sosenko',
author_email='razorx@evansosenko.com',
packages=find_packages(exclude=[... |
Clean up un-needed commented line after jkrzywon fixed subprocess bad behaviour | __version__ = "4.0b1"
__build__ = "GIT_COMMIT"
try:
import logging
import subprocess
import os
import platform
FNULL = open(os.devnull, 'w')
if platform.system() == "Windows":
args = ['git', 'describe', '--tags']
else:
args = ['git describe --tags']
git_revision = subproc... | __version__ = "4.0b1"
__build__ = "GIT_COMMIT"
try:
import logging
import subprocess
import os
import platform
FNULL = open(os.devnull, 'w')
if platform.system() == "Windows":
args = ['git', 'describe', '--tags']
else:
args = ['git describe --tags']
git_revision = subproc... |
Remove AWS credentioals from build cache config
The plugin uses the AWS CLI default credentials chain to find
the necessary AWS access and secret keys. | /*
* Copyright 2017 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applica... | /*
* Copyright 2017 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applica... |
Fix typo on constructor method name
refs #31 | <?php
namespace Pragma\Router;
class RouterException extends \Exception{
const GET_CONFIG_ERROR = 1;
const POST_CONFIG_ERROR = 2;
const DELETE_CONFIG_ERROR = 3;
const PATCH_CONFIG_ERROR = 4;
const PUT_CONFIG_ERROR = 5;
const NO_ROUTE_CODE = 6;
const NO_ROUTE_FOR_CODE = 7;
const WRONG_NUMBER_PARAMS_CODE = 8;
... | <?php
namespace Pragma\Router;
class RouterException extends \Exception{
const GET_CONFIG_ERROR = 1;
const POST_CONFIG_ERROR = 2;
const DELETE_CONFIG_ERROR = 3;
const PATCH_CONFIG_ERROR = 4;
const PUT_CONFIG_ERROR = 5;
const NO_ROUTE_CODE = 6;
const NO_ROUTE_FOR_CODE = 7;
const WRONG_NUMBER_PARAMS_CODE = 8;
... |
Add check on curl extension | <?php
// PHP 5.3 minimum
if (version_compare(PHP_VERSION, '5.3.0', '<')) {
die('This software require PHP 5.3.0 minimum');
}
// Short tags must be enabled for PHP < 5.4
if (version_compare(PHP_VERSION, '5.4.0', '<')) {
if (! ini_get('short_open_tag')) {
die('This software require to have short tags... | <?php
// PHP 5.3 minimum
if (version_compare(PHP_VERSION, '5.3.0', '<')) {
die('This software require PHP 5.3.0 minimum');
}
// Short tags must be enabled for PHP < 5.4
if (version_compare(PHP_VERSION, '5.4.0', '<')) {
if (! ini_get('short_open_tag')) {
die('This software require to have short tags... |
Add stat update packet code | module.exports = {
// Packet constants
PLAYER_START: "1",
PLAYER_ADD: "2",
PLAYER_ANGLE: "2",
PLAYER_UPDATE: "3",
PLAYER_ATTACK :"4",
LEADERBOAD: "5",
PLAYER_MOVE: "3",
PLAYER_REMOVE: "4",
LEADERS_UPDATE: "5",
LOAD_GAME_OBJ: "6",
GATHER_ANIM: "7",
AUTO_ATK: "7",
W... | module.exports = {
// Packet constants
PLAYER_START: "1",
PLAYER_ADD: "2",
PLAYER_ANGLE: "2",
PLAYER_UPDATE: "3",
PLAYER_ATTACK :"4",
LEADERBOAD: "5",
PLAYER_MOVE: "3",
PLAYER_REMOVE: "4",
LEADERS_UPDATE: "5",
LOAD_GAME_OBJ: "6",
GATHER_ANIM: "7",
AUTO_ATK: "7",
W... |
Solve bug when creating new pages | function loadCreator (collectionId) {
var pageType, releaseDate;
getCollection(collectionId,
success = function (response) {
if (!response.publishDate) {
releaseDate = null;
} else {
releaseDate = response.publishDate;
}
},
error = function (response) {
handleApi... | function loadCreator (collectionId) {
var pageType, releaseDate;
getCollection(collectionId,
success = function (response) {
if (!response.publishDate) {
releaseDate = null;
} else {
releaseDate = response.publishDate;
}
},
error = function (response) {
handleApi... |
Remove redundant 'slides' var from test | (function() {
'use strict';
describe("<%= pluginFullName %>", function() {
var deck,
createDeck = function() {
slides = [];
var parent = document.createElement('article');
for (var i = 0; i < 10; i++) {
parent.appendChild(document.createElement('section'));
}
... | (function() {
'use strict';
describe("<%= pluginFullName %>", function() {
var slides, deck,
createDeck = function() {
slides = [];
var parent = document.createElement('article');
for (var i = 0; i < 10; i++) {
slides.push(document.createElement('section'));
... |
Update du nombre de legendaries max | import React from 'react';
import ItemLink from 'common/ItemLink';
import ITEM_QUALITIES from 'common/ITEM_QUALITIES';
import SPELLS from 'common/SPELLS';
import Analyzer from 'Parser/Core/Analyzer';
import Combatants from 'Parser/Core/Modules/Combatants';
import SUGGESTION_IMPORTANCE from 'Parser/Core/ISSUE_IMPORTANC... | import React from 'react';
import ItemLink from 'common/ItemLink';
import ITEM_QUALITIES from 'common/ITEM_QUALITIES';
import SPELLS from 'common/SPELLS';
import Analyzer from 'Parser/Core/Analyzer';
import Combatants from 'Parser/Core/Modules/Combatants';
import SUGGESTION_IMPORTANCE from 'Parser/Core/ISSUE_IMPORTANC... |
Switch to denydisconnect simply cos early talkers are RUDE! | // This plugin checks for clients that talk before we sent a response
var constants = require('../constants');
var config = require('../config');
exports.register = function() {
this.pause = config.get('early_talker.pause', 'value');
this.register_hook('data', 'check_early_talker');
};
exports.check_early... | // This plugin checks for clients that talk before we sent a response
var constants = require('../constants');
var config = require('../config');
exports.register = function() {
this.pause = config.get('early_talker.pause', 'value');
this.register_hook('data', 'check_early_talker');
};
exports.check_early... |
[TACHYON-1559] Fix the two checkstyle errors originating out of the additional assertion | /*
* Licensed to the University of California, Berkeley 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 no... | /*
* Licensed to the University of California, Berkeley 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 no... |
Update meow options to be in line with v4.0.0 | #!/usr/bin/env node
'use strict';
// foreign modules
const meow = require('meow');
// local modules
const error = require('../lib/error.js');
const logger = require('../lib/utils/logger.js');
const main = require('../index.js');
// this module
const cli = meow({
help: main.help,
version: true
}, {
flags: {
... | #!/usr/bin/env node
'use strict';
// foreign modules
const meow = require('meow');
// local modules
const error = require('../lib/error.js');
const logger = require('../lib/utils/logger.js');
const main = require('../index.js');
// this module
const cli = meow({
help: main.help,
version: true
}, {
boolean: ... |
Add dotted notation key support (ie. themes) | const appendUnit = (value, unit) => (
value ? `${value}${unit}` : '0'
);
const getPropValue = (obj, keys) => {
const [key, balance] = keys.split(/\.(.+)/);
const value = obj[key];
if (balance) {
return getPropValue(value, balance);
}
return value;
};
const mapStringTemplateToGetter = (value) => {
if... | const appendUnit = (value, unit) => (
value ? `${value}${unit}` : '0'
);
const mapStringTemplateToGetter = (value) => {
if (typeof value === 'string') {
const [key, unit] = value.split(':');
return unit
? props => appendUnit(props[key], unit)
: props => props[key];
}
return value;
};
const... |
Add new icons to tests | import { moduleForComponent, test } from 'ember-qunit'
import hbs from 'htmlbars-inline-precompile'
moduleForComponent('svg-icon', 'Integration | Component | svg icon', {
integration: true
})
const icons = [
'arrow-left',
'arrow-right',
'bubble',
'check',
'checkmark-circle',
'clipboard-check',
'cog',
... | import { moduleForComponent, test } from 'ember-qunit'
import hbs from 'htmlbars-inline-precompile'
moduleForComponent('svg-icon', 'Integration | Component | svg icon', {
integration: true
})
const icons = [
'arrow-left',
'arrow-right',
'bubble',
'check',
'ellipsis-horz',
'menu',
'paper-plane',
'pen... |
Clean up unused folders. Clean up css message | module.exports = {
modules: {
definition: 'commonjs',
wrapper: 'commonjs'
},
paths: {
'public': 'www'
},
files: {
javascripts: {
joinTo: {
'js/app.js': [/^(?!app)/,/^app/]
}
},
stylesheets: {
joinTo: {
'css/app.css': /^(app)/
}
... | module.exports = {
modules: {
definition: 'commonjs',
wrapper: 'commonjs'
},
paths: {
'public': 'www'
},
files: {
javascripts: {
joinTo: {
'js/app.js': [/^(?!app)/,/^app/]
}
},
stylesheets: {
defaultExtension: 'scss',
joinTo: {
'... |
Use `$ which bower` by default
@benrudolph
What do you think of this approach? | """
This is a home for shared dev settings. Feel free to add anything that all
devs should have set.
Add `from dev_settings import *` to the top of your localsettings file to use.
You can then override or append to any of these settings there.
"""
import os
LOCAL_APPS = (
'django_extensions',
)
####### Django E... | """
This is a home for shared dev settings. Feel free to add anything that all
devs should have set.
Add `from dev_settings import *` to the top of your localsettings file to use.
You can then override or append to any of these settings there.
"""
LOCAL_APPS = (
'django_extensions',
)
####### Django Extensions ... |
Increase job graph poll interval. | define([
'underscore'
],
function(_) {
var namespace = "_pollable",
defaultInterval = 200000;
function get(t, k) {
if (!(t[namespace] && t[namespace][k])) { return null; }
return t[namespace][k];
}
function set(t, k, v) {
if (!t[namespace]) { t[namespace] = {}; }
if (_.isObject(k)) { ... | define([
'underscore'
],
function(_) {
var namespace = "_pollable",
defaultInterval = 60000;
function get(t, k) {
if (!(t[namespace] && t[namespace][k])) { return null; }
return t[namespace][k];
}
function set(t, k, v) {
if (!t[namespace]) { t[namespace] = {}; }
if (_.isObject(k)) { _... |
Update trigger rtd build script - use https instead of http. | #!/usr/bin/env python
# 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 "Licen... | #!/usr/bin/env python
# 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 "Licen... |
Fix support check that skips tests on ALL browsers
Mistake and poor checking on my part. | const html = require('choo/html');
const callcount = require('./callcount.js');
const chai = require('chai');
const expect = chai.expect;
// Skip a test if the browser does not support locale-based number formatting
function ifLocaleSupportedIt (name, test) {
if (window.Intl && window.Intl.NumberFormat) {
it(nam... | const html = require('choo/html');
const callcount = require('./callcount.js');
const chai = require('chai');
const expect = chai.expect;
// Skip a test if the browser does not support locale-based number formatting
function ifLocaleSupportedIt (test) {
if (window.Intl && window.Intl.NumberFormat) {
it(test);
... |
Add missing 'process' global for settings tests | const chai = require('chai')
const { expect } = chai
const SandboxedModule = require('sandboxed-module')
describe('Settings', function() {
describe('s3', function() {
it('should use JSONified env var if present', function() {
const s3Settings = {
bucket1: {
auth_key: 'bucket1_key',
... | const chai = require('chai')
const { expect } = chai
const SandboxedModule = require('sandboxed-module')
describe('Settings', function() {
describe('s3', function() {
it('should use JSONified env var if present', function() {
const s3Settings = {
bucket1: {
auth_key: 'bucket1_key',
... |
Fix the spore test, as some functions were added by restjson | import unittest
try:
import simplejson as json
except ImportError:
import json
from wsme.tests.protocol import WSTestRoot
import wsme.tests.test_restjson
import wsme.spore
class TestSpore(unittest.TestCase):
def test_spore(self):
spore = wsme.spore.getdesc(WSTestRoot())
print spore
... | import unittest
try:
import simplejson as json
except ImportError:
import json
from wsme.tests.protocol import WSTestRoot
import wsme.spore
class TestSpore(unittest.TestCase):
def test_spore(self):
spore = wsme.spore.getdesc(WSTestRoot())
print spore
spore = json.loads(spore)
... |
Remove extra line already handle by the route xml | package io.openex.email.attachment;
import org.apache.camel.Exchange;
import org.apache.camel.impl.DefaultAttachment;
import javax.mail.util.ByteArrayDataSource;
import java.util.ArrayList;
import java.util.List;
import static io.openex.email.attachment.EmailDownloader.ATTACHMENTS_CONTENT;
/**
* Created by Julien ... | package io.openex.email.attachment;
import org.apache.camel.Exchange;
import org.apache.camel.impl.DefaultAttachment;
import javax.mail.util.ByteArrayDataSource;
import java.util.ArrayList;
import java.util.List;
import static io.openex.email.attachment.EmailDownloader.ATTACHMENTS_CONTENT;
/**
* Created by Julien ... |
Add support for unkeyed params array. | var route = function(name, params = {}, absolute = true) {
var domain = (namedRoutes[name].domain || baseUrl).replace(/\/+$/,'') + '/',
url = (absolute ? domain : '') + namedRoutes[name].uri,
arrayKey = 0;
return url.replace(
/\{([^}]+)\}/gi,
function (tag) {
var key... | var route = function(name, params = {}, absolute = true) {
var domain = (namedRoutes[name].domain || baseUrl).replace(/\/+$/,'') + '/',
url = (absolute ? domain : '') + namedRoutes[name].uri
return url.replace(
/\{([^}]+)\}/gi,
function (tag) {
var key = tag.replace(/\{|\}/g... |
Update the Edge example test | """
This test is only for Microsoft Edge (Chromium)!
(Tested on Edge Version 89.0.774.54)
"""
from seleniumbase import BaseCase
class EdgeTests(BaseCase):
def test_edge(self):
if self.browser != "edge":
print("\n This test is only for Microsoft Edge (Chromium)!")
print(' (Run th... | """
This test is only for Microsoft Edge (Chromium)!
"""
from seleniumbase import BaseCase
class EdgeTests(BaseCase):
def test_edge(self):
if self.browser != "edge":
print("\n This test is only for Microsoft Edge (Chromium)!")
print(' (Run this test using "--edge" or "--browser=... |
Test extension with mock registry | import mock, unittest
from mopidy_spotify import Extension, backend as backend_lib
class ExtensionTest(unittest.TestCase):
def test_get_default_config(self):
ext = Extension()
config = ext.get_default_config()
self.assertIn('[spotify]', config)
self.assertIn('enabled = true', c... | import unittest
from mopidy_spotify import Extension, backend as backend_lib
class ExtensionTest(unittest.TestCase):
def test_get_default_config(self):
ext = Extension()
config = ext.get_default_config()
self.assertIn('[spotify]', config)
self.assertIn('enabled = true', config)... |
Add doc task to build | 'use strict';
var gulp = require('gulp');
var runSequence = require('run-sequence');
var taskLoader = require('gulp-task-loader');
var $ = require('./gulp.config.js');
// load all tasks from folder 'tasks'
// tasks named after task file name
taskLoader('tasks');
gulp.task('default', function(cb){
run... | 'use strict';
var gulp = require('gulp');
var runSequence = require('run-sequence');
var taskLoader = require('gulp-task-loader');
var $ = require('./gulp.config.js');
// load all tasks from folder 'tasks'
// tasks named after task file name
taskLoader('tasks');
gulp.task('default', function(cb){
run... |
Add js extension required for proper jspm importing | /**
* @overview A module that initializes the Gallery with Flickity
* @module Gallery.js
*/
import Flickity from 'flickity';
import { ImgixSettings } from '../media/ImgixSettings.js';
export const Gallery = {
/**
* Sets up any galleries on the page
* @returns {void}
*/
init() {
const galleryEls = d... | /**
* @overview A module that initializes the Gallery with Flickity
* @module Gallery.js
*/
import Flickity from 'flickity';
import { ImgixSettings } from '../media/ImgixSettings';
export const Gallery = {
/**
* Sets up any galleries on the page
* @returns {void}
*/
init() {
const galleryEls = docu... |
[AdminBundle] Test console exception subscriber without instantiating a specific command | <?php
namespace Kunstmaan\AdminBundle\Tests\EventListener;
use Kunstmaan\AdminBundle\EventListener\ConsoleExceptionSubscriber;
use PHPUnit\Framework\TestCase;
use Psr\Log\LoggerInterface;
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Event\ConsoleErrorEvent;
use Symfony\Component\Consol... | <?php
namespace Kunstmaan\AdminBundle\Tests\EventListener;
use Kunstmaan\AdminBundle\Command\ApplyAclCommand;
use Kunstmaan\AdminBundle\EventListener\ConsoleExceptionSubscriber;
use PHPUnit\Framework\TestCase;
use Psr\Log\LoggerInterface;
use Symfony\Component\Console\Event\ConsoleErrorEvent;
use Symfony\Component\Co... |
Add more logging as default in production | 'use strict';
// Exports
export default function defaultConfig(env = 'development') {
return {
env: env,
loggers: [
{
name: 'stdout',
level: 'info',
stream: process.stdout
},
{
name: 'stderr',
... | 'use strict';
// Exports
export default function defaultConfig(env = 'development') {
return {
env: env,
loggers: [
{
name: 'stdout',
level: (env === 'production') ? 'warn' : 'info',
stream: process.stdout
},
{
... |
Add delete mapping for family. | package arnelid.bjorn.redo.rest;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable... | package arnelid.bjorn.redo.rest;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
... |
Fix bad calculations in challenge 41 | // Challenge 41 - Implement unpadded message recovery oracle
// http://cryptopals.com/sets/6/challenges/41
package cryptopals
import (
"crypto/rand"
"math/big"
)
type challenge41 struct {
}
func (challenge41) Client(key *publicKey, net Network) string {
c := readInt(net)
S, _ := rand.Int(rand.Reader, key.n)
C... | // Challenge 41 - Implement unpadded message recovery oracle
// http://cryptopals.com/sets/6/challenges/41
package cryptopals
import (
"crypto/rand"
"math/big"
)
type challenge41 struct {
}
func (challenge41) Client(key *publicKey, net Network) string {
c := readInt(net)
S, _ := rand.Int(rand.Reader, key.n)
C... |
Modify required package list to minimal pakcages. | import os
from setuptools import setup, find_packages
package_files_paths = []
def package_files(directory):
global package_files_paths
for (path, directories, filenames) in os.walk(directory):
for filename in filenames:
if filename == '.gitignore':
continue
prin... | import os
from setuptools import setup, find_packages
package_files_paths = []
def package_files(directory):
global package_files_paths
for (path, directories, filenames) in os.walk(directory):
for filename in filenames:
if filename == '.gitignore':
continue
prin... |
Fix typo in error handling, preventing an error to be thrown while catching a top level error | import { initOptions, keycloak } from "keycloak"
;(async() => {
keycloak.onTokenExpired = () =>
keycloak
.updateToken()
.then(() => {
console.info("Token refreshed")
})
.catch(error => {
console.warn(
"Keycloak client failed to refresh token, re-authentication is ... | import { initOptions, keycloak } from "keycloak"
;(async() => {
keycloak.onTokenExpired = () =>
keycloak
.updateToken()
.then(() => {
console.info("Token refreshed")
})
.catch(error => {
console.warn(
"Keycloak client failed to refresh token, re-authentication is ... |
Use caller as key for subfolder runtime deps | import caller from 'caller'
import { _resolveFilename } from 'module'
import { dirname } from 'path'
export default class RuntimeDependencyManager {
constructor() {
this.dependencies = {}
this.subFolderDependencies = {}
}
selfTransitiveThenUpdate (subfolder) {
const callingModule = caller()
if ... | import caller from 'caller'
import { _resolveFilename } from 'module'
import { dirname } from 'path'
export default class RuntimeDependencyManager {
constructor() {
this.dependencies = {}
this.subFolderDependencies = {}
}
selfTransitiveThenUpdate (module) {
if (!this.subFolderDependencies[module]) {... |
Fix the FileNotFoundError when data director is not exist | #-*- coding: utf-8 -*-
import pandas as pd
import pandas_datareader.data as web
import datetime
import config
import os
import re
import pickle
def get_file_path(code):
if not os.path.exists(config.DATA_PATH):
try:
os.makedirs(config.DATA_PATH)
except:
pass
return os.path.join(config.DATA_PATH... | #-*- coding: utf-8 -*-
import pandas as pd
import pandas_datareader.data as web
import datetime
import config
import os
import re
import pickle
def get_file_path(code):
return os.path.join(config.DATA_PATH, 'data', code + '.pkl')
def download(code, year1, month1, day1, year2, month2, day2):
start = datetime.datet... |
Add & comment out --harmony_arrow_functions | 'use strict';
var findup = require('findup-sync');
var spawnSync = require('child_process').spawnSync;
var gruntPath = findup('node_modules/grunt-cli/bin/grunt', {cwd: __dirname});
process.title = 'grunth';
var harmonyFlags = [
'--es-staging',
'--harmony_scoping',
// '--harmony_modules', // We have `requi... | 'use strict';
var findup = require('findup-sync');
var spawnSync = require('child_process').spawnSync;
var gruntPath = findup('node_modules/grunt-cli/bin/grunt', {cwd: __dirname});
process.title = 'grunth';
var harmonyFlags = [
'--es-staging',
'--harmony_scoping',
// '--harmony_modules', // We have `requi... |
Add location to user profile post | #from phonenumber_field.serializerfields import PhoneNumberField
from rest_framework import serializers
from drf_extra_fields.geo_fields import PointField
from .models import User
class UserSerializer(serializers.ModelSerializer):
""" Usage:
from rest_framework.renderers import JSONRenderer
from ... | #from phonenumber_field.serializerfields import PhoneNumberField
from rest_framework import serializers
from drf_extra_fields.geo_fields import PointField
from .models import User
class UserSerializer(serializers.ModelSerializer):
""" Usage:
from rest_framework.renderers import JSONRenderer
from ... |
Fix build on RPi. Building from source timesout on karma tests so increase timeouts | module.exports = function(config) {
'use strict';
config.set({
basePath: __dirname + '/public_gen',
frameworks: ['mocha', 'expect', 'sinon'],
// list of files / patterns to load in the browser
files: [
'vendor/npm/es6-shim/es6-shim.js',
'vendor/npm/systemjs/dist/system.src.js',
... | module.exports = function(config) {
'use strict';
config.set({
basePath: __dirname + '/public_gen',
frameworks: ['mocha', 'expect', 'sinon'],
// list of files / patterns to load in the browser
files: [
'vendor/npm/es6-shim/es6-shim.js',
'vendor/npm/systemjs/dist/system.src.js',
... |
Fix getting product in build_dashboard task | from __future__ import annotations
from typing import TYPE_CHECKING
from celery.utils.log import get_task_logger
from keeper.celery import celery_app
from keeper.models import Product
from keeper.services.dashboard import build_dashboard as build_dashboard_svc
if TYPE_CHECKING:
import celery.task
__all__ = ["b... | from __future__ import annotations
from typing import TYPE_CHECKING
from celery.utils.log import get_task_logger
from keeper.celery import celery_app
from keeper.models import Product
from keeper.services.dashboard import build_dashboard as build_dashboard_svc
if TYPE_CHECKING:
import celery.task
__all__ = ["b... |
Fix regex to include .jsx | var path = require('path');
var webpack = require('webpack');
module.exports = {
devtool: 'eval',
entry: [
'webpack-dev-server/client?http://localhost:3000',
'webpack/hot/only-dev-server',
'./index'
],
output: {
path: path.join(__dirname, 'dist'),
filename: 'bundle.js',
publicPath: '/st... | var path = require('path');
var webpack = require('webpack');
module.exports = {
devtool: 'eval',
entry: [
'webpack-dev-server/client?http://localhost:3000',
'webpack/hot/only-dev-server',
'./index'
],
output: {
path: path.join(__dirname, 'dist'),
filename: 'bundle.js',
publicPath: '/st... |
Fix typo in @return annotation | <?php
/**
* @author @fabfuel <fabian@fabfuel.de>
* @created 25.11.14, 08:12
*/
namespace Fabfuel\Prophiler\Plugin\Phalcon\Mvc;
use Phalcon\Events\Event;
use Phalcon\Mvc\ViewInterface;
interface ViewPluginInterface
{
/**
* @param Event $event
* @param ViewInterface $view
* @return void
*/
... | <?php
/**
* @author @fabfuel <fabian@fabfuel.de>
* @created 25.11.14, 08:12
*/
namespace Fabfuel\Prophiler\Plugin\Phalcon\Mvc;
use Phalcon\Events\Event;
use Phalcon\Mvc\ViewInterface;
interface ViewPluginInterface
{
/**
* @param Event $event
* @param ViewInterface $view
* @return void()
*/... |
Fix pushing the original files back on the stream | var through = require('through2');
var gutil = require('gulp-util');
var extend = require('extend');
var vinylFile = require('vinyl-file');
var StringDecoder = require('string_decoder').StringDecoder;
var Analyzer = require('./Analyzer');
var Logger = require('./Logger');
var resolver = null;
mo... | var through = require('through2');
var gutil = require('gulp-util');
var extend = require('extend');
var vinylFile = require('vinyl-file');
var StringDecoder = require('string_decoder').StringDecoder;
var Analyzer = require('./Analyzer');
var Logger = require('./Logger');
var resolver = null;
mo... |
Reset filter query params on "Members" click in sidebar
closes https://github.com/TryGhost/Team/issues/967
Member filters is reset when clicked on "Members" in the left sidebar. | import {helper} from '@ember/component/helper';
export const DEFAULT_QUERY_PARAMS = {
posts: {
type: null,
visibility: null,
author: null,
tag: null,
order: null
},
pages: {
type: null,
visibility: null,
author: null,
tag: null,
... | import {helper} from '@ember/component/helper';
export const DEFAULT_QUERY_PARAMS = {
posts: {
type: null,
visibility: null,
author: null,
tag: null,
order: null
},
pages: {
type: null,
visibility: null,
author: null,
tag: null,
... |
Remove escapeRegExp in favor of lodash.escapeRegExp | exports._regExpRegExp = /^\/(.+)\/([im]?)$/;
exports._lineRegExp = /\r\n|\r|\n/;
exports.splitLines = function (text) {
var lines = [];
var match, line;
while (match = exports._lineRegExp.exec(text)) {
line = text.slice(0, match.index) + match[0];
text = text.slice(line.length);
lines.push(line);
}... | exports._regExpRegExp = /^\/(.+)\/([im]?)$/;
exports._lineRegExp = /\r\n|\r|\n/;
exports.splitLines = function (text) {
var lines = [];
var match, line;
while (match = exports._lineRegExp.exec(text)) {
line = text.slice(0, match.index) + match[0];
text = text.slice(line.length);
lines.push(line);
}... |
Change string to check in test | <?php
/*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIAB... | <?php
/*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIAB... |
Increase turn timer to avoid flaky test
Longer turn timer for Tic Tac Toe game test | package com.github.sandorw.mocabogaso.games.tictactoe;
import static org.junit.Assert.*;
import org.junit.Test;
import com.github.sandorw.mocabogaso.Game;
import com.github.sandorw.mocabogaso.games.GameResult;
import com.github.sandorw.mocabogaso.games.defaults.DefaultGameMove;
import com.github.sandorw.mocabogaso.g... | package com.github.sandorw.mocabogaso.games.tictactoe;
import static org.junit.Assert.*;
import org.junit.Test;
import com.github.sandorw.mocabogaso.Game;
import com.github.sandorw.mocabogaso.games.GameResult;
import com.github.sandorw.mocabogaso.games.defaults.DefaultGameMove;
import com.github.sandorw.mocabogaso.g... |
Use a more precise pattern to id ^R ezproxy url tokens. | from django.conf.urls import url
from django.contrib.auth.decorators import login_required
from . import views
urlpatterns = [
url(r'^u/(?P<url>http[s]?://(?:[a-zA-Z]|[0-9]|[$-_@.&+]|[!*\(\),]|(?:%[0-9a-fA-F][0-9a-fA-F]))+)$',
login_required(views.EZProxyAuth.as_view()),
name='ezproxy_auth_u'
... | from django.conf.urls import url
from django.contrib.auth.decorators import login_required
from . import views
urlpatterns = [
url(r'^u/(?P<url>http[s]?://(?:[a-zA-Z]|[0-9]|[$-_@.&+]|[!*\(\),]|(?:%[0-9a-fA-F][0-9a-fA-F]))+)$',
login_required(views.EZProxyAuth.as_view()),
name='ezproxy_auth_u'
... |
Make watch kicker load up using configured source path | // Runs the webpack dev server and respawns
// the server when pages,components, and tags
// are created or destroyed.
//
// This is required because the webpack
// static site generator plugin requires a
// static list of paths
const spawn = require('child_process').spawn;
const chokidar = require('chokidar');
con... | // Runs the webpack dev server and respawns
// the server when pages,components, and tags
// are created or destroyed.
//
// This is required because the webpack
// static site generator plugin requires a
// static list of paths
const spawn = require('child_process').spawn;
const chokidar = require('chokidar');
con... |
Allow instantiation of the Barlesque object to be overridden. | <?php
/*
* Copyright 2012 Mo McRoberts.
*
* 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... | <?php
/*
* Copyright 2012 Mo McRoberts.
*
* 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... |
Fix migration for various situations | # -*- coding: utf-8 -*-
# Generated by Django 1.11.16 on 2019-01-28 18:20
import pickle
from django.db import migrations, models
import evennia.utils.picklefield
from evennia.utils.utils import to_bytes, to_str
def migrate_serverconf(apps, schema_editor):
"""
Move server conf from a custom binary field into a... | # -*- coding: utf-8 -*-
# Generated by Django 1.11.16 on 2019-01-28 18:20
import pickle
from django.db import migrations, models
import evennia.utils.picklefield
from evennia.utils.utils import to_bytes
def migrate_serverconf(apps, schema_editor):
"""
Move server conf from a custom binary field into a PickleO... |
Update the USDGBP exchange rate | // https://www.bloomberg.com/quote/USDGBP:CUR
const EXCHANGE_RATE_USD_TO_GBP = 0.7062
const EXCHANGE_RATE_GBP_TO_USD = parseFloat(
Number(1 / EXCHANGE_RATE_USD_TO_GBP).toFixed(4)
)
const DATE_LONG_FORMAT = 'd MMMM yyyy'
const DATE_DAY_LONG_FORMAT = 'E, dd MMM yyyy'
const DATE_MEDIUM_FORMAT = 'd mmm yyyy'
const DATE_... | // https://www.bloomberg.com/quote/USDGBP:CUR
const EXCHANGE_RATE_USD_TO_GBP = 0.7189
const EXCHANGE_RATE_GBP_TO_USD = parseFloat(
Number(1 / EXCHANGE_RATE_USD_TO_GBP).toFixed(4)
)
const DATE_LONG_FORMAT = 'd MMMM yyyy'
const DATE_DAY_LONG_FORMAT = 'E, dd MMM yyyy'
const DATE_MEDIUM_FORMAT = 'd mmm yyyy'
const DATE_... |
Update team page header on load | function retrieveGetParameters(){
let parameters = {}
window.location.search
.substring(1) //Remove '?' at beginning
.split('&') //Split key-value pairs
.map((currentElement) => { //Fil... | function retrieveGetParameters(){
let parameters = {}
window.location.search
.substring(1) //Remove '?' at beginning
.split('&') //Split key-value pairs
.map((currentElement) => { //Fil... |
Add children array to default component data | const fs = require('fs');
const path = require('path');
const overrideRequiredComponentStyle = {
position: 'absolute'
};
const defaultRequiredComponentStyle = {
width: '100px',
height: '100px'
};
const getComponentLibrary = (directory = path.join(__dirname, '/components/VisComponents')) => {
const componentL... | const fs = require('fs');
const path = require('path');
const overrideRequiredComponentStyle = {
position: 'absolute'
};
const defaultRequiredComponentStyle = {
width: '100px',
height: '100px'
};
const getComponentLibrary = (directory = path.join(__dirname, '/components/VisComponents')) => {
const componentL... |
Add coding for python 2.7 compatibility | # -*- coding: utf-8 *-*
# This file is part of wger Workout Manager.
#
# wger Workout Manager is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any ... | # This file is part of wger Workout Manager.
#
# wger Workout Manager is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# wger W... |
Fix import path for blobstore gcs driver in project template | // +build appengine
package main
import (
"net/http"
"time"
_ "gnd.la/admin" // required for make-assets command
_ "gnd.la/cache/driver/memcache" // enable memcached cache driver
_ "gnd.la/orm/blobstore/gcs" // enable Google Could Storage blobstore driver
// Uncomment the following line to ... | // +build appengine
package main
import (
"net/http"
"time"
_ "gnd.la/admin" // required for make-assets command
_ "gnd.la/cache/driver/memcache" // enable memcached cache driver
_ "gnd.la/orm/driver/gcs" // enable Google Could Storage blobstore driver
// Uncomment the following line to ... |
Remove useless imports from flask alchemy demo | import unittest
import demoapp
import demoapp_factories
class DemoAppTestCase(unittest.TestCase):
def setUp(self):
demoapp.app.config['SQLALCHEMY_DATABASE_URI'] = 'sqlite://'
demoapp.app.config['TESTING'] = True
self.app = demoapp.app.test_client()
self.db = demoapp.db
se... | import os
import unittest
import tempfile
import demoapp
import demoapp_factories
class DemoAppTestCase(unittest.TestCase):
def setUp(self):
demoapp.app.config['SQLALCHEMY_DATABASE_URI'] = 'sqlite://'
demoapp.app.config['TESTING'] = True
self.app = demoapp.app.test_client()
self.d... |
Fix build script on windows. | /*
Leaflet building, testing and linting scripts.
To use, install Node, then run the following commands in the project root:
npm install -g jake
npm install
To check the code for errors and build Leaflet from source, run "jake".
To run the tests, run "jake test".
For a custom build, open build/build.html in... | /*
Leaflet building, testing and linting scripts.
To use, install Node, then run the following commands in the project root:
npm install -g jake
npm install
To check the code for errors and build Leaflet from source, run "jake".
To run the tests, run "jake test".
For a custom build, open build/build.html in... |
[Fix] Fix login with error login data redirect to / with no message | /**
* Created by Indexyz on 2017/4/10.
*/
"use strict";
/**
* Created by Indexyz on 2017/4/7.
*/
const db = require("mongoose");
const userSchema = require("../../Db/Schema/User");
const userService = require("../../Db/Service/userService");
let userModel = db.model(require('../../Define/Db').Db.USER_DB, userSchem... | /**
* Created by Indexyz on 2017/4/10.
*/
"use strict";
/**
* Created by Indexyz on 2017/4/7.
*/
const db = require("mongoose");
const userSchema = require("../../Db/Schema/User");
const userService = require("../../Db/Service/userService");
let userModel = db.model(require('../../Define/Db').Db.USER_DB, userSchem... |
Use spaces before the item name string in itemsets | # -*- coding: utf-8 -*-
"""
Item Sets
- ItemSet.dbc
"""
from .. import *
from ..globalstrings import *
class ItemSet(Model):
pass
class ItemSetTooltip(Tooltip):
def tooltip(self):
items = self.obj.getItems()
maxItems = len(items)
self.append("name", ITEM_SET_NAME % (self.obj.getName(), 0, maxItems), ... | # -*- coding: utf-8 -*-
"""
Item Sets
- ItemSet.dbc
"""
from .. import *
from ..globalstrings import *
class ItemSet(Model):
pass
class ItemSetTooltip(Tooltip):
def tooltip(self):
items = self.obj.getItems()
maxItems = len(items)
self.append("name", ITEM_SET_NAME % (self.obj.getName(), 0, maxItems), ... |
Fix issue with displaying the correct options on array fields | <?php /** @var \Dms\Core\Form\IFieldOption[] $options */ ?>
<?php /** @var array $value */ ?>
@if (count($value) === 0)
@include('dms::components.field.null.value')
@else
<ul class="dms-display-list list-group">
@foreach ($options as $option)
<li class="list-group-item">
@if(... | <?php /** @var \Dms\Core\Form\IFieldOption[] $options */ ?>
<?php /** @var array $value */ ?>
@if (count($value) === 0)
@include('dms::components.field.null.value')
@else
<ul class="dms-display-list list-group">
@foreach ($value as $item)
@if(isset($options[$item]))
<li class... |
Add code example for Godoc. | package jump
import "testing"
func TestHashInBucketRange(t *testing.T) {
h := Hash(1, 1)
if h != 0 {
t.Error("expected bucket to be 0, got", h)
}
h = Hash(42, 57)
if h != 43 {
t.Error("expected bucket to be 43, got", h)
}
h = Hash(0xDEAD10CC, 1)
if h != 0 {
t.Error("expected bucket to be 0, got", h)
... | package jump
import "testing"
func TestHashInBucketRange(t *testing.T) {
h := Hash(1, 1)
if h != 0 {
t.Error("expected bucket to be 0, got", h)
}
h = Hash(42, 57)
if h != 43 {
t.Error("expected bucket to be 43, got", h)
}
h = Hash(0xDEAD10CC, 1)
if h != 0 {
t.Error("expected bucket to be 0, got", h)
... |
Fix webpack setup for production builds | var webpack = require('webpack');
var path = require('path');
var BUILD_DIR = path.resolve(__dirname, 'public', 'dist');
var APP_DIR = path.resolve(__dirname, 'src');
var API_BASE_URL = process.env.NODE_ENV === 'production' ? 'http://api.eachday.life' : 'http://localhost:5000'
var config = {
entry: APP_DIR + '/inde... | var webpack = require('webpack');
var path = require('path');
var BUILD_DIR = path.resolve(__dirname, 'public', 'dist');
var APP_DIR = path.resolve(__dirname, 'src');
var API_BASE_URL = process.env.NODE_ENV === 'production' ? 'http://api.eachday.life' : 'http://localhost:5000'
var config = {
entry: APP_DIR + '/inde... |
Make site url be http, not https | from django.core.paginator import Paginator, EmptyPage, InvalidPage
from django.contrib.syndication.views import add_domain
from django.contrib.sites.models import get_current_site
def get_site_url(request, path):
"""Retrieve current site site
Always returns as http (never https)
"""
current_site = g... | from django.core.paginator import Paginator, EmptyPage, InvalidPage
from django.contrib.syndication.views import add_domain
from django.contrib.sites.models import get_current_site
def get_site_url(request, path):
current_site = get_current_site(request)
return add_domain(current_site.domain, path, request.i... |
Remove WKPB from geosearch - also change test | import unittest
from datapunt_geosearch import config
from datapunt_geosearch import datasource
class TestBAGDataset(unittest.TestCase):
def test_query(self):
x = 120993
y = 485919
ds = datasource.BagDataSource(dsn=config.DSN_BAG)
results = ds.query(x, y)
self.assertEqua... | import unittest
from datapunt_geosearch import config
from datapunt_geosearch import datasource
class TestBAGDataset(unittest.TestCase):
def test_query(self):
x = 120993
y = 485919
ds = datasource.BagDataSource(dsn=config.DSN_BAG)
results = ds.query(x, y)
self.assertEqua... |
Add mime types to GCodeWriter plugin | # Copyright (c) 2015 Ultimaker B.V.
# Cura is released under the terms of the AGPLv3 or higher.
from . import GCodeWriter
from UM.i18n import i18nCatalog
catalog = i18nCatalog("cura")
def getMetaData():
return {
"type": "mesh_writer",
"plugin": {
"name": "GCode Writer",
"a... | # Copyright (c) 2015 Ultimaker B.V.
# Cura is released under the terms of the AGPLv3 or higher.
from . import GCodeWriter
from UM.i18n import i18nCatalog
catalog = i18nCatalog("cura")
def getMetaData():
return {
"type": "mesh_writer",
"plugin": {
"name": "GCode Writer",
"a... |
Save antibody-log at each time in temp directory | package shell
import (
"fmt"
"github.com/kardianos/osext"
)
const template = `#!/usr/bin/env zsh
ANTIBODY_BINARY="%s"
antibody() {
case "$1" in
bundle|update)
tmp_dir=$(mktemp -d)
while read -u 3 bundle; do
source "$bundle" 2&> ${temp_dir}/antibody-log
done 3< <( $ANTIBODY_BINARY $@ )
;;
*)
$ANTIBO... | package shell
import (
"fmt"
"github.com/kardianos/osext"
)
const template = `#!/usr/bin/env zsh
ANTIBODY_BINARY="%s"
antibody() {
case "$1" in
bundle|update)
while read -u 3 bundle; do
touch /tmp/antibody-log && chmod 777 /tmp/antibody-log
source "$bundle" 2&> /tmp/antibody-log
done 3< <( $ANTIBODY_BI... |
Define the port variable for reconnection | import pymysql
class MySQL():
def __init__(self, host, user, password, port):
self._host = host
self._user = user
self._password = password
self._port = port
self._conn = pymysql.connect(host=host, port=port,
user=user, passwd=password)
self._... | import pymysql
class MySQL():
def __init__(self, host, user, password, port):
self._host = host
self._user = user
self._password = password
self._conn = pymysql.connect(host=host, port=port,
user=user, passwd=password)
self._cursor = self._conn.cursor... |
Change default zerofill to 5 | <?php
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class AddZerofillToSettings extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('settings', function (Blueprint $table) {
... | <?php
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class AddZerofillToSettings extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('settings', function (Blueprint $table) {
... |
Fix container list bug when missing image |
def getContainerDetails(container):
ip = 'N/A'
if container.state().network != None and container.state().network.get('eth0') != None:
if len(container.state().network.get('eth0')['addresses']) > 0:
ip = container.state().network['eth0']['addresses'][0].get('address', 'N/A')
image = '... |
def getContainerDetails(container):
ip = 'N/A'
if container.state().network != None and container.state().network.get('eth0') != None:
if len(container.state().network.get('eth0')['addresses']) > 0:
ip = container.state().network['eth0']['addresses'][0].get('address', 'N/A')
return {
... |
Fix space between title and version select | import theme from '../../theme'
export default {
mdContent: {},
content: {
position: 'relative',
},
markdown: {
display: 'block',
},
actions: {
float: 'right',
display: 'flex',
alignItems: 'center',
position: 'relative',
zIndex: 5,
marginLeft: 20
},
action: {
display... | import theme from '../../theme'
export default {
mdContent: {},
content: {
position: 'relative',
},
markdown: {
display: 'block',
},
actions: {
float: 'right',
display: 'flex',
alignItems: 'center',
position: 'relative',
zIndex: 5
},
action: {
display: 'flex',
height... |
Add class name as argument. | <?php
/*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS B... | <?php
/*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS B... |
Change the "user" variable to "doc" | Template.Users.events({
'click [name=add]': function(e, tmpl) {
Router.go('add');
}
});
Template.User.events({
'click .remove': function(e, tmpl) {
if (confirm('Are you sure to remove "' + this.fullName() + '"')) {
Meteor.call('/user/remove', this);
}
}
});
Template.Form.events({
'change i... | Template.Users.events({
'click [name=add]': function(e, tmpl) {
Router.go('add');
}
});
Template.User.events({
'click .remove': function(e, tmpl) {
if (confirm('Are you sure to remove "' + this.fullName() + '"')) {
Meteor.call('/user/remove', this);
}
}
});
Template.Form.events({
'change i... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.