text:
/* global protractor:false expect:false inject:false module:false element:false browser:false by:false */

// Load other modules
var helpers = require('../helpers.e2e.js');
var shared = require('./shared.page.js');

var Navbar = require('./navbar.page.js');
var DashboardPage = require('./dashboard.page.js');
var LoginPage = require('./login.page.js');

var TEST_HOSTNAME = shared.config.TEST_HOSTNAME;
var TEST_USERNAME = shared.config.TEST_USERNAME;
var TEST_PASSWORD = shared.config.TEST_PASSWORD;

var PAGE_TITLE = 'Labs Workbench Catalog';
var PAGE_ROUTE = /https?\:\/\/.+\/dashboard\/\#?\/?store/;

var EC = protractor.ExpectedConditions;

var CatalogPage = function() {
    "use strict";

    // Search Header
    this.searchFilter = element(by.model('newTag.text'));
    this.removeTagBtn = element(by.css('[ng-click="$removeTag()"]'));
    this.toggleCardsBtn = element(by.id('toggleCardsBtn'));
    this.viewAsIcon = element(by.id('viewAsIcon'));
    this.importBtn = element(by.id('importApplicationBtn'));
    this.createBtn = element(by.id('createApplicationBtn'));
    this.autocompleteSuggestions = element.all(by.repeater('item in suggestionList.items track by track(item)'));

    // Mutually exclusive app spec list (view as)
    this.table = element.all(by.repeater("spec in specs | display | showTags:tags.selected | orderBy:'label' track by spec.key"));
    this.cards = element.all(by.repeater('spec in set'));

    // Modals
    this.exportSpecModal = element(by.id('exportSpecModal'));
    this.cloneSpecModal = element(by.id('cloneSpecModal'));
    this.importSpecModal = element(by.id('importSpecModal'));
    this.deleteSpecModal = element(by.id('deleteSpecModal'));

    // Shared Modal Stuff
    this.validationText = element(by.id('validationText'));
    this.confirmBtn = element(by.id('confirmBtn'));
    this.cancelBtn = element(by.id('cancelBtn'));
    this.closeBtn = element(by.id('closeBtn'));

    // Other Modal Stuff
    this.specJsonTextArea = element(by.id('specJsonTextArea'));               // Import spec modal
    this.cloneKeyInput = element(by.id('cloneKeyInput'));                     // Clone spec modal
    this.editBtn = element(by.id('editBtn'));                                 // Export spec modal
    this.copyToClipboardModalBtn = element(by.id('copyToClipboardModalBtn')); // Export spec modal

    // Pass in a card or table row to get its inner buttons
    this.logoLink = function(cardOrRow) {  return cardOrRow.element(by.id('logoLink')); };
    this.addBtn = function(cardOrRow) {  return cardOrRow.element(by.id('addBtn')); };
    this.viewBtn = function(cardOrRow) {  return cardOrRow.element(by.id('viewBtn')); };
    this.helpLink = function(cardOrRow) {  return cardOrRow.element(by.id('helpLink')); };
    this.moreActionsDropdown = function(cardOrRow) {  return cardOrRow.element(by.id('moreActionsDropdown')); };
    this.cloneBtn = function(cardOrRow) {  return cardOrRow.element(by.id('cloneBtn')); };
    this.copyToClipboardBtn = function(cardOrRow) {  return cardOrRow.element(by.id('copyToClipboardBtn')); };
    this.viewJsonBtn = function(cardOrRow) {  return cardOrRow.element(by.id('viewJsonBtn')); };
    this.viewDocsBtn = function(cardOrRow) {  return cardOrRow.element(by.id('viewDocsBtn')); };

    // User-applications only
    this.editBtn = function(cardOrRow) {  return cardOrRow.element(by.id('editBtn')); };
    this.deleteBtn = function(cardOrRow) {  return cardOrRow.element(by.id('deleteBtn')); };
};

// Navigate to the Catalog view
CatalogPage.prototype.get = function(loggedIn) {
    "use strict";

    //var navbar = new Navbar();
    //var dashboardPage = new DashboardPage();
    var loginPage = new LoginPage();
    var self = this;

    //dashboardPage.get(loggedIn);
    //navbar.clickCatalogNav();

    browser.get(TEST_HOSTNAME + '/dashboard/store');
    browser.waitForAngular();
    browser.getCurrentUrl().then(function(url) {
        if (url.indexOf('login') !== -1) {
            loginPage.verify();
            browser.waitForAngular();
            loginPage.enterUsername(TEST_USERNAME);
            loginPage.enterPassword(TEST_PASSWORD);
            loginPage.clickLogin();
            browser.waitForAngular();
        }

        self.verify();
    });
};

// Ensure that we are on the correct page
CatalogPage.prototype.verify = function() {
    "use strict";

    browser.waitForAngular();
    expect(browser.getCurrentUrl()).toMatch(PAGE_ROUTE);
    expect(browser.getTitle()).toEqual(PAGE_TITLE);
};

CatalogPage.prototype.applyTag = function(tagName) {
    "use strict";

    // Type into the search filter, but do not press enter
    this.searchFilter.sendKeys(tagName);

    // Select first (only) suggestion from the autocomplete
    this.autocompleteSuggestions.then(function(suggestions) {
        expect(suggestions.length).toBe(1);
        suggestions[0].click();
        browser.waitForAngular();
    });
};

CatalogPage.prototype.applyFilter = function(text) {
    "use strict";

    // Type into the search filter
    this.searchFilter.sendKeys(text);

    // Press the Enter key
    browser.actions().sendKeys(protractor.Key.ENTER).perform();
    browser.waitForAngular();
};

// setTo === true => enable cards view
// setTo === false => enable table view
// setTo === null => toggle
CatalogPage.prototype.toggleCardsView = function(setTo) {
    "use strict";

    var self = this;
    browser.waitForAngular();
    return helpers.hasClass(this.viewAsIcon, 'fa-table').then(function(showCards) {
        if ((showCards && setTo !== true) || (!showCards && setTo !== false)) {
            // We are currently in the cards view
            self.toggleCardsBtn.click();
            browser.waitForAngular();
        }
    });
};

CatalogPage.prototype.installApplication = function(specKey, viewAsTable) {
    "use strict";

    var self = this;
    browser.waitForAngular();
    return helpers.selectByModel(viewAsTable ? self.table : self.cards, "spec.key", function(key) {
            return key === specKey; // How to know we've found our match
        },
        function(match) {  // What to do with our match
            //helpers.scrollIntoViewAndClick(self.addBtn(card));
            helpers.scrollIntoView(match);

            var addBtn = self.addBtn(match);
            browser.wait(EC.elementToBeClickable(addBtn), 5000);
            addBtn.click();
            browser.waitForAngular();
            return match;
        });
};

CatalogPage.prototype.viewApplicationOnDashboard = function(specKey, viewAsTable) {
    "use strict";

    var self = this;
    browser.waitForAngular();
    return helpers.selectByModel(viewAsTable ? self.table : self.cards, "spec.key", function(key) {
            return key === specKey; // How to know we've found our match
        },
        function(match) {  // What to do with our match
            //helpers.scrollIntoViewAndClick(self.addBtn(card));
            var viewBtn = self.viewBtn(match);
            browser.wait(EC.elementToBeClickable(viewBtn), 5000);
            viewBtn.click();
            browser.waitForAngular();
            return match;
        });
};

CatalogPage.prototype.importSpec = function(specJson) {
    "use strict";

    // Click the import button
    var importBtn = this.importBtn;
    browser.wait(EC.elementToBeClickable(importBtn), 5000);
    importBtn.click();
    browser.waitForAngular();

    // Wait for the modal to popup
    browser.wait(EC.visibilityOf(this.importSpecModal), 5000);
    browser.wait(EC.visibilityOf(this.specJsonTextArea), 5000);

    // Input the new spec JSON
    this.specJsonTextArea.clear();
    this.specJsonTextArea.sendKeys(specJson);

    // Click the confirm button
    var confirmBtn = this.confirmBtn;
    browser.wait(EC.elementToBeClickable(confirmBtn), 5000);
    confirmBtn.click();
    browser.waitForAngular();
};

CatalogPage.prototype.viewJsonModal = function(specKey, viewAsTable) {
    "use strict";

    var self = this;
    browser.waitForAngular();
    return helpers.selectByModel(viewAsTable ? self.table : self.cards, "spec.key", function(key) {
            return key === specKey; // How to know we've found our match
        },
        function(match) {  // What to do with our match
            var moreActionsDropdown = self.moreActionsDropdown(match);
            browser.wait(EC.elementToBeClickable(moreActionsDropdown), 5000);
            moreActionsDropdown.click();

            browser.wait(EC.elementToBeClickable(self.viewJsonBtn(match)), 5000);
            self.viewJsonBtn(match).click();

            browser.waitForAngular();
            return match;
        });
};

CatalogPage.prototype.copySpecToClipboard = function(specKey, viewAsTable) {
    "use strict";

    var self = this;
    browser.waitForAngular();
    return helpers.selectByModel(viewAsTable ? self.table : self.cards, "spec.key", function(key) {
            return key === specKey; // How to know we've found our match
        },
        function(match) {  // What to do with our match
            var moreActionsDropdown = self.moreActionsDropdown(match);
            browser.wait(EC.elementToBeClickable(moreActionsDropdown), 5000);
            moreActionsDropdown.click();

            var copyToClipboardBtn = self.copyToClipboardBtn(match);
            browser.wait(EC.elementToBeClickable(copyToClipboardBtn), 5000);
            copyToClipboardBtn.click();

            browser.waitForAngular();
            return match;
        });
};

CatalogPage.prototype.cloneSpec = function(oldKey, newKey, viewAsTable) {
    "use strict";

    var self = this;
    browser.waitForAngular();
    return helpers.selectByModel(viewAsTable ? self.table : self.cards, "spec.key", function(key) {
            return key === oldKey; // How to know we've found our match
        },
        function(match) {  // What to do with our match
            var moreActionsDropdown = self.moreActionsDropdown(match);
            browser.wait(EC.elementToBeClickable(moreActionsDropdown), 5000);
            moreActionsDropdown.click();

            var cloneBtn = self.cloneBtn(match);
            browser.wait(EC.elementToBeClickable(cloneBtn), 5000);
            cloneBtn.click();

            browser.wait(EC.visibilityOf(self.cloneSpecModal), 5000);
            browser.wait(EC.visibilityOf(self.cloneKeyInput), 5000);

            var cloneKeyInput = self.cloneKeyInput;

            // Field should default to current key
            expect(cloneKeyInput.getAttribute('value')).toBe(oldKey);

            // Enter a new key
            cloneKeyInput.clear();
            cloneKeyInput.sendKeys(newKey);

            var confirmBtn = self.confirmBtn;
            browser.wait(EC.elementToBeClickable(confirmBtn), 5000);
            confirmBtn.click();

            browser.waitForAngular();
            return match;
        });
};

CatalogPage.prototype.editSpec = function(specKey, viewAsTable) {
    "use strict";

    var self = this;
    browser.waitForAngular();
    return helpers.selectByModel(viewAsTable ? self.table : self.cards, "spec.key", function(key) {
            return key === specKey; // How to know we've found our match
        },
        function(match) {  // What to do with our match
            browser.waitForAngular();
            var moreActionsDropdown = self.moreActionsDropdown(match);
            browser.wait(EC.elementToBeClickable(moreActionsDropdown), 5000);
            moreActionsDropdown.click();

            var editBtn = self.editBtn(match);
            browser.wait(EC.elementToBeClickable(editBtn), 5000);
            editBtn.click();

            browser.waitForAngular();
            return match;
        });
};

CatalogPage.prototype.deleteSpec = function(specKey, viewAsTable) {
    "use strict";

    var self = this;
    browser.waitForAngular();
    return helpers.selectByModel(viewAsTable ? self.table : self.cards, "spec.key", function(key) {
            return key === specKey; // How to know we've found our match
        },
        function(match) {  // What to do with our match
            browser.waitForAngular();
            var moreActionsDropdown = self.moreActionsDropdown(match);
            browser.wait(EC.elementToBeClickable(moreActionsDropdown), 5000);
            moreActionsDropdown.click();

            var deleteBtn = self.deleteBtn(match);
            browser.wait(EC.elementToBeClickable(deleteBtn), 5000);
            deleteBtn.click();

            browser.wait(EC.visibilityOf(self.deleteSpecModal), 5000);

            var confirmBtn = self.confirmBtn;
            browser.wait(EC.elementToBeClickable(confirmBtn), 5000);
            confirmBtn.click();

            browser.waitForAngular();
            return match;
        });
};

CatalogPage.prototype.clickViewDocumentation = function(specKey, viewAsTable) {
    "use strict";

    var self = this;
    browser.waitForAngular();
    return helpers.selectByModel(viewAsTable ? self.table : self.cards, "spec.key", function(key) {
            return key === specKey; // How to know we've found our match
        },
        function(match) {  // What to do with our match
            browser.waitForAngular();
            var moreActionsDropdown = self.moreActionsDropdown(match);
            browser.wait(EC.elementToBeClickable(moreActionsDropdown), 5000);
            moreActionsDropdown.click();

            var viewDocsBtn = self.viewDocsBtn(match);
            browser.wait(EC.elementToBeClickable(viewDocsBtn), 5000);
            viewDocsBtn.click();

            browser.waitForAngular();
            return match;
        });
};

CatalogPage.prototype.clickHelpLink = function(specKey, viewAsTable) {
    "use strict";

    var self = this;
    browser.waitForAngular();
    return helpers.selectByModel(viewAsTable ? self.table : self.cards, "spec.key", function(key) {
            return key === specKey; // How to know we've found our match
        },
        function(match) {  // What to do with our match
            browser.waitForAngular();
            var helpLink = self.helpLink(match);
            browser.wait(EC.elementToBeClickable(helpLink), 5000);
            helpLink.click();

            browser.waitForAngular();
            return match;
        });
};

module.exports = CatalogPage;
plication = function(specKey, viewAsTable) {
  "use strict";

  var self = this;
    browser.waitForAngular();
  return helpers.selectByModel(viewAsTable ? self.table : self.cards, "spec.key", function(key) {
    return key === specKey; // How to know we've found our match
  },
  function(match) {  // What to do with our match
    browser.waitForAngular();
    //helpers.scrollIntoViewAndClick(self.addBtn(card));
    helpers.scrollIntoView(match);

    var addBtn = self.addBtn(match);
    browser.wait(EC.elementToBeClickable(addBtn), 5000);
    addBtn.click();

    browser.waitForAngular();
    return match;
  });
};

CatalogPage.prototype.viewApplicationOnDashboard = function(specKey, viewAsTable) {
  "use strict";

  var self = this;
  browser.waitForAngular();
  return helpers.selectByModel(viewAsTable ? self.table : self.cards, "spec.key", function(key) {
    return key === specKey; // How to know we've found our match
  },
  function(match) {  // What to do with our match
    browser.waitForAngular();
    //helpers.scrollIntoViewAndClick(self.addBtn(card));
    var viewBtn = self.viewBtn(match);
    browser.wait(EC.elementToBeClickable(viewBtn), 5000);
    viewBtn.click();

    return match;
  });
};

CatalogPage.prototype.importSpec = function(specJson) {
  "use strict";

  // Click the import button
  var importBtn = this.importBtn;
  browser.wait(EC.elementToBeClickable(importBtn), 5000);
  importBtn.click();

  // Wait for the modal to popup
  browser.wait(EC.visibilityOf(this.importSpecModal), 5000);
  browser.wait(EC.visibilityOf(this.specJsonTextArea), 5000);

  // Input the new spec JSON
  this.specJsonTextArea.clear();
  this.specJsonTextArea.sendKeys(specJson);

  // Click the confirm button
  var confirmBtn = this.confirmBtn;
  browser.wait(EC.elementToBeClickable(confirmBtn), 5000);
  confirmBtn.click();
  browser.waitForAngular();
};

CatalogPage.prototype.viewJsonModal = function(specKey, viewAsTable) {
  "use strict";

  var self = this;
  browser.waitForAngular();
  return helpers.selectByModel(viewAsTable ? self.table : self.cards, "spec.key", function(key) {
    return key === specKey; // How to know we've found our match
  },
  function(match) {  // What to do with our match
    browser.waitForAngular();
    var moreActionsDropdown = self.moreActionsDropdown(match);
    browser.wait(EC.elementToBeClickable(moreActionsDropdown), 5000);
    moreActionsDropdown.click();

    browser.wait(EC.elementToBeClickable(self.viewJsonBtn(match)), 5000);
    self.viewJsonBtn(match).click();
    browser.waitForAngular();

    return match;
  });
};

CatalogPage.prototype.copySpecToClipboard = function(specKey, viewAsTable) {
  "use strict";

  var self = this;
  browser.waitForAngular();
  return helpers.selectByModel(viewAsTable ? self.table : self.cards, "spec.key", function(key) {
    return key === specKey; // How to know we've found our match
  },
  function(match) {  // What to do with our match
    var moreActionsDropdown = self.moreActionsDropdown(match);
    browser.wait(EC.elementToBeClickable(moreActionsDropdown), 5000);
    moreActionsDropdown.click();

    var copyToClipboardBtn = self.copyToClipboardBtn(match);
    browser.wait(EC.elementToBeClickable(copyToClipboardBtn), 5000);
    copyToClipboardBtn.click();

    return match;
  });
};

CatalogPage.prototype.cloneSpec = function(oldKey, newKey, viewAsTable) {
  "use strict";

  var self = this;
  browser.waitForAngular();
  return helpers.selectByModel(viewAsTable ? self.table : self.cards, "spec.key", function(key) {
    return key === oldKey; // How to know we've found our match
  },
  function(match) {  // What to do with our match
    browser.waitForAngular();
    var moreActionsDropdown = self.moreActionsDropdown(match);
    browser.wait(EC.elementToBeClickable(moreActionsDropdown), 5000);
    moreActionsDropdown.click();

    var cloneBtn = self.cloneBtn(match);
    browser.wait(EC.elementToBeClickable(cloneBtn), 5000);
    cloneBtn.click();
    browser.waitForAngular();

    browser.wait(EC.visibilityOf(self.cloneSpecModal), 5000);
    browser.wait(EC.visibilityOf(self.cloneKeyInput), 5000);

    var cloneKeyInput = self.cloneKeyInput;

    // Field should default to current key
    expect(cloneKeyInput.getAttribute('value')).toBe(oldKey);

    // Enter a new key
    cloneKeyInput.clear();
    cloneKeyInput.sendKeys(newKey);
    browser.waitForAngular();

    var confirmBtn = self.confirmBtn;
    browser.wait(EC.elementToBeClickable(confirmBtn), 5000);
    confirmBtn.click();
    browser.waitForAngular();

    return match;
  });
};

CatalogPage.prototype.editSpec = function(specKey, viewAsTable) {
  "use strict";

  var self = this;
  browser.waitForAngular();
  return helpers.selectByModel(viewAsTable ? self.table : self.cards, "spec.key", function(key) {
    return key === specKey; // How to know we've found our match
  },
  function(match) {  // What to do with our match
    browser.waitForAngular();
    var moreActionsDropdown = self.moreActionsDropdown(match);
    browser.wait(EC.elementToBeClickable(moreActionsDropdown), 5000);
    moreActionsDropdown.click();

    var editBtn = self.editBtn(match);
    browser.wait(EC.elementToBeClickable(editBtn), 5000);
    editBtn.click();
    browser.waitForAngular();

    return match;
  });
};

CatalogPage.prototype.deleteSpec = function(specKey, viewAsTable) {
  "use strict";

  var self = this;
  browser.waitForAngular();
  return helpers.selectByModel(viewAsTable ? self.table : self.cards, "spec.key", function(key) {
    return key === specKey; // How to know we've found our match
  },
  function(match) {  // What to do with our match
    browser.waitForAngular();
    var moreActionsDropdown = self.moreActionsDropdown(match);
    browser.wait(EC.elementToBeClickable(moreActionsDropdown), 5000);
    moreActionsDropdown.click();

    var deleteBtn = self.deleteBtn(match);
    browser.wait(EC.elementToBeClickable(deleteBtn), 5000);
    deleteBtn.click();
    browser.waitForAngular();

    browser.wait(EC.visibilityOf(self.deleteSpecModal), 5000);

    var confirmBtn = self.confirmBtn;
    browser.wait(EC.elementToBeClickable(confirmBtn), 5000);
    confirmBtn.click();
    browser.waitForAngular();

    return match;
  });
};

CatalogPage.prototype.clickViewDocumentation = function(specKey, viewAsTable) {
  "use strict";

  var self = this;
  browser.waitForAngular();
  return helpers.selectByModel(viewAsTable ? self.table : self.cards, "spec.key", function(key) {
    return key === specKey; // How to know we've found our match
  },
  function(match) {  // What to do with our match
    browser.waitForAngular();
    var moreActionsDropdown = self.moreActionsDropdown(match);
    browser.wait(EC.elementToBeClickable(moreActionsDropdown), 5000);
    moreActionsDropdown.click();

    var viewDocsBtn = self.viewDocsBtn(match);
    browser.wait(EC.elementToBeClickable(viewDocsBtn), 5000);
    viewDocsBtn.click();
    browser.waitForAngular();

    return match;
  });
};

CatalogPage.prototype.clickHelpLink = function(specKey, viewAsTable) {
  "use strict";

  var self = this;
  browser.waitForAngular();
  return helpers.selectByModel(viewAsTable ? self.table : self.cards, "spec.key", function(key) {
    return key === specKey; // How to know we've found our match
  },
  function(match) {  // What to do with our match
    browser.waitForAngular();
    var helpLink = self.helpLink(match);
    browser.wait(EC.elementToBeClickable(helpLink), 5000);
    helpLink.click();

    browser.waitForAngular();
    return match;
  });
};

module.exports = CatalogPage;


text:
#import <UIKit/UIKit.h>
#import <CoreLocation/CoreLocation.h>

@interface LocationDetailViewController : UITableViewController

@property (nonatomic, strong) CLLocation *location;

@end

redpajama_set_name: RedPajamaGithub


text:
package scala.tasty
package internal.scalac

import scala.tools.nsc.Global
import scala.tools.nsc.plugins.{Plugin => NscPlugin, PluginComponent => NscPluginComponent}
import phase.TastyPhase
import scala.collection.mutable
import scala.tools.nsc.SubComponent
import scala.tools.nsc.Phase
import scala.tools.nsc.backend.jvm.GenBCode
import scala.tools.nsc.typechecker.Analyzer
import scala.tools.nsc.transform.Erasure

class Plugin(val global: Global) extends NscPlugin with TastyPhase {
  val name = "tasty"
  val description = """Pickles Scala trees (tasty format).
  For more information visit https://github.com/VladimirNik/tasty"""

  def changePhasesOrder(runsAfterPhase: String, phaseClass: Class[_], fieldToModify: Object) = {
    val newRunsAfter = List(runsAfterPhase)
    val runsAfterField = phaseClass.getDeclaredField("runsAfter")
    runsAfterField.setAccessible(true)
    runsAfterField.set(fieldToModify, newRunsAfter)
  }

  //update the order of phases
  //typer, superaccessors
  changePhasesOrder("typer", classOf[scala.tools.nsc.Global$superAccessors$], global.superAccessors)

  //superaccessors, patmat
  changePhasesOrder("superaccessors", classOf[scala.tools.nsc.Global$patmat$], global.patmat)

  //patmat, extensionMethods
  changePhasesOrder("patmat", classOf[scala.tools.nsc.Global$extensionMethods$], global.extensionMethods)

  val components = List[NscPluginComponent](TastyComponent)
}


text:
/**
 * Internal utility classes for the Log4j 2 API.
 */
package org.apache.logging.log4j.util;


text:
function [phandles, returnPeriods, returnLevels, retrunLevelsErrs] = tsEvaPlotReturnLevelsGPD( epsilon, sigma, threshold, epsilonStdErr, sigmaStdErr, thresholdStdErr, nPeaks, timeHorizonInYears, varargin  )
%

args.minReturnPeriodYears = 5;
args.maxReturnPeriodYears = 1000;
args.confidenceAreaColor = [189 252	201]/255; % light green
args.confidenceBarColor = [34 139 34]/255; % dark green
args.returnLevelColor = 'k';
args.xlabel = 'return period (years)';
args.ylabel = 'return levels (m)';
args.ylim = [];
args = tsEasyParseNamedArgs(varargin, args);
minReturnPeriodYears = args.minReturnPeriodYears;
maxReturnPeriodYears = args.maxReturnPeriodYears;

returnPeriods = logspace(log10(minReturnPeriodYears), log10(maxReturnPeriodYears));

[returnLevels, retrunLevelsErrs] = tsEvaComputeReturnLevelsGPD(epsilon, sigma, threshold, epsilonStdErr, sigmaStdErr, thresholdStdErr, nPeaks, timeHorizonInYears, returnPeriods);

supRLCI = returnLevels + 2*retrunLevelsErrs;
infRLCI = returnLevels - 2*retrunLevelsErrs;
if ~isempty(args.ylim)
  maxRL = max(args.ylim);
  minRL = min(args.ylim);
else
  maxRL = max(supRLCI);
  minRL = min(infRLCI);
end

f = figure;
phandles{1} = f;
f.Position = [0, 0, 1300, 700] + 10;
h = area(returnPeriods, cat(1, infRLCI, supRLCI - infRLCI)', 'linestyle', 'none');
h(1).FaceColor = [1,1,1];
h(2).FaceColor = args.confidenceAreaColor;
hold on;
phandles{2} = h;

phandles{3} = plot(returnPeriods, returnLevels, 'color', args.returnLevelColor, 'linewidth', 3);
hold on;
phandles{4} = plot(returnPeriods, supRLCI, 'color', args.confidenceBarColor, 'linewidth', 2);
phandles{5} = plot(returnPeriods, infRLCI, 'color', args.confidenceBarColor, 'linewidth', 2);
set(gca, 'Xscale', 'log');

ylim([minRL maxRL]);
xlim([minReturnPeriodYears, maxReturnPeriodYears]);

grid on;
set(gca,'layer','top');

set(gca, 'fontsize', 20);
xlabel(args.xlabel, 'fontsize', 24);
ylabel(args.ylabel, 'fontsize', 24);

set(f, 'paperpositionmode', 'auto');

end


text:
SRC_LANG	= sh

include devkit.mk


text:
% List of open inputs
% Smooth: Images to Smooth - cfg_files
% Written by Nanbo Sun and CBIG under MIT license: https://github.com/ThomasYeoLab/CBIG/blob/master/LICENSE.md
addpath(spm_dir)

nrun = 1; % enter the number of runs here
jobfile = {[script_dir '/CBIG_MMLDA_smooth_job.m']};
jobs = repmat(jobfile, 1, nrun);
inputs = cell(1, nrun);
for crun = 1:nrun
    inputs{1, crun} = {modulated_image}; % Smooth: Images to Smooth - cfg_files
end
spm('defaults', 'FMRI');
spm_jobman('run', jobs, inputs{:});

rmpath(spm_dir)


text:
<?php

namespace ctala\transaccion\classes;

/**
 * Description of Transaccion
 *
 * @author ctala
 */
class Transaccion {
    /*
     * Estas son las variables básicas de una transaccion.
     */

    public $ct_order_id;
    //Esta variable es la que usaremos como "idSession" de transbank
    public $ct_token_tienda;
    public $ct_monto;
    public $ct_token_service;
    public $ct_email;
    public $ct_firma;
    //Esta es la variable con la que firmaremos el mensaje
    private $ct_token_secret;

    function __construct($ct_order_id, $ct_token_tienda, $ct_monto, $ct_token_service, $ct_email = NULL) {
        $this->ct_order_id = $ct_order_id;
        $this->ct_token_tienda = $ct_token_tienda;
        $this->ct_monto = $ct_monto;
        $this->ct_token_service = $ct_token_service;
        $this->ct_email = $ct_email;
    }

    function setCt_token_secret($ct_token_secret) {
        $this->ct_token_secret = $ct_token_secret;
    }

    function getArrayResponse() {
        $arreglo = $this->getArray();
        $arreglo["ct_firma"] = $this->firmarArreglo($arreglo);
        return $arreglo;
    }

    function getArray() {
        $resultado = [
            "ct_order_id" => $this->ct_order_id,
            "ct_token_tienda" => $this->ct_token_tienda,
            "ct_monto" => $this->ct_monto,
            "ct_token_service" => $this->ct_token_service
        ];

        if ($this->ct_email !== NULL) {
            $resultado["ct_email"] = $this->ct_email;
        }

        ksort($resultado);
        return $resultado;
    }

    function firmarArreglo($arreglo) {

        //Ordeno Arreglo
        ksort($arreglo);
        //Concateno Arreglo
        $mensaje = $this->concatenarArreglo($arreglo);

        //Firmo Mensaje
        $mensajeFirmado = $this->firmarMensaje($mensaje, $this->ct_token_secret);

        //Guardo y retorno el mensaje firmado
        $this->ct_firma = $mensajeFirmado;
        return $mensajeFirmado;
    }

    function firmarMensaje($mensaje, $claveCifrado) {
        $mensajeFirmado = hash_hmac('sha256', $mensaje, $claveCifrado);
        return $mensajeFirmado;
    }

    public function concatenarArreglo($arreglo) {
        $resultado = "";

        foreach ($arreglo as $field => $value) {
            $resultado .= $field . $value;
        }

        return $resultado;
    }

}


text:
namespace peloton {
namespace test {

class OptimizerSQLTests : public PelotonTest {};

void CreateAndLoadTable() {
  // Create a table first
  TestingSQLUtil::ExecuteSQLQuery(
      "CREATE TABLE test(a INT PRIMARY KEY, b INT, c INT);");

  // Insert tuples into table
  TestingSQLUtil::ExecuteSQLQuery("INSERT INTO test VALUES (1, 22, 333);");
}

TEST_F(OptimizerSQLTests, SimpleSelectTest) {
  catalog::Catalog::GetInstance()->CreateDatabase(DEFAULT_DB_NAME, nullptr);

  CreateAndLoadTable();

  std::vector<StatementResult> result;
  std::vector<FieldInfo> tuple_descriptor;
  std::string error_message;
  int rows_changed;
  std::unique_ptr<optimizer::AbstractOptimizer> optimizer(
      new optimizer::Optimizer());

  std::string query("SELECT * from test");
  auto select_plan = TestingSQLUtil::GeneratePlanWithOptimizer(optimizer, query);
  EXPECT_EQ(select_plan->GetPlanNodeType(), PlanNodeType::SEQSCAN);

  // test small int
  TestingSQLUtil::ExecuteSQLQueryWithOptimizer(
      optimizer, query, result, tuple_descriptor, rows_changed, error_message);
  // Check the return value
  // Should be: 1, 22, 333
  EXPECT_EQ(0, rows_changed);
  EXPECT_EQ("1", TestingSQLUtil::GetResultValueAsString(result, 0));
  EXPECT_EQ("22", TestingSQLUtil::GetResultValueAsString(result, 1));

  // test small int
  TestingSQLUtil::ExecuteSQLQueryWithOptimizer(
      optimizer, "SELECT b, a, c from test", result, tuple_descriptor,
      rows_changed, error_message);
  // Check the return value
  // Should be: 22, 1, 333
  EXPECT_EQ(0, rows_changed);
  EXPECT_EQ("22", TestingSQLUtil::GetResultValueAsString(result, 0));
  EXPECT_EQ("1", TestingSQLUtil::GetResultValueAsString(result, 1));

  // free the database just created
  auto &txn_manager = concurrency::TransactionManagerFactory::GetInstance();
  auto txn = txn_manager.BeginTransaction();
  catalog::Catalog::GetInstance()->DropDatabaseWithName(DEFAULT_DB_NAME, txn);
  txn_manager.CommitTransaction(txn);
}

TEST_F(OptimizerSQLTests, SelectProjectionTest) {
  catalog::Catalog::GetInstance()->CreateDatabase(DEFAULT_DB_NAME, nullptr);

  CreateAndLoadTable();

  std::vector<StatementResult> result;
  std::vector<FieldInfo> tuple_descriptor;
  std::string error_message;
  int rows_changed;
  std::unique_ptr<optimizer::AbstractOptimizer> optimizer(
      new optimizer::Optimizer());

  std::string query("SELECT a * 5 + b, -1 + c from test");

  // check for plan node type
  auto select_plan = TestingSQLUtil::GeneratePlanWithOptimizer(optimizer, query);
  EXPECT_EQ(select_plan->GetPlanNodeType(), PlanNodeType::PROJECTION);
  EXPECT_EQ(select_plan->GetChildren()[0]->GetPlanNodeType(),
            PlanNodeType::SEQSCAN);

  // test small int
  TestingSQLUtil::ExecuteSQLQueryWithOptimizer(
      optimizer, query, result, tuple_descriptor, rows_changed, error_message);
  // Check the return value
  // Should be: 27, 332
  EXPECT_EQ("27", TestingSQLUtil::GetResultValueAsString(result, 0));
  EXPECT_EQ("332", TestingSQLUtil::GetResultValueAsString(result, 1));

  // free the database just created
  auto &txn_manager = concurrency::TransactionManagerFactory::GetInstance();
  auto txn = txn_manager.BeginTransaction();
  catalog::Catalog::GetInstance()->DropDatabaseWithName(DEFAULT_DB_NAME, txn);
  txn_manager.CommitTransaction(txn);
}

}  // namespace test
}  // namespace peloton


text:
#pragma once

#include "../inc/MarlinConfigPre.h"

typedef struct {
  uint8_t   active_speed,    // 0-255 (fullspeed); Speed with enabled stepper motors
            idle_speed;      // 0-255 (fullspeed); Speed after idle period with all motors are disabled
  uint16_t  duration;        // Duration in seconds for the fan to run after all motors are disabled
  bool      auto_mode;       // Default true
} controllerFan_settings_t;

#ifndef CONTROLLERFAN_SPEED_ACTIVE
  #define CONTROLLERFAN_SPEED_ACTIVE 255
#endif
#ifndef CONTROLLERFAN_SPEED_IDLE
  #define CONTROLLERFAN_SPEED_IDLE     0
#endif
#ifndef CONTROLLERFAN_IDLE_TIME
  #define CONTROLLERFAN_IDLE_TIME     60
#endif

static constexpr controllerFan_settings_t controllerFan_defaults = {
  CONTROLLERFAN_SPEED_ACTIVE,
  CONTROLLERFAN_SPEED_IDLE,
  CONTROLLERFAN_IDLE_TIME,
  true
};

#if ENABLED(USE_CONTROLLER_FAN)

class ControllerFan {
  private:
    static uint8_t speed;
    static void set_fan_speed(const uint8_t s);

  public:
    #if ENABLED(CONTROLLER_FAN_EDITABLE)
      static controllerFan_settings_t settings;
    #else
      static const controllerFan_settings_t &settings;
    #endif
    static inline bool state() { return speed > 0; }
    static inline void init() { reset(); }
    static inline void reset() { TERN_(CONTROLLER_FAN_EDITABLE, settings = controllerFan_defaults); }
    static void setup();
    static void update();
};

extern ControllerFan controllerFan;

#endif


text:
package net.desenlace.quiz;

import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;

import javax.json.Json;
import javax.servlet.annotation.WebServlet;

@WebServlet("/set_tema")
public class SetTema extends ApiServlet {

	private static final long serialVersionUID = -3911609276462246792L;

	public SetTema(){
		super(true);
	}

	@Override
	protected String postResponse(Request request, Connection db) throws SQLException, ApiException{
		int id = request.getInt("id");

		if(!esTemaDeUsuario(id,db)){
			throw new ApiException(400, "El tema no es valido");
		}

		PreparedStatement st = db.prepareStatement("update quiz.usuarios set tema_actual=? where id=quiz.usr();");
		st.setInt(1, id);
		st.execute();

		return Json.createObjectBuilder()
			.add("id", id)
			.build()
			.toString();

	}

	/**
	 * Devuelve true si el usuario es propietario del tema con el id indicado
	 * @param id El id del tema
	 * @param db La conexion con la BBDD
	 * @return true si el usuario es propietario del tema con el id indicado
	 * @throws SQLException
	 */
	private boolean esTemaDeUsuario(int id, Connection db) throws SQLException {
		PreparedStatement st = db.prepareStatement("select exists(select 1 from quiz.temas where usuario=quiz.usr() and id=?);");
		st.setInt(1, id);
		ResultSet r = st.executeQuery();
		if(r.next()){
			return r.getBoolean(1);
		}
		return false;
	}
}


text:
{-
 - Hacq (c) 2013 NEC Laboratories America, Inc.  All rights reserved.
 -
 - This file is part of Hacq.
 - Hacq is distributed under the 3-clause BSD license.
 - See the LICENSE file for more details.
 -}

{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE FlexibleInstances #-}
{-# LANGUAGE GeneralizedNewtypeDeriving #-}
{-# LANGUAGE MultiParamTypeClasses #-}
{-# LANGUAGE UndecidableInstances #-}

module Control.Monad.Quantum.PhaseShift.Binary.Kickback.Estimate (
    module Control.Monad.Quantum.PhaseShift.Binary.Class,
    PhaseKickbackEstimateT(..)) where

import Control.Applicative (Applicative)
import Control.Monad (when, unless)
import Control.Monad.Trans (MonadTrans(lift))
import Data.Functor ((<$>))
import qualified Data.Sequence as Seq

import Control.Monad.Memo.Class
import Control.Monad.Quantum.Class
import Control.Monad.Quantum.PhaseShift.Binary.Class
import Control.Monad.Quantum.ApproxSequence.Class (MonadApproxSequence)
import Control.Monad.Quantum.PhaseShift.Class (MonadPhaseShift)
import Control.Monad.Quantum.Adder (adder, subtractor)
import Control.Monad.Quantum.Counter.Class
import Util ((!))

newtype PhaseKickbackEstimateT c k m a = PhaseKickbackEstimateT {
  -- |Run a `PhaseKickbackEstimateT`, assuming that the resource states have been prepared.
  runPhaseKickbackEstimateT :: m a
} deriving (Functor, Applicative, Monad, MonadQuantumBase w, MonadToffoli w, MonadQuantum w, MonadPhaseShift w angle, MonadApproxSequence w, MonadQuantumCounter w c)

instance MonadTrans (PhaseKickbackEstimateT c k) where
  lift = PhaseKickbackEstimateT

-- The following instance requires UndecidableInstances.
instance MonadMemo (Either k (Int, Integer)) m => MonadMemo k (PhaseKickbackEstimateT c k m) where
  memoize k (PhaseKickbackEstimateT m) = PhaseKickbackEstimateT $
      memoize (Left k) m

instance (MonadQuantum () m, MonadMemo (Either k (Int, Integer)) m) => MonadBinaryPhaseShift () (PhaseKickbackEstimateT c k m) where

  applyGlobalBinaryPhase k _ | k <= 0 = return ()
  applyGlobalBinaryPhase k m = PhaseKickbackEstimateT $ do
      ctrls <- askCtrls
      unless (null ctrls) $
        memoize (Right (k, m)) $
          if m > 0 then
            let ml = integerToBinary m
                low = take (k - 3) ml
                high = take 3 $ drop (k - 3) ml in
            parallels_ [
              when (k >= 1 && length high >= 3 && high !! 2) $
                negateGlobalPhase,
              when (k >= 2 && length high >= 2 && high !! 1) $
                rotateGlobalPhase90 False,
              when (k >= 3 && length high >= 1 && high !! 0) $
                rotateGlobalPhase45 False,
              subtractor (Seq.replicate k ()) (BitConst <$> low) (BitConst False)]
          else
            let ml = integerToBinary (-m)
                low = take (k - 3) ml
                high = take 3 $ drop (k - 3) ml in
            parallels_ [
              when (k >= 1 && length high >= 3 && high !! 2) $
                negateGlobalPhase,
              when (k >= 2 && length high >= 2 && high !! 1) $
                rotateGlobalPhase90 True,
              when (k >= 3 && length high >= 1 && high !! 0) $
                rotateGlobalPhase45 True,
              adder (Seq.replicate k ()) (BitConst <$> low) (BitConst False)]
  {-# INLINABLE applyGlobalBinaryPhase #-}

  applyBinaryPhaseShift k m
    | n <= 0 =
        return ()
    | n == 1 =
        control (m ! 0) $
          applyGlobalBinaryPhase k 1
    | otherwise = compressCtrls 1 $
        parallels_ [
          when (k >= 1 && n >= k) $
            applyZ (m ! (k - 1)),
          when (k >= 2 && n >= k - 1) $
            applyS (m ! (k - 2)) False,
          when (k >= 3 && n >= k - 2) $
            applyT (m ! (k - 3)) False,
          when (k >= 4) $
            subtractor (Seq.replicate k ()) (Seq.take (k - 3) m) (BitConst False)]
    where
      n = min k (Seq.length m)
  {-# INLINABLE applyBinaryPhaseShift #-}

integerToBinary :: Integer -> [Bool]
integerToBinary 0 = []
integerToBinary m = odd m : integerToBinary (m `div` 2)


text:
<?php

namespace Psalm\Issue;

final class PossiblyInvalidPropertyAssignment extends CodeIssue
{
    public const ERROR_LEVEL = 3;
    public const SHORTCODE = 112;
}


text:
Programming Guide
-----------------

Configure the slider using one of the included block methods. Most of the time
you will probably want to use handleValueChanged:

Basic examples below.

JOESlider Configuration
-----------------------

```
- (void)configureSlider
{
    ViewController *__weak weakSelf = self;

    [self.slider handleValueChanged:^ (int value) {

        ViewController *strongSelf = weakSelf;

        strongSelf.valueLabel.text = [NSString stringWithFormat:@"%d", value];
    }];
}
```

JOEStopSlider Configuration w/ Stop Components
---------------------------------------------

```
- (void)configureStopSlider
{
    self.stopSlider.stopComponents = @[@(0), @(20), @(40), @(60)];

     ViewController *__weak weakSelf = self;

    [self.stopSlider handleValueChanged:^(int value) {

        ViewController *strongSelf = weakSelf;

        strongSelf.valueLabel.text = [NSString stringWithFormat:@"%d", value];
    }];
}
```


text:
namespace syncer {

const char kKeystoreEncryptionTag[] = "keystore_encryption";
const char kKeystoreEncryptionFlag[] = "sync-keystore-encryption";
const char kAutofillCullingTag[] = "autofill_culling";
const char kFaviconSyncTag[] = "favicon_sync";
const char kFaviconSyncFlag[] = "enable-sync-favicons";

// A structure to hold the enable status of experimental sync features.
struct Experiments {
  Experiments() : keystore_encryption(false),
                  autofill_culling(false),
                  favicon_sync(false),
                  favicon_sync_limit(200) {}

  bool Matches(const Experiments& rhs) {
    return (keystore_encryption == rhs.keystore_encryption &&
            autofill_culling == rhs.autofill_culling &&
            favicon_sync == rhs.favicon_sync &&
            favicon_sync_limit == rhs.favicon_sync_limit);
  }

  // Enable keystore encryption logic and the new encryption UI.
  bool keystore_encryption;

  // Enable deletion of expired autofill entries (if autofill sync is enabled).
  bool autofill_culling;

  // Enable the favicons sync datatypes (favicon images and favicon tracking).
  bool favicon_sync;

  // The number of favicons that a client is permitted to sync.
  int favicon_sync_limit;
};

}  // namespace syncer

#endif  // SYNC_UTIL_EXPERIMENTS_


text:
// (C) Copyright 2015 Moodle Pty Ltd.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//     http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

import { Component, ViewChild } from '@angular/core';
import { IonicPage, NavParams } from 'ionic-angular';
import { AddonModSurveyIndexComponent } from '../../components/index/index';

/**
 * Page that displays a survey.
 */
@IonicPage({ segment: 'addon-mod-survey-index' })
@Component({
    selector: 'page-addon-mod-survey-index',
    templateUrl: 'index.html',
})
export class AddonModSurveyIndexPage {
    @ViewChild(AddonModSurveyIndexComponent) surveyComponent: AddonModSurveyIndexComponent;

    title: string;
    module: any;
    courseId: number;

    constructor(navParams: NavParams) {
        this.module = navParams.get('module') || {};
        this.courseId = navParams.get('courseId');
        this.title = this.module.name;
    }

    /**
     * Update some data based on the survey instance.
     *
     * @param survey Survey instance.
     */
    updateData(survey: any): void {
        this.title = survey.name || this.title;
    }
}


text:
package emhs.db.util;

import emhs.db.components.UIElement;

import javax.swing.*;
import java.awt.*;

public class UISurface extends UIElement {
    public UISurface() {
        super();
    }

    public final boolean update(final AWTEvent e, final String eventType, Void b) {
        SwingUtilities.invokeLater(new Runnable() {
            @Override
            public void run() {
                update(e, eventType);
            }
        });

        return false;
    }
}


text:
<UIView backgroundColor="#dddddd">
    <Constraint on="top" with=":topLayoutGuide.bottom"/>
    <Constraint on="width,height,centerX" with=":superview"/>
    <UIView>
        <Constraint on="top"/>
        <Constraint on="width" with=":superview" constant="-30"/>
        <Constraint on="centerX" with=":superview"/>
        <UILabel text="Nick">
            <Constraint on="centerY,left" with=":superview"/>
        </UILabel>
        <UITextField id="nick" backgroundColor="whiteColor"
                     layer.cornerRadius="6"
                     placeholder="Enter your nick">
            <Constraint on="centerY,right" with=":superview"/>
            <Constraint on="height" with=":superview" constant="-20"/>
            <Constraint on="width" with=":superview" constant="-60"/>
        </UITextField>
    </UIView>
    <UIView>
        <Constraint on="top" with=":previous.bottom"/>
        <Constraint on="width" with=":superview" constant="-30"/>
        <Constraint on="centerX" with=":superview"/>
        <UILabel text="Comment">
            <Constraint on="left,top" with=":superview"/>
        </UILabel>
        <UITextView id="comment" backgroundColor="whiteColor"
                    layer.cornerRadius="6">
            <Constraint on="top" with=":previous.bottom" constant="10"/>
            <Constraint on="height" constant="130"/>
            <Constraint on="height" with=":superview" constant="-30"/>
            <Constraint on="width, left" with=":superview"/>
        </UITextView>
    </UIView>

    <UIButton id="submit" backgroundColor="#d0dd00" layer.cornerRadius="4">
        <Constraint on="top" with=":previous.bottom" constant="10"/>
        <Constraint on="width" with=":superview" multiplier=".5" constant="-10"/>
        <Constraint on="left" with=":superview" constant="15"/>
        <title title="Submit"/>
    </UIButton>

    <UIView>
        <Constraint on="top" with=":previous.bottom" constant="10"/>
        <Constraint on="left" with=":superview" constant="15"/>
        <Constraint on="width" with=":superview" constant="-30"/>
        <Constraint on="height" with="#youLikeItLabel" relation="greaterOrEqual"/>
        <UILabel text="Do you like it?" id="youLikeItLabel">
            <Constraint on="top,left" constant="0"/>
        </UILabel>
        <UISwitch tintColor="#f17e00" onTintColor="#f17e00" thumbTintColor="#dd2a1b">
            <Constraint on="centerY" with=":previous"/>
            <Constraint on="right" with=":superview"/>
        </UISwitch>
    </UIView>

</UIView>


text:
#import "NSObject.h"

@class SSSQLiteDatabase, SSSQLiteQueryDescriptor;

@interface SSSQLiteQuery : NSObject
{
    SSSQLiteDatabase *_database;
    SSSQLiteQueryDescriptor *_descriptor;
}

- (id)_newSelectSQLWithProperties:(const id *)arg1 count:(unsigned long long)arg2;
@property(readonly) SSSQLiteQueryDescriptor *queryDescriptor;
- (void)enumeratePersistentIDsAndProperties:(const id *)arg1 count:(unsigned long long)arg2 usingBlock:(id)arg3;
- (void)enumeratePersistentIDsUsingBlock:(id)arg1;
- (void)enumerateMemoryEntitiesWithProperties:(id)arg1 usingBlock:(id)arg2;
- (void)enumerateMemoryEntitiesUsingBlock:(id)arg1;
- (_Bool)deleteAllEntities;
@property(readonly) SSSQLiteDatabase *database;
- (_Bool)createTemporaryTableWithName:(id)arg1 properties:(const id *)arg2 count:(unsigned long long)arg3;
@property(readonly) long long countOfEntities;
- (id)copySelectSQLWithProperties:(const id *)arg1 count:(unsigned long long)arg2;
- (id)copyEntityIdentifiers;
- (void)bindToSelectStatement:(struct sqlite3_stmt *)arg1 bindingIndex:(inout int *)arg2;
- (void)dealloc;
- (id)initWithDatabase:(id)arg1 descriptor:(id)arg2;

@end


text:
class RenameBuildPartResultToBuildPartRun < ActiveRecord::Migration[5.0]
  def self.up
    rename_table :build_part_results, :build_attempts
    rename_column :build_artifacts, :build_part_result_id, :build_attempt_id
  end

  def self.down
    rename_column :build_artifacts, :build_attempt_id, :build_part_result_id
    rename_table :build_attempts, :build_part_results
  end
end


text:
from django import template
from django.template.loader import render_to_string

def create_button(name, url, type='text', input_type="submit"):
    """ return a button dictionary
        ˙
        @param name: name to display
        @param url: target
        @param type: type of button, valid option are 'text' or 'input'
        @param input: type: if type == input, option are 'reset' or 'submit'

        @example:
            >>> from hwm import button.generator

            # create one item
            >>> buttons_list = []
            >>> buttons_list.append(button.generator.create_button('Action1', 'http://www.test.com', 'text'))

    """

    return {'name':name,'url':url, 'type':type}


text:
#include "tclInt.h"

/* Forward declaration */
struct ThreadSpecificData;

/*
 * One of the following structures exists for each asynchronous handler:
 */

typedef struct AsyncHandler {
    int ready;			/* Non-zero means this handler should be
				 * invoked in the next call to
				 * Tcl_AsyncInvoke. */
    struct AsyncHandler *nextPtr;
				/* Next in list of all handlers for the
				 * process. */
    Tcl_AsyncProc *proc;	/* Procedure to call when handler is
				 * invoked. */
    ClientData clientData;	/* Value to pass to handler when it is
				 * invoked. */
    struct ThreadSpecificData *originTsd;
				/* Used in Tcl_AsyncMark to modify thread-
				 * specific data from outside the thread it is
				 * associated to. */
    Tcl_ThreadId originThrdId;	/* Origin thread where this token was created
				 * and where it will be yielded. */
} AsyncHandler;

typedef struct ThreadSpecificData {
    /*
     * The variables below maintain a list of all existing handlers specific
     * to the calling thread.
     */
    AsyncHandler *firstHandler;	/* First handler defined for process, or NULL
				 * if none. */
    AsyncHandler *lastHandler;	/* Last handler or NULL. */
    int asyncReady;		/* This is set to 1 whenever a handler becomes
				 * ready and it is cleared to zero whenever
				 * Tcl_AsyncInvoke is called. It can be
				 * checked elsewhere in the application by
				 * calling Tcl_AsyncReady to see if
				 * Tcl_AsyncInvoke should be invoked. */
    int asyncActive;		/* Indicates whether Tcl_AsyncInvoke is
				 * currently working. If so then we won't set
				 * asyncReady again until Tcl_AsyncInvoke
				 * returns. */
    Tcl_Mutex asyncMutex;	/* Thread-specific AsyncHandler linked-list
				 * lock */
} ThreadSpecificData;
static Tcl_ThreadDataKey dataKey;

/*
 *----------------------------------------------------------------------
 *
 * TclFinalizeAsync --
 *
 *	Finalizes the mutex in the thread local data structure for the async
 *	subsystem.
 *
 * Results:
 *	None.
 *
 * Side effects:
 *	Forgets knowledge of the mutex should it have been created.
 *
 *----------------------------------------------------------------------
 */

void
TclFinalizeAsync(void)
{
    ThreadSpecificData *tsdPtr = TCL_TSD_INIT(&dataKey);

    if (tsdPtr->asyncMutex != NULL) {
	Tcl_MutexFinalize(&tsdPtr->asyncMutex);
    }
}

/*
 *----------------------------------------------------------------------
 *
 * Tcl_AsyncCreate --
 *
 *	This procedure creates the data structures for an asynchronous
 *	handler, so that no memory has to be allocated when the handler is
 *	activated.
 *
 * Results:
 *	The return value is a token for the handler, which can be used to
 *	activate it later on.
 *
 * Side effects:
 *	Information about the handler is recorded.
 *
 *----------------------------------------------------------------------
 */

Tcl_AsyncHandler
Tcl_AsyncCreate(
    Tcl_AsyncProc *proc,	/* Procedure to call when handler is
				 * invoked. */
    ClientData clientData)	/* Argument to pass to handler. */
{
    AsyncHandler *asyncPtr;
    ThreadSpecificData *tsdPtr = TCL_TSD_INIT(&dataKey);

    asyncPtr = (AsyncHandler *) ckalloc(sizeof(AsyncHandler));
    asyncPtr->ready = 0;
    asyncPtr->nextPtr = NULL;
    asyncPtr->proc = proc;
    asyncPtr->clientData = clientData;
    asyncPtr->originTsd = tsdPtr;
    asyncPtr->originThrdId = Tcl_GetCurrentThread();

    Tcl_MutexLock(&tsdPtr->asyncMutex);
    if (tsdPtr->firstHandler == NULL) {
	tsdPtr->firstHandler = asyncPtr;
    } else {
	tsdPtr->lastHandler->nextPtr = asyncPtr;
    }
    tsdPtr->lastHandler = asyncPtr;
    Tcl_MutexUnlock(&tsdPtr->asyncMutex);
    return (Tcl_AsyncHandler) asyncPtr;
}

/*
 *----------------------------------------------------------------------
 *
 * Tcl_AsyncMark --
 *
 *	This procedure is called to request that an asynchronous handler be
 *	invoked as soon as possible. It's typically called from an interrupt
 *	handler, where it isn't safe to do anything that depends on or
 *	modifies application state.
 *
 * Results:
 *	None.
 *
 * Side effects:
 *	The handler gets marked for invocation later.
 *
 *----------------------------------------------------------------------
 */

void
Tcl_AsyncMark(
    Tcl_AsyncHandler async)		/* Token for handler. */
{
    AsyncHandler *token = (AsyncHandler *) async;

    Tcl_MutexLock(&token->originTsd->asyncMutex);
    token->ready = 1;
    if (!token->originTsd->asyncActive) {
	token->originTsd->asyncReady = 1;
	Tcl_ThreadAlert(token->originThrdId);
    }
    Tcl_MutexUnlock(&token->originTsd->asyncMutex);
}

/*
 *----------------------------------------------------------------------
 *
 * Tcl_AsyncInvoke --
 *
 *	This procedure is called at a "safe" time at background level to
 *	invoke any active asynchronous handlers.
 *
 * Results:
 *	The return value is a normal Tcl result, which is intended to replace
 *	the code argument as the current completion code for interp.
 *
 * Side effects:
 *	Depends on the handlers that are active.
 *
 *----------------------------------------------------------------------
 */

int
Tcl_AsyncInvoke(
    Tcl_Interp *interp,		/* If invoked from Tcl_Eval just after
				 * completing a command, points to
				 * interpreter. Otherwise it is NULL. */
    int code)			/* If interp is non-NULL, this gives
				 * completion code from command that just
				 * completed. */
{
    AsyncHandler *asyncPtr;
    ThreadSpecificData *tsdPtr = TCL_TSD_INIT(&dataKey);

    Tcl_MutexLock(&tsdPtr->asyncMutex);

    if (tsdPtr->asyncReady == 0) {
	Tcl_MutexUnlock(&tsdPtr->asyncMutex);
	return code;
    }
    tsdPtr->asyncReady = 0;
    tsdPtr->asyncActive = 1;
    if (interp == NULL) {
	code = 0;
    }

    /*
     * Make one or more passes over the list of handlers, invoking at most one
     * handler in each pass. After invoking a handler, go back to the start of
     * the list again so that (a) if a new higher-priority handler gets marked
     * while executing a lower priority handler, we execute the higher-
     * priority handler next, and (b) if a handler gets deleted during the
     * execution of a handler, then the list structure may change so it isn't
     * safe to continue down the list anyway.
     */

    while (1) {
	for (asyncPtr = tsdPtr->firstHandler; asyncPtr != NULL;
		asyncPtr = asyncPtr->nextPtr) {
	    if (asyncPtr->ready) {
		break;
	    }
	}
	if (asyncPtr == NULL) {
	    break;
	}
	asyncPtr->ready = 0;
	Tcl_MutexUnlock(&tsdPtr->asyncMutex);
	code = (*asyncPtr->proc)(asyncPtr->clientData, interp, code);
	Tcl_MutexLock(&tsdPtr->asyncMutex);
    }
    tsdPtr->asyncActive = 0;
    Tcl_MutexUnlock(&tsdPtr->asyncMutex);
    return code;
}

/*
 *----------------------------------------------------------------------
 *
 * Tcl_AsyncDelete --
 *
 *	Frees up all the state for an asynchronous handler. The handler should
 *	never be used again.
 *
 * Results:
 *	None.
 *
 * Side effects:
 *	The state associated with the handler is deleted.
 *
 *	Failure to locate the handler in current thread private list
 *	of async handlers will result in panic; exception: the list
 *	is already empty (potential trouble?).
 *	Consequently, threads should create and delete handlers
 *	themselves.  I.e. a handler created by one should not be
 *	deleted by some other thread.
 *
 *----------------------------------------------------------------------
 */

void
Tcl_AsyncDelete(
    Tcl_AsyncHandler async)		/* Token for handler to delete. */
{
    ThreadSpecificData *tsdPtr = TCL_TSD_INIT(&dataKey);
    AsyncHandler *asyncPtr = (AsyncHandler *) async;
    AsyncHandler *prevPtr, *thisPtr;

    /*
     * Assure early handling of the constraint
     */

    if (asyncPtr->originThrdId != Tcl_GetCurrentThread()) {
	Tcl_Panic("Tcl_AsyncDelete: async handler deleted by the wrong thread");
    }

    /*
     * If we come to this point when TSD's for the current
     * thread have already been garbage-collected, we are
     * in the _serious_ trouble. OTOH, we tolerate calling
     * with already cleaned-up handler list (should we?).
     */

    Tcl_MutexLock(&tsdPtr->asyncMutex);
    if (tsdPtr->firstHandler != NULL) {
	prevPtr = thisPtr = tsdPtr->firstHandler;
	while (thisPtr != NULL && thisPtr != asyncPtr) {
	    prevPtr = thisPtr;
	    thisPtr = thisPtr->nextPtr;
	}
	if (thisPtr == NULL) {
	    Tcl_Panic("Tcl_AsyncDelete: cannot find async handler");
	}
	if (asyncPtr == tsdPtr->firstHandler) {
	    tsdPtr->firstHandler = asyncPtr->nextPtr;
	} else {
	    prevPtr->nextPtr = asyncPtr->nextPtr;
	}
	if (asyncPtr == tsdPtr->lastHandler) {
	    tsdPtr->lastHandler = prevPtr;
	}
    }
    Tcl_MutexUnlock(&tsdPtr->asyncMutex);
    ckfree((char *) asyncPtr);
}

/*
 *----------------------------------------------------------------------
 *
 * Tcl_AsyncReady --
 *
 *	This procedure can be used to tell whether Tcl_AsyncInvoke needs to be
 *	called. This procedure is the external interface for checking the
 *	thread-specific asyncReady variable.
 *
 * Results:
 *	The return value is 1 whenever a handler is ready and is 0 when no
 *	handlers are ready.
 *
 * Side effects:
 *	None.
 *
 *----------------------------------------------------------------------
 */

int
Tcl_AsyncReady(void)
{
    ThreadSpecificData *tsdPtr = TCL_TSD_INIT(&dataKey);
    return tsdPtr->asyncReady;
}

int *
TclGetAsyncReadyPtr(void)
{
    ThreadSpecificData *tsdPtr = TCL_TSD_INIT(&dataKey);
    return &(tsdPtr->asyncReady);
}

/*
 * Local Variables:
 * mode: c
 * c-basic-offset: 4
 * fill-column: 78
 * End:
 */


text:
@interface REDValidationRuleTests : XCTestCase
@end

@implementation REDValidationRuleTests

#pragma mark - validate:allowDefault

- (void)testRulePassingValidation
{
	REDValidationRule *rule = [REDValidationRule ruleWithBlock:^BOOL(id value) {
		return YES;
	}];
	XCTAssertEqual([rule validate:nil allowDefault:NO], REDValidationResultValid);
}

- (void)testRuleFailingValidation
{
	REDValidationRule *rule = [REDValidationRule ruleWithBlock:^BOOL(id value) {
		return NO;
	}];
	XCTAssertEqual([rule validate:nil allowDefault:NO], REDValidationResultInvalid);
}

- (void)testRuleFailsValidationWithoutABlock
{
	REDValidationRule *rule = [REDValidationRule ruleWithBlock:nil];
	XCTAssertEqual([rule validate:nil allowDefault:NO], REDValidationResultInvalid);
}

- (void)testNetworkRulePassingValidation
{
	XCTestExpectation *validationExpectation = [self expectationWithDescription:@"validated"];
	REDNetworkValidationRule *rule = [REDNetworkValidationRule ruleWithBlock:^NSURLSessionTask *(id value, REDNetworkValidationRuleResultBlock completion) {
		NSURLSessionTask *task = [[NSURLSession sharedSession] dataTaskWithURL:[NSURL URLWithString:@"http://localhost"] completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
			completion(YES, nil);
			[validationExpectation fulfill];
		}];
		[task resume];
		return task;
	}];

	id delegateMock = [OCMockObject niceMockForProtocol:@protocol(REDNetworkValidationRuleDelegate)];
	rule.delegate = delegateMock;
	[[delegateMock expect] validationRule:rule completedNetworkValidationOfUIComponent:nil withResult:REDValidationResultValid error:nil];

	[rule validate:nil allowDefault:NO];

	[self waitForExpectationsWithTimeout:5.0 handler:nil];
	[delegateMock verify];
}

- (void)testNetworkRuleFailingValidation
{
	XCTestExpectation *validationExpectation = [self expectationWithDescription:@"validated"];
	REDNetworkValidationRule *rule = [REDNetworkValidationRule ruleWithBlock:^NSURLSessionTask *(id value, REDNetworkValidationRuleResultBlock completion) {
		NSURLSessionTask *task = [[NSURLSession sharedSession] dataTaskWithURL:[NSURL URLWithString:@"http://localhost"] completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
			completion(NO, nil);
			[validationExpectation fulfill];
		}];
		[task resume];
		return task;
	}];

	id delegateMock = [OCMockObject niceMockForProtocol:@protocol(REDNetworkValidationRuleDelegate)];
	rule.delegate = delegateMock;
	[[delegateMock expect] validationRule:rule completedNetworkValidationOfUIComponent:nil withResult:REDValidationResultInvalid error:nil];

	[rule validate:nil allowDefault:NO];

	[self waitForExpectationsWithTimeout:5.0 handler:nil];
	[delegateMock verify];
}

- (void)testNetworkRuleIsPendingUntilCompletionIsCalled
{
	XCTestExpectation *validationExpectation = [self expectationWithDescription:@"validated"];
	REDNetworkValidationRule *rule = [REDNetworkValidationRule ruleWithBlock:^NSURLSessionTask *(id value, REDNetworkValidationRuleResultBlock completion) {
		NSURLSessionTask *task = [[NSURLSession sharedSession] dataTaskWithURL:[NSURL URLWithString:@"http://localhost"] completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
			completion(YES, nil);
			[validationExpectation fulfill];
		}];
		[task resume];
		return task;
	}];

	XCTAssertEqual([rule validate:nil allowDefault:NO], REDValidationResultPending, @"Validation should be pending until completion is called");
	[self waitForExpectationsWithTimeout:5.0 handler:nil];
}

- (void)testNetworkRuleFailsValidationWithoutABlock
{
	REDNetworkValidationRule *rule = [REDNetworkValidationRule ruleWithBlock:nil];
	XCTAssertEqual([rule validate:nil allowDefault:NO], REDValidationResultInvalid);
}

- (void)testValidateReturnsDefaultValidIfValidationAllowsDefaultAndValueIsDefault
{
	id<REDValidationRuleType> rule = [REDValidationRule ruleWithBlock:^BOOL(id value) {
		return YES;
	}];

	UITextField *textField = [UITextField new];

	XCTAssertEqual([rule validate:textField allowDefault:YES], REDValidationResultDefaultValid, @"Validation should not have run since validated value is default value and rule allows default");
}

- (void)testValidateRunsValidationIfValidationAllowsDefaultAndValueIsNotDefault
{
	REDValidationRule *rule = [REDValidationRule ruleWithBlock:^BOOL(id value) {
		return YES;
	}];

	UITextField *textField = [UITextField new];
	textField.text = @"test";

	XCTAssertEqual([rule validate:textField allowDefault:YES], REDValidationResultValid, @"Validation should have run and passed");
}

- (void)testValidateReturnsDefaultValidIfNetworkValidationAllowsDefaultAndValueIsDefault
{
	REDNetworkValidationRule *rule = [REDNetworkValidationRule ruleWithBlock:^NSURLSessionTask *(id value, REDNetworkValidationRuleResultBlock completion) {
		NSURLSessionTask *task = [[NSURLSession sharedSession] dataTaskWithURL:[NSURL URLWithString:@"http://localhost"] completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
			completion(YES, nil);
		}];
		[task resume];
		return task;
	}];

	UITextField *textField = [UITextField new];

	XCTAssertEqual([rule validate:textField allowDefault:YES], REDValidationResultDefaultValid, @"Validation should not have run since validated value is default value and rule allows default");
}

- (void)testValidateNotifiesDelegateIfNetworkValidationAllowsDefaultAndValueIsDefault
{
	REDNetworkValidationRule *rule = [REDNetworkValidationRule ruleWithBlock:^NSURLSessionTask *(id value, REDNetworkValidationRuleResultBlock completion) {
		NSURLSessionTask *task = [[NSURLSession sharedSession] dataTaskWithURL:[NSURL URLWithString:@"http://localhost"] completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
			completion(YES, nil);
		}];
		[task resume];
		return task;
	}];

	UITextField *textField = [UITextField new];

	id delegateMock = [OCMockObject niceMockForProtocol:@protocol(REDNetworkValidationRuleDelegate)];
	rule.delegate = delegateMock;
	[[delegateMock expect] validationRule:rule completedNetworkValidationOfUIComponent:textField withResult:REDValidationResultDefaultValid error:nil];

	[rule validate:textField allowDefault:YES];

	[delegateMock verify];
}

- (void)testValidateRunsValidationIfNetworkValidationAllowsDefaultAndValueIsNotDefault
{
	XCTestExpectation *validationExpectation = [self expectationWithDescription:@"validated"];
	REDNetworkValidationRule *rule = [REDNetworkValidationRule ruleWithBlock:^NSURLSessionTask *(id value, REDNetworkValidationRuleResultBlock completion) {
		NSURLSessionTask *task = [[NSURLSession sharedSession] dataTaskWithURL:[NSURL URLWithString:@"http://localhost"] completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
			completion(YES, nil);
			[validationExpectation fulfill];
		}];
		[task resume];
		return task;
	}];

	UITextField *textField = [UITextField new];
	textField.text = @"test";

	id delegateMock = [OCMockObject niceMockForProtocol:@protocol(REDNetworkValidationRuleDelegate)];
	rule.delegate = delegateMock;
	[[delegateMock expect] validationRule:rule completedNetworkValidationOfUIComponent:textField withResult:REDValidationResultValid error:nil];

	[rule validate:textField allowDefault:YES];

	[self waitForExpectationsWithTimeout:5.0 handler:nil];
	[delegateMock verify];
}

@end


text:
describe('spiceApi', function() {
  var mockFirebaseArray, mockFirebaseRef, mockQ, mockAuthService, spiceApiObj;

  //load module
  beforeEach(function() {
    module('allSpiceApp');
  });

  //set up mock service object
  beforeEach(inject(function(spiceApi) {
    spiceApiObj = spiceApi;
  }))

  it('should define methods', function() {
    expect(spiceApiObj.getAll).toBeDefined();
    expect(spiceApiObj.getAll).toEqual(jasmine.any(Function));
  });

  it('getObj should return null', function() {
    expect(spiceApiObj.getObj()).toBeNull();
  });

  it('getObj should return an object after setting', function() {
    spiceApiObj.setObj({});
    expect(spiceApiObj.getObj()).not.toBeNull();
    expect(spiceApiObj.getObj()).toEqual(jasmine.any(Object));
  });

  it('filter should return true if matched', function () {
    var item = { user: { uid: 'user1', name: ''}, name: 'name', description: '', ingredients: '', tags: '', directions: '' };

    expect(spiceApiObj.filter(item)).toEqual(true);
    expect(spiceApiObj.filter(item,'user1')).toEqual(true);
    expect(spiceApiObj.filter(item,'user2', 'name')).toEqual(true);
    expect(spiceApiObj.filter(item,'user2', 'NAME')).toEqual(true);

    expect(spiceApiObj.filter(item,'user2')).toEqual(false);
    expect(spiceApiObj.filter(item,'user2', 'false')).toEqual(false);

    item.pinnedUsers = { user3: true };
    expect(spiceApiObj.filter(item,'user3')).toEqual(true);
  });
});


text:
<?xml version="1.0" encoding="UTF-8"?>

<!--
  ~ Licensed under the Apache License, Version 2.0 (the "License");
  ~ you may not use this file except in compliance with the License.
  ~ You may obtain a copy of the License at
  ~
  ~       http://www.apache.org/licenses/LICENSE-2.0
  ~
  ~ Unless required by applicable law or agreed to in writing, software
  ~ distributed under the License is distributed on an "AS IS" BASIS,
  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  ~ See the License for the specific language governing permissions and
  ~ limitations under the License.
  ~
  ~ Adapted from sources of Activiti 5.22 by mederly.
  ~ Portions Copyright (c) 2010-2017 Evolveum
  -->

<!DOCTYPE configuration PUBLIC "-//mybatis.org//DTD Config 3.0//EN" "http://mybatis.org/dtd/mybatis-3-config.dtd">

<configuration>
  <settings>
    <setting name="lazyLoadingEnabled" value="false" />
  </settings>
  <typeAliases>
    <typeAlias type="org.activiti.engine.impl.persistence.ByteArrayRefTypeHandler" alias="ByteArrayRefTypeHandler"/>
  </typeAliases>
  <typeHandlers>
    <typeHandler handler="ByteArrayRefTypeHandler"
                 javaType="org.activiti.engine.impl.persistence.entity.ByteArrayRef"
                 jdbcType="VARCHAR"/>
  </typeHandlers>
  <mappers>
    <mapper resource="org/activiti/db/mapping/entity/Attachment.xml" />
    <mapper resource="org/activiti/db/mapping/entity/ByteArray.xml" />
    <mapper resource="org/activiti/db/mapping/entity/Comment.xml" />
    <mapper resource="org/activiti/db/mapping/entity/Deployment.xml" />
    <mapper resource="org/activiti/db/mapping/entity/Execution.xml" />
    <mapper resource="org/activiti/db/mapping/entity/Group.xml" />
    <mapper resource="org/activiti/db/mapping/entity/HistoricActivityInstance.xml" />
    <mapper resource="org/activiti/db/mapping/entity/HistoricDetail.xml" />
    <mapper resource="org/activiti/db/mapping/entity/HistoricProcessInstance.xml" />
    <mapper resource="org/activiti/db/mapping/entity/HistoricVariableInstance.xml" />
    <mapper resource="org/activiti/db/mapping/entity/HistoricTaskInstance.xml" />
    <mapper resource="org/activiti/db/mapping/entity/HistoricIdentityLink.xml" />
    <mapper resource="org/activiti/db/mapping/entity/IdentityInfo.xml" />
    <mapper resource="org/activiti/db/mapping/entity/IdentityLink.xml" />
    <mapper resource="org/activiti/db/mapping/entity/Job.xml" />
    <mapper resource="org/activiti/db/mapping/entity/Membership.xml" />
    <mapper resource="org/activiti/db/mapping/entity/Model.xml" />
    <mapper resource="org/activiti/db/mapping/entity/ProcessDefinition.xml" />
    <mapper resource="org/activiti/db/mapping/entity/ProcessDefinitionInfo.xml" />
    <mapper resource="org/activiti/db/mapping/entity/Property.xml" />
    <mapper resource="org/activiti/db/mapping/entity/Resource.xml" />
    <mapper resource="org/activiti/db/mapping/entity/TableData.xml" />
    <mapper resource="mybatis/Task.xml" />
    <mapper resource="org/activiti/db/mapping/entity/User.xml" />
    <mapper resource="org/activiti/db/mapping/entity/VariableInstance.xml" />
    <mapper resource="org/activiti/db/mapping/entity/EventSubscription.xml" />
    <mapper resource="org/activiti/db/mapping/entity/EventLogEntry.xml" />
  </mappers>
</configuration>


text:
"""Supports checking WebKit style in png files."""

from webkitpy.common import read_checksum_from_png
from webkitpy.common.system.systemhost import SystemHost
from webkitpy.common.checkout.scm.detection import SCMDetector

class PNGChecker(object):
    """Check svn:mime-type for checking style"""

    categories = set(['image/png'])

    def __init__(self, file_path, handle_style_error, host=None):
        self._file_path = file_path
        self._handle_style_error = handle_style_error
        self._host = host or SystemHost()
        self._fs = self._host.filesystem

    def check(self, inline=None):
        if self._fs.exists(self._file_path) and self._file_path.endswith("-expected.png"):
            with self._fs.open_binary_file_for_reading(self._file_path) as filehandle:
                if not read_checksum_from_png.read_checksum(filehandle):
                    self._handle_style_error(
                        0, 'image/png', 5, "Image lacks a checksum. Generate pngs using run-webkit-tests to ensure they have a checksum.")


text:
Exercise 1
---

Take in a number from the user (between -50 and 50) then output between which multiples of 10 the number is between and whether it is positive or negative.
If the number is 0, simply output that the number was 0.
If the number is a multiple of 10, output that the number was a positive/negative multiple of 10.
If the number is not between -50 and 50, inclusive, then do nothing.

Example 1:

> Enter a number: **-37**

> Your number is negative and between -30 and -40

Example 2:

> Enter a number: **40**

> Your number is a positive multiple of 10

Example 3:

> Enter a number: **0**

> Your number is 0

Exercise 2
---

Take in a 5-character word from the user.

Then, convert the "word" to proper capitalization (first letter is capitalized, and the rest lowercase).

Example:

> Enter a 5-letter word: **hElLo**

> Your word is Hello.

Exercise 3
---

Get a character from the user, and display its integer equivalent.
If it is a letter, print the opposite case.
Additionally, print the integer equivqalent of the opposite case if applicable.

Example:

> Enter a character: **c**

> 'c' in decimal is 99.

> 'C' in decimal is 67.

> Enter a character: **=**

> '=' in decimal is 61.

Exercise 4
---
Create a password guessing game where a user attempts to break your passcode based on hints.
Using 4 integers, decide the relationship (less than, greather than, equal to, twice as much, etc)
between any number of your integers. These relationships is what defines your passcode.
For example, my passcode could be:
num1 has to be greather than num2, num2 has to be less than num3 and num3 has to be equal to num4.
The user is then prompted to enter 4 numbers and told whether each number fits your specifications
or does not. A message is then prompted saying whether the user failed or succeeded.

Example:
> Enter 4 numbers: **12, 2, 600, 4**

> The first number looks good!

> The second number looks good!

> The third number needs some fixing...

> The fourth number needs some fixing...

> Sorry you didn't break the code!

> Enter 4 numbers: **12, 2, 6, 3**

> The first number looks good!

> The second number looks good!

> The third number looks good!

> The fourth looks good!

> Congrats! You broke the code! :)

(Challenge: Instead of integers, use floating point numbers)

*pssst SI Leaders, this is a helpful example to slowly introduce loops if you'd like.
The program does not have to terminate after every attempt, keep it going with a while.*

Quiz!
---
[quiz03](https://docs.google.com/a/ucr.edu/forms/d/e/1FAIpQLSdhx0KAG771b-4_UUHiabldZcYEWCgXnaOZXZNJzyMryMbb0w/viewform)


text:
package org.assertj.core.error;

import static java.lang.String.format;
import static org.assertj.core.api.BDDAssertions.then;
import static org.assertj.core.api.BDDAssertions.thenIllegalArgumentException;
import static org.assertj.core.error.ShouldBeSorted.shouldBeSorted;
import static org.assertj.core.util.Arrays.array;

import org.assertj.core.internal.TestDescription;
import org.assertj.core.presentation.StandardRepresentation;
import org.junit.jupiter.api.Test;

/**
 * Tests for <code>{@link ShouldBeSorted#create(org.assertj.core.description.Description, org.assertj.core.presentation.Representation)}</code>.
 *
 * @author Joel Costigliola
 */
class ShouldBeSorted_create_Test {

  @Test
  void should_create_error_message() {
    // GIVEN
    ErrorMessageFactory factory = shouldBeSorted(1, array("b", "c", "a"));
    // WHEN
    String message = factory.create(new TestDescription("Test"), new StandardRepresentation());
    // THEN
    then(message).isEqualTo(format("[Test] %ngroup is not sorted because element 1:%n  \"c\"%nis not less or equal than element 2:%n  \"a\"%ngroup was:%n  [\"b\", \"c\", \"a\"]"));
  }

  @Test
  void should_fail_if_object_parameter_is_not_an_array() {
    thenIllegalArgumentException().isThrownBy(() -> shouldBeSorted(1, "not an array"));
  }
}


text:
package com.jess.arms.utils;

import android.annotation.TargetApi;
import android.app.Activity;
import android.content.Context;
import android.graphics.Color;
import android.os.Build;
import android.support.annotation.ColorInt;
import android.support.v4.widget.DrawerLayout;
import android.view.View;
import android.view.ViewGroup;
import android.view.WindowManager;
import android.widget.LinearLayout;

import com.jess.arms.widget.StatusBarView;

import static com.jess.arms.utils.UiUtils.getColor;

/**
 * ============================================================
 * 版权: xx有限公司 版权所有(c)2016
 *

 * 作者:Loofer
 * 版本:1.0
 * 创建日期 :2016/12/29 22:17.
 * 描述: 完善沉浸式状态栏
 *

 * 注:如果您修改了本类请填写以下内容作为记录,如非本人操作劳烦通知,谢谢!!!
 * Modified Date Modify Content:
 *

 * ==========================================================
 */

public class StatusBarUtil {

    public static final int DEFAULT_STATUS_BAR_ALPHA = 0;

    /**
     * 设置状态栏颜色
     *
     * @param activity 需要设置的 activity
     * @param color    状态栏颜色值
     */
    public static void setColor(Activity activity, Object color) {
        if (color instanceof String) {// "#666666"
            setColor(activity, Color.parseColor((String) color), DEFAULT_STATUS_BAR_ALPHA);
        } else if (color instanceof Integer) {
            if ((Integer) color > 0)// R.string.app_color
                setColor(activity, getColor(Integer.parseInt(color.toString())), DEFAULT_STATUS_BAR_ALPHA);
        } else throw new IllegalStateException("The current color is not found");
    }

    /**
     * 设置状态栏颜色
     *
     * @param activity       需要设置的activity
     * @param color          状态栏颜色值
     * @param statusBarAlpha 状态栏透明度
     */

    public static void setColor(Activity activity, @ColorInt int color, int statusBarAlpha) {
        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
            activity.getWindow().addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS);
            activity.getWindow().clearFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);
            activity.getWindow().setStatusBarColor(calculateStatusColor(color, statusBarAlpha));
        } else if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
            activity.getWindow().addFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);
            ViewGroup decorView = (ViewGroup) activity.getWindow().getDecorView();
            int count = decorView.getChildCount();
            if (count > 0 && decorView.getChildAt(count - 1) instanceof StatusBarView) {
                decorView.getChildAt(count - 1).setBackgroundColor(calculateStatusColor(color, statusBarAlpha));
            } else {
                StatusBarView statusView = createStatusBarView(activity, color, statusBarAlpha);
                decorView.addView(statusView);
            }
            setRootView(activity);
        }
    }

    /**
     * 为滑动返回界面设置状态栏颜色
     *
     * @param activity 需要设置的activity
     * @param color    状态栏颜色值
     */
    public static void setColorForSwipeBack(Activity activity, int color) {
        setColorForSwipeBack(activity, color, DEFAULT_STATUS_BAR_ALPHA);
    }

    /**
     * 为滑动返回界面设置状态栏颜色
     *
     * @param activity       需要设置的activity
     * @param color          状态栏颜色值
     * @param statusBarAlpha 状态栏透明度
     */
    public static void setColorForSwipeBack(Activity activity, @ColorInt int color, int statusBarAlpha) {
        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
            ViewGroup contentView = ((ViewGroup) activity.findViewById(android.R.id.content));
            contentView.setPadding(0, getStatusBarHeight(activity), 0, 0);
            contentView.setBackgroundColor(calculateStatusColor(color, statusBarAlpha));
            setTransparentForWindow(activity);
        }
    }

    /**
     * 设置状态栏纯色 不加半透明效果
     *
     * @param activity 需要设置的 activity
     * @param color    状态栏颜色值
     */
    public static void setColorNoTranslucent(Activity activity, @ColorInt int color) {
        setColor(activity, color, 0);
    }

    /**
     * 设置状态栏颜色(5.0以下无半透明效果,不建议使用)
     *
     * @param activity 需要设置的 activity
     * @param color    状态栏颜色值
     */
    @Deprecated
    public static void setColorDiff(Activity activity, @ColorInt int color) {
        if (Build.VERSION.SDK_INT < Build.VERSION_CODES.KITKAT) {
            return;
        }
        transparentStatusBar(activity);
        ViewGroup contentView = (ViewGroup) activity.findViewById(android.R.id.content);
        // 移除半透明矩形,以免叠加
        if (contentView.getChildCount() > 1) {
            contentView.getChildAt(1).setBackgroundColor(color);
        } else {
            contentView.addView(createStatusBarView(activity, color));
        }
        setRootView(activity);
    }

    /**
     * 使状态栏半透明
     *

     * 适用于图片作为背景的界面,此时需要图片填充到状态栏
     *
     * @param activity 需要设置的activity
     */
    public static void setTranslucent(Activity activity) {
        setTranslucent(activity, DEFAULT_STATUS_BAR_ALPHA);
    }

    /**
     * 使状态栏半透明
     *

     * 适用于图片作为背景的界面,此时需要图片填充到状态栏
     *
     * @param activity       需要设置的activity
     * @param statusBarAlpha 状态栏透明度
     */
    public static void setTranslucent(Activity activity, int statusBarAlpha) {
        if (Build.VERSION.SDK_INT < Build.VERSION_CODES.KITKAT) {
            return;
        }
        setTransparent(activity);
        addTranslucentView(activity, statusBarAlpha);
    }

    /**
     * 针对根布局是 CoordinatorLayout, 使状态栏半透明
     *

     * 适用于图片作为背景的界面,此时需要图片填充到状态栏
     *
     * @param activity       需要设置的activity
     * @param statusBarAlpha 状态栏透明度
     */
    public static void setTranslucentForCoordinatorLayout(Activity activity, int statusBarAlpha) {
        if (Build.VERSION.SDK_INT < Build.VERSION_CODES.KITKAT) {
            return;
        }
        transparentStatusBar(activity);
        addTranslucentView(activity, statusBarAlpha);
    }

    /**
     * 设置状态栏全透明
     *
     * @param activity 需要设置的activity
     */
    public static void setTransparent(Activity activity) {
        if (Build.VERSION.SDK_INT < Build.VERSION_CODES.KITKAT) {
            return;
        }
        transparentStatusBar(activity);
        setRootView(activity);
    }

    /**
     * 使状态栏透明(5.0以上半透明效果,不建议使用)
     *

     * 适用于图片作为背景的界面,此时需要图片填充到状态栏
     *
     * @param activity 需要设置的activity
     */
    @Deprecated
    public static void setTranslucentDiff(Activity activity) {
        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
            // 设置状态栏透明
            activity.getWindow().addFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);
            setRootView(activity);
        }
    }

    /**
     * 为DrawerLayout 布局设置状态栏变色
     *
     * @param activity     需要设置的activity
     * @param drawerLayout DrawerLayout
     * @param color        状态栏颜色值
     */
    public static void setColorForDrawerLayout(Activity activity, DrawerLayout drawerLayout, @ColorInt int color) {
        setColorForDrawerLayout(activity, drawerLayout, color, DEFAULT_STATUS_BAR_ALPHA);
    }

    /**
     * 为DrawerLayout 布局设置状态栏颜色,纯色
     *
     * @param activity     需要设置的activity
     * @param drawerLayout DrawerLayout
     * @param color        状态栏颜色值
     */
    public static void setColorNoTranslucentForDrawerLayout(Activity activity, DrawerLayout drawerLayout, @ColorInt int color) {
        setColorForDrawerLayout(activity, drawerLayout, color, 0);
    }

    /**
     * 为DrawerLayout 布局设置状态栏变色
     *
     * @param activity       需要设置的activity
     * @param drawerLayout   DrawerLayout
     * @param color          状态栏颜色值
     * @param statusBarAlpha 状态栏透明度
     */
    public static void setColorForDrawerLayout(Activity activity, DrawerLayout drawerLayout, @ColorInt int color,
                                               int statusBarAlpha) {
        if (Build.VERSION.SDK_INT < Build.VERSION_CODES.KITKAT) {
            return;
        }
        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
            activity.getWindow().addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS);
            activity.getWindow().clearFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);
            activity.getWindow().setStatusBarColor(Color.TRANSPARENT);
        } else {
            activity.getWindow().addFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);
        }
        // 生成一个状态栏大小的矩形
        // 添加 statusBarView 到布局中
        ViewGroup contentLayout = (ViewGroup) drawerLayout.getChildAt(0);
        if (contentLayout.getChildCount() > 0 && contentLayout.getChildAt(0) instanceof StatusBarView) {
            contentLayout.getChildAt(0).setBackgroundColor(color);
        } else {
            StatusBarView statusBarView = createStatusBarView(activity, color);
            contentLayout.addView(statusBarView, 0);
        }
        // 内容布局不是 LinearLayout 时,设置padding top
        if (!(contentLayout instanceof LinearLayout) && contentLayout.getChildAt(1) != null) {
            contentLayout.getChildAt(1)
                    .setPadding(contentLayout.getPaddingLeft(), getStatusBarHeight(activity) + contentLayout.getPaddingTop(),
                            contentLayout.getPaddingRight(), contentLayout.getPaddingBottom());
        }
        // 设置属性
        setDrawerLayoutProperty(drawerLayout, contentLayout);
        addTranslucentView(activity, statusBarAlpha);
    }

    /**
     * 设置 DrawerLayout 属性
     *
     * @param drawerLayout              DrawerLayout
     * @param drawerLayoutContentLayout DrawerLayout 的内容布局
     */
    private static void setDrawerLayoutProperty(DrawerLayout drawerLayout, ViewGroup drawerLayoutContentLayout) {
        ViewGroup drawer = (ViewGroup) drawerLayout.getChildAt(1);
        drawerLayout.setFitsSystemWindows(false);
        drawerLayoutContentLayout.setFitsSystemWindows(false);
        drawerLayoutContentLayout.setClipToPadding(true);
        drawer.setFitsSystemWindows(false);
    }

    /**
     * 为DrawerLayout 布局设置状态栏变色(5.0以下无半透明效果,不建议使用)
     *
     * @param activity     需要设置的activity
     * @param drawerLayout DrawerLayout
     * @param color        状态栏颜色值
     */
    @Deprecated
    public static void setColorForDrawerLayoutDiff(Activity activity, DrawerLayout drawerLayout, @ColorInt int color) {
        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
            activity.getWindow().addFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);
            // 生成一个状态栏大小的矩形
            ViewGroup contentLayout = (ViewGroup) drawerLayout.getChildAt(0);
            if (contentLayout.getChildCount() > 0 && contentLayout.getChildAt(0) instanceof StatusBarView) {
                contentLayout.getChildAt(0).setBackgroundColor(calculateStatusColor(color, DEFAULT_STATUS_BAR_ALPHA));
            } else {
                // 添加 statusBarView 到布局中
                StatusBarView statusBarView = createStatusBarView(activity, color);
                contentLayout.addView(statusBarView, 0);
            }
            // 内容布局不是 LinearLayout 时,设置padding top
            if (!(contentLayout instanceof LinearLayout) && contentLayout.getChildAt(1) != null) {
                contentLayout.getChildAt(1).setPadding(0, getStatusBarHeight(activity), 0, 0);
            }
            // 设置属性
            setDrawerLayoutProperty(drawerLayout, contentLayout);
        }
    }

    /**
     * 为 DrawerLayout 布局设置状态栏透明
     *
     * @param activity     需要设置的activity
     * @param drawerLayout DrawerLayout
     */
    public static void setTranslucentForDrawerLayout(Activity activity, DrawerLayout drawerLayout) {
        setTranslucentForDrawerLayout(activity, drawerLayout, DEFAULT_STATUS_BAR_ALPHA);
    }

    /**
     * 为 DrawerLayout 布局设置状态栏透明
     *
     * @param activity     需要设置的activity
     * @param drawerLayout DrawerLayout
     */
    public static void setTranslucentForDrawerLayout(Activity activity, DrawerLayout drawerLayout, int statusBarAlpha) {
        if (Build.VERSION.SDK_INT < Build.VERSION_CODES.KITKAT) {
            return;
        }
        setTransparentForDrawerLayout(activity, drawerLayout);
        addTranslucentView(activity, statusBarAlpha);
    }

    /**
     * 为 DrawerLayout 布局设置状态栏透明
     *
     * @param activity     需要设置的activity
     * @param drawerLayout DrawerLayout
     */
    public static void setTransparentForDrawerLayout(Activity activity, DrawerLayout drawerLayout) {
        if (Build.VERSION.SDK_INT < Build.VERSION_CODES.KITKAT) {
            return;
        }
        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
            activity.getWindow().addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS);
            activity.getWindow().clearFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);
            activity.getWindow().setStatusBarColor(Color.TRANSPARENT);
        } else {
            activity.getWindow().addFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);
        }

        ViewGroup contentLayout = (ViewGroup) drawerLayout.getChildAt(0);
        // 内容布局不是 LinearLayout 时,设置padding top
        if (!(contentLayout instanceof LinearLayout) && contentLayout.getChildAt(1) != null) {
            contentLayout.getChildAt(1).setPadding(0, getStatusBarHeight(activity), 0, 0);
        }

        // 设置属性
        setDrawerLayoutProperty(drawerLayout, contentLayout);
    }

    /**
     * 为 DrawerLayout 布局设置状态栏透明(5.0以上半透明效果,不建议使用)
     *
     * @param activity     需要设置的activity
     * @param drawerLayout DrawerLayout
     */
    @Deprecated
    public static void setTranslucentForDrawerLayoutDiff(Activity activity, DrawerLayout drawerLayout) {
        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
            // 设置状态栏透明
            activity.getWindow().addFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);
            // 设置内容布局属性
            ViewGroup contentLayout = (ViewGroup) drawerLayout.getChildAt(0);
            contentLayout.setFitsSystemWindows(true);
            contentLayout.setClipToPadding(true);
            // 设置抽屉布局属性
            ViewGroup vg = (ViewGroup) drawerLayout.getChildAt(1);
            vg.setFitsSystemWindows(false);
            // 设置 DrawerLayout 属性
            drawerLayout.setFitsSystemWindows(false);
        }
    }

    /**
     * 为头部是 ImageView 的界面设置状态栏全透明
     *
     * @param activity       需要设置的activity
     * @param needOffsetView 需要向下偏移的 View
     */
    public static void setTransparentForImageView(Activity activity, View needOffsetView) {
        setTranslucentForImageView(activity, 0, needOffsetView);
    }

    /**
     * 为头部是 ImageView 的界面设置状态栏透明(使用默认透明度)
     *
     * @param activity       需要设置的activity
     * @param needOffsetView 需要向下偏移的 View
     */
    public static void setTranslucentForImageView(Activity activity, View needOffsetView) {
        setTranslucentForImageView(activity, DEFAULT_STATUS_BAR_ALPHA, needOffsetView);
    }

    /**
     * 为头部是 ImageView 的界面设置状态栏透明
     *
     * @param activity       需要设置的activity
     * @param statusBarAlpha 状态栏透明度
     * @param needOffsetView 需要向下偏移的 View
     */
    public static void setTranslucentForImageView(Activity activity, int statusBarAlpha, View needOffsetView) {
        if (Build.VERSION.SDK_INT < Build.VERSION_CODES.KITKAT) {
            return;
        }
        setTransparentForWindow(activity);
        addTranslucentView(activity, statusBarAlpha);
        if (needOffsetView != null) {
            ViewGroup.MarginLayoutParams layoutParams = (ViewGroup.MarginLayoutParams) needOffsetView.getLayoutParams();
            layoutParams.setMargins(layoutParams.leftMargin, layoutParams.topMargin + getStatusBarHeight(activity),
                    layoutParams.rightMargin, layoutParams.bottomMargin);
        }
    }

    /**
     * 为 fragment 头部是 ImageView 的设置状态栏透明
     *
     * @param activity       fragment 对应的 activity
     * @param needOffsetView 需要向下偏移的 View
     */
    public static void setTranslucentForImageViewInFragment(Activity activity, View needOffsetView) {
        setTranslucentForImageViewInFragment(activity, DEFAULT_STATUS_BAR_ALPHA, needOffsetView);
    }

    /**
     * 为 fragment 头部是 ImageView 的设置状态栏透明
     *
     * @param activity       fragment 对应的 activity
     * @param needOffsetView 需要向下偏移的 View
     */
    public static void setTransparentForImageViewInFragment(Activity activity, View needOffsetView) {
        setTranslucentForImageViewInFragment(activity, 0, needOffsetView);
    }

    /**
     * 为 fragment 头部是 ImageView 的设置状态栏透明
     *
     * @param activity       fragment 对应的 activity
     * @param statusBarAlpha 状态栏透明度
     * @param needOffsetView 需要向下偏移的 View
     */
    public static void setTranslucentForImageViewInFragment(Activity activity, int statusBarAlpha, View needOffsetView) {
        setTranslucentForImageView(activity, statusBarAlpha, needOffsetView);
        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT && Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP) {
            clearPreviousSetting(activity);
        }
    }

    ///////////////////////////////////////////////////////////////////////////////////

    @TargetApi(Build.VERSION_CODES.KITKAT)
    private static void clearPreviousSetting(Activity activity) {
        ViewGroup decorView = (ViewGroup) activity.getWindow().getDecorView();
        int count = decorView.getChildCount();
        if (count > 0 && decorView.getChildAt(count - 1) instanceof StatusBarView) {
            decorView.removeViewAt(count - 1);
            ViewGroup rootView = (ViewGroup) ((ViewGroup) activity.findViewById(android.R.id.content)).getChildAt(0);
            rootView.setPadding(0, 0, 0, 0);
        }
    }

    /**
     * 添加半透明矩形条
     *
     * @param activity       需要设置的 activity
     * @param statusBarAlpha 透明值
     */
    private static void addTranslucentView(Activity activity, int statusBarAlpha) {
        ViewGroup contentView = (ViewGroup) activity.findViewById(android.R.id.content);
        if (contentView.getChildCount() > 1) {
            contentView.getChildAt(1).setBackgroundColor(Color.argb(statusBarAlpha, 0, 0, 0));
        } else {
            contentView.addView(createTranslucentStatusBarView(activity, statusBarAlpha));
        }
    }

    /**
     * 生成一个和状态栏大小相同的彩色矩形条
     *
     * @param activity 需要设置的 activity
     * @param color    状态栏颜色值
     * @return 状态栏矩形条
     */
    private static StatusBarView createStatusBarView(Activity activity, @ColorInt int color) {
        // 绘制一个和状态栏一样高的矩形
        StatusBarView statusBarView = new StatusBarView(activity);
        LinearLayout.LayoutParams params =
                new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, getStatusBarHeight(activity));
        statusBarView.setLayoutParams(params);
        statusBarView.setBackgroundColor(color);
        return statusBarView;
    }

    /**
     * 生成一个和状态栏大小相同的半透明矩形条
     *
     * @param activity 需要设置的activity
     * @param color    状态栏颜色值
     * @param alpha    透明值
     * @return 状态栏矩形条
     */
    private static StatusBarView createStatusBarView(Activity activity, @ColorInt int color, int alpha) {
        // 绘制一个和状态栏一样高的矩形
        StatusBarView statusBarView = new StatusBarView(activity);
        LinearLayout.LayoutParams params =
                new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, getStatusBarHeight(activity));
        statusBarView.setLayoutParams(params);
        statusBarView.setBackgroundColor(calculateStatusColor(color, alpha));
        return statusBarView;
    }

    /**
     * 设置根布局参数
     */
    private static void setRootView(Activity activity) {
        ViewGroup parent = (ViewGroup) activity.findViewById(android.R.id.content);
        for (int i = 0, count = parent.getChildCount(); i < count; i++) {
            View childView = parent.getChildAt(i);
            if (childView instanceof ViewGroup) {
                childView.setFitsSystemWindows(true);
                ((ViewGroup) childView).setClipToPadding(true);
            }
        }
    }

    /**
     * 设置透明
     */
    private static void setTransparentForWindow(Activity activity) {
        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
            activity.getWindow().setStatusBarColor(Color.TRANSPARENT);
            activity.getWindow()
                    .getDecorView()
                    .setSystemUiVisibility(View.SYSTEM_UI_FLAG_LAYOUT_STABLE | View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN);
        } else if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
            activity.getWindow()
                    .setFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS, WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);
        }
    }

    /**
     * 使状态栏透明
     */
    @TargetApi(Build.VERSION_CODES.KITKAT)
    private static void transparentStatusBar(Activity activity) {
        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
            activity.getWindow().addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS);
            activity.getWindow().clearFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);
            activity.getWindow().addFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_NAVIGATION);
            activity.getWindow().setStatusBarColor(Color.TRANSPARENT);
        } else {
            activity.getWindow().addFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);
        }
    }

    /**
     * 创建半透明矩形 View
     *
     * @param alpha 透明值
     * @return 半透明 View
     */
    private static StatusBarView createTranslucentStatusBarView(Activity activity, int alpha) {
        // 绘制一个和状态栏一样高的矩形
        StatusBarView statusBarView = new StatusBarView(activity);
        LinearLayout.LayoutParams params =
                new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, getStatusBarHeight(activity));
        statusBarView.setLayoutParams(params);
        statusBarView.setBackgroundColor(Color.argb(alpha, 0, 0, 0));
        return statusBarView;
    }

    /**
     * 获取状态栏高度
     *
     * @param context context
     * @return 状态栏高度
     */
    private static int getStatusBarHeight(Context context) {
        // 获得状态栏高度
        int resourceId = context.getResources().getIdentifier("status_bar_height", "dimen", "android");
        return context.getResources().getDimensionPixelSize(resourceId);
    }

    /**
     * 计算状态栏颜色
     *
     * @param color color值
     * @param alpha alpha值
     * @return 最终的状态栏颜色
     */
    private static int calculateStatusColor(@ColorInt int color, int alpha) {
        float a = 1 - alpha / 255f;
        int red = color >> 16 & 0xff;
        int green = color >> 8 & 0xff;
        int blue = color & 0xff;
        red = (int) (red * a + 0.5);
        green = (int) (green * a + 0.5);
        blue = (int) (blue * a + 0.5);
        return 0xff << 24 | red << 16 | green << 8 | blue;
    }

}


text:
<?php

namespace Pimcore\Migrations\Provider;

use Baleen\Cli\Provider\RepositoryProvider as BaseRepositoryProvider;
use Baleen\Cli\Provider\Services;
use Pimcore\Migrations\Migration\MigrationFactory;

/**
 * Class RepositoryProvider
 *
 * @author Gabriel Somoza <gabriel@strategery.io>
 */
class RepositoryProvider extends BaseRepositoryProvider
{
    public function register()
    {
        parent::register();

        $container = $this->getContainer();
        $container->add(Services::MIGRATION_FACTORY, MigrationFactory::class)
            ->withArgument(PimcoreProvider::SERVICE_DB);
    }
}