text:
package org.pentaho.di.ui.repo;

import java.lang.reflect.InvocationHandler;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;

import org.pentaho.di.repository.IRepositoryService;

public class RepositoryServiceSessionTimeoutHandler implements InvocationHandler {

  private final IRepositoryService repositoryService;

  private final SessionTimeoutHandler sessionTimeoutHandler;

  public RepositoryServiceSessionTimeoutHandler( IRepositoryService repositoryService,
      SessionTimeoutHandler sessionTimeoutHandler ) {
    this.repositoryService = repositoryService;
    this.sessionTimeoutHandler = sessionTimeoutHandler;
  }

  @Override
  public Object invoke( Object proxy, Method method, Object[] args ) throws Throwable {
    try {
      return method.invoke( repositoryService, args );
    } catch ( InvocationTargetException ex ) {
      return sessionTimeoutHandler.handle( repositoryService, ex.getCause(), method, args );
    }
  }
}


text:
#include "test_rs232.h"

test_rs232::test_rs232(QObject *parent) : QObject(parent)
{
   /** how to use it? **/
     // open com3
   emit com.sigOpenComm("com3");
     // send data to com3 (it is very very easy to send data to com port.
   emit com.sigSendDatagram("Hello RS232 \n\r");
     // handle the signal from com for data received.
   connect(&com,SIGNAL(sigDataReceived(QByteArray)),
         this,SLOT(onDataReceived(QByteArray)));

}

test_rs232::~test_rs232()
{

}

void test_rs232::onDataReceived(QByteArray data){
    qDebug()<<"Received: " <<data.size() << " bytes. "<<data.toHex();
    // echo
    emit com.sigSendDatagram(data);
}

redpajama_set_name: RedPajamaGithub


text:
package devtestlabs

// Copyright (c) Microsoft and contributors.  All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by 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.
//
// Code generated by Microsoft (R) AutoRest Code Generator 0.17.0.0
// Changes may cause incorrect behavior and will be lost if the code is
// regenerated.

import (
	"github.com/Azure/go-autorest/autorest"
	"github.com/Azure/go-autorest/autorest/azure"
	"net/http"
)

// ScheduleOperationsClient is the azure DevTest Labs REST API.
type ScheduleOperationsClient struct {
	ManagementClient
}

// NewScheduleOperationsClient creates an instance of the
// ScheduleOperationsClient client.
func NewScheduleOperationsClient(subscriptionID string) ScheduleOperationsClient {
	return NewScheduleOperationsClientWithBaseURI(DefaultBaseURI, subscriptionID)
}

// NewScheduleOperationsClientWithBaseURI creates an instance of the
// ScheduleOperationsClient client.
func NewScheduleOperationsClientWithBaseURI(baseURI string, subscriptionID string) ScheduleOperationsClient {
	return ScheduleOperationsClient{NewWithBaseURI(baseURI, subscriptionID)}
}

// CreateOrUpdateResource create or replace an existing schedule.
//
// resourceGroupName is the name of the resource group. labName is the name of
// the lab. name is the name of the schedule.
func (client ScheduleOperationsClient) CreateOrUpdateResource(resourceGroupName string, labName string, name string, schedule Schedule) (result Schedule, err error) {
	req, err := client.CreateOrUpdateResourcePreparer(resourceGroupName, labName, name, schedule)
	if err != nil {
		return result, autorest.NewErrorWithError(err, "devtestlabs.ScheduleOperationsClient", "CreateOrUpdateResource", nil, "Failure preparing request")
	}

	resp, err := client.CreateOrUpdateResourceSender(req)
	if err != nil {
		result.Response = autorest.Response{Response: resp}
		return result, autorest.NewErrorWithError(err, "devtestlabs.ScheduleOperationsClient", "CreateOrUpdateResource", resp, "Failure sending request")
	}

	result, err = client.CreateOrUpdateResourceResponder(resp)
	if err != nil {
		err = autorest.NewErrorWithError(err, "devtestlabs.ScheduleOperationsClient", "CreateOrUpdateResource", resp, "Failure responding to request")
	}

	return
}

// CreateOrUpdateResourcePreparer prepares the CreateOrUpdateResource request.
func (client ScheduleOperationsClient) CreateOrUpdateResourcePreparer(resourceGroupName string, labName string, name string, schedule Schedule) (*http.Request, error) {
	pathParameters := map[string]interface{}{
		"labName":           autorest.Encode("path", labName),
		"name":              autorest.Encode("path", name),
		"resourceGroupName": autorest.Encode("path", resourceGroupName),
		"subscriptionId":    autorest.Encode("path", client.SubscriptionID),
	}

	queryParameters := map[string]interface{}{
		"api-version": client.APIVersion,
	}

	preparer := autorest.CreatePreparer(
		autorest.AsJSON(),
		autorest.AsPut(),
		autorest.WithBaseURL(client.BaseURI),
		autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/schedules/{name}", pathParameters),
		autorest.WithJSON(schedule),
		autorest.WithQueryParameters(queryParameters))
	return preparer.Prepare(&http.Request{})
}

// CreateOrUpdateResourceSender sends the CreateOrUpdateResource request. The method will close the
// http.Response Body if it receives an error.
func (client ScheduleOperationsClient) CreateOrUpdateResourceSender(req *http.Request) (*http.Response, error) {
	return autorest.SendWithSender(client, req)
}

// CreateOrUpdateResourceResponder handles the response to the CreateOrUpdateResource request. The method always
// closes the http.Response Body.
func (client ScheduleOperationsClient) CreateOrUpdateResourceResponder(resp *http.Response) (result Schedule, err error) {
	err = autorest.Respond(
		resp,
		client.ByInspecting(),
		azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated),
		autorest.ByUnmarshallingJSON(&result),
		autorest.ByClosing())
	result.Response = autorest.Response{Response: resp}
	return
}

// DeleteResource delete schedule.
//
// resourceGroupName is the name of the resource group. labName is the name of
// the lab. name is the name of the schedule.
func (client ScheduleOperationsClient) DeleteResource(resourceGroupName string, labName string, name string) (result autorest.Response, err error) {
	req, err := client.DeleteResourcePreparer(resourceGroupName, labName, name)
	if err != nil {
		return result, autorest.NewErrorWithError(err, "devtestlabs.ScheduleOperationsClient", "DeleteResource", nil, "Failure preparing request")
	}

	resp, err := client.DeleteResourceSender(req)
	if err != nil {
		result.Response = resp
		return result, autorest.NewErrorWithError(err, "devtestlabs.ScheduleOperationsClient", "DeleteResource", resp, "Failure sending request")
	}

	result, err = client.DeleteResourceResponder(resp)
	if err != nil {
		err = autorest.NewErrorWithError(err, "devtestlabs.ScheduleOperationsClient", "DeleteResource", resp, "Failure responding to request")
	}

	return
}

// DeleteResourcePreparer prepares the DeleteResource request.
func (client ScheduleOperationsClient) DeleteResourcePreparer(resourceGroupName string, labName string, name string) (*http.Request, error) {
	pathParameters := map[string]interface{}{
		"labName":           autorest.Encode("path", labName),
		"name":              autorest.Encode("path", name),
		"resourceGroupName": autorest.Encode("path", resourceGroupName),
		"subscriptionId":    autorest.Encode("path", client.SubscriptionID),
	}

	queryParameters := map[string]interface{}{
		"api-version": client.APIVersion,
	}

	preparer := autorest.CreatePreparer(
		autorest.AsDelete(),
		autorest.WithBaseURL(client.BaseURI),
		autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/schedules/{name}", pathParameters),
		autorest.WithQueryParameters(queryParameters))
	return preparer.Prepare(&http.Request{})
}

// DeleteResourceSender sends the DeleteResource request. The method will close the
// http.Response Body if it receives an error.
func (client ScheduleOperationsClient) DeleteResourceSender(req *http.Request) (*http.Response, error) {
	return autorest.SendWithSender(client, req)
}

// DeleteResourceResponder handles the response to the DeleteResource request. The method always
// closes the http.Response Body.
func (client ScheduleOperationsClient) DeleteResourceResponder(resp *http.Response) (result autorest.Response, err error) {
	err = autorest.Respond(
		resp,
		client.ByInspecting(),
		azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent),
		autorest.ByClosing())
	result.Response = resp
	return
}

// Execute execute a schedule. This operation can take a while to complete.
// This method may poll for completion. Polling can be canceled by passing
// the cancel channel argument. The channel will be used to cancel polling
// and any outstanding HTTP requests.
//
// resourceGroupName is the name of the resource group. labName is the name of
// the lab. name is the name of the schedule.
func (client ScheduleOperationsClient) Execute(resourceGroupName string, labName string, name string, cancel <-chan struct{}) (result autorest.Response, err error) {
	req, err := client.ExecutePreparer(resourceGroupName, labName, name, cancel)
	if err != nil {
		return result, autorest.NewErrorWithError(err, "devtestlabs.ScheduleOperationsClient", "Execute", nil, "Failure preparing request")
	}

	resp, err := client.ExecuteSender(req)
	if err != nil {
		result.Response = resp
		return result, autorest.NewErrorWithError(err, "devtestlabs.ScheduleOperationsClient", "Execute", resp, "Failure sending request")
	}

	result, err = client.ExecuteResponder(resp)
	if err != nil {
		err = autorest.NewErrorWithError(err, "devtestlabs.ScheduleOperationsClient", "Execute", resp, "Failure responding to request")
	}

	return
}

// ExecutePreparer prepares the Execute request.
func (client ScheduleOperationsClient) ExecutePreparer(resourceGroupName string, labName string, name string, cancel <-chan struct{}) (*http.Request, error) {
	pathParameters := map[string]interface{}{
		"labName":           autorest.Encode("path", labName),
		"name":              autorest.Encode("path", name),
		"resourceGroupName": autorest.Encode("path", resourceGroupName),
		"subscriptionId":    autorest.Encode("path", client.SubscriptionID),
	}

	queryParameters := map[string]interface{}{
		"api-version": client.APIVersion,
	}

	preparer := autorest.CreatePreparer(
		autorest.AsPost(),
		autorest.WithBaseURL(client.BaseURI),
		autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/schedules/{name}/execute", pathParameters),
		autorest.WithQueryParameters(queryParameters))
	return preparer.Prepare(&http.Request{Cancel: cancel})
}

// ExecuteSender sends the Execute request. The method will close the
// http.Response Body if it receives an error.
func (client ScheduleOperationsClient) ExecuteSender(req *http.Request) (*http.Response, error) {
	return autorest.SendWithSender(client,
		req,
		azure.DoPollForAsynchronous(client.PollingDelay))
}

// ExecuteResponder handles the response to the Execute request. The method always
// closes the http.Response Body.
func (client ScheduleOperationsClient) ExecuteResponder(resp *http.Response) (result autorest.Response, err error) {
	err = autorest.Respond(
		resp,
		client.ByInspecting(),
		azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted),
		autorest.ByClosing())
	result.Response = resp
	return
}

// GetResource get schedule.
//
// resourceGroupName is the name of the resource group. labName is the name of
// the lab. name is the name of the schedule.
func (client ScheduleOperationsClient) GetResource(resourceGroupName string, labName string, name string) (result Schedule, err error) {
	req, err := client.GetResourcePreparer(resourceGroupName, labName, name)
	if err != nil {
		return result, autorest.NewErrorWithError(err, "devtestlabs.ScheduleOperationsClient", "GetResource", nil, "Failure preparing request")
	}

	resp, err := client.GetResourceSender(req)
	if err != nil {
		result.Response = autorest.Response{Response: resp}
		return result, autorest.NewErrorWithError(err, "devtestlabs.ScheduleOperationsClient", "GetResource", resp, "Failure sending request")
	}

	result, err = client.GetResourceResponder(resp)
	if err != nil {
		err = autorest.NewErrorWithError(err, "devtestlabs.ScheduleOperationsClient", "GetResource", resp, "Failure responding to request")
	}

	return
}

// GetResourcePreparer prepares the GetResource request.
func (client ScheduleOperationsClient) GetResourcePreparer(resourceGroupName string, labName string, name string) (*http.Request, error) {
	pathParameters := map[string]interface{}{
		"labName":           autorest.Encode("path", labName),
		"name":              autorest.Encode("path", name),
		"resourceGroupName": autorest.Encode("path", resourceGroupName),
		"subscriptionId":    autorest.Encode("path", client.SubscriptionID),
	}

	queryParameters := map[string]interface{}{
		"api-version": client.APIVersion,
	}

	preparer := autorest.CreatePreparer(
		autorest.AsGet(),
		autorest.WithBaseURL(client.BaseURI),
		autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/schedules/{name}", pathParameters),
		autorest.WithQueryParameters(queryParameters))
	return preparer.Prepare(&http.Request{})
}

// GetResourceSender sends the GetResource request. The method will close the
// http.Response Body if it receives an error.
func (client ScheduleOperationsClient) GetResourceSender(req *http.Request) (*http.Response, error) {
	return autorest.SendWithSender(client, req)
}

// GetResourceResponder handles the response to the GetResource request. The method always
// closes the http.Response Body.
func (client ScheduleOperationsClient) GetResourceResponder(resp *http.Response) (result Schedule, err error) {
	err = autorest.Respond(
		resp,
		client.ByInspecting(),
		azure.WithErrorUnlessStatusCode(http.StatusOK),
		autorest.ByUnmarshallingJSON(&result),
		autorest.ByClosing())
	result.Response = autorest.Response{Response: resp}
	return
}

// List list schedules in a given lab.
//
// resourceGroupName is the name of the resource group. labName is the name of
// the lab. filter is the filter to apply on the operation. top is the
// maximum number of resources to return from the operation. orderBy is the
// ordering expression for the results, using OData notation.
func (client ScheduleOperationsClient) List(resourceGroupName string, labName string, filter string, top *int32, orderBy string) (result ResponseWithContinuationSchedule, err error) {
	req, err := client.ListPreparer(resourceGroupName, labName, filter, top, orderBy)
	if err != nil {
		return result, autorest.NewErrorWithError(err, "devtestlabs.ScheduleOperationsClient", "List", nil, "Failure preparing request")
	}

	resp, err := client.ListSender(req)
	if err != nil {
		result.Response = autorest.Response{Response: resp}
		return result, autorest.NewErrorWithError(err, "devtestlabs.ScheduleOperationsClient", "List", resp, "Failure sending request")
	}

	result, err = client.ListResponder(resp)
	if err != nil {
		err = autorest.NewErrorWithError(err, "devtestlabs.ScheduleOperationsClient", "List", resp, "Failure responding to request")
	}

	return
}

// ListPreparer prepares the List request.
func (client ScheduleOperationsClient) ListPreparer(resourceGroupName string, labName string, filter string, top *int32, orderBy string) (*http.Request, error) {
	pathParameters := map[string]interface{}{
		"labName":           autorest.Encode("path", labName),
		"resourceGroupName": autorest.Encode("path", resourceGroupName),
		"subscriptionId":    autorest.Encode("path", client.SubscriptionID),
	}

	queryParameters := map[string]interface{}{
		"api-version": client.APIVersion,
	}
	if len(filter) > 0 {
		queryParameters["$filter"] = autorest.Encode("query", filter)
	}
	if top != nil {
		queryParameters["$top"] = autorest.Encode("query", *top)
	}
	if len(orderBy) > 0 {
		queryParameters["$orderBy"] = autorest.Encode("query", orderBy)
	}

	preparer := autorest.CreatePreparer(
		autorest.AsGet(),
		autorest.WithBaseURL(client.BaseURI),
		autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/schedules", pathParameters),
		autorest.WithQueryParameters(queryParameters))
	return preparer.Prepare(&http.Request{})
}

// ListSender sends the List request. The method will close the
// http.Response Body if it receives an error.
func (client ScheduleOperationsClient) ListSender(req *http.Request) (*http.Response, error) {
	return autorest.SendWithSender(client, req)
}

// ListResponder handles the response to the List request. The method always
// closes the http.Response Body.
func (client ScheduleOperationsClient) ListResponder(resp *http.Response) (result ResponseWithContinuationSchedule, err error) {
	err = autorest.Respond(
		resp,
		client.ByInspecting(),
		azure.WithErrorUnlessStatusCode(http.StatusOK),
		autorest.ByUnmarshallingJSON(&result),
		autorest.ByClosing())
	result.Response = autorest.Response{Response: resp}
	return
}

// ListNextResults retrieves the next set of results, if any.
func (client ScheduleOperationsClient) ListNextResults(lastResults ResponseWithContinuationSchedule) (result ResponseWithContinuationSchedule, err error) {
	req, err := lastResults.ResponseWithContinuationSchedulePreparer()
	if err != nil {
		return result, autorest.NewErrorWithError(err, "devtestlabs.ScheduleOperationsClient", "List", nil, "Failure preparing next results request")
	}
	if req == nil {
		return
	}

	resp, err := client.ListSender(req)
	if err != nil {
		result.Response = autorest.Response{Response: resp}
		return result, autorest.NewErrorWithError(err, "devtestlabs.ScheduleOperationsClient", "List", resp, "Failure sending next results request")
	}

	result, err = client.ListResponder(resp)
	if err != nil {
		err = autorest.NewErrorWithError(err, "devtestlabs.ScheduleOperationsClient", "List", resp, "Failure responding to next results request")
	}

	return
}

// PatchResource modify properties of schedules.
//
// resourceGroupName is the name of the resource group. labName is the name of
// the lab. name is the name of the schedule.
func (client ScheduleOperationsClient) PatchResource(resourceGroupName string, labName string, name string, schedule Schedule) (result Schedule, err error) {
	req, err := client.PatchResourcePreparer(resourceGroupName, labName, name, schedule)
	if err != nil {
		return result, autorest.NewErrorWithError(err, "devtestlabs.ScheduleOperationsClient", "PatchResource", nil, "Failure preparing request")
	}

	resp, err := client.PatchResourceSender(req)
	if err != nil {
		result.Response = autorest.Response{Response: resp}
		return result, autorest.NewErrorWithError(err, "devtestlabs.ScheduleOperationsClient", "PatchResource", resp, "Failure sending request")
	}

	result, err = client.PatchResourceResponder(resp)
	if err != nil {
		err = autorest.NewErrorWithError(err, "devtestlabs.ScheduleOperationsClient", "PatchResource", resp, "Failure responding to request")
	}

	return
}

// PatchResourcePreparer prepares the PatchResource request.
func (client ScheduleOperationsClient) PatchResourcePreparer(resourceGroupName string, labName string, name string, schedule Schedule) (*http.Request, error) {
	pathParameters := map[string]interface{}{
		"labName":           autorest.Encode("path", labName),
		"name":              autorest.Encode("path", name),
		"resourceGroupName": autorest.Encode("path", resourceGroupName),
		"subscriptionId":    autorest.Encode("path", client.SubscriptionID),
	}

	queryParameters := map[string]interface{}{
		"api-version": client.APIVersion,
	}

	preparer := autorest.CreatePreparer(
		autorest.AsJSON(),
		autorest.AsPatch(),
		autorest.WithBaseURL(client.BaseURI),
		autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/schedules/{name}", pathParameters),
		autorest.WithJSON(schedule),
		autorest.WithQueryParameters(queryParameters))
	return preparer.Prepare(&http.Request{})
}

// PatchResourceSender sends the PatchResource request. The method will close the
// http.Response Body if it receives an error.
func (client ScheduleOperationsClient) PatchResourceSender(req *http.Request) (*http.Response, error) {
	return autorest.SendWithSender(client, req)
}

// PatchResourceResponder handles the response to the PatchResource request. The method always
// closes the http.Response Body.
func (client ScheduleOperationsClient) PatchResourceResponder(resp *http.Response) (result Schedule, err error) {
	err = autorest.Respond(
		resp,
		client.ByInspecting(),
		azure.WithErrorUnlessStatusCode(http.StatusOK),
		autorest.ByUnmarshallingJSON(&result),
		autorest.ByClosing())
	result.Response = autorest.Response{Response: resp}
	return
}


text:
<!DOCTYPE html>

	<title>DOM Manipulation - Traversing the DOM</title>

Doncho Minkov : 43

Evlogi Hristov : 14

Konstantin Simeonov : 21

Viktor Tsvetkov : 73

Martin Vesheff : 11

Kristian Tsuklev : 5

Ivan Kolev : 23

Steven Tsvetkov : 18


text:
@implementation Build

@dynamic project;
@dynamic branch;
@dynamic type;
@dynamic url;
@dynamic startedAt;
@dynamic finishedAt;
@dynamic updatedAt;
@dynamic status;
@dynamic objectId;
@dynamic isInvalid;
@dynamic invalidMessage;

@dynamic commitSha;
@dynamic commitAuthor;
@dynamic commitEmail;
@dynamic commitMessage;

// [Name of associated class] + [Did | Will] + [UniquePartOfName] + Notification
NSString * const PMBuildDidSaveNotication = @"PMBuildDidSaveNotication";
NSString * const PMBuildDidBecomeSelected = @"PMBuildDidBecomeSelected";
NSString * const PMBuildsDidBecomeActiveNotication = @"PMBuildsDidBecomeActiveNotication";
NSString * const sortString = @"type,project,branch";

// Thread safe: https://developer.apple.com/library/mac/documentation/Cocoa/Conceptual/Multithreading/ThreadSafetySummary/ThreadSafetySummary.html
static NSArray* whitelistedKeys;

+ (void)initialize
{
    static BOOL initialized = NO;
    if(!initialized)
    {
        initialized = YES;
        whitelistedKeys = [NSArray arrayWithObjects:
                           @"type", @"project", @"branch", @"status", @"url",
                           @"startedAt", @"finishedAt", @"commitSha", @"commitMessage",
                           @"commitAuthor", @"commitEmail", @"accessToken",
                           @"isInvalid", @"invalidMessage",
                           nil];
    }
}

+ (NSArray *)all
{
    return [Build MR_findAllSortedBy:sortString ascending:YES];
}

+ (NSArray *)forType:(NSString*)type
{
    NSPredicate *predicate = [NSPredicate predicateWithFormat:@"type = %@ AND NOT objectId = nil",type];

    return [Build MR_findAllSortedBy:sortString ascending:YES withPredicate:predicate];
}

+ (NSArray *)saved
{
    NSPredicate *predicate = [NSPredicate predicateWithFormat:@"NOT objectId = nil"];
    return [Build MR_findAllSortedBy:sortString ascending:YES withPredicate:predicate];
}

+ (NSArray *)allInContext:(NSManagedObjectContext *)context
{
    return [Build MR_findAllSortedBy:sortString ascending:YES inContext:context];
}

+ (void)refreshSavedBuildsInBackground:(void (^)(BOOL, NSArray *))callback
{
    // Retrieve from parse
    PFQuery *query = [PFQuery queryWithClassName:@"Build"];
    [query orderByAscending:sortString];
    [query findObjectsInBackgroundWithBlock:^(NSArray *objects, NSError *error) {
        if (!error) {
            __block NSArray *refreshedBuilds;
            // Save in Core Data
            [MagicalRecord saveUsingCurrentThreadContextWithBlockAndWait:^(NSManagedObjectContext *localContext) {
                [Build MR_truncateAllInContext:localContext];
                [self createBuilds:objects InContext:localContext];
                refreshedBuilds = [Build allInContext:localContext];
            }];

            // invoke callback with new builds
            callback(YES, refreshedBuilds);
        } else {
            NSLog(@"# Failed to refresh saved builds\n%@", error);
            callback(NO, nil);
        }
    }];
}

+ (void)createBuilds:(NSArray*)parseBuilds InContext:(NSManagedObjectContext *)localContext {
    for (PFObject *parseBuild in parseBuilds) {
        Build *build = [Build MR_createInContext:localContext];
        [build setFromDictionary: [ParseHelper toDictionary: parseBuild]];
        [build setObjectId: parseBuild.objectId];
        [build setUpdatedAt: parseBuild.updatedAt];
    }
}

+ (void)updateSavedBuild:(NSDictionary *)dictionary
{
    [MagicalRecord saveWithBlockAndWait:^(NSManagedObjectContext *localContext) {
        Build* build;
        NSString *objectId = [dictionary objectForKey:@"objectId"];

        build = [Build MR_findFirstByAttribute:@"objectId" withValue:objectId inContext:localContext];
        if (!build) {
            build = [Build MR_createInContext:localContext];
        }

        [build setFromDictionary:dictionary];
    }];
}

+ (void)saveInBackground:(NSArray *)builds withBlock:(void (^)(BOOL))mainThreadCallback
{
    NSArray *parseObjects = _.arrayMap(builds, ^PFObject *(Build*build) {
        return [self generateParseObject:build];
    });

    [PFObject saveAllInBackground:parseObjects block:^(BOOL succeeded, NSError *error) {
        if (succeeded) {
            [MagicalRecord saveWithBlockAndWait:^(NSManagedObjectContext *localContext) {
                NSLog(@"# Writing added builds to Core Data!");
                [self createBuilds:parseObjects InContext:localContext];
            }];

            [self notifyBuildsSaved];
        } else {
            NSLog(@"Failed to save parse objects:\n%@", [error description]);
        }

        dispatch_async(dispatch_get_main_queue(), ^{
            mainThreadCallback(succeeded);
        });
    }];
}

+ (id)valueOrNSNull:(id)value
{
    if (value) {
        return value;
    } else {
        return [NSNull null];
    }
}

- (id)valueOrNil:(id)value
{
    if ([Helper isAnyNull:value]) {
        return nil;
    } else if ([value respondsToSelector:@selector(objectForKey:)]) {
        return [Helper parseDateSafelyFromDictionary:value withKey:@"iso"];
    } else {
        return value;
    }
}

+ (PFObject *)generateParseObject:(Build*) build
{
    PFObject *buildObject = [PFObject objectWithClassName:@"Build"];
    for (NSString* key in whitelistedKeys) {
        buildObject[key] = [self valueOrNSNull: [build valueForKey:key]];
    }

    buildObject[@"user"] = [PFUser currentUser];
    buildObject.ACL = [PFACL ACLWithUser:[PFUser currentUser]];
    return buildObject;
}

- (NSString *)description
{
    return [NSString stringWithFormat: @"Build: ObjectId=%@ Project=%@ Branch=%@ Status=%@ Url=%@", self.objectId, self.project, self.branch, self.status, self.url];
}

- (BOOL)isSimilarTo:(Build *)build
{
    return [[self project] isEqualToString:[build project]] &&
        [[self type] isEqualToString: [build type]];
}

- (void)setFromDictionary:(NSDictionary*)dic
{
    for (NSString* key in whitelistedKeys) {
        id someVal = [self valueOrNil:dic[key]];
        [self setValue:someVal forKey:key];
    }

    if ([dic objectForKey:@"objectId"]) {
        [self setObjectId:[dic objectForKey:@"objectId"]];
    }
}

+ (void)notifyBuildsSaved
{
    NSNotificationCenter *center = [NSNotificationCenter defaultCenter];
    [center postNotificationName:PMBuildDidSaveNotication object:nil];
}

- (void)deleteInBackground
{
    PFObject *object = [PFObject objectWithoutDataWithClassName:@"Build" objectId:[self objectId]];
    [object deleteInBackground];
    [self MR_deleteEntity];
}

@end


text:
package com.datawizards.sparklocal.impl.scala.`lazy`.dataset

import com.datawizards.sparklocal.dataset.KeyValueGroupedDataSetAPI
import com.datawizards.sparklocal.impl.scala.dataset.{DataSetAPIScalaBase, KeyValueGroupedDataSetAPIScalaBase}
import org.apache.spark.sql.Encoder

import scala.collection.{GenIterable, SeqView}
import scala.reflect.ClassTag

class KeyValueGroupedDataSetAPIScalaLazyImpl[K: ClassTag, T: ClassTag](private[sparklocal] val data: Map[K,SeqView[T, Seq[T]]]) extends KeyValueGroupedDataSetAPIScalaBase[K, T] {
  override type InternalCollection = Map[K, SeqView[T, Seq[T]]]

  override private[sparklocal] def create[U: ClassTag](it: GenIterable[U])(implicit enc: Encoder[U]=null): DataSetAPIScalaBase[U] =
    DataSetAPIScalaLazyImpl.create(it)

  override def mapValues[W: ClassTag](func: (T) => W)
                                     (implicit enc: Encoder[W]=null): KeyValueGroupedDataSetAPI[K, W] =
    new KeyValueGroupedDataSetAPIScalaLazyImpl(data.mapValues(_.map(func).view))
}


text:
Release History
====================================

2.0.0 (Released 2020-12-23)
---------------------------
* Add Django 2.2, 3.0 and 3.1 support
* Switch from Travis CI to Github Actions CI
* Add pre-commit, black, isort checks

Breaking changes
~~~~~~~~~~~~~~~~
* Drop Django <2.2 support
* Drop Python 2 support

1.1.0 (Released 2018-04-17)
---------------------------
* Add Django 1.11 support, drop Django <1.11 support

Note: adding Django 2.0 support will require
`django-selectable <http://django-selectable.readthedocs.io/en/latest/>`_
to add Django 2.0 support first.

1.0.0 (Released 2017-01-04)
---------------------------
* Add Django 1.8+ support
* Drop Django 1.7 support
* Travis CI

0.10.0 (Released 2014-11-19)
----------------------------
* Support for Django 1.7
* Moved to django-taggit dropping support for django-tagging
* Dropped South migrations

0.9.1 (Released 2014-11-03)
------------------------------------
* Fixed Python 3 compatibility bug #59
* Removed test coverage for unsupported Python 2.6 and Django 1.3

0.9.0 (Released 2014-02-24)
------------------------------------

* Setup tox
* Support Django's custom user model
* Python 3 support
* Flake8 improvements

0.8.0 (Released 2014-02-05)
------------------------------------

* Fix migrations to run on MySQL
* Configurable content types with included JS/CSS requirements
* Updated message API to be compatible with Django 1.4+
* Updated template url syntax to be compatible with Django 1.5+
* Add missing CSRF token to attach form (see #38)
* Allow use of `{% render_content_area "by-slug-string" %}`
* Provide proper eTag and Last Modified checks to `edit_pagelet` view,
  avoiding edits that get lost by overzealous caching
* Add `truncate_html_words` shim for Django 1.6+ compatibility
* Fix urls.py imports to work with Django 1.6+

0.7.2 (Released 2012-03-28)
------------------------------------

* Updated migration 0003 to be a data migration
* Made Page.tags field always exist, and add migration for it

0.7.1  (Released 2011-09-29)
------------------------------------

* Add Read the Docs reference to README
* Update sample_project to work with Django 1.3
* Use CDN for external jQuery dependencies
* Add migration to install sequences properly on PostgreSQL

0.7.0 (Released 2011-04-01)
------------------------------------

* Add docs and publish on Read the Docs
* Update media references to work better with staticfiles
* Make PageletBase an abstract base class
* Begin using South for migrations
* Update sample_project to use Django 1.2

0.6.2 (Released 2010-12-03)
------------------------------------

* Remove use of .format() to support earlier versions of Python
* Fix license reference and URL endpoint in setup.py
* Include sample_project in MANIFEST.in
* Update license date

0.6.0 (Released 2010-09-12)
------------------------------------

* First official release

Development sponsored by `Caktus Consulting Group, LLC.
<http://www.caktusgroup.com/services>`_.


text:
// Copyright 2018 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

package org.chromium.chrome.browser.feed;

import android.text.TextUtils;

import androidx.annotation.VisibleForTesting;

import org.chromium.chrome.browser.feed.library.api.host.config.Configuration;
import org.chromium.chrome.browser.feed.library.api.host.config.Configuration.ConfigKey;
import org.chromium.chrome.browser.flags.ChromeFeatureList;

/**
 * Collection of configurable parameters and default values given to the Feed. Every getter passes
 * checks to see if it has been overridden by a field trail param.
 */
public final class FeedConfiguration {
    /** Do not allow construction */
    private FeedConfiguration() {}

    private static final String ABANDON_RESTORE_BELOW_FOLD = "abandon_restore_below_fold";
    /** Default value for whether to restore below fold. */
    public static final boolean ABANDON_RESTORE_BELOW_FOLD_DEFAULT = false;

    private static final String CARD_MENU_TOOLTIP_ELIGIBLE = "card_menu_tooltip_eligible";
    /** Default value for if card menus should have tooltips enabled. */
    public static final boolean CARD_MENU_TOOLTIP_ELIGIBLE_DEFAULT = true;

    private static final String CONSUME_SYNTHETIC_TOKENS = "consume_synthetic_tokens_bool";
    /** Default value for whether to consumer synthetic tokens on load. */
    public static final boolean CONSUME_SYNTHETIC_TOKENS_DEFAULT = false;

    private static final String CONSUME_SYNTHETIC_TOKENS_WHILE_RESTORING =
            "consume_synthetic_tokens_while_restoring_bool";
    /** Default value for whether to consumer synthetic tokens on restore. */
    public static final boolean CONSUME_SYNTHETIC_TOKENS_WHILE_RESTORING_DEFAULT = true;

    private static final String DEFAULT_ACTION_TTL_SECONDS = "default_action_ttl_seconds";
    /** Default value for the TTL of default action (3 days). */
    public static final long DEFAULT_ACTION_TTL_SECONDS_DEFAULT = 259200;

    private static final String FEED_ACTION_SERVER_ENDPOINT = "feed_action_server_endpoint";
    /** Default value for the endpoint used for recording uploaded actions to the server. */
    public static final String FEED_ACTION_SERVER_ENDPOINT_DEFAULT =
            "https://www.google.com/httpservice/retry/ClankActionUploadService/ClankActionUpload";

    private static final String FEED_ACTION_SERVER_MAX_ACTIONS_PER_REQUEST =
            "feed_action_server_max_actions_per_request";
    /**
     * Default value for maximum number of actions to be uploaded to the enpoint in a single
     * request.
     */
    public static final long FEED_ACTION_SERVER_MAX_ACTIONS_PER_REQUEST_DEFAULT = 20;

    private static final String FEED_ACTION_SERVER_MAX_SIZE_PER_REQUEST =
            "feed_action_server_max_size_per_request";
    /**
     * Default value for maximum size in bytes of the request to be uploaded to the enpoint in a
     * single request.
     */
    public static final long FEED_ACTION_SERVER_MAX_SIZE_PER_REQUEST_DEFAULT = 1000;

    private static final String FEED_ACTION_SERVER_METHOD = "feed_action_server_method";
    /** Default value for the HTTP method call to the feed action server (put/post/etc). */
    public static final String FEED_ACTION_SERVER_METHOD_DEFAULT = "POST";

    private static final String FEED_SERVER_ENDPOINT = "feed_server_endpoint";
    /** Default value for server endpoint. */
    public static final String FEED_SERVER_ENDPOINT_DEFAULT =
            "https://www.google.com/httpservice/noretry/DiscoverClankService/FeedQuery";

    private static final String FEED_SERVER_METHOD = "feed_server_method";
    /** Default value for feed server method. */
    public static final String FEED_SERVER_METHOD_DEFAULT = "GET";

    private static final String FEED_SERVER_RESPONSE_LENGTH_PREFIXED =
            "feed_server_response_length_prefixed";
    /** Default value for feed server response length prefixed. */
    public static final boolean FEED_SERVER_RESPONSE_LENGTH_PREFIXED_DEFAULT = true;

    private static final String FEED_UI_ENABLED = "feed_ui_enabled";
    /** Default value for the type of UI to request from the server. */
    public static final boolean FEED_UI_ENABLED_DEFAULT = true;

    private static final String INITIAL_NON_CACHED_PAGE_SIZE = "initial_non_cached_page_size";
    /** Default value for initial non cached page size. */
    public static final long INITIAL_NON_CACHED_PAGE_SIZE_DEFAULT = 10;

    private static final String LIMIT_PAGE_UPDATES_IN_HEAD = "limit_page_updates_in_head";
    /** Default value for whether to update HEAD when making a page request. */
    public static final boolean LIMIT_PAGE_UPDATES_IN_HEAD_DEFAULT = false;

    private static final String LOGGING_IMMEDIATE_CONTENT_THRESHOLD_MS =
            "logging_immediate_content_threshold_ms";
    /** Default value for logging immediate content threshold. */
    public static final long LOGGING_IMMEDIATE_CONTENT_THRESHOLD_MS_DEFAULT = 1000;

    private static final String MANAGE_INTERESTS_ENABLED = "manage_interests_enabled";
    /** Default value for whether to use menu options to launch interest management page. */
    public static final boolean MANAGE_INTERESTS_ENABLED_DEFAULT = true;

    private static final String SEND_FEEDBACK_ENABLED = "send_feedback_enabled";

    private static final String MAXIMUM_GC_ATTEMPTS = "maximum_gc_attempts";
    /** Default value for the maximum number of times that the GC task can re-enqueue itself. */
    public static final long MAXIMUM_GC_ATTEMPTS_DEFAULT = 10;

    private static final String NON_CACHED_MIN_PAGE_SIZE = "non_cached_min_page_size";
    /** Default value for non cached minimum page size. */
    public static final long NON_CACHED_MIN_PAGE_SIZE_DEFAULT = 5;

    private static final String NON_CACHED_PAGE_SIZE = "non_cached_page_size";
    /** Default value for non cached page size. */
    public static final long NON_CACHED_PAGE_SIZE_DEFAULT = 25;

    private static final String SESSION_LIFETIME_MS = "session_lifetime_ms";
    /** Default value for session lifetime. */
    public static final long SESSION_LIFETIME_MS_DEFAULT = 3600000;

    private static final String SNIPPETS_ENABLED = "snippets_enabled";
    /** Default value for whether to show article snippets. */
    public static final boolean SNIPPETS_ENABLED_DEFAULT = true;

    private static final String SPINNER_DELAY_MS = "spinner_delay";
    /** Default value for delay before showing a spinner. */
    public static final long SPINNER_DELAY_MS_DEFAULT = 500;

    private static final String SPINNER_MINIMUM_SHOW_TIME_MS = "spinner_minimum_show_time";
    /** Default value for how long spinners must be shown for. */
    public static final long SPINNER_MINIMUM_SHOW_TIME_MS_DEFAULT = 0;

    private static final String STORAGE_MISS_THRESHOLD = "storage_miss_threshold";
    /** Default number of items that can be missing from a call to FeedStore before failing. */
    public static final long STORAGE_MISS_THRESHOLD_DEFAULT = 100;

    private static final String TRIGGER_IMMEDIATE_PAGINATION = "trigger_immediate_pagination";
    /** Default value for triggering immediate pagination. */
    public static final boolean TRIGGER_IMMEDIATE_PAGINATION_DEFAULT = false;

    private static final String UNDOABLE_ACTIONS_ENABLED = "undoable_actions_enabled";
    /** Default value for if undoable actions should be presented to the user. */
    public static final boolean UNDOABLE_ACTIONS_ENABLED_DEFAULT = true;

    private static final String USE_SECONDARY_PAGE_REQUEST = "use_secondary_page_request";
    /** Default value for pagination behavior. */
    public static final boolean USE_SECONDARY_PAGE_REQUEST_DEFAULT = false;

    private static final String USE_TIMEOUT_SCHEDULER = "use_timeout_scheduler";
    /** Default value for the type of scheduler handling. */
    public static final boolean USE_TIMEOUT_SCHEDULER_DEFAULT = true;

    private static final String VIEW_LOG_THRESHOLD = "view_log_threshold";
    /** Default value for logging view threshold. */
    public static final double VIEW_LOG_THRESHOLD_DEFAULT = 0.66d;

    /** @return Whether the Stream aborts restores if user is past configured fold count. */
    @VisibleForTesting
    static boolean getAbandonRestoreBelowFold() {
        return ChromeFeatureList.getFieldTrialParamByFeatureAsBoolean(
                ChromeFeatureList.INTEREST_FEED_CONTENT_SUGGESTIONS, ABANDON_RESTORE_BELOW_FOLD,
                ABANDON_RESTORE_BELOW_FOLD_DEFAULT);
    }

    /** @return Whether to show card tooltips. */
    @VisibleForTesting
    static boolean getCardMenuTooltipEligible() {
        return ChromeFeatureList.getFieldTrialParamByFeatureAsBoolean(
                ChromeFeatureList.INTEREST_FEED_CONTENT_SUGGESTIONS, CARD_MENU_TOOLTIP_ELIGIBLE,
                CARD_MENU_TOOLTIP_ELIGIBLE_DEFAULT);
    }

    /** @return Whether synthetic tokens should be consumed when they are found. */
    @VisibleForTesting
    static boolean getConsumeSyntheticTokens() {
        return ChromeFeatureList.getFieldTrialParamByFeatureAsBoolean(
                ChromeFeatureList.INTEREST_FEED_CONTENT_SUGGESTIONS, CONSUME_SYNTHETIC_TOKENS,
                CONSUME_SYNTHETIC_TOKENS_DEFAULT);
    }

    /**
     * @return Whether synthetic tokens should be automatically consume when restoring. This will
     * not cause synthetic tokens to be consumed when opening with a new session.
     */
    @VisibleForTesting
    static boolean getConsumeSyntheticTokensWhileRestoring() {
        return ChromeFeatureList.getFieldTrialParamByFeatureAsBoolean(
                ChromeFeatureList.INTEREST_FEED_CONTENT_SUGGESTIONS,
                CONSUME_SYNTHETIC_TOKENS_WHILE_RESTORING,
                CONSUME_SYNTHETIC_TOKENS_WHILE_RESTORING_DEFAULT);
    }

    /** @return The TTL (in seconds) for the default action. */
    @VisibleForTesting
    static long getDefaultActionTtlSeconds() {
        return ChromeFeatureList.getFieldTrialParamByFeatureAsInt(
                ChromeFeatureList.INTEREST_FEED_CONTENT_SUGGESTIONS, DEFAULT_ACTION_TTL_SECONDS,
                (int) DEFAULT_ACTION_TTL_SECONDS_DEFAULT);
    }

    /** @return The endpoint used for recording uploaded actions to the server. */
    @VisibleForTesting
    static String getFeedActionServerEndpoint() {
        String paramValue = ChromeFeatureList.getFieldTrialParamByFeature(
                ChromeFeatureList.INTEREST_FEED_CONTENT_SUGGESTIONS, FEED_ACTION_SERVER_ENDPOINT);
        return TextUtils.isEmpty(paramValue) ? FEED_ACTION_SERVER_ENDPOINT_DEFAULT : paramValue;
    }

    /**
     * @return Maximum number of actions to be uploaded to the endpoint in a single request.
     */
    @VisibleForTesting
    static long getFeedActionServerMaxActionsPerRequest() {
        return (long) ChromeFeatureList.getFieldTrialParamByFeatureAsInt(
                ChromeFeatureList.INTEREST_FEED_CONTENT_SUGGESTIONS,
                FEED_ACTION_SERVER_MAX_ACTIONS_PER_REQUEST,
                (int) FEED_ACTION_SERVER_MAX_ACTIONS_PER_REQUEST_DEFAULT);
    }

    /**
     * @return Maximum size in bytes of the request to be uploaded to the endpoint in a single
     *         request.
     */
    @VisibleForTesting
    static long getFeedActionServerMaxSizePerRequest() {
        return (long) ChromeFeatureList.getFieldTrialParamByFeatureAsInt(
                ChromeFeatureList.INTEREST_FEED_CONTENT_SUGGESTIONS,
                FEED_ACTION_SERVER_MAX_SIZE_PER_REQUEST,
                (int) FEED_ACTION_SERVER_MAX_SIZE_PER_REQUEST_DEFAULT);
    }

    /** @return The HTTP method call to the feed action server (put/post/etc). */
    @VisibleForTesting
    static String getFeedActionServerMethod() {
        String paramValue = ChromeFeatureList.getFieldTrialParamByFeature(
                ChromeFeatureList.INTEREST_FEED_CONTENT_SUGGESTIONS, FEED_ACTION_SERVER_METHOD);
        return TextUtils.isEmpty(paramValue) ? FEED_ACTION_SERVER_METHOD_DEFAULT : paramValue;
    }

    /** @return Feed server endpoint to use to fetch content suggestions. */
    @VisibleForTesting
    static String getFeedServerEndpoint() {
        String paramValue = ChromeFeatureList.getFieldTrialParamByFeature(
                ChromeFeatureList.INTEREST_FEED_CONTENT_SUGGESTIONS, FEED_SERVER_ENDPOINT);
        return TextUtils.isEmpty(paramValue) ? FEED_SERVER_ENDPOINT_DEFAULT : paramValue;
    }

    /** @return Feed server method to use when fetching content suggestions. */
    @VisibleForTesting
    static String getFeedServerMethod() {
        String paramValue = ChromeFeatureList.getFieldTrialParamByFeature(
                ChromeFeatureList.INTEREST_FEED_CONTENT_SUGGESTIONS, FEED_SERVER_METHOD);
        return TextUtils.isEmpty(paramValue) ? FEED_SERVER_METHOD_DEFAULT : paramValue;
    }

    /** @return Whether server response should be length prefixed. */
    @VisibleForTesting
    static boolean getFeedServerResponseLengthPrefixed() {
        return ChromeFeatureList.getFieldTrialParamByFeatureAsBoolean(
                ChromeFeatureList.INTEREST_FEED_CONTENT_SUGGESTIONS,
                FEED_SERVER_RESPONSE_LENGTH_PREFIXED, FEED_SERVER_RESPONSE_LENGTH_PREFIXED_DEFAULT);
    }

    /** @return Whether to ask the server for "Feed" UI or just basic UI. */
    public static boolean getFeedUiEnabled() {
        return ChromeFeatureList.getFieldTrialParamByFeatureAsBoolean(
                ChromeFeatureList.INTEREST_FEED_CONTENT_SUGGESTIONS, FEED_UI_ENABLED,
                FEED_UI_ENABLED_DEFAULT);
    }

    /** @return Used to decide where to place the more button initially. */
    @VisibleForTesting
    static int getInitialNonCachedPageSize() {
        return ChromeFeatureList.getFieldTrialParamByFeatureAsInt(
                ChromeFeatureList.INTEREST_FEED_CONTENT_SUGGESTIONS, INITIAL_NON_CACHED_PAGE_SIZE,
                (int) INITIAL_NON_CACHED_PAGE_SIZE_DEFAULT);
    }

    /** @return Whether to update HEAD when making a page request. */
    @VisibleForTesting
    static boolean getLimitPageUpdatesInHead() {
        return ChromeFeatureList.getFieldTrialParamByFeatureAsBoolean(
                ChromeFeatureList.INTEREST_FEED_CONTENT_SUGGESTIONS, LIMIT_PAGE_UPDATES_IN_HEAD,
                LIMIT_PAGE_UPDATES_IN_HEAD_DEFAULT);
    }

    /**
     * @return How long before showing content after opening NTP is no longer considered immediate
     *         in UMA.
     */
    @VisibleForTesting
    static long getLoggingImmediateContentThresholdMs() {
        return (long) ChromeFeatureList.getFieldTrialParamByFeatureAsInt(
                ChromeFeatureList.INTEREST_FEED_CONTENT_SUGGESTIONS,
                LOGGING_IMMEDIATE_CONTENT_THRESHOLD_MS,
                (int) LOGGING_IMMEDIATE_CONTENT_THRESHOLD_MS_DEFAULT);
    }

    /** @return Whether to show context menu option to launch to customization page. */
    @VisibleForTesting
    static boolean getManageInterestsEnabled() {
        return ChromeFeatureList.getFieldTrialParamByFeatureAsBoolean(
                ChromeFeatureList.INTEREST_FEED_CONTENT_SUGGESTIONS, MANAGE_INTERESTS_ENABLED,
                MANAGE_INTERESTS_ENABLED_DEFAULT);
    }

    /** @return Whether to show context menu option to send feedback. */
    @VisibleForTesting
    static boolean getSendFeedbackEnabled() {
        return ChromeFeatureList.isEnabled(ChromeFeatureList.INTEREST_FEED_FEEDBACK);
    }

    /** @return The maximum number of times that the GC task can re-enqueue itself. */
    @VisibleForTesting
    static long getMaximumGcAttempts() {
        return (long) ChromeFeatureList.getFieldTrialParamByFeatureAsInt(
                ChromeFeatureList.INTEREST_FEED_CONTENT_SUGGESTIONS, MAXIMUM_GC_ATTEMPTS,
                (int) MAXIMUM_GC_ATTEMPTS_DEFAULT);
    }

    /** @return Used to decide where to place the more button. */
    @VisibleForTesting
    static int getNonCachedMinPageSize() {
        return ChromeFeatureList.getFieldTrialParamByFeatureAsInt(
                ChromeFeatureList.INTEREST_FEED_CONTENT_SUGGESTIONS, NON_CACHED_MIN_PAGE_SIZE,
                (int) NON_CACHED_MIN_PAGE_SIZE_DEFAULT);
    }

    /** @return Used to decide where to place the more button. */
    @VisibleForTesting
    static int getNonCachedPageSize() {
        return ChromeFeatureList.getFieldTrialParamByFeatureAsInt(
                ChromeFeatureList.INTEREST_FEED_CONTENT_SUGGESTIONS, NON_CACHED_PAGE_SIZE,
                (int) NON_CACHED_PAGE_SIZE_DEFAULT);
    }

    /** @return Time until feed stops restoring the UI. */
    @VisibleForTesting
    static long getSessionLifetimeMs() {
        return (long) ChromeFeatureList.getFieldTrialParamByFeatureAsInt(
                ChromeFeatureList.INTEREST_FEED_CONTENT_SUGGESTIONS, SESSION_LIFETIME_MS,
                (int) SESSION_LIFETIME_MS_DEFAULT);
    }

    /** @return Whether the article snippets feature is enabled. */
    @VisibleForTesting
    static boolean getSnippetsEnabled() {
        return ChromeFeatureList.getFieldTrialParamByFeatureAsBoolean(
                ChromeFeatureList.INTEREST_FEED_CONTENT_SUGGESTIONS, SNIPPETS_ENABLED,
                SNIPPETS_ENABLED_DEFAULT);
    }

    /** @return Delay before a spinner should be shown after content is requested. */
    @VisibleForTesting
    static long getSpinnerDelayMs() {
        return (long) ChromeFeatureList.getFieldTrialParamByFeatureAsInt(
                ChromeFeatureList.INTEREST_FEED_CONTENT_SUGGESTIONS, SPINNER_DELAY_MS,
                (int) SPINNER_DELAY_MS_DEFAULT);
    }

    /** @return Minimum time before a spinner should show before disappearing. */
    @VisibleForTesting
    static long getSpinnerMinimumShowTimeMs() {
        return (long) ChromeFeatureList.getFieldTrialParamByFeatureAsInt(
                ChromeFeatureList.INTEREST_FEED_CONTENT_SUGGESTIONS, SPINNER_MINIMUM_SHOW_TIME_MS,
                (int) SPINNER_MINIMUM_SHOW_TIME_MS_DEFAULT);
    }

    /** @return The number of items that can be missing from a call to FeedStore before failing. */
    @VisibleForTesting
    static long getStorageMissThreshold() {
        return (long) ChromeFeatureList.getFieldTrialParamByFeatureAsInt(
                ChromeFeatureList.INTEREST_FEED_CONTENT_SUGGESTIONS, STORAGE_MISS_THRESHOLD,
                (int) STORAGE_MISS_THRESHOLD_DEFAULT);
    }

    /**
     * @return Whether UI initially shows "More" button upon reaching the end of known content,
     *         when server could potentially have more content.
     */
    @VisibleForTesting
    static boolean getTriggerImmediatePagination() {
        return ChromeFeatureList.getFieldTrialParamByFeatureAsBoolean(
                ChromeFeatureList.INTEREST_FEED_CONTENT_SUGGESTIONS, TRIGGER_IMMEDIATE_PAGINATION,
                TRIGGER_IMMEDIATE_PAGINATION_DEFAULT);
    }

    /** @return Whether to allow the present the user with the ability to undo actions. */
    @VisibleForTesting
    static boolean getUndoableActionsEnabled() {
        return ChromeFeatureList.getFieldTrialParamByFeatureAsBoolean(
                ChromeFeatureList.INTEREST_FEED_CONTENT_SUGGESTIONS, UNDOABLE_ACTIONS_ENABLED,
                UNDOABLE_ACTIONS_ENABLED_DEFAULT);
    }

    /**
     * @return Whether the Feed's session handling should use logic to deal with timeouts and
     * placing new results below the fold.
     */
    @VisibleForTesting
    static boolean getUseTimeoutScheduler() {
        return ChromeFeatureList.getFieldTrialParamByFeatureAsBoolean(
                ChromeFeatureList.INTEREST_FEED_CONTENT_SUGGESTIONS, USE_TIMEOUT_SCHEDULER,
                USE_TIMEOUT_SCHEDULER_DEFAULT);
    }

    /**
     * @return If secondary (a more intuitive) pagination approach should be used, or the original
     * Zine matching behavior should be used.
     */
    @VisibleForTesting
    static boolean getUseSecondaryPageRequest() {
        return ChromeFeatureList.getFieldTrialParamByFeatureAsBoolean(
                ChromeFeatureList.INTEREST_FEED_CONTENT_SUGGESTIONS, USE_SECONDARY_PAGE_REQUEST,
                USE_SECONDARY_PAGE_REQUEST_DEFAULT);
    }

    /** @return How much of a card must be on screen to generate a UMA log view. */
    @VisibleForTesting
    static double getViewLogThreshold() {
        return ChromeFeatureList.getFieldTrialParamByFeatureAsDouble(
                ChromeFeatureList.INTEREST_FEED_CONTENT_SUGGESTIONS, VIEW_LOG_THRESHOLD,
                VIEW_LOG_THRESHOLD_DEFAULT);
    }

    /**
     * @return A fully built {@link Configuration}, ready to be given to the Feed.
     */
    public static Configuration createConfiguration() {
        return new Configuration.Builder()
                .put(ConfigKey.ABANDON_RESTORE_BELOW_FOLD,
                        FeedConfiguration.getAbandonRestoreBelowFold())
                .put(ConfigKey.CARD_MENU_TOOLTIP_ELIGIBLE,
                        FeedConfiguration.getCardMenuTooltipEligible())
                .put(ConfigKey.CONSUME_SYNTHETIC_TOKENS,
                        FeedConfiguration.getConsumeSyntheticTokens())
                .put(ConfigKey.CONSUME_SYNTHETIC_TOKENS_WHILE_RESTORING,
                        FeedConfiguration.getConsumeSyntheticTokensWhileRestoring())
                .put(ConfigKey.DEFAULT_ACTION_TTL_SECONDS,
                        FeedConfiguration.getDefaultActionTtlSeconds())
                .put(ConfigKey.FEED_ACTION_SERVER_ENDPOINT,
                        FeedConfiguration.getFeedActionServerEndpoint())
                .put(ConfigKey.FEED_ACTION_SERVER_MAX_ACTIONS_PER_REQUEST,
                        FeedConfiguration.getFeedActionServerMaxActionsPerRequest())
                .put(ConfigKey.FEED_ACTION_SERVER_MAX_SIZE_PER_REQUEST,
                        FeedConfiguration.getFeedActionServerMaxSizePerRequest())
                .put(ConfigKey.FEED_ACTION_SERVER_METHOD,
                        FeedConfiguration.getFeedActionServerMethod())
                .put(ConfigKey.FEED_SERVER_ENDPOINT, FeedConfiguration.getFeedServerEndpoint())
                .put(ConfigKey.FEED_SERVER_METHOD, FeedConfiguration.getFeedServerMethod())
                .put(ConfigKey.FEED_SERVER_RESPONSE_LENGTH_PREFIXED,
                        FeedConfiguration.getFeedServerResponseLengthPrefixed())
                .put(ConfigKey.FEED_UI_ENABLED, FeedConfiguration.getFeedUiEnabled())
                .put(ConfigKey.INITIAL_NON_CACHED_PAGE_SIZE,
                        FeedConfiguration.getInitialNonCachedPageSize())
                .put(ConfigKey.LIMIT_PAGE_UPDATES_IN_HEAD,
                        FeedConfiguration.getLimitPageUpdatesInHead())
                .put(ConfigKey.LOGGING_IMMEDIATE_CONTENT_THRESHOLD_MS,
                        FeedConfiguration.getLoggingImmediateContentThresholdMs())
                .put(ConfigKey.MANAGE_INTERESTS_ENABLED,
                        FeedConfiguration.getManageInterestsEnabled())
                .put(ConfigKey.SEND_FEEDBACK_ENABLED, FeedConfiguration.getSendFeedbackEnabled())
                .put(ConfigKey.MAXIMUM_GC_ATTEMPTS, FeedConfiguration.getMaximumGcAttempts())
                .put(ConfigKey.NON_CACHED_MIN_PAGE_SIZE,
                        FeedConfiguration.getNonCachedMinPageSize())
                .put(ConfigKey.NON_CACHED_PAGE_SIZE, FeedConfiguration.getNonCachedPageSize())
                .put(ConfigKey.SESSION_LIFETIME_MS, FeedConfiguration.getSessionLifetimeMs())
                .put(ConfigKey.SNIPPETS_ENABLED, FeedConfiguration.getSnippetsEnabled())
                .put(ConfigKey.SPINNER_DELAY_MS, FeedConfiguration.getSpinnerDelayMs())
                .put(ConfigKey.SPINNER_MINIMUM_SHOW_TIME_MS,
                        FeedConfiguration.getSpinnerMinimumShowTimeMs())
                .put(ConfigKey.STORAGE_MISS_THRESHOLD, FeedConfiguration.getStorageMissThreshold())
                .put(ConfigKey.TRIGGER_IMMEDIATE_PAGINATION,
                        FeedConfiguration.getTriggerImmediatePagination())
                .put(ConfigKey.UNDOABLE_ACTIONS_ENABLED,
                        FeedConfiguration.getUndoableActionsEnabled())
                .put(ConfigKey.USE_TIMEOUT_SCHEDULER, FeedConfiguration.getUseTimeoutScheduler())
                .put(ConfigKey.USE_SECONDARY_PAGE_REQUEST,
                        FeedConfiguration.getUseSecondaryPageRequest())
                .put(ConfigKey.VIEW_LOG_THRESHOLD, FeedConfiguration.getViewLogThreshold())
                .build();
    }
}


text:
package io.dropwizard.jackson;

import com.fasterxml.jackson.core.JsonGenerator;
import com.fasterxml.jackson.core.JsonParser;
import com.fasterxml.jackson.core.Version;
import com.fasterxml.jackson.databind.BeanDescription;
import com.fasterxml.jackson.databind.DeserializationConfig;
import com.fasterxml.jackson.databind.DeserializationContext;
import com.fasterxml.jackson.databind.JavaType;
import com.fasterxml.jackson.databind.JsonDeserializer;
import com.fasterxml.jackson.databind.JsonMappingException;
import com.fasterxml.jackson.databind.JsonSerializer;
import com.fasterxml.jackson.databind.Module;
import com.fasterxml.jackson.databind.SerializationConfig;
import com.fasterxml.jackson.databind.SerializerProvider;
import com.fasterxml.jackson.databind.deser.Deserializers;
import com.fasterxml.jackson.databind.ser.Serializers;
import com.github.benmanes.caffeine.cache.CaffeineSpec;

import java.io.IOException;

/**
 * A Jackson module that can (de)serialize {@link CaffeineSpec CaffeineSpecs}.
 *
 * @since 2.0
 */
public class CaffeineModule extends Module {
    private static class CaffeineSpecDeserializer extends JsonDeserializer<CaffeineSpec> {
        @Override
        public CaffeineSpec deserialize(JsonParser jp,
                                        DeserializationContext ctxt) throws IOException {
            final String text = jp.getText();
            final boolean disabled = "off".equalsIgnoreCase(text) || "disabled".equalsIgnoreCase(text);
            return CaffeineSpec.parse(disabled ? "initialCapacity=0,maximumSize=0" : text);
        }
    }

    private static class CaffeineSpecSerializer extends JsonSerializer<CaffeineSpec> {
        @Override
        public void serialize(CaffeineSpec value, JsonGenerator gen, SerializerProvider serializers) throws IOException {
            gen.writeString(value.toParsableString());
        }
    }

    private static class CaffeineDeserializers extends Deserializers.Base {
        @Override
        public JsonDeserializer<?> findBeanDeserializer(JavaType type,
                                                        DeserializationConfig config,
                                                        BeanDescription beanDesc) throws JsonMappingException {
            if (CaffeineSpec.class.isAssignableFrom(type.getRawClass())) {
                return new CaffeineSpecDeserializer();
            }

            return super.findBeanDeserializer(type, config, beanDesc);
        }
    }

    private static class CaffeineSerializers extends Serializers.Base {
        @Override
        public JsonSerializer<?> findSerializer(SerializationConfig config, JavaType type, BeanDescription beanDesc) {
            if (CaffeineSpec.class.isAssignableFrom(type.getRawClass())) {
                return new CaffeineSpecSerializer();
            }

            return super.findSerializer(config, type, beanDesc);
        }
    }

    @Override
    public String getModuleName() {
        return this.getClass().getSimpleName();
    }

    @Override
    public Version version() {
        return Version.unknownVersion();
    }

    @Override
    public void setupModule(SetupContext context) {
        context.addDeserializers(new CaffeineDeserializers());
        context.addSerializers(new CaffeineSerializers());
    }
}


text:
from neutron.agent.linux import ovs_lib
from neutron.common import utils
from neutron.plugins.common import constants as const
from neutron.plugins.openvswitch.common import constants as ovs_const

def vxlan_supported(root_helper, from_ip='192.0.2.1', to_ip='192.0.2.2'):
    name = "vxlantest-" + utils.get_random_string(6)
    with ovs_lib.OVSBridge(name, root_helper) as br:
        port = br.add_tunnel_port(from_ip, to_ip, const.TYPE_VXLAN)
        return port != ovs_const.INVALID_OFPORT

def patch_supported(root_helper):
    seed = utils.get_random_string(6)
    name = "patchtest-" + seed
    peer_name = "peertest0-" + seed
    patch_name = "peertest1-" + seed
    with ovs_lib.OVSBridge(name, root_helper) as br:
        port = br.add_patch_port(patch_name, peer_name)
        return port != ovs_const.INVALID_OFPORT


text:
// Copyright 2020 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

/**
 * @fileoverview An EditableLine encapsulates all data concerning a line in the
 * automation tree necessary to provide output. Editable: an editable selection
 * (e.g. start/end offsets) get saved. Line: nodes/offsets at the beginning/end
 * of a line get saved.
 */
import {AutomationPredicate} from '../../../common/automation_predicate.js';
import {AutomationUtil} from '../../../common/automation_util.js';
import {constants} from '../../../common/constants.js';
import {Cursor, CURSOR_NODE_INDEX, CursorMovement, CursorUnit} from '../../../common/cursors/cursor.js';
import {CursorRange} from '../../../common/cursors/range.js';
import {RecoveryStrategy, TreePathRecoveryStrategy} from '../../../common/cursors/recovery_strategy.js';
import {Spannable} from '../../common/spannable.js';
import {LibLouis} from '../braille/liblouis.js';
import {Output} from '../output/output.js';
import {OutputCustomEvent, OutputNodeSpan} from '../output/output_types.js';

const AutomationEvent = chrome.automation.AutomationEvent;
const AutomationNode = chrome.automation.AutomationNode;
const Dir = constants.Dir;
const EventType = chrome.automation.EventType;
const FormType = LibLouis.FormType;
const RoleType = chrome.automation.RoleType;
const StateType = chrome.automation.StateType;
const Movement = CursorMovement;
const Unit = CursorUnit;

export class EditableLine {
  /**
   * @param {!AutomationNode} startNode
   * @param {number} startIndex
   * @param {!AutomationNode} endNode
   * @param {number} endIndex
   * @param {boolean=} opt_baseLineOnStart  Controls whether to use
   *     |startNode| or |endNode| for Line computations. Selections are
   * automatically truncated up to either the line start or end.
   */
  constructor(startNode, startIndex, endNode, endIndex, opt_baseLineOnStart) {
    /** @private {!Cursor} */
    this.start_ = new Cursor(startNode, startIndex);
    this.start_ = this.start_.deepEquivalent || this.start_;
    /** @private {!Cursor} */
    this.end_ = new Cursor(endNode, endIndex);
    this.end_ = this.end_.deepEquivalent || this.end_;

    /** @private {AutomationNode|undefined} */
    this.endContainer_;

    // Update |startIndex| and |endIndex| if the calls above to
    // Cursor.deepEquivalent results in cursors to different container
    // nodes. The cursors can point directly to inline text boxes, in which case
    // we should not adjust the container start or end index.
    if (!AutomationPredicate.text(startNode) ||
        (this.start_.node !== startNode &&
         this.start_.node.parent !== startNode)) {
      startIndex =
          (this.start_.index === CURSOR_NODE_INDEX && this.start_.node.name) ?
          this.start_.node.name.length :
          this.start_.index;
    }

    if (!AutomationPredicate.text(endNode) ||
        (this.end_.node !== endNode && this.end_.node.parent !== endNode)) {
      endIndex =
          (this.end_.index === CURSOR_NODE_INDEX && this.end_.node.name) ?
          this.end_.node.name.length :
          this.end_.index;
    }

    /** @private {number} */
    this.localContainerStartOffset_ = startIndex;
    /** @private {number} */
    this.localContainerEndOffset_ = endIndex;

    // Computed members.
    /** @private {Spannable} */
    this.value_;
    /** @private {AutomationNode|undefined} */
    this.lineStart_;
    /** @private {AutomationNode|undefined} */
    this.lineEnd_;
    /** @private {AutomationNode|undefined} */
    this.startContainer_;
    /** @private {string} */
    this.startContainerValue_ = '';
    /** @private {AutomationNode|undefined} */
    this.lineStartContainer_;
    /** @private {number} */
    this.localLineStartContainerOffset_ = 0;
    /** @private {AutomationNode|undefined} */
    this.lineEndContainer_;
    /** @private {number} */
    this.localLineEndContainerOffset_ = 0;
    /** @type {RecoveryStrategy} */
    this.lineStartContainerRecovery_;

    this.computeLineData_(opt_baseLineOnStart);
  }

  /**
   * @param {boolean=} opt_baseLineOnStart Computes the line based on the start
   * node if true.
   * @private
   */
  computeLineData_(opt_baseLineOnStart) {
    // Note that we calculate the line based only upon |start_| or
    // |end_| even if they do not fall on the same line. It is up to
    // the caller to specify which end to base this line upon since it requires
    // reasoning about two lines.
    let nameLen = 0;
    const lineBase = opt_baseLineOnStart ? this.start_ : this.end_;
    const lineExtend = opt_baseLineOnStart ? this.end_ : this.start_;

    if (lineBase.node.name) {
      nameLen = lineBase.node.name.length;
    }

    this.value_ = new Spannable(lineBase.node.name || '', lineBase);
    if (lineBase.node === lineExtend.node) {
      this.value_.setSpan(lineExtend, 0, nameLen);
    }

    this.startContainer_ = this.start_.node;
    if (this.startContainer_.role === RoleType.INLINE_TEXT_BOX) {
      this.startContainer_ = this.startContainer_.parent;
    }
    this.startContainerValue_ =
        this.startContainer_.role === RoleType.TEXT_FIELD ?
        this.startContainer_.value || '' :
        this.startContainer_.name || '';
    this.endContainer_ = this.end_.node;
    if (this.endContainer_.role === RoleType.INLINE_TEXT_BOX) {
      this.endContainer_ = this.endContainer_.parent;
    }

    // Initialize defaults.
    this.lineStart_ = lineBase.node;
    this.lineEnd_ = this.lineStart_;
    this.lineStartContainer_ = this.lineStart_.parent;
    this.lineEndContainer_ = this.lineStart_.parent;

    // Annotate each chunk with its associated inline text box node.
    this.value_.setSpan(this.lineStart_, 0, nameLen);

    // Also, track the nodes necessary for selection (either their parents, in
    // the case of inline text boxes, or the node itself).
    const parents = [this.startContainer_];

    // Keep track of visited nodes to ensure we don't visit the same node twice.
    // Workaround for crbug.com/1203840.
    const visited = new WeakSet();
    if (this.lineStart_) {
      visited.add(this.lineStart_);
    }

    let data = this.computeLineStartMetadata_(
        this.lineStart_, this.value_, parents, visited);
    this.lineStart_ = data.lineStart;
    this.lineStartContainer_ = this.lineStart_.parent;
    this.value_ = data.value;
    const textCountBeforeLineStart = data.textCountBeforeLineStart;
    this.localLineStartContainerOffset_ = textCountBeforeLineStart;
    if (this.lineStartContainer_) {
      this.lineStartContainerRecovery_ =
          new TreePathRecoveryStrategy(this.lineStartContainer_);
    }

    data = this.computeLineEndMetadata_(
        this.lineEnd_, this.value_, parents, visited);
    this.lineEnd_ = data.lineEnd;
    this.lineEndContainer_ = this.lineEnd_.parent;
    this.value_ = data.value;
    const textCountAfterLineEnd = data.textCountAfterLineEnd;
    if (this.lineEndContainer_.name) {
      this.localLineEndContainerOffset_ =
          this.lineEndContainer_.name.length - textCountAfterLineEnd;
    }

    // Annotate with all parent static texts as NodeSpans so that braille
    // routing can key properly into the node with an offset.
    this.value_ = this.annotateWithParents_(
        this.value_, parents, textCountBeforeLineStart, textCountAfterLineEnd);
  }

  /**
   * @param {AutomationNode|undefined} scanNode
   * @param {Spannable} value
   * @param {!Array<!AutomationNode>} parents
   * @param {!WeakSet<!AutomationNode>} visited
   * @return {!{
   *      lineStart: (AutomationNode|undefined),
   *      value: Spannable,
   *      textCountBeforeLineStart: number}}
   * @private
   */
  computeLineStartMetadata_(scanNode, value, parents, visited) {
    let lineStart = scanNode;
    if (scanNode) {
      scanNode = this.getPreviousOnLine_(scanNode);
    }
    // Compute |lineStart|.
    while (scanNode && !visited.has(scanNode)) {
      visited.add(scanNode);
      lineStart = scanNode;

      if (scanNode.role !== RoleType.INLINE_TEXT_BOX) {
        parents.unshift(scanNode);
      } else if (parents[0] !== scanNode.parent) {
        parents.unshift(scanNode.parent);
      }

      const prepend = new Spannable(scanNode.name, scanNode);
      prepend.append(/** @type {!Spannable} */ (value));
      value = prepend;

      scanNode = this.getPreviousOnLine_(scanNode);
    }

    // Note that we need to account for potential offsets into the static texts
    // as follows.
    let textCountBeforeLineStart = 0;
    let finder = lineStart;
    while (finder.previousSibling &&
           (EditableLine.includeOffscreen ||
            !finder.previousSibling.state[StateType.OFFSCREEN])) {
      finder = finder.previousSibling;
      textCountBeforeLineStart += finder.name ? finder.name.length : 0;
    }

    return {lineStart, value, textCountBeforeLineStart};
  }

  /**
   * @param {AutomationNode|undefined} scanNode
   * @param {Spannable} value
   * @param {!Array<!AutomationNode>} parents
   * @param {!WeakSet<!AutomationNode>} visited
   * @return {!{
   *      lineEnd: (AutomationNode|undefined),
   *      value: Spannable,
   *      textCountAfterLineEnd: number}}
   * @private
   */
  computeLineEndMetadata_(scanNode, value, parents, visited) {
    let lineEnd = scanNode;
    if (scanNode) {
      scanNode = this.getNextOnLine_(scanNode);
    }
    // Compute |lineEnd|.
    while (scanNode && !visited.has(scanNode)) {
      visited.add(scanNode);
      lineEnd = scanNode;

      if (scanNode.role !== RoleType.INLINE_TEXT_BOX) {
        parents.push(scanNode);
      } else if (parents[parents.length - 1] !== scanNode.parent) {
        parents.push(scanNode.parent);
      }

      let annotation = scanNode;
      if (scanNode === this.end_.node) {
        annotation = this.end_;
      }

      value.append(new Spannable(scanNode.name, annotation));

      scanNode = this.getNextOnLine_(scanNode);
    }

    // Note that we need to account for potential offsets into the static texts
    // as follows.
    let textCountAfterLineEnd = 0;
    let finder = lineEnd;
    while (finder.nextSibling &&
           (EditableLine.includeOffscreen ||
            !finder.nextSibling.state[StateType.OFFSCREEN])) {
      finder = finder.nextSibling;
      textCountAfterLineEnd += finder.name ? finder.name.length : 0;
    }

    return {lineEnd, value, textCountAfterLineEnd};
  }

  /**
   * @param {Spannable} value
   * @param {!Array<!AutomationNode>} parents
   * @param {number} textCountBeforeLineStart
   * @param {number} textCountAfterLineEnd
   * @return {Spannable}
   * @private
   */
  annotateWithParents_(
      value, parents, textCountBeforeLineStart, textCountAfterLineEnd) {
    let len = 0;
    for (let i = 0; i < parents.length; i++) {
      const parent = parents[i];

      if (!parent.name) {
        continue;
      }

      const prevLen = len;
      let currentLen = parent.name.length;
      let offset = 0;

      // Subtract off the text count before when at the start of line.
      if (i === 0) {
        currentLen -= textCountBeforeLineStart;
        offset = textCountBeforeLineStart;
      }

      // Subtract text count after when at the end of the line.
      if (i === parents.length - 1) {
        currentLen -= textCountAfterLineEnd;
      }

      len += currentLen;

      try {
        value.setSpan(new OutputNodeSpan(parent, offset), prevLen, len);

        // Also, annotate this span if it is associated with line container.
        if (parent === this.startContainer_) {
          value.setSpan(parent, prevLen, len);
        }
      } catch (e) {
      }
    }
    return value;
  }

  /**
   * @param {!AutomationNode} node
   * @return {!AutomationNode|undefined}
   * @private
   */
  getNextOnLine_(node) {
    const nextOnLine = node.nextOnLine;
    const nextSibling = node.nextSibling;
    if (nextOnLine && nextOnLine.role) {
      // Ensure that there is a next-on-line node. The role can be undefined
      // for an object that has been destroyed since the object was first
      // cached.
      return nextOnLine;
    }

    if (nextSibling && nextSibling.previousOnLine === node) {
      // Catches potential breaks in the chain of next-on-line nodes.
      return nextSibling.firstChild;
    }

    return undefined;
  }

  /**
   * @param {!AutomationNode} node
   * @return {!AutomationNode|undefined}
   * @private
   */
  getPreviousOnLine_(node) {
    const previousLine = node.previousOnLine;
    const previousSibling = node.previousSibling;
    if (previousLine && previousLine.role) {
      // Ensure that there is a previous-on-line node. The role can be undefined
      // for an object that has been destroyed since the object was first
      // cached.
      return previousLine;
    }

    if (previousSibling && previousSibling.lastChild &&
        previousSibling.lastChild.nextOnLine === node) {
      // Catches potential breaks in the chain of previous-on-line nodes.
      return previousSibling.lastChild;
    }

    return undefined;
  }

  /**
   * Gets the selection offset based on the text content of this line.
   * @return {number}
   */
  get startOffset() {
    // It is possible that the start cursor points to content before this line
    // (e.g. in a multi-line selection).
    try {
      return this.value_.getSpanStart(this.start_) +
          (this.start_.index === CURSOR_NODE_INDEX ? 0 : this.start_.index);
    } catch (e) {
      // When that happens, fall back to the start of this line.
      return 0;
    }
  }

  /**
   * Gets the selection offset based on the text content of this line.
   * @return {number}
   */
  get endOffset() {
    try {
      return this.value_.getSpanStart(this.end_) +
          (this.end_.index === CURSOR_NODE_INDEX ? 0 : this.end_.index);
    } catch (e) {
      return this.value_.length;
    }
  }

  /**
   * Gets the selection offset based on the parent's text.
   * The parent is expected to be static text.
   * @return {number}
   */
  get localStartOffset() {
    return this.localContainerStartOffset_;
  }

  /**
   * Gets the selection offset based on the parent's text.
   * The parent is expected to be static text.
   * @return {number}
   */
  get localEndOffset() {
    return this.localContainerEndOffset_;
  }

  /**
   * Gets the start offset of the container, relative to the line text
   * content. The container refers to the static text parenting the inline
   * text box.
   * @return {number}
   */
  get containerStartOffset() {
    return this.value_.getSpanStart(this.startContainer_);
  }

  /**
   * Gets the end offset of the container, relative to the line text content.
   * The container refers to the static text parenting the inline text box.
   * @return {number}
   */
  get containerEndOffset() {
    return this.value_.getSpanEnd(this.startContainer_) - 1;
  }

  /**
   * The text content of this line.
   * @return {string} The text of this line.
   */
  get text() {
    return this.value_.toString();
  }

  /** @return {string} */
  get selectedText() {
    return this.value_.toString().substring(this.startOffset, this.endOffset);
  }

  /** @return {AutomationNode|undefined} */
  get startContainer() {
    return this.startContainer_;
  }

  /** @return {AutomationNode|undefined} */
  get endContainer() {
    return this.endContainer_;
  }

  /** @return {Spannable} */
  get value() {
    return this.value_;
  }

  /** @return {!Cursor} */
  get start() {
    return this.start_;
  }

  /** @return {!Cursor} */
  get end() {
    return this.end_;
  }

  /** @return {number} */
  get localContainerStartOffset() {
    return this.localContainerStartOffset_;
  }

  /** @return {number} */
  get localContainerEndOffset() {
    return this.localContainerEndOffset_;
  }

  /** @return {string} */
  get startContainerValue() {
    return this.startContainerValue_;
  }

  /** @return {boolean} */
  hasCollapsedSelection() {
    return this.start_.equals(this.end_);
  }

  /**
   * Returns whether this line has selection over text nodes.
   * @return {boolean}
   */
  hasTextSelection() {
    if (this.start_.node && this.end_.node) {
      return AutomationPredicate.text(this.start_.node) &&
          AutomationPredicate.text(this.end_.node);
    }

    return false;
  }

  /**
   * Returns true if |otherLine| surrounds the same line as |this|. Note that
   * the contents of the line might be different.
   * @param {EditableLine} otherLine
   * @return {boolean}
   */
  isSameLine(otherLine) {
    // Equality is intentionally loose here as any of the state nodes can be
    // invalidated at any time. We rely upon the start/anchor of the line
    // staying the same.
    return (otherLine.lineStartContainer_ === this.lineStartContainer_ &&
            otherLine.localLineStartContainerOffset_ ===
                this.localLineStartContainerOffset_) ||
        (otherLine.lineEndContainer_ === this.lineEndContainer_ &&
         otherLine.localLineEndContainerOffset_ ===
             this.localLineEndContainerOffset_) ||
        (otherLine.lineStartContainerRecovery_.node ===
             this.lineStartContainerRecovery_.node &&
         otherLine.localLineStartContainerOffset_ ===
             this.localLineStartContainerOffset_);
  }

  /**
   * Returns true if |otherLine| surrounds the same line as |this| and has the
   * same selection.
   * @param {EditableLine} otherLine
   * @return {boolean}
   */
  isSameLineAndSelection(otherLine) {
    return this.isSameLine(otherLine) &&
        this.startOffset === otherLine.startOffset &&
        this.endOffset === otherLine.endOffset;
  }

  /**
   * Returns whether this line comes before |otherLine| in document order.
   * @param {!EditableLine} otherLine
   * @return {boolean}
   */
  isBeforeLine(otherLine) {
    if (!this.lineStartContainer_ || !otherLine.lineStartContainer_) {
      return false;
    }

    if (this.isSameLine(otherLine)) {
      return this.endOffset <= otherLine.endOffset;
    }

    return AutomationUtil.getDirection(
               this.lineStartContainer_, otherLine.lineStartContainer_) ===
        Dir.FORWARD;
  }

  /**
   * Performs a validation that this line still refers to a line given its
   * internally tracked state.
   * @return {boolean}
   */
  isValidLine() {
    if (!this.lineStartContainer_ || !this.lineEndContainer_) {
      return false;
    }

    const start = new Cursor(
        this.lineStartContainer_, this.localLineStartContainerOffset_);
    const end = new Cursor(
        this.lineEndContainer_, this.localLineEndContainerOffset_ - 1);
    const localStart = start.deepEquivalent || start;
    const localEnd = end.deepEquivalent || end;
    const localStartNode = localStart.node;
    const localEndNode = localEnd.node;

    // Unfortunately, there are asymmetric errors in lines, so we need to
    // check in both directions.
    let testStartNode = localStartNode;
    do {
      if (testStartNode === localEndNode) {
        return true;
      }

      // Hack/workaround for broken *OnLine links.
      if (testStartNode.nextOnLine && testStartNode.nextOnLine.role) {
        testStartNode = testStartNode.nextOnLine;
      } else if (
          testStartNode.nextSibling &&
          testStartNode.nextSibling.previousOnLine === testStartNode) {
        testStartNode = testStartNode.nextSibling;
      } else {
        break;
      }
    } while (testStartNode);

    let testEndNode = localEndNode;
    do {
      if (testEndNode === localStartNode) {
        return true;
      }

      // Hack/workaround for broken *OnLine links.
      if (testEndNode.previousOnLine && testEndNode.previousOnLine.role) {
        testEndNode = testEndNode.previousOnLine;
      } else if (
          testEndNode.previousSibling &&
          testEndNode.previousSibling.nextOnLine === testEndNode) {
        testEndNode = testEndNode.previousSibling;
      } else {
        break;
      }
    } while (testEndNode);

    return false;
  }

  /**
   * Speaks the line using text to speech.
   * @param {EditableLine} prevLine
   */
  speakLine(prevLine) {
    // Detect when the entire line is just a breaking space. This occurs on
    // Google Docs and requires that we speak it as a new line. However, we
    // still need to account for all of the possible rich output occurring from
    // ancestors of line nodes.
    const isLineBreakingSpace = this.text === '\u00a0';

    const prev = (prevLine && prevLine.startContainer_.role) ?
        prevLine.startContainer_ :
        null;
    const lineNodes =
        /** @type {Array<!AutomationNode>} */ (this.value_.getSpansInstanceOf(
            /** @type {function()} */ (this.startContainer_.constructor)));
    const speakNodeAtIndex = (index, prev) => {
      const cur = lineNodes[index];
      if (!cur) {
        return;
      }

      if (cur.children.length) {
        speakNodeAtIndex(++index, cur);
        return;
      }

      const o = new Output();

      if (isLineBreakingSpace) {
        // Apply a replacement for \u00a0 to \n.
        o.withSpeechTextReplacement('\u00a0', '\n');
      }

      o.withRichSpeech(
           CursorRange.fromNode(cur),
           prev ? CursorRange.fromNode(prev) : CursorRange.fromNode(cur),
           OutputCustomEvent.NAVIGATE)
          .onSpeechEnd(() => {
            speakNodeAtIndex(++index, cur);
          });

      // Ignore whitespace only output except if it is leading content on the
      // line.
      if (!o.isOnlyWhitespace || index === 0) {
        o.go();
      } else {
        speakNodeAtIndex(++index, cur);
      }
    };

    speakNodeAtIndex(0, prev);
  }

  /**
   * Creates a range around the character to the right of the line's starting
   * position.
   * @return {!CursorRange}
   */
  createCharRange() {
    const start = this.start_;
    let end = start.move(Unit.CHARACTER, Movement.DIRECTIONAL, Dir.FORWARD);

    // The following conditions detect when|start|moves across a node boundary
    // to|end|.
    if (start.node !== end.node ||
        // When |start| and |end| are equal, that means we've reached
        // the end of the document. This is a node boundary as well.
        start.equals(end)) {
      end = new Cursor(start.node, start.index + 1);
    }
    return new CursorRange(start, end);
  }

  /**
   * @param {boolean} shouldMoveToPreviousWord
   * @return {!CursorRange}
   */
  createWordRange(shouldMoveToPreviousWord) {
    const pos = this.start_;
    // When movement goes to the end of a word, we actually want to
    // describe the word itself; this is considered the previous word so
    // impacts the movement type below. We can give further context e.g.
    // by saying "end of word", if we chose to be more verbose.
    const start = pos.move(
        Unit.WORD,
        shouldMoveToPreviousWord ? Movement.DIRECTIONAL : Movement.BOUND,
        Dir.BACKWARD);
    const end = start.move(Unit.WORD, Movement.BOUND, Dir.FORWARD);
    return new CursorRange(start, end);
  }
}

/**
 * Controls whether line computations include offscreen inline text boxes. Note
 * that a caller should have this set prior to creating a line.
 * @public {boolean}
 */
EditableLine.includeOffscreen = true;


text:
rightBicep = Runtime.createAndStart("rightBicep", "Servo")

# Next we need to attach ther servo Service to a Controller Service, in this case it  will be the head
# Adafruit16ChServoDriver. We also need to tell the Servo Service which pin on the controller
# the servo is connected to, in this case pin 15
rightBicep.attach(rightArm,15)

# Now we tell the Servo Service about our servos limits, in some cases if the servo goes to far, things will break
rightBicep.setMinMax(0,180)

# This allows you to map the input to the Servo service to an actual servo position output
rightBicep.map(0,180,1,180)

# there is a rest command that can be issued to the servo,
# when that happens, this is the position that the servo will go to
rightBicep.setRest(90)

# if your servo run backwards, then set this to true in order to reverse it.
rightBicep.setInverted(False)

# degrees per second rotational velocity, setting -1 will set the speed to the servo's default
rightBicep.setVelocity(60)

# this allows the Servo Sevice to turn off the motor when it has reached the target position.
# the major advantage to this is the servos will use less power and have a lower chance of buring out.
rightBicep.setAutoDisable(True)

# Ok now that we have fully defined the headX servo lets make sure it is in the rest position.
rightBicep.rest()

# commands not used here but will be in other parts on the program are the following:
# rightBicep.moveTo(x) where x is the position you want move to.
# rightBicep.moveToBlockig(x) as above except execution of the program will pause until the position is reached.
# rightBicep.disable() will turn off the servo without unloading the service.
# rightBicep.enable() the oposite of disable will turn the servo back on after being disabled.
# disable and enable are not required if setAutoDisable is set to True

# For each servo that we have, we need to create a Servo Service, so this will be a process
# of repeating what we did above for each servo just using a diferent object name.
rightElbow = Runtime.createAndStart("rightElbow", "Servo")
rightElbow.attach(rightArm,14)
rightElbow.setMinMax(0,180)
rightElbow.map(0,180,1,180)
rightElbow.setRest(90)
rightElbow.setInverted(False)
rightElbow.setVelocity(60)
rightElbow.setAutoDisable(True)
rightElbow.rest()

rightWrist = Runtime.createAndStart("rightWrist", "Servo")
rightWrist.attach(rightArm,0)
rightWrist.setMinMax(0,180)
rightWrist.map(0,180,1,180)
rightWrist.setRest(90)
rightWrist.setInverted(False)
rightWrist.setVelocity(60)
rightWrist.setAutoDisable(True)
rightWrist.rest()

rightThumb = Runtime.createAndStart("rightThumb", "Servo")
rightThumb.attach(rightArm,1)
rightThumb.setMinMax(0,180)
rightThumb.map(0,180,1,180)
rightThumb.setRest(90)
rightThumb.setInverted(False)
rightThumb.setVelocity(60)
rightThumb.setAutoDisable(True)
rightThumb.rest()

rightIndex = Runtime.createAndStart("rightIndex", "Servo")
rightIndex.attach(rightArm,2)
rightIndex.setMinMax(0,180)
rightIndex.map(0,180,1,180)
rightIndex.setRest(90)
rightIndex.setInverted(False)
rightIndex.setVelocity(60)
rightIndex.setAutoDisable(True)
rightIndex.rest()

rightMajure = Runtime.createAndStart("rightMajure", "Servo")
rightMajure.attach(rightArm,3)
rightMajure.setMinMax(0,180)
rightMajure.map(0,180,1,180)
rightMajure.setRest(90)
rightMajure.setInverted(False)
rightMajure.setVelocity(60)
rightMajure.setAutoDisable(True)
rightMajure.rest()

rightRing = Runtime.createAndStart("rightRing", "Servo")
rightRing.attach(rightArm,4)
rightRing.setMinMax(0,180)
rightRing.map(0,180,1,180)
rightRing.setRest(90)
rightRing.setInverted(False)
rightRing.setVelocity(60)
rightRing.setAutoDisable(True)
rightRing.rest()

rightLittle = Runtime.createAndStart("rightLittle", "Servo")
rightLittle.attach(rightArm,5)
rightLittle.setMinMax(0,180)
rightLittle.map(0,180,1,180)
rightLittle.setRest(90)
rightLittle.setInverted(False)
rightLittle.setVelocity(60)
rightLittle.setAutoDisable(True)
rightLittle.rest()


text:
<?php
namespace TYPO3\CMS\Lang\View\Language;

/**
 * JSON view for "activateLanguage" action in "Language" controller
 */
class ActivateLanguageJson extends \TYPO3\CMS\Lang\View\AbstractJsonView
{
    /**
     * Returns the response data
     *
     * @return array The response data
     */
    protected function getReponseData()
    {
        return $this->variables['response'];
    }
}


text:
<?php

/**
 * A Date MIME Header for Swift Mailer.
 *
 * @author Chris Corbyn
 */
class Swift_Mime_Headers_DateHeader extends Swift_Mime_Headers_AbstractHeader{
    /**
     * The UNIX timestamp value of this Header.
     *
     * @var int
     */
    private $_timestamp;

    /**
     * Creates a new DateHeader with $name and $timestamp.
     *
     * Example:
     * <code>
     * <?php
     * $header = new Swift_Mime_Headers_DateHeader('Date', time());
     * ?>
     * </code>
     *
     * @param string             $name    of Header
     * @param Swift_Mime_Grammar $grammar
     */
    public function __construct($name, Swift_Mime_Grammar $grammar) {
        $this->setFieldName($name);
        parent::__construct($grammar);
    }

    /**
     * Get the type of Header that this instance represents.
     *
     * @see TYPE_TEXT, TYPE_PARAMETERIZED, TYPE_MAILBOX
     * @see TYPE_DATE, TYPE_ID, TYPE_PATH
     *
     * @return int
     */
    public function getFieldType() {
        return self::TYPE_DATE;
    }

    /**
     * Set the model for the field body.
     *
     * This method takes a UNIX timestamp.
     *
     * @param int $model
     */
    public function setFieldBodyModel($model) {
        $this->setTimestamp($model);
    }

    /**
     * Get the model for the field body.
     *
     * This method returns a UNIX timestamp.
     *
     * @return mixed
     */
    public function getFieldBodyModel() {
        return $this->getTimestamp();
    }

    /**
     * Get the UNIX timestamp of the Date in this Header.
     *
     * @return int
     */
    public function getTimestamp() {
        return $this->_timestamp;
    }

    /**
     * Set the UNIX timestamp of the Date in this Header.
     *
     * @param int $timestamp
     */
    public function setTimestamp($timestamp) {
        if (!is_null($timestamp)) {
            $timestamp = (int) $timestamp;
        }
        $this->clearCachedValueIf($this->_timestamp != $timestamp);
        $this->_timestamp = $timestamp;
    }

    /**
     * Get the string value of the body in this Header.
     *
     * This is not necessarily RFC 2822 compliant since folding white space will
     * not be added at this stage (see {@link toString()} for that).
     *
     * @see toString()
     *
     * @return string
     */
    public function getFieldBody() {
        if (!$this->getCachedValue()) {
            if (isset($this->_timestamp)) {
                $this->setCachedValue(date('r', $this->_timestamp));
            }
        }

        return $this->getCachedValue();
    }
}


text:
GarageDoorProject
=================