text stringlengths 17 1.47k | positive stringlengths 673 4.43k | negative stringlengths 677 2.81k |
|---|---|---|
Enable external database (non dss) suport for KeyValueStorage |
import pymongo
from .config import config
from .tools import show
client = pymongo.MongoClient()
conf = config['database']
database_name = conf['name']
_db = client[database_name]
class KeyValueStorage(object):
def __init__(self, database_name, db=_db):
self.__dict__['_db'] = db[database_name]
def... |
import pymongo
from .config import config
from .tools import show
client = pymongo.MongoClient()
conf = config['database']
database_name = conf['name']
_db = client[database_name]
class KeyValueStorage(object):
def __init__(self, database_name):
self.__dict__['_db'] = _db[database_name]
def __geta... |
Debug travis to pypi deploy | import amazon
from setuptools import setup, find_packages
import pypandoc
long_description = pypandoc.convert('README.md', 'rst')
setup(name='python-amazon-simple-product-api',
version=amazon.__version__,
description="A simple Python wrapper for the Amazon.com Product Advertising API",
long_descr... | import amazon
from setuptools import setup, find_packages
long_description = pypandoc.convert('README.md', 'rst')
setup(name='python-amazon-simple-product-api',
version=amazon.__version__,
description="A simple Python wrapper for the Amazon.com Product Advertising API",
long_description=long_desc... |
Change empy engine to use Interpreter class. | #!/usr/bin/env python
"""Provide the empy templating engine."""
from __future__ import print_function
import os.path
import em
try:
from StringIO import StringIO
except ImportError:
from io import StringIO
from . import Engine
class SubsystemWrapper(em.Subsystem):
"""Wrap EmPy's Subsystem class.
... | #!/usr/bin/env python
"""Provide the empy templating engine."""
from __future__ import print_function
import os.path
import em
from . import Engine
class SubsystemWrapper(em.Subsystem):
"""Wrap EmPy's Subsystem class.
Allows to open files relative to a base directory.
"""
def __init__(self, bas... |
Allow brunch server to listen on 0.0.0.0 | exports.config = {
npm: {
styles: {
'normalize.css': ['normalize.css']
}
},
conventions: {
ignored: [
/[\\/]_/,
/\.spec\.js$/
]
},
files: {
javascripts: {
joinTo: 'app.js'
},
stylesheets: {
joinTo: 'app.css'
}
},
server: {
hostname: '0.0... | exports.config = {
npm: {
styles: {
'normalize.css': ['normalize.css']
}
},
conventions: {
ignored: [
/[\\/]_/,
/\.spec\.js$/
]
},
files: {
javascripts: {
joinTo: 'app.js'
},
stylesheets: {
joinTo: 'app.css'
}
},
overrides: {
production:... |
Add support for Python 3 | #!/usr/bin/env python
# Original author : Jonathan Zempel, https://github.com/jzempel
# Copied from https://gist.github.com/jzempel/4624227
# Copied here for the purpose of adding it to PyPI
from pkg_resources import parse_version
try:
from xmlrpclib import ServerProxy
except ImportError:
import xmlrpc.client
... | #!/usr/bin/env python
# Original author : Jonathan Zempel, https://github.com/jzempel
# Copied from https://gist.github.com/jzempel/4624227
# Copied here for the purpose of adding it to PyPI
from pkg_resources import parse_version
from xmlrpclib import ServerProxy
pypi = ServerProxy("http://pypi.python.org/pypi")
d... |
Mark error flag if an object is not present on S3 | from selinon import StoragePool
from cucoslib.models import WorkerResult, Analysis
from .base import BaseHandler
class CleanPostgres(BaseHandler):
""" Clean JSONB columns in Postgres """
def execute(self):
s3 = StoragePool.get_connected_storage('S3Data')
results = self.postgres.session.query... | from selinon import StoragePool
from cucoslib.models import WorkerResult, Analysis
from .base import BaseHandler
class CleanPostgres(BaseHandler):
""" Clean JSONB columns in Postgres """
def execute(self):
s3 = StoragePool.get_connected_storage('S3Data')
results = self.postgres.session.query... |
Use GET /me if you want the current user JSON | import logging
from google.appengine.ext import webapp
from google.appengine.ext.webapp import util
from google.appengine.api import users
from django.utils import simplejson
from model import get_current_youtify_user
from model import YoutifyUser
from model import get_youtify_user_by_nick
from model import get_current... | import logging
from google.appengine.ext import webapp
from google.appengine.ext.webapp import util
from google.appengine.api import users
from django.utils import simplejson
from model import get_current_youtify_user
from model import YoutifyUser
from model import get_youtify_user_by_nick
from model import get_current... |
Fix substringing of long breadcrumb items |
var Mocha = require('mocha'),
_ = require('underscore');
module.exports = function (browser, dashboard, suite /*, config*/) {
var tests = {
'has a breadcrumb': function () {
return browser
.$('#global-breadcrumb ol').isDisplayed()
.should.eventually.be.ok
.$('#global-breadcrumb... |
var Mocha = require('mocha'),
_ = require('underscore');
module.exports = function (browser, dashboard, suite /*, config*/) {
var tests = {
'has a breadcrumb': function () {
return browser
.$('#global-breadcrumb ol').isDisplayed()
.should.eventually.be.ok
.$('#global-breadcrumb... |
Implement basic functionality for cache stat monitoring | <?php
class Better_PHP_Cache
{
private $cache_files_dir;
private $monitor_cache_stats;
public function __construct($cache_files_dir, $monitor_cache_stats = TRUE)
{
if($cache_files_dir)
{
if(file_exists($cache_files_dir) && is_writable($cac... | <?php
class Better_PHP_Cache
{
private $cache_files_dir;
public function __construct($cache_files_dir)
{
if($cache_files_dir)
{
if(file_exists($cache_files_dir) && is_writable($cache_files_dir))
{
$this->cache_f... |
Remove type hinting broke by Promises | <?php
namespace Alchemy\expression;
use Exception;
/**
* Represent an UPDATE statment in SQL
*/
class Update extends Query {
protected $table;
protected $values = array();
/**
* Set the table into update
*
* @param Table $table
*/
public function table($table = null) {
... | <?php
namespace Alchemy\expression;
use Exception;
/**
* Represent an UPDATE statment in SQL
*/
class Update extends Query {
protected $table;
protected $values = array();
/**
* Set the table into update
*
* @param Table $table
*/
public function table($table = null) {
... |
Clean up & comment language determination | const i18n = require('i18next')
const _ = require('underscore')
const path = require('path')
module.exports = {
setup(options = {}) {
const subdomainLang = options.subdomainLang || {}
const availableLngs = _.pluck(_.values(subdomainLang), 'lngCode')
i18n.init({
resGetPath: path.resolve(__dirname, ... | const i18n = require('i18next')
const _ = require('underscore')
const path = require('path')
module.exports = {
setup(options = {}) {
const subdomainLang = options.subdomainLang || {}
const availableLngs = _.pluck(_.values(subdomainLang), 'lngCode')
i18n.init({
resGetPath: path.resolve(__dirname, '... |
Fix : range output datas format validation | from .base import Client
class RangeIter(object):
def __init__(self, range_datas):
self._container = range_datas if self._valid_range(range_datas) else None
def _valid_range(self, range_datas):
if (not isinstance(range_datas, (list, tuple)) or
any(not isinstance(pair, (list, tuple... | from .base import Client
class RangeIter(object):
def __init__(self, range_datas):
self._container = range_datas if self._valid_range(range_datas) else None
def _valid_range(self, range_datas):
if (not isinstance(range_datas, tuple) or
any(not isinstance(pair, tuple) for pair in r... |
Use debug module to print sql for debugging purposes | const BaseDataview = require('./base');
const debug = require('debug')('windshaft:dataview:list');
const TYPE = 'list';
const listSqlTpl = ctx => `select ${ctx._columns} from (${ctx._query}) as _cdb_list`;
/**
{
type: 'list',
options: {
columns: ['name', 'description']
}
}
*/
module.exports = cla... | const BaseDataview = require('./base');
const TYPE = 'list';
const listSqlTpl = ctx => `select ${ctx._columns} from (${ctx._query}) as _cdb_list`;
/**
{
type: 'list',
options: {
columns: ['name', 'description']
}
}
*/
module.exports = class List extends BaseDataview{
constructor (query, optio... |
Comment out problematic test for now | from __future__ import absolute_import, division, print_function
import os
import sys
import pytest
from mock import MagicMock
# At the moment it is not possible to have PyQt5 and PyQt4 installed
# simultaneously because one requires the Qt4 libraries while the other
# requires the Qt5 libraries
class TestQT5(obje... | from __future__ import absolute_import, division, print_function
import os
import sys
import pytest
from mock import MagicMock
# At the moment it is not possible to have PyQt5 and PyQt4 installed
# simultaneously because one requires the Qt4 libraries while the other
# requires the Qt5 libraries
class TestQT5(obj... |
Refactor - slightly more elegant way of splitting the template
Splitting the template into the button element and the popup. | /*
* Provide a search widget with a popup to enter and clear search terms.
* Test suite can get a handle on this for clean slate testing.
*/
tsbar.initSearchWidget = function(exports, $) {
function SearchWidget() {
this.$compiledTemplate = $(exports.tswidgets.templates['search.hbs'](Handlebars));
... | /*
* Provide a search widget with a popup to enter and clear search terms.
* Test suite can get a handle on this for clean slate testing.
*/
tsbar.initSearchWidget = function(exports, $) {
function SearchWidget() {
this.$compiledTemplate = $(exports.tswidgets.templates['search.hbs'](Handlebars));
... |
Fix missing username in test | import pytest
import os
import rememberberry
from rememberscript import RememberMachine, FileStorage
from rememberberry.testing import tmp_data_path, assert_replies, get_isolated_story
@pytest.mark.asyncio
@tmp_data_path('/tmp/data/', delete=True)
async def test_anki_account():
storage = FileStorage()
storage[... | import pytest
import os
import rememberberry
from rememberscript import RememberMachine, FileStorage
from rememberberry.testing import tmp_data_path, assert_replies, get_isolated_story
@pytest.mark.asyncio
@tmp_data_path('/tmp/data/', delete=True)
async def test_anki_account():
storage = FileStorage()
m, stora... |
Comment release by default to fix fatal | <?php
return [
/*
* This is your authorization key which you get from your profile.
* @ http://www.larabug.com
*/
'login_key' => env('LB_KEY', 'LB_KEY'),
/*
* This is your project key which you receive when creating a project
* @ http://www.larabug.com/projects
*/
'proje... | <?php
return [
/*
* This is your authorization key which you get from your profile.
* @ http://www.larabug.com
*/
'login_key' => env('LB_KEY', 'LB_KEY'),
/*
* This is your project key which you receive when creating a project
* @ http://www.larabug.com/projects
*/
'proje... |
Improve error description showing class name | <?php
/**
* DronePHP (http://www.dronephp.com)
*
* @link http://github.com/Pleets/DronePHP
* @copyright Copyright (c) 2016 DronePHP. (http://www.dronephp.com)
* @license http://www.dronephp.com/license
*/
namespace Drone\Db;
abstract class Entity
{
/**
* @var string
*/
private $tableNam... | <?php
/**
* DronePHP (http://www.dronephp.com)
*
* @link http://github.com/Pleets/DronePHP
* @copyright Copyright (c) 2016 DronePHP. (http://www.dronephp.com)
* @license http://www.dronephp.com/license
*/
namespace Drone\Db;
abstract class Entity
{
/**
* @var string
*/
private $tableNam... |
Fix except handler raises immediately | import json
from django.core.serializers.base import DeserializationError
from django.core.serializers.json import (
DjangoJSONEncoder, PythonDeserializer, Serializer as JsonSerializer)
from prices import Money
MONEY_TYPE = 'Money'
class Serializer(JsonSerializer):
def _init_options(self):
super()._... | import json
from django.core.serializers.base import DeserializationError
from django.core.serializers.json import (
DjangoJSONEncoder, PythonDeserializer, Serializer as JsonSerializer)
from prices import Money
MONEY_TYPE = 'Money'
class Serializer(JsonSerializer):
def _init_options(self):
super()._... |
Fix performance issue with publishing images | <?php
namespace JonoM\FocusPoint\Extensions;
use JonoM\FocusPoint\Dev\FocusPointMigrationTask;
use JonoM\FocusPoint\FieldType\DBFocusPoint;
use SilverStripe\Assets\Image;
use SilverStripe\Assets\Storage\DBFile;
/**
* FocusPoint Image extension.
* Extends Image to allow automatic cropping from a selected focus poin... | <?php
namespace JonoM\FocusPoint\Extensions;
use JonoM\FocusPoint\Dev\FocusPointMigrationTask;
use JonoM\FocusPoint\FieldType\DBFocusPoint;
use SilverStripe\Assets\Image;
use SilverStripe\Assets\Storage\DBFile;
/**
* FocusPoint Image extension.
* Extends Image to allow automatic cropping from a selected focus poin... |
Implement new version of react-mdl's DataTable including TableHeader component. | import React, { PropTypes } from 'react';
import { Link } from 'react-router';
import { DataTable, TableHeader, FABButton, Icon } from 'react-mdl';
import Pagination from './Pagination';
import './lawList.scss';
const LawList = ({ laws, page, pageSize, selectPage, total }) => {
const rows = laws.map(law => ({...la... | import React, { PropTypes } from 'react';
import { Link } from 'react-router';
import { DataTable, FABButton, Icon } from 'react-mdl';
import Pagination from './Pagination';
import './lawList.scss';
const LawList = ({ laws, page, pageSize, selectPage, total }) => {
const columns = [
{ name: 'groupkey', label: ... |
Make it cleaner to read | /* @flow */
var React = require('react');
var FlexCell: any = require('./FlexCell.react');
var FlexDetail = require('./FlexDetail.react');
class FlexGrid extends React.Component{
state: {detail: string};
render: Function;
constructor(): void {
super();
this.state = {detail:''};
this... | /* @flow */
var React = require('react');
var FlexCell: any = require('./FlexCell.react');
var FlexDetail = require('./FlexDetail.react');
class FlexGrid extends React.Component{
state: {detail: string};
render: Function;
constructor(): void {
super();
this.state = {detail:''};
this... |
Add MIT LICENSE. Fix test dir removing issue - re-raise exception after delete this dir. | #!/usr/bin/env python3
from passwd_change import passwd_change, shadow_change, mails_delete
from unittest import TestCase, TestLoader, TextTestRunner
import os
import subprocess
class PasswdChange_Test(TestCase):
def setUp(self):
"""
Preconditions
"""
subprocess.call(['mkdir', 't... | #!/usr/bin/env python3
from passwd_change import passwd_change, shadow_change, mails_delete
from unittest import TestCase, TestLoader, TextTestRunner
import os
import subprocess
class PasswdChange_Test(TestCase):
def setUp(self):
"""
Preconditions
"""
subprocess.call(['mkdir', 't... |
Change the way gradle detects if task is needed to run | package org.graphwalker.gradle.plugin.task;
import org.gradle.api.Task;
import org.gradle.api.specs.Spec;
import org.gradle.api.tasks.TaskAction;
import java.io.File;
import java.io.IOException;
import java.nio.file.FileVisitResult;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.SimpleFil... | package org.graphwalker.gradle.plugin.task;
import org.gradle.api.Task;
import org.gradle.api.specs.Spec;
import org.gradle.api.tasks.TaskAction;
import java.io.File;
import java.io.IOException;
import java.nio.file.FileVisitResult;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.SimpleFil... |
Rename the class named ArrayHeap to the class named MaxHeap. Simplify __init__ method code to make it readable | # -*- coding:utf-8 -*-
import numpy as np
class MaxHeap(object):
def __init__(self, sz, data):
self.sz = sz
self.heap = [0] * (sz + 1)
self.cnt = len(data)
self.heap[1: self.cnt + 1] = data
self.build_heap()
def build_heap(self):
last_non_leaf = se... | # -*- coding:utf-8 -*-
import numpy as np
class ArrayHeap(object):
def __init__(self, sz, data = None):
self.sz = sz
self.cnt = 0
self.heap = [0 for i in range(sz + 1)]
if data is not None:
for i, val in enumerate(data):
self.heap[i + 1] = val
... |
Fix sorting of rooms in schedule | from django.db.models import Case
from django.db.models import IntegerField
from django.db.models import Value
from django.db.models import When
from django.template import RequestContext
from django.template.response import TemplateResponse
from pyconcz_2016.speakers.models import Speaker, Slot
def speakers_list(re... | from django.db.models import Case
from django.db.models import IntegerField
from django.db.models import Value
from django.db.models import When
from django.template import RequestContext
from django.template.response import TemplateResponse
from pyconcz_2016.speakers.models import Speaker, Slot
def speakers_list(re... |
Add a default template attribute | 'use strict';
/*!
* angular-bootstrap-grid-list-toggle
* https://github.com/seblucas/angular-bootstrap-grid-list-toggle
* Copyright (c) 2015 ; Licensed MIT
*/
angular.module('seblucas.slGridListToggle', [])
.directive('slGridListToggle', function() {
return {
restrict: 'E',
require: '^... | 'use strict';
/*!
* angular-bootstrap-grid-list-toggle
* https://github.com/seblucas/angular-bootstrap-grid-list-toggle
* Copyright (c) 2015 ; Licensed MIT
*/
angular.module('seblucas.slGridListToggle', [])
.directive('slGridListToggle', function() {
return {
restrict: 'E',
require: '^... |
Use instanceof instead of class_basename | <?php
declare(strict_types=1);
namespace Arcanedev\Localization\Middleware;
use Closure;
use Illuminate\Http\Request;
/**
* Class LocaleCookieRedirect
*
* @package Arcanedev\Localization\Middleware
* @author ARCANEDEV <arcanedev.maroc@gmail.com>
*/
class LocaleCookieRedirect extends Middleware
{
/* ... | <?php
declare(strict_types=1);
namespace Arcanedev\Localization\Middleware;
use Closure;
use Illuminate\Http\Request;
/**
* Class LocaleCookieRedirect
*
* @package Arcanedev\Localization\Middleware
* @author ARCANEDEV <arcanedev.maroc@gmail.com>
*/
class LocaleCookieRedirect extends Middleware
{
/* ... |
Use itertools.cycle for repeating digits | import itertools
from .base import Shipper
class FedEx(Shipper):
shipper = 'FedEx'
class FedExExpress(FedEx):
barcode_pattern = r'^\d{34}$'
@property
def tracking_number(self):
return self.barcode[20:].lstrip('0')
@property
def valid_checksum(self):
chars, check_digit = se... | from .base import Shipper
class FedEx(Shipper):
shipper = 'FedEx'
class FedExExpress(FedEx):
barcode_pattern = r'^\d{34}$'
@property
def tracking_number(self):
return self.barcode[20:].lstrip('0')
@property
def valid_checksum(self):
chars, check_digit = self.tracking_number... |
Raise exception on incorrect argument type | from pysteps.cascade import decomposition, bandpass_filters
_cascade_methods = dict()
_cascade_methods['fft'] = decomposition.decomposition_fft
_cascade_methods['gaussian'] = bandpass_filters.filter_gaussian
_cascade_methods['uniform'] = bandpass_filters.filter_uniform
def get_method(name):
"""
Return a call... |
from pysteps.cascade import decomposition, bandpass_filters
_cascade_methods = dict()
_cascade_methods['fft'] = decomposition.decomposition_fft
_cascade_methods['gaussian'] = bandpass_filters.filter_gaussian
_cascade_methods['uniform'] = bandpass_filters.filter_uniform
def get_method(name):
"""
Return a cal... |
Update links when it starts getting redirected | import os
import time
from constants import *
from dbhelper import *
from dbItemManagerV2 import DbItemManagerV2
from link import Link
LINK_EXPIRY_TIME_IN_DAYS = 80
class LinkManager(DbItemManagerV2):
"""
Manage links stored on AWS dynamo db database.
Contains functions for CRUD operations on the links ... | import os
import time
from constants import *
from dbhelper import *
from dbItemManagerV2 import DbItemManagerV2
from link import Link
LINK_EXPIRY_TIME_IN_DAYS = 80
class LinkManager(DbItemManagerV2):
"""
Manage links stored on AWS dynamo db database.
Contains functions for CRUD operations on the links ... |
Allow for modules without exports
They are undefined, so the seen[name] test would previously fail. | var define, requireModule, require, requirejs;
(function() {
var registry = {}, seen = {};
define = function(name, deps, callback) {
registry[name] = { deps: deps, callback: callback };
};
requirejs = require = requireModule = function(name) {
requirejs._eak_seen = registry;
if (seen.hasOwnPropert... | var define, requireModule, require, requirejs;
(function() {
var registry = {}, seen = {};
define = function(name, deps, callback) {
registry[name] = { deps: deps, callback: callback };
};
requirejs = require = requireModule = function(name) {
requirejs._eak_seen = registry;
if (seen[name]) { retu... |
Drop requirement for urllib3 - it is part of requests. | from setuptools import setup, find_packages
setup(
name='ckanext-archiver',
version='0.1',
packages=find_packages(),
install_requires=[
'celery==2.4.2',
'kombu==2.1.3',
'kombu-sqlalchemy==1.1.0',
'SQLAlchemy>=0.6.6',
'requests==1.1.0',
'messytables>=0.1.4... | from setuptools import setup, find_packages
setup(
name='ckanext-archiver',
version='0.1',
packages=find_packages(),
install_requires=[
'celery==2.4.2',
'kombu==2.1.3',
'kombu-sqlalchemy==1.1.0',
'SQLAlchemy>=0.6.6',
'requests==1.1.0',
'messytables>=0.1.4... |
Add pylint to installation requirements | """
Created on 21/03/2012
@author: losa, sortega
"""
import os
from setuptools import setup, find_packages
def find_files(path):
files = []
for dirname, subdirnames, filenames in os.walk(path):
for subdirname in subdirnames:
files.extend(find_files(os.path.join(dirname, subdirname)))
... | """
Created on 21/03/2012
@author: losa, sortega
"""
import os
from setuptools import setup, find_packages
def find_files(path):
files = []
for dirname, subdirnames, filenames in os.walk(path):
for subdirname in subdirnames:
files.extend(find_files(os.path.join(dirname, subdirname)))
... |
Rename visualize to viz in CDF | from geopandas import GeoDataFrame
from ..utils.geom_utils import generate_index, generate_geometry
class CartoDataFrame(GeoDataFrame):
def __init__(self, *args, **kwargs):
super(CartoDataFrame, self).__init__(*args, **kwargs)
@staticmethod
def from_carto(*args, **kwargs):
from ..io.car... | from geopandas import GeoDataFrame
from ..utils.geom_utils import generate_index, generate_geometry
class CartoDataFrame(GeoDataFrame):
def __init__(self, *args, **kwargs):
super(CartoDataFrame, self).__init__(*args, **kwargs)
@staticmethod
def from_carto(*args, **kwargs):
from ..io.car... |
Use base_url to form metrics url
Otherwise this ends up not working in cases where
the notebook is hosted (like JupyterHub) with a
different base_url | define(['jquery', 'base/js/utils'], function ($, utils) {
function createDisplayDiv() {
$('#maintoolbar-container').append(
$('<div>').attr('id', 'nbresuse-display')
.addClass('btn-group')
.addClass('pull-right')
.append(
$(... | define(['jquery'], function ($) {
var displayDiv = null;
function createDisplayDiv() {
$('#maintoolbar-container').append(
$('<div>').attr('id', 'nbresuse-display')
.addClass('btn-group')
.addClass('pull-right')
.append(
... |
Return the module setup/teardown promises. | import { module as qunitModule } from 'qunit';
function beforeEachCallback(callbacks) {
if (typeof callbacks !== 'object') { return; }
if (!callbacks) { return; }
var beforeEach;
if (callbacks.setup) {
beforeEach = callbacks.setup;
delete callbacks.setup;
}
if (callbacks.beforeEach) {
before... | import { module as qunitModule } from 'qunit';
function beforeEachCallback(callbacks) {
if (typeof callbacks !== 'object') { return; }
if (!callbacks) { return; }
var beforeEach;
if (callbacks.setup) {
beforeEach = callbacks.setup;
delete callbacks.setup;
}
if (callbacks.beforeEach) {
befo... |
Support for error and end events | const iterateObject = require("iterate-object")
, typpy = require("typpy")
, mapObject = require("map-o")
;
function prepareData(input) {
iterateObject(input, value => {
if (typpy(value.types, String)) {
value.types = { normal: [value.types] };
} else if (typpy(value.types,... | const iterateObject = require("iterate-object")
, typpy = require("typpy")
, mapObject = require("map-o")
;
function prepareData(input) {
iterateObject(input, value => {
if (typpy(value.types, String)) {
value.types = { normal: [value.types] };
} else if (typpy(value.types,... |
Revert "it's work!!! for tegEnity"
This reverts commit b66c557ffab584ed1f8083857fd67732fce21bc1. | package com.netcracker.students_project.entity;
import javax.persistence.*;
@Entity
@Table(name = "teg", schema = "netcracker", catalog = "nc_student_project")
public class TegEntity {
private int id;
private String text;
@Id
@Column(name = "id", columnDefinition = "serial")
@GeneratedValue(strat... | package com.netcracker.students_project.entity;
import org.hibernate.annotations.Generated;
import org.hibernate.annotations.GenerationTime;
import javax.persistence.*;
@Entity
@Table(name = "teg", schema = "netcracker", catalog = "nc_student_project")
public class TegEntity {
private int id;
private String ... |
Use list comprehensions and consolidate error formatting where error details are either a list or a string. |
from rest_framework import status
from rest_framework.exceptions import APIException, ParseError
def json_api_exception_handler(exc, context):
""" Custom exception handler that returns errors object as an array """
# Import inside method to avoid errors when the OSF is loaded without Django
from rest_fr... |
from rest_framework import status
from rest_framework.exceptions import APIException, ParseError
def json_api_exception_handler(exc, context):
""" Custom exception handler that returns errors object as an array """
# Import inside method to avoid errors when the OSF is loaded without Django
from rest_fr... |
Use same data processing for main and summary charts. | function example () {
var
container = document.getElementById('demo'),
H = Humble.Vis,
E = Flotr.EventAdapter,
data = [],
hash = window.location.hash,
amplitude = (hash ? .05 : .001),
mainOptions = {
height : 200,
width : 600,
data : data,
flotr : {}
}... | function example () {
var
container = document.getElementById('demo'),
H = Humble.Vis,
E = Flotr.EventAdapter,
data = [],
hash = window.location.hash,
amplitude = (hash ? .05 : .001),
mainOptions = {
height : 200,
width : 600,
data : data,
flotr : {}
}... |
Add an exception if ssh not configured | # -*- coding: utf-8 -*-
__author__ = 'John Moylan'
import sys
from paramiko import SSHClient, SSHConfig, AutoAddPolicy
from pyvarnish.settings import SSH_CONFIG
class Varnish_admin():
def __init__(self, server=''):
self.server = server
self.conf = self.config()
def config(self):
s... | # -*- coding: utf-8 -*-
__author__ = 'John Moylan'
from paramiko import SSHClient, SSHConfig, AutoAddPolicy
from pyvarnish.settings import SSH_CONFIG
class Varnish_admin():
def __init__(self, server=''):
self.server = server
self.conf = self.config()
def config(self):
sshconfig = SS... |
Fix tab/space issues and use automatic name wildcard
- Using a regular query search allows ADS to automatically adjust author
name to hit multiple abstracts | #!/usr/bin/python
import sys, os
import ads
from nameparser import HumanName
reload(sys)
sys.setdefaultencoding('utf8')
names_file = open(sys.argv[1])
#Default abstract storage
abstract_directory = "abstracts"
if len(sys.argv) > 2:
abstract_directory = sys.argv[2]
if not os.path.exists(abstract_directory):
... | #!/usr/bin/python
import sys, os
import ads
from nameparser import HumanName
reload(sys)
sys.setdefaultencoding('utf8')
names_file = open(sys.argv[1])
#Default abstract storage
abstract_directory = "abstracts"
if len(sys.argv) > 2:
abstract_directory = sys.argv[2]
if not os.path.exists(abstract_directory):
os.ma... |
Fix mochaRunner:custom task's script and style paths | module.exports = function(grunt) {
grunt.loadNpmTasks('grunt-mocha-test');
grunt.loadNpmTasks('grunt-contrib-jshint');
// Load the plugin's tasks
grunt.loadTasks('tasks');
grunt.initConfig({
jshint: {
options: {jshintrc: '.jshintrc'},
all: ['Gruntfile.js', 'tasks/*.js', 'test/tasks/*.tes... | module.exports = function(grunt) {
grunt.loadNpmTasks('grunt-mocha-test');
grunt.loadNpmTasks('grunt-contrib-jshint');
// Load the plugin's tasks
grunt.loadTasks('tasks');
grunt.initConfig({
jshint: {
options: {jshintrc: '.jshintrc'},
all: ['Gruntfile.js', 'tasks/*.js', 'test/tasks/*.tes... |
Add a little function to make it easier to create users on-the-fly via NIS | from django.conf import settings
from django.contrib.auth.models import User, check_password
import crypt
import nis
class NISBackend:
"""
Authenticate against a user on an NIS server.
"""
def authenticate(self, username, password):
user = None
try:
passwd = nis.match(user... | from django.conf import settings
from django.contrib.auth.models import User, check_password
import crypt
import nis
class NISBackend:
"""
Authenticate against a user on an NIS server.
"""
def authenticate(self, username, password):
user = None
try:
passwd = nis.match(user... |
[FIX] Define UTC as tz in get_working_days_of_date method | # -*- coding: utf-8 -*-
# See README.rst file on addon root folder for license details
from openerp import models, api
from datetime import datetime, timedelta
class ResourceCalendar(models.Model):
_inherit = 'resource.calendar'
@api.v7
def get_working_days_of_date(self, cr, uid, id, start_dt=None, end_... | # -*- coding: utf-8 -*-
# See README.rst file on addon root folder for license details
from openerp import models, api
from datetime import datetime, timedelta
class ResourceCalendar(models.Model):
_inherit = 'resource.calendar'
@api.v7
def get_working_days_of_date(self, cr, uid, id, start_dt=None, end_... |
Use clone() method from BaseModel to copy most recent fileversion |
def copy_files(src, target_node, parent=None, name=None):
"""Copy the files from src to the target node
:param Folder src: The source to copy children from
:param Node target_node: The node to copy files to
:param Folder parent: The parent of to attach the clone of src to, if applicable
"""
ass... | from osf.models.base import generate_object_id
def copy_files(src, target_node, parent=None, name=None):
"""Copy the files from src to the target node
:param Folder src: The source to copy children from
:param Node target_node: The node to copy files to
:param Folder parent: The parent of to attach th... |
Use a data-provider for tests. | <?php
namespace Tests;
use Dyrynda\Database\Support\GeneratesUuid;
use PHPUnit_Framework_TestCase;
class UuidResolversTest extends PHPUnit_Framework_TestCase
{
/**
* @var \PHPUnit_Framework_MockObject_MockObject|\Dyrynda\Database\Support\GeneratesUuid
*/
protected $generator;
public function s... | <?php
namespace Tests;
use PHPUnit_Framework_TestCase;
use ReflectionClass;
class UuidResolversTest extends PHPUnit_Framework_TestCase
{
/**
* @var \PHPUnit_Framework_MockObject_MockObject|\Dyrynda\Database\Support\GeneratesUuid
*/
protected $generator;
public function setUp()
{
$t... |
Fix for randomly failing Welcome page tests
Change-Id: Icfa3aefc8753a3300b6e8e17850685a59bee1c0a | /*
* Copyright 2015 Mirantis, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may
* not use this file except in compliance with the License. You may obtain
* a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed ... | /*
* Copyright 2015 Mirantis, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may
* not use this file except in compliance with the License. You may obtain
* a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed ... |
Add cleaner error messages for single-string options | var request = require('request');
var Promise = require('bluebird');
var _ = require('lodash');
var internals = {
convertJSONSafe: function(s){
if(s && (typeof s === 'string')) {
try{
return JSON.parse(s);
} catch(e){
return s;
}
} else {
return s;
}
}
};
module... | var request = require('request');
var Promise = require('bluebird');
var _ = require('lodash');
var internals = {
convertJSONSafe: function(s){
if(s && (typeof s === 'string')) {
try{
return JSON.parse(s);
} catch(e){
return s;
}
} else {
return s;
}
}
};
module... |
Add simple check to throw error if permissions exists | <?php
/**
* Created by PhpStorm.
* User: sonja
* Date: 1/26/18
* Time: 10:30 AM
*/
namespace AppBundle\API\Sharing;
use AppBundle\Entity\FennecUser;
use AppBundle\Entity\Permissions;
use AppBundle\Entity\WebuserData;
use AppBundle\Service\DBVersion;
class Projects
{
private $manager;
const ERROR_NOT_L... | <?php
/**
* Created by PhpStorm.
* User: sonja
* Date: 1/26/18
* Time: 10:30 AM
*/
namespace AppBundle\API\Sharing;
use AppBundle\Entity\FennecUser;
use AppBundle\Entity\Permissions;
use AppBundle\Entity\WebuserData;
use AppBundle\Service\DBVersion;
class Projects
{
private $manager;
const ERROR_NOT_L... |
Fix lexer test error message | <?php
namespace igorw\edn;
class LexerTest extends \PHPUnit_Framework_TestCase {
/**
* @test
* @dataProvider provideInvalidEdn
* @expectedException Phlexy\LexingException
*/
function parseShouldRejectInvalidSyntax($edn) {
$data = tokenize($edn);
$this->fail(sprintf('Expect... | <?php
namespace igorw\edn;
class LexerTest extends \PHPUnit_Framework_TestCase {
/**
* @test
* @dataProvider provideInvalidEdn
* @expectedException Phlexy\LexingException
*/
function parseShouldRejectInvalidSyntax($edn) {
$data = tokenize($edn);
$this->fail(sprintf('Expect... |
Clean unused default values for properties | <?php
/*
* Go! AOP framework
*
* @copyright Copyright 2013, Lisachenko Alexander <lisachenko.it@gmail.com>
*
* This source file is subject to the license that is bundled
* with this source code in the file LICENSE.
*/
namespace Go\Aop\Framework;
use Go\Aop\IntroductionInfo;
/**
* Advice for introduction that... | <?php
/*
* Go! AOP framework
*
* @copyright Copyright 2013, Lisachenko Alexander <lisachenko.it@gmail.com>
*
* This source file is subject to the license that is bundled
* with this source code in the file LICENSE.
*/
namespace Go\Aop\Framework;
use Go\Aop\IntroductionInfo;
/**
* Advice for introduction that... |
Make sure adapter is created correctly | <?php declare(strict_types=1);
namespace Imbo\Behat;
use Imbo\EventListener\ImageVariations;
use Imbo\EventListener\ImageVariations\Database\MongoDB;
use Imbo\EventListener\ImageVariations\Storage\GridFS;
/**
* Enable the image variations event listener
*/
return [
'eventListeners' => [
'imageVariations... | <?php declare(strict_types=1);
namespace Imbo\Behat;
use Imbo\EventListener\ImageVariations;
use Imbo\EventListener\ImageVariations\Database\MongoDB;
use Imbo\EventListener\ImageVariations\Storage\GridFS;
/**
* Enable the image variations event listener
*/
return [
'eventListeners' => [
'imageVariations... |
Update function name used in the streamtester | """
This file defines a general method for evaluating ftfy using data that arrives
in a stream. A concrete implementation of it is found in `twitter_tester.py`.
"""
from __future__ import print_function, unicode_literals
from ftfy.fixes import fix_encoding
from ftfy.chardata import possible_encoding
class StreamTeste... | """
This file defines a general method for evaluating ftfy using data that arrives
in a stream. A concrete implementation of it is found in `twitter_tester.py`.
"""
from __future__ import print_function, unicode_literals
from ftfy.fixes import fix_text_encoding
from ftfy.chardata import possible_encoding
class Stream... |
Fix some bugs and better blueprint view | @extends('layouts.user.main')
@section('title')
{{trans('layout.zagros')}}::{{trans('layout.projects')}}
@stop
@section('projects-navbar')active @stop
@section('content')
<div class="col-md-6 col-md-offset-3">
<h2 class="text-center">Projects</h2>
@if (Session::has('message'))
<p ... | @extends('layouts.user.main')
@section('title')
{{trans('layout.zagros')}}::{{trans('layout.prjs')}}
@stop
@section('projects-navbar')active @stop
@section('content')
<div class="col-md-6 col-md-offset-3">
<h2 class="text-center">Projects</h2>
@if (Session::has('message'))
<p clas... |
BAP-3724: Add email owners to search index
- Fix cs | <?php
namespace Oro\Bundle\EmailBundle\EventListener;
use Symfony\Component\Security\Core\User\UserInterface;
use Oro\Bundle\SearchBundle\Event\PrepareEntityMapEvent;
use Oro\Bundle\EmailBundle\Entity\Email;
use Oro\Bundle\EmailBundle\Entity\EmailRecipient;
use Oro\Bundle\OrganizationBundle\Entity\OrganizationAwareI... | <?php
namespace Oro\Bundle\EmailBundle\EventListener;
use Symfony\Component\Security\Core\User\UserInterface;
use Oro\Bundle\SearchBundle\Event\PrepareEntityMapEvent;
use Oro\Bundle\EmailBundle\Entity\Email;
use Oro\Bundle\EmailBundle\Entity\EmailRecipient;
use Oro\Bundle\OrganizationBundle\Entity\OrganizationAwareI... |
fix(props): Convert GroupedActivityFeed length to number in jsx | const React = require("react");
const {connect} = require("react-redux");
const {GroupedActivityFeed} = require("components/ActivityFeed/ActivityFeed");
const Spotlight = require("components/Spotlight/Spotlight");
const TimelinePage = React.createClass({
render() {
const props = this.props;
const navItems =... | const React = require("react");
const {connect} = require("react-redux");
const {GroupedActivityFeed} = require("components/ActivityFeed/ActivityFeed");
const Spotlight = require("components/Spotlight/Spotlight");
const TimelinePage = React.createClass({
render() {
const props = this.props;
const navItems =... |
Make it not expect json | $( document ).ready( function() {
function showUploadedImage( source ) {
$( "#userImage" ).attr( "src", source );
}
$( "#image-form" ).submit( function() {
var image = document.getElementById( "image" ).files[ 0 ];
var token = $( "input[type=hidden]" ).val();
var formdata = n... | $( document ).ready( function() {
function showUploadedImage( source ) {
$( "#userImage" ).attr( "src", source );
}
$( "#image-form" ).submit( function() {
var image = document.getElementById( "image" ).files[ 0 ];
var token = $( "input[type=hidden]" ).val();
var formdata = n... |
Add a TODO for ascii filter | var core = require('../../core');
// TODO (cengler) - The Y is flipped in this shader for some reason.
/**
* @author Vico @vicocotea
* original shader : https://www.shadertoy.com/view/lssGDj by @movAX13h
*/
/**
* An ASCII filter.
*
* @class
* @extends AbstractFilter
* @namespace PIXI.filters
*/
function Asc... | var core = require('../../core');
/**
* @author Vico @vicocotea
* original shader : https://www.shadertoy.com/view/lssGDj by @movAX13h
*/
/**
* An ASCII filter.
*
* @class
* @extends AbstractFilter
* @namespace PIXI.filters
*/
function AsciiFilter()
{
core.AbstractFilter.call(this,
// vertex shad... |
Fix indices with multiple key hits in same file. | package com.jetbrains.python.psi.search;
import com.intellij.openapi.project.Project;
import com.intellij.psi.search.ProjectScope;
import com.intellij.psi.stubs.StubIndex;
import com.intellij.util.Processor;
import com.intellij.util.QueryExecutor;
import com.jetbrains.python.psi.PyClass;
import com.jetbrains.python.ps... | package com.jetbrains.python.psi.search;
import com.intellij.openapi.project.Project;
import com.intellij.psi.search.ProjectScope;
import com.intellij.psi.stubs.StubIndex;
import com.intellij.util.Processor;
import com.intellij.util.QueryExecutor;
import com.jetbrains.python.psi.PyClass;
import com.jetbrains.python.ps... |
Fix crash tasks with unicode string name (like name: héhé). | class Formatter(object):
def format(self, match):
formatstr = u"[{0}] {1}\n{2}:{3}\n{4}\n"
return formatstr.format(match.rule.id,
match.message,
match.filename,
match.linenumber,
... | class Formatter(object):
def format(self, match):
formatstr = "[{0}] {1}\n{2}:{3}\n{4}\n"
return formatstr.format(match.rule.id,
match.message,
match.filename,
match.linenumber,
... |
Use dimension shape instead of coordinate system type | define(function (require) {
return function (seriesType, ecModel) {
ecModel.eachSeriesByType(seriesType, function (seriesModel) {
var data = seriesModel.getData();
var coordSys = seriesModel.coordinateSystem;
if (coordSys) {
var dims = coordSys.dimension... | define(function (require) {
return function (seriesType, ecModel) {
ecModel.eachSeriesByType(seriesType, function (seriesModel) {
var data = seriesModel.getData();
var coordSys = seriesModel.coordinateSystem;
if (coordSys) {
var dims = coordSys.dimension... |
Fix calling to wrong Utility class | <?php
/**
* @file
*
* @package In2pire
* @subpackage Cli
* @author Nhat Tran <nhat.tran@inspire.vn>
*/
namespace In2pire\Cli\Question;
use In2pire\Component\Utility\String;
final class Container
{
public static function create($question, $command)
{
static $cache = [];
$cacheKey = $que... | <?php
/**
* @file
*
* @package In2pire
* @subpackage Cli
* @author Nhat Tran <nhat.tran@inspire.vn>
*/
namespace In2pire\Cli\Question;
use In2pire\Component\Utility\String;
final class Container
{
public static function create($question, $command)
{
static $cache = [];
$cacheKey = $que... |
Add priority option to send_queued | __version__ = '2.0.0'
def get_account(using=None):
from django.conf import settings
accounts = settings.SMSGATEWAY_ACCOUNTS
if using is not None:
return accounts[using]
else:
return accounts[accounts['__default__']]
def send(to, msg, signature, using=None, reliable=False):
"""
... | __version__ = '2.0.0'
def get_account(using=None):
from django.conf import settings
accounts = settings.SMSGATEWAY_ACCOUNTS
if using is not None:
return accounts[using]
else:
return accounts[accounts['__default__']]
def send(to, msg, signature, using=None, reliable=False):
"""
... |
Change method data to view | <?php
namespace Hook;
class Navigation
{
public function view($data)
{
return [
'nav' => [
[
[
'url'=>'user/signin',
'img'=>'user48.png',
... | <?php
namespace Hook;
class Navigation
{
public function data($data)
{
return [
'nav' => [
[
[
'url'=>'user/signin',
'img'=>'user48.png',
... |
ENH: Make ID3Lab allow attr to be pluggable | import IPython
import ts_charting.lab.lab as tslab
import ipycli.standalone as sa
from workbench import sharedx
class ID3Lab(tslab.Lab):
_html_obj = None
def __init__(self, draw=False, html_obj=None):
super(ID3Lab, self).__init__(draw=draw)
if html_obj is None:
html_obj = sharedx
... | import IPython
import ts_charting.lab.lab as tslab
import ipycli.standalone as sa
from workbench import sharedx
class ID3Lab(tslab.Lab):
def get_varname(self):
"""
Try to get the variable that this lab is
bound to in the IPython kernel
"""
inst = IPython.InteractiveShell._... |
Rename method and param to better describe what is happening | <?php
namespace Lily\Test\Usage;
use Symfony\Component\DomCrawler\Crawler;
use Lily\Application\MiddlewareApplication;
use Lily\Application\RoutedApplication;
use Lily\Util\Request;
use Lily\Util\Response;
class DescribeTestingTest extends \PHPUnit_Framework_TestCase
{
private function applicationToTest()
... | <?php
namespace Lily\Test\Usage;
use Symfony\Component\DomCrawler\Crawler;
use Lily\Application\MiddlewareApplication;
use Lily\Application\RoutedApplication;
use Lily\Util\Request;
use Lily\Util\Response;
class DescribeTestingTest extends \PHPUnit_Framework_TestCase
{
private function applicationToTest()
... |
Fix errors in set_welcome and update for http_client | from http_client import HttpClient
class Bot():
"""
@brief Facebook messenger bot
"""
def __init__(self, token):
self.api_token = token
self.client = HttpClient(token)
def send_message(self, message, completion):
def _completion(response, error):
print error
... | from http_client import HttpClient
class Bot():
"""
@brief Facebook messenger bot
"""
def __init__(self, token):
self.api_token = token
self.client = HttpClient()
def send_message(self, message, completion):
def _completion(response, error):
print error
... |
Add option for launching server
There was no option to start the server and you had to do it manually.
Now it can be started with:
1) -s with default configuration
2) --server <PORT> for manual port choice | import argparse
"""
usage: mfh.py [-h] [-c | --client [PORT]] [-u] [-v]
Serve some sweet honey to the ubiquitous bots!
optional arguments:
-h, --help show this help message and exit
-c launch client with on port defined in settings
--client [PORT] port to start a client on
-u, --updater ... | import argparse
"""
usage: mfh.py [-h] [-c | --client [PORT]] [-u] [-v]
Serve some sweet honey to the ubiquitous bots!
optional arguments:
-h, --help show this help message and exit
-c launch client with on port defined in settings
--client [PORT] port to start a client on
-u, --updater ... |
Adjust cURL headers to avoid certain bot-blockers | <?php
namespace Craft;
use Guzzle\Http\Client;
class VzUrl_ValidationService extends BaseApplicationComponent
{
public function check($url)
{
if (empty($url)) {
return false;
}
// Store the original, so we can pass it back in the response
$originalUrl = $url;
... | <?php
namespace Craft;
use Guzzle\Http\Client;
class VzUrl_ValidationService extends BaseApplicationComponent
{
public function check($url)
{
if (empty($url)) {
return false;
}
// Store the original, so we can pass it back in the response
$originalUrl = $url;
... |
Change import order to satisfy pylint. | """Tests for crabigator.wanikani."""
from __future__ import print_function
import os
from unittest import TestCase
from crabigator.wanikani import WaniKani, WaniKaniError
# TestCase exposes too many public methods. Disable the pylint warning for it.
# pylint: disable=too-many-public-methods
class TestWaniKani(TestC... | """Tests for crabigator.wanikani."""
from __future__ import print_function
from crabigator.wanikani import WaniKani, WaniKaniError
import os
from unittest import TestCase
# TestCase exposes too many public methods. Disable the pylint warning for it.
# pylint: disable=too-many-public-methods
class TestWaniKani(TestCa... |
Add one more component test | <?php
namespace Xu\Tests\Foundation;
use Xu\Foundation\Foundation;
class Foundation_Test extends \WP_UnitTestCase {
public function test_component() {
$this->assertTrue( xu( '' ) instanceof Foundation );
$this->assertEquals( Foundation::VERSION, xu( 'xu' )->version() );
}
public functio... | <?php
namespace Xu\Tests\Foundation;
use Xu\Foundation\Foundation;
class Foundation_Test extends \WP_UnitTestCase {
public function test_component() {
$this->assertTrue( xu( '' ) instanceof Foundation );
$this->assertEquals( Foundation::VERSION, xu( 'xu' )->version() );
}
public functio... |
Mark runserver as a plumbing command | """Command-line utilities for HTTP service subsystem."""
import werkzeug.debug
import werkzeug.serving
from jacquard.commands import BaseCommand
from jacquard.service import get_wsgi_app
class RunServer(BaseCommand):
"""
Run a debug server.
**This is for debug, local use only, not production.**
Th... | """Command-line utilities for HTTP service subsystem."""
import werkzeug.debug
import werkzeug.serving
from jacquard.commands import BaseCommand
from jacquard.service import get_wsgi_app
class RunServer(BaseCommand):
"""
Run a debug server.
**This is for debug, local use only, not production.**
Th... |
Fix Google Authenticator unit test | <?php
/*
* This file is part of the Sonata package.
*
* (c) Thomas Rabaix <thomas.rabaix@sonata-project.org>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Sonata\Bundle\QABundle\Tests;
class SonataUserTwoStepVerifica... | <?php
/*
* This file is part of the Sonata package.
*
* (c) Thomas Rabaix <thomas.rabaix@sonata-project.org>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Sonata\Bundle\QABundle\Tests;
class SonataUserTwoStepVerifica... |
Remove console logs from files... | angular.module('events.events.filter', [])
.filter('showEvents', function () {
return function (events, filter) {
var result = [];
function filterIsSet () {
return typeof filter !== 'undefined' && (typeof filter.topics !== 'undefined' || typeof filter.searchText !== 'undefined');
}
... | angular.module('events.events.filter', [])
.filter('showEvents', function () {
return function (events, filter) {
var result = [];
function filterIsSet () {
return typeof filter !== 'undefined' && (typeof filter.topics !== 'undefined' || typeof filter.searchText !== 'undefined');
}
... |
Change name of module made by cython to rk4cython to test. | from distutils.core import setup
from distutils.extension import Extension
from Cython.Distutils import build_ext
import numpy
import configuration
ext_modules = [Extension("sourceterm.srccython", ["sourceterm/srccython.pyx"],
extra_compile_args=["-g"],
extra_link_args=["-g"],
... | from distutils.core import setup
from distutils.extension import Extension
from Cython.Distutils import build_ext
import numpy
import configuration
ext_modules = [Extension("sourceterm.srccython", ["sourceterm/srccython.pyx"],
extra_compile_args=["-g"],
extra_link_args=["-g"],
... |
Remove string replace in favor of sprintf | <?php
class Philwinkle_Fixerio_Model_Import extends Mage_Directory_Model_Currency_Import_Abstract
{
protected $_url = 'http://api.fixer.io/latest?base=%1$s&symbols=%2$s';
protected $_messages = array();
/**
* HTTP client
*
* @var Varien_Http_Client
*/
protected $_httpClient;
pub... | <?php
class Philwinkle_Fixerio_Model_Import extends Mage_Directory_Model_Currency_Import_Abstract
{
protected $_url = 'http://api.fixer.io/latest?base={{CURRENCY_FROM}}&symbols={{CURRENCY_TO}}';
protected $_messages = array();
/**
* HTTP client
*
* @var Varien_Http_Client
*/
protect... |
Fix position of curly brace | package annotations.util;
/*>>>
import org.checkerframework.checker.nullness.qual.*;
*/
/**
* {@link Strings} provides useful static methods related to strings.
*/
public abstract class Strings {
private Strings() {}
/**
* Returns the given string, escaped and quoted according to Java
* conventio... | package annotations.util;
/*>>>
import org.checkerframework.checker.nullness.qual.*;
*/
/**
* {@link Strings} provides useful static methods related to strings.
*/
public abstract class Strings {
private Strings() {}
/**
* Returns the given string, escaped and quoted according to Java
* conventio... |
Fix checking for posting providers. | <?php
namespace Borfast\Socializr;
class Socializr
{
protected $config = array();
protected $login_providers = array('Google', 'Facebook');
protected $posting_providers = array('Twitter', 'Facebook');
public function __construct($config)
{
$this->config = $config;
}
/**
* P... | <?php
namespace Borfast\Socializr;
class Socializr
{
protected $config = array();
protected $login_providers = array('Google', 'Facebook');
protected $posting_providers = array('Twitter', 'Facebook');
public function __construct($config)
{
$this->config = $config;
}
/**
* P... |
Remove id attribute from input fix | <?php
namespace Banklink\Request;
/**
* Generic request representation
*
* @author Roman Marintsenko <inoryy@gmail.com>
* @since 31.10.2012
*/
abstract class Request
{
protected $requestUrl;
protected $requestData = array();
/**
* @param string $requestUrl
* @param array $requestData
... | <?php
namespace Banklink\Request;
/**
* Generic request representation
*
* @author Roman Marintsenko <inoryy@gmail.com>
* @since 31.10.2012
*/
abstract class Request
{
protected $requestUrl;
protected $requestData = array();
/**
* @param string $requestUrl
* @param array $requestData
... |
Add DOB field to User entity (JANUS-40)
* Fix DOB form definition. | <?php
namespace Ice\ExternalUserBundle\Form\Type;
use FOS\UserBundle\Form\Type\RegistrationFormType as BaseType;
use Symfony\Component\Form\FormBuilderInterface,
Symfony\Component\OptionsResolver\OptionsResolverInterface;
class UpdateFormType extends BaseType
{
public function buildForm(FormBuilderInterface... | <?php
namespace Ice\ExternalUserBundle\Form\Type;
use FOS\UserBundle\Form\Type\RegistrationFormType as BaseType;
use Symfony\Component\Form\FormBuilderInterface,
Symfony\Component\OptionsResolver\OptionsResolverInterface;
class UpdateFormType extends BaseType
{
public function buildForm(FormBuilderInterface... |
Revert "fix scroll low framerate"
This reverts commit 1ad82adaec7893b2478dd75de4d5a171ea58a015. | 'use strict';
$(function () {
// Handler for .ready() called.
$('[data-scrollToLink]').each(function (i, l) {
var $link = $(l);
$link.on('click', function () {
$('body').scrollTo('#' + $link.attr('data-scrollToLink'), 500, {offset: {top: -50} });
});
});
$("#owl-exam... | 'use strict';
$(function () {
// Handler for .ready() called.
$('[data-scrollToLink]').each(function (i, l) {
var $link = $(l);
$link.on('click', function () {
$('body').scrollTo('#' + $link.attr('data-scrollToLink'), 500, {offset: {top: -50} });
});
});
$(window).on... |
Update line by default, compute x1 and x2. | ;(function() {
var isInited = false;
var marker = null;
SVG.extend(SVG.Element, {
connectable: function(options, elmTarget) {
if (elmTarget === undefined) {
elmTarget = options;
options = {};
}
var elmSource = this;
v... | ;(function() {
var isInited = false;
var marker = null;
SVG.extend(SVG.Element, {
connectable: function(options, elmTarget) {
if (elmTarget === undefined) {
elmTarget = options;
options = {};
}
var elmSource = this;
v... |
Put a ref for item editor. | import { Component } from 'substance'
import CardComponent from '../shared/CardComponent'
export default class CollectionEditor extends Component {
getActionHandlers () {
return {
'remove-item': this._removeCollectionItem
}
}
render ($$) {
const model = this.props.model
let items = model.g... | import { Component } from 'substance'
import CardComponent from '../shared/CardComponent'
export default class CollectionEditor extends Component {
getActionHandlers () {
return {
'remove-item': this._removeCollectionItem
}
}
render ($$) {
const model = this.props.model
let items = model.g... |
Use HTTPS for JCenter repository | package com.kantenkugel.discordbot.versioncheck;
import org.apache.commons.lang3.tuple.Pair;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
public enum RepoType
{
JCENTER("https://jcenter.bintray.com/", Pair.of("jcenter()", null), "bintray"),
MAVENCENTRAL("https://repo.maven.ap... | package com.kantenkugel.discordbot.versioncheck;
import org.apache.commons.lang3.tuple.Pair;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
public enum RepoType
{
JCENTER("http://jcenter.bintray.com/", Pair.of("jcenter()", null), "bintray"),
MAVENCENTRAL("https://repo.maven.apa... |
Add title bar event listener | const settings = require('electron-settings')
var alpha = document.getElementById('alpha');
var remote = require('electron').remote;
// Listen for checkbox click
alpha.addEventListener('click', function(event) {
if (event.target.type === 'checkbox') {
if (event.target.parentElement.classList.contai... | const settings = require('electron-settings')
var alpha = document.getElementById('alpha');
// Listen for checkbox click
alpha.addEventListener('click', function(event) {
if (event.target.type === 'checkbox') {
if (event.target.parentElement.classList.contains('beta')) {
handleSelection(... |
Test port config definition for hapi-auth-hawk | /**
* Created by Omnius on 6/15/16.
*/
'use strict';
const Boom = require('boom');
exports.register = (server, options, next) => {
server.auth.strategy('hawk-login-auth-strategy', 'hawk', {
getCredentialsFunc: (sessionId, callback) => {
const redis = server.app.redis;
const met... | /**
* Created by Omnius on 6/15/16.
*/
'use strict';
const Boom = require('boom');
exports.register = (server, options, next) => {
server.auth.strategy('hawk-login-auth-strategy', 'hawk', {
getCredentialsFunc: (sessionId, callback) => {
const redis = server.app.redis;
const met... |
[Glitch] Fix crash if a notification contains an unprocessed media attachment
Port 0c24c865b785a557f43125c976090e271247a2b1 to glitch-soc
Signed-off-by: Claire <82b964c50e9d1d222e48cf5046e6484a966a7b07@sitedethib.com> | import React from 'react';
import ImmutablePropTypes from 'react-immutable-proptypes';
import PropTypes from 'prop-types';
import ImmutablePureComponent from 'react-immutable-pure-component';
import { FormattedMessage } from 'react-intl';
import classNames from 'classnames';
import Icon from 'flavours/glitch/components... | import React from 'react';
import ImmutablePropTypes from 'react-immutable-proptypes';
import PropTypes from 'prop-types';
import ImmutablePureComponent from 'react-immutable-pure-component';
import Icon from 'flavours/glitch/components/icon';
const filename = url => url.split('/').pop().split('#')[0].split('?')[0];
... |
Fix issue where PHP would try to escape slashes in a string in json_encode | <?php
class FacebookJS {
private $_initOptions = array(
"status" => true,
"cookie" => true,
"oauth" => true,
"xfbml" => true
);
public function setAppId($appId){
if (!is_null($appId)){
$this->_initOptions["appid"] = $appId;
}
}
pub... | <?php
class FacebookJS {
private $_initOptions = array(
"status" => true,
"cookie" => true,
"oauth" => true,
"xfbml" => true
);
public function setAppId($appId){
if (!is_null($appId)){
$this->_initOptions["appid"] = $appId;
}
}
pub... |
Fix to work with Hive13
Reviewers: jeff, JamesGreenhill
Reviewed By: JamesGreenhill
Differential Revision: http://phabricator.local.disqus.net/D13528 | package org.openx.data.jsonserde.objectinspector.primitive;
import org.apache.hadoop.hive.serde2.objectinspector.primitive.AbstractPrimitiveJavaObjectInspector;
import org.apache.hadoop.hive.serde2.objectinspector.primitive.PrimitiveObjectInspectorUtils;
import org.apache.hadoop.hive.serde2.objectinspector.primitive.S... | package org.openx.data.jsonserde.objectinspector.primitive;
import org.apache.hadoop.hive.serde2.objectinspector.primitive.AbstractPrimitiveJavaObjectInspector;
import org.apache.hadoop.hive.serde2.objectinspector.primitive.PrimitiveObjectInspectorUtils;
import org.apache.hadoop.hive.serde2.objectinspector.primitive.S... |
Use wrapped object for presenter | <?php
namespace Lio\Forum\Replies;
use Input;
use McCool\LaravelAutoPresenter\BasePresenter;
use Misd\Linkify\Linkify;
use Request;
class ReplyPresenter extends BasePresenter
{
public function url()
{
$slug = $this->getWrappedObject()->thread->slug;
$threadUrl = action('Forum\ForumThreadsContr... | <?php
namespace Lio\Forum\Replies;
use App;
use Input;
use McCool\LaravelAutoPresenter\BasePresenter;
use Request;
class ReplyPresenter extends BasePresenter
{
public function url()
{
$slug = $this->thread->slug;
$threadUrl = action('Forum\ForumThreadsController@getShowThread', [$slug]);
... |
Add 'One For All' Queue Id (Valorant) | package no.stelar7.api.r4j.basic.constants.types.val;
import no.stelar7.api.r4j.basic.constants.types.CodedEnum;
import java.util.Optional;
import java.util.stream.Stream;
public enum GameQueueType implements CodedEnum<GameQueueType>
{
COMPETITIVE("competitive"),
DEATHMATCH("deathmatch"),
SPIKE_RUSH... | package no.stelar7.api.r4j.basic.constants.types.val;
import no.stelar7.api.r4j.basic.constants.types.CodedEnum;
import java.util.Optional;
import java.util.stream.Stream;
public enum GameQueueType implements CodedEnum<GameQueueType>
{
COMPETITIVE("competitive"),
DEATHMATCH("deathmatch"),
SPIKE_RUSH... |
Add chalk to file to copie | module.exports = function(grunt) {
var config = {
copy: {
src: {
files: [{
expand: true,
src: [
'node_modules/socket.io/**/*',
'node_modules/fast-http/**/*',
'node_modules/opn/**/*',
'node_modules/chalk/**/*',
'*.html',... | module.exports = function(grunt) {
var config = {
copy: {
src: {
files: [{
expand: true,
src: [
'node_modules/socket.io/**/*',
'node_modules/fast-http/**/*',
'node_modules/opn/**/*',
'*.html',
'source/',
've... |
Fix bug with automatic date transformations | /**
* convert json dates to date objects
* for all requests using the $http service
*
* @return callback for app.config()
*/
define([], function () {
'use strict';
var regexIso8601 = /^(\d{4}|\+\d{6})(?:-(\d{2})(?:-(\d{2})(?:T(\d{2}):(\d{2}):(\d{2})\.(\d{1,})(Z|([\-+])(\d{2}):(\d{2}))?)?)?)?$/;
functio... | /**
* convert json dates to date objects
* for all requests using the $http service
*
* @return callback for app.config()
*/
define([], function () {
'use strict';
var regexIso8601 = /^(\d{4}|\+\d{6})(?:-(\d{2})(?:-(\d{2})(?:T(\d{2}):(\d{2}):(\d{2})\.(\d{1,})(Z|([\-+])(\d{2}):(\d{2}))?)?)?)?$/;
functio... |
Allow runtime toggling of mocks | var config = require('../lib/config'),
cors = require('../lib/cors'),
fs = require('fs');
var paths = [],
len = 0;
exports.init = function() {
if (config.mocksEnabled) {
console.log("Mock server enabled");
}
var pathSource = require('./paths');
for (var name in pathSource) {
paths.push({... | var config = require('../lib/config'),
cors = require('../lib/cors'),
fs = require('fs');
var paths = [],
len = 0;
exports.init = function() {
if (config.mocksEnabled) {
console.log("Mock server enabled");
var pathSource = require('./paths');
for (var name in pathSource) {
... |
Add filter by state (SAAS-635) | 'use strict';
(function() {
angular.module('ncsaas')
.service('customersService', ['baseServiceClass', '$q', 'agreementsService', customersService]);
function customersService(baseServiceClass, $q, agreementsService) {
var ServiceClass = baseServiceClass.extend({
filterByCustomer: false,
init... | 'use strict';
(function() {
angular.module('ncsaas')
.service('customersService', ['baseServiceClass', '$q', 'agreementsService', customersService]);
function customersService(baseServiceClass, $q, agreementsService) {
var ServiceClass = baseServiceClass.extend({
filterByCustomer: false,
init... |
Add try accept block for bs4 features | from ..darkobject import DarkObject
from bs4 import BeautifulSoup
import requests
import logging
import time
import bs4
class Scrubber(DarkObject):
def __init__(self):
super(Scrubber, self).__init__()
def scrub(self):
"""
Get item metadata.
"""
return {}
# noinspe... | from ..darkobject import DarkObject
from bs4 import BeautifulSoup
import requests
import logging
import time
class Scrubber(DarkObject):
def __init__(self):
super(Scrubber, self).__init__()
def scrub(self):
"""
Get item metadata.
"""
return {}
# noinspection PyBro... |
Use the Controllers namespace rather than Http | <?php
namespace App\Providers;
use Illuminate\Routing\Router;
use Illuminate\Foundation\Support\Providers\RouteServiceProvider as ServiceProvider;
class RouteServiceProvider extends ServiceProvider
{
/**
* This namespace is applied to the controller routes in your routes file.
*
* In addition, it ... | <?php
namespace App\Providers;
use Illuminate\Routing\Router;
use Illuminate\Foundation\Support\Providers\RouteServiceProvider as ServiceProvider;
class RouteServiceProvider extends ServiceProvider
{
/**
* This namespace is applied to the controller routes in your routes file.
*
* In addition, it ... |
Change support requirement to key | <?php
namespace LinkValue\MobileNotifBundle\DependencyInjection\Compiler;
use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\Reference;
/**
* Collect all mobile clients and store it to applic... | <?php
namespace LinkValue\MobileNotifBundle\DependencyInjection\Compiler;
use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\Reference;
/**
* Collect all mobile clients and store it to applic... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.