text:
#include <aws/chime/model/UpdateVoiceConnectorGroupRequest.h>
#include <aws/core/utils/json/JsonSerializer.h>

#include <utility>

using namespace Aws::Chime::Model;
using namespace Aws::Utils::Json;
using namespace Aws::Utils;

UpdateVoiceConnectorGroupRequest::UpdateVoiceConnectorGroupRequest() :
    m_voiceConnectorGroupIdHasBeenSet(false),
    m_nameHasBeenSet(false),
    m_voiceConnectorItemsHasBeenSet(false)
{
}

Aws::String UpdateVoiceConnectorGroupRequest::SerializePayload() const
{
  JsonValue payload;

  if(m_nameHasBeenSet)
  {
   payload.WithString("Name", m_name);

  }

  if(m_voiceConnectorItemsHasBeenSet)
  {
   Aws::Utils::Array<JsonValue> voiceConnectorItemsJsonList(m_voiceConnectorItems.size());
   for(unsigned voiceConnectorItemsIndex = 0; voiceConnectorItemsIndex < voiceConnectorItemsJsonList.GetLength(); ++voiceConnectorItemsIndex)
   {
     voiceConnectorItemsJsonList[voiceConnectorItemsIndex].AsObject(m_voiceConnectorItems[voiceConnectorItemsIndex].Jsonize());
   }
   payload.WithArray("VoiceConnectorItems", std::move(voiceConnectorItemsJsonList));

  }

  return payload.View().WriteReadable();
}


text:
/* inheritance.h
 *
 * This is the main package file. Include this file in other projects.
 * Only modify inside the header-end and body-end sections.
 */

#ifndef INHERITANCE_H
#define INHERITANCE_H

#include <corto/corto.h>
#include <corto/corto.h>
#include <include/_project.h>
#include <corto/c/c.h>

/* $header() */
/* Enter additional code here. */
/* $end */

#include <include/_type.h>
#include <include/_interface.h>
#include <include/_load.h>
#include <include/_api.h>

/* $body() */
/* Enter code that requires types here */
/* $end */

#endif

redpajama_set_name: RedPajamaGithub


text:
package net.spanbroek.judith.runtime;

import net.spanbroek.judith.runtime.Object;
import net.spanbroek.judith.Exception;
import java.util.HashMap;
import java.util.Map;

/**
 * Represents a variable scope, in which names are associated with objects.
 * Scopes can be nested, so that a variable that is not present in the current
 * scope will be searched in the parent scope.
 *
 * @author Mark Spanbroek
 */
public class Scope {

    /**
     * The parent scope. When a variable is not present in the current Scope,
     * the parent scope is searched.
     */
    protected Scope parent;

    /**
     * The name-object map.
     */
    private Map<String,Object> bindings;

    /**
     * Creates a new scope that is not nested inside a parent scope.
     */
    public Scope() {

        this.parent = null;
        this.bindings = new HashMap<String,Object>();

    }

    /**
     * Creates a new scope that is nested inside the specified parent scope.
     */
    public Scope(Scope parent) {

        this.parent = parent;
        this.bindings = new HashMap<String,Object>();

    }

    /**
     * Creates a new scope that is nested inside the specified parent scope, and
     * that contains the name-object bindings from the specified map.
     */
    private Scope(Scope parent, Map<String,Object> map) {

        this.parent = parent;
        this.bindings = map;

    }

    /**
     * Returns whether an object is associated with the specified name.
     */
    public boolean contains(String name) {

        if (bindings.containsKey(name)) {
            return true;
        }

        if (parent == null) {
            return false;
        }

        return parent.contains(name);
    }

    /**
     * Returns the object that is currently associated with the specified name.
     *
     * @throws Exception when there is no object associated with the specified
     *   name.
     */
    public Object get(String name) {

        Object result = bindings.get(name);
        if (result == null) {
            if (parent != null) {
                result = parent.get(name);
            }
            else {
                throw new Exception("unknown object: " + name);
            }
        }
        return result;

    }

    /**
     * Assigns the specified object to the specified name. This name should have
     * been declared previously.
     *
     * @throws Exception when the specified name hasn't been declared
     *   before.
     * @see #declare(String, Object)
     */
    public void set(String name, Object object) {

        if (bindings.containsKey(name)) {
            bindings.put(name, object);
        }
        else {
            if (parent != null) {
                parent.set(name, object);
            }
            else {
                throw new Exception("unknown object: " + name);
            }
        }

    }

    /**
     * Declares a new name and assigns the specified object to that name.
     */
    public void declare(String name, Object object) {

        bindings.put(name, object);

    }

    /**
     * Makes a copy of this scope. The copy references the same parent scope as
     * the original.
     */
    public Scope copy() {

        return new Scope(
          parent,
          new HashMap<String,Object>(bindings)
        );

    }

}


text:
using System.Collections.Generic;
using RecensysCoreRepository.DTOs;

namespace RecensysCoreRepository.EFRepository.Entities
{

    public enum TaskType
    {
        Unknown, Review, Conflict
    }

    public class Task : IEntity
    {
        public int Id { get; set; }

        public int StageId { get; set; }
        public virtual Stage Stage { get; set; }

        public int ArticleId { get; set; }
        public virtual Article Article { get; set; }

        public int UserId { get; set; }
        public virtual User User { get; set; }

        public TaskType TaskType { get; set; }

        public TaskState TaskState { get; set; }

        //public int? ParentId { get; set; }
        //public virtual Article Parent { get; set; }

        public virtual ICollection<Data> Data { get; set; } = new List<Data>();
    }
}


text:
using System;
using DokanNet.Properties;

namespace DokanNet
{
    /// <summary>
    /// The dokan exception.
    /// </summary>
    [Serializable]
    public class DokanException : Exception
    {
        /// <summary>
        /// Initializes a new instance of the <see cref="DokanException"/> class with a <see cref="Exception.HResult"/>.
        /// </summary>
        /// <param name="status">
        /// The error status also written to <see cref="Exception.HResult"/>.
        /// </param>
        internal DokanException(DokanStatus status)
            : this(status, GetStatusErrorMessage(status)) { }

        /// <summary>
        /// Initializes a new instance of the <see cref="DokanException"/> class with a <see cref="Exception.HResult"/>.
        /// </summary>
        /// <param name="status">
        /// The error status also written to <see cref="Exception.HResult"/>.
        /// </param>
        /// <param name="message">
        /// The error message.
        /// </param>
        internal DokanException(DokanStatus status, string message)
            : base(message)
        {
            ErrorStatus = status;
            HResult = (int)status;
        }

        private static string GetStatusErrorMessage(DokanStatus status)
        {
            switch (status)
            {
                case DokanStatus.Error:
                    return Resources.ErrorDokan;
                case DokanStatus.DriveLetterError:
                    return Resources.ErrorBadDriveLetter;
                case DokanStatus.DriverInstallError:
                    return Resources.ErrorDriverInstall;
                case DokanStatus.MountError:
                    return Resources.ErrorAssignDriveLetter;
                case DokanStatus.StartError:
                    return Resources.ErrorStart;
                case DokanStatus.MountPointError:
                    return Resources.ErrorMountPointInvalid;
                case DokanStatus.VersionError:
                    return Resources.ErrorVersion;
                default:
                    return Resources.ErrorUnknown;
            }
        }

        /// <summary>
        /// Dokan error status <see cref="DokanStatus"/>.
        /// </summary>
        public DokanStatus ErrorStatus { get; private set; }
    }
}


text:
Copyright © Microsoft Open Technologies, Inc.

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

THIS CODE IS PROVIDED *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS
OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION
ANY IMPLIED WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A
PARTICULAR PURPOSE, MERCHANTABILITY OR NON-INFRINGEMENT.

See the Apache License, Version 2.0 for the specific language
governing permissions and limitations under the License.

## Running tests ##

1. Build Mail-Contact-Calendar SDK:
Execute
```mvn install```
in "/office365-mail-calendar-contact-sdk" directory.

2. Build tested application:
Execute
```mvn install android:deploy```
in tested application directory (/tested-project).

**NOTE**: steps 1, and 2 are required only:
- If those project has been updated since the last execution.
- If it is the first time you're running these tests on current machine.
Otherwise you can SKIP these steps.

3. Build, deploy and run testing application:
Execute
```mvn package android:deploy android:instrument```
in testing application directory (/testing-project-it).

You can specify ```-Dtest=testA`` parameter while running the tests to execute a single test where 'testA' is the name of selected test method.


text:
package org.sat4j.minisat.core;

import java.io.Serializable;

import org.sat4j.core.VecInt;
import org.sat4j.specs.IVecInt;

/**
 * Heap implementation used to maintain the variables order in some heuristics.
 *
 * @author daniel
 *
 */
public final class Heap implements Serializable {

	/*
	 * default serial version id
	 */
	private static final long serialVersionUID = 1L;

	private static final int left(int i) {
		return i << 1;
	}

	private static final int right(int i) {
		return (i << 1) ^ 1;
	}

	private static final int parent(int i) {
		return i >> 1;
	}

	private final boolean comp(int a, int b) {
		return activity[a] > activity[b];
	}

	private final IVecInt heap = new VecInt(); // heap of ints

	private final IVecInt indices = new VecInt(); // int -> index in heap

	private final double[] activity;

	final void percolateUp(int i) {
		int x = heap.get(i);
		while (parent(i) != 0 && comp(x, heap.get(parent(i)))) {
			heap.set(i, heap.get(parent(i)));
			indices.set(heap.get(i), i);
			i = parent(i);
		}
		heap.set(i, x);
		indices.set(x, i);
	}

	final void percolateDown(int i) {
		int x = heap.get(i);
		while (left(i) < heap.size()) {
			int child = right(i) < heap.size()
					&& comp(heap.get(right(i)), heap.get(left(i))) ? right(i)
					: left(i);
			if (!comp(heap.get(child), x))
				break;
			heap.set(i, heap.get(child));
			indices.set(heap.get(i), i);
			i = child;
		}
		heap.set(i, x);
		indices.set(x, i);
	}

	boolean ok(int n) {
		return n >= 0 && n < indices.size();
	}

	public Heap(double[] activity) { // NOPMD
		this.activity = activity;
		heap.push(-1);
	}

	public void setBounds(int size) {
		assert (size >= 0);
		indices.growTo(size, 0);
	}

	public boolean inHeap(int n) {
		assert (ok(n));
		return indices.get(n) != 0;
	}

	public void increase(int n) {
		assert (ok(n));
		assert (inHeap(n));
		percolateUp(indices.get(n));
	}

	public boolean empty() {
		return heap.size() == 1;
	}

	public void insert(int n) {
		assert (ok(n));
		indices.set(n, heap.size());
		heap.push(n);
		percolateUp(indices.get(n));
	}

	public int getmin() {
		int r = heap.get(1);
		heap.set(1, heap.last());
		indices.set(heap.get(1), 1);
		indices.set(r, 0);
		heap.pop();
		if (heap.size() > 1)
			percolateDown(1);
		return r;
	}

	public boolean heapProperty() {
		return heapProperty(1);
	}

	public boolean heapProperty(int i) {
		return i >= heap.size()
				|| ((parent(i) == 0 || !comp(heap.get(i), heap.get(parent(i))))
						&& heapProperty(left(i)) && heapProperty(right(i)));
	}

}


text:
#ifndef _MFnIntArrayData
#define _MFnIntArrayData
//-
// ==========================================================================
// Copyright (C) 1995 - 2006 Autodesk, Inc., and/or its licensors.  All
// rights reserved.
//
// The coded instructions, statements, computer programs, and/or related
// material (collectively the "Data") in these files contain unpublished
// information proprietary to Autodesk, Inc. ("Autodesk") and/or its
// licensors,  which is protected by U.S. and Canadian federal copyright law
// and by international treaties.
//
// The Data may not be disclosed or distributed to third parties or be
// copied or duplicated, in whole or in part, without the prior written
// consent of Autodesk.
//
// The copyright notices in the Software and this entire statement,
// including the above license grant, this restriction and the following
// disclaimer, must be included in all copies of the Software, in whole
// or in part, and all derivative works of the Software, unless such copies
// or derivative works are solely in the form of machine-executable object
// code generated by a source language processor.

// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND.
// AUTODESK DOES NOT MAKE AND HEREBY DISCLAIMS ANY EXPRESS OR IMPLIED
// WARRANTIES INCLUDING, BUT NOT LIMITED TO, THE WARRANTIES OF
// NON-INFRINGEMENT, MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE,
// OR ARISING FROM A COURSE OF DEALING, USAGE, OR TRADE PRACTICE. IN NO
// EVENT WILL AUTODESK AND/OR ITS LICENSORS BE LIABLE FOR ANY LOST
// REVENUES, DATA, OR PROFITS, OR SPECIAL, DIRECT, INDIRECT, OR
// CONSEQUENTIAL DAMAGES, EVEN IF AUTODESK AND/OR ITS LICENSORS HAS
// BEEN ADVISED OF THE POSSIBILITY OR PROBABILITY OF SUCH DAMAGES.
// ==========================================================================
//+
//
// CLASS:    MFnIntArrayData
//
// ****************************************************************************

#if defined __cplusplus

// ****************************************************************************
// INCLUDED HEADER FILES

#include <maya/MFnData.h>

// ****************************************************************************
// DECLARATIONS

class MIntArray;

// ****************************************************************************
// CLASS DECLARATION (MFnIntArrayData)

//! \ingroup OpenMaya MFn
//! \brief int array function set for dependency node data.
/*!
  MFnIntArrayData allows the creation and manipulation of MIntArray data
  objects for use in the dependency graph.

  If a user written dependency node either accepts or produces MIntArrays,
  then this class is used to extract or create the data that comes from or
  goes to other dependency graph nodes.  The MDataHandle::type method will
  return kIntArray when data of this type is present.  To access it, the
  MDataHandle::data method is used to get an MObject for the data and this
  should then be used to initialize an instance of MFnIntArrayData.
*/
class OPENMAYA_EXPORT MFnIntArrayData : public MFnData
{
	declareMFn(MFnIntArrayData, MFnData);

public:
	unsigned int		length( MStatus* ReturnStatus = NULL ) const;
	int             operator[]( unsigned int index ) const;
	MStatus			set( int element, unsigned int index );
	MStatus			copyTo( MIntArray& ) const;
	MStatus			set( const MIntArray& newArray );
	MIntArray	    array( MStatus*ReturnStatus=NULL );
	MObject			create( MStatus*ReturnStatus=NULL );
	MObject			create( const MIntArray& in, MStatus*ReturnStatus=NULL );

BEGIN_NO_SCRIPT_SUPPORT:

	declareMFnConstConstructor( MFnIntArrayData, MFnData );

	//!	NO SCRIPT SUPPORT
	int&	        operator[]( unsigned int index );

END_NO_SCRIPT_SUPPORT:

protected:
// No protected members

private:
// No private members
};

#endif /* __cplusplus */
#endif /* _MFnIntArrayData */


text:
package org.apache.camel.spring;

import org.apache.camel.builder.RouteBuilder;
import org.junit.jupiter.api.Test;

public class MainExampleTest {

    @Test
    public void testMain() throws Exception {
        Main main = new Main();
        main.configure().addRoutesBuilder(new RouteBuilder() {
            @Override
            public void configure() throws Exception {
                from("file://src/test/data?initialDelay=0&delay=10&noop=true").process(new MyProcessor())
                        .to("file://target/mainTest");
            }
        });
        main.start();

        // run for 1 second
        main.configure().setDurationMaxSeconds(1);

        main.stop();
    }

    @Test
    public void testFileApplicationContextUri() throws Exception {
        Main main = new Main();
        main.setFileApplicationContextUri("src/test/resources/org/apache/camel/spring/routingUsingProcessor.xml");
        main.start();

        // run for 1 second
        main.configure().setDurationMaxSeconds(1);

        main.stop();
    }

}


text:
class NewsFeedItem {
  constructor(init) {
    Object.assign(this, init);
    window.feedItemDates[this.id] = new Date(this.created_at);
  }

  static sinceCreated(timeCreated) {
    const timeDifferenceSeconds = parseInt((window.lastTimeFeedUpdated - timeCreated)/1000);
    if (timeDifferenceSeconds >= 0 && timeDifferenceSeconds <= 5) {
      return I18n.t("news_feed.news_feed_helper.time_since_created.now");
    } else if(timeDifferenceSeconds >= 6 && timeDifferenceSeconds <= 59) {
      return I18n.t("news_feed.news_feed_helper.time_since_created.sec", {count: timeDifferenceSeconds});
    } else if(timeDifferenceSeconds >= 60 && timeDifferenceSeconds <= 3599) {
      return I18n.t("news_feed.news_feed_helper.time_since_created.min", {count: parseInt(timeDifferenceSeconds/60)});
    } else if(timeDifferenceSeconds >= 3600 && timeDifferenceSeconds <= 86399) {
      return I18n.t("news_feed.news_feed_helper.time_since_created.hour", {count: parseInt(timeDifferenceSeconds/3600)});
    } else if(timeDifferenceSeconds >= 86400 && timeDifferenceSeconds <= 2627999) {
      return I18n.t("news_feed.news_feed_helper.time_since_created.day", {count: parseInt(timeDifferenceSeconds/86400)});
    } else if(timeDifferenceSeconds >= 2628000 && timeDifferenceSeconds <= 31535999) {
      return I18n.t("news_feed.news_feed_helper.time_since_created.month", {count: parseInt(timeDifferenceSeconds/2628000)});
    } else {
      return I18n.t("news_feed.news_feed_helper.time_since_created.year", {count: parseInt(timeDifferenceSeconds/31536000)});
    }
  }

  get timeSinceCreated() {
    return this.constructor.sinceCreated(window.feedItemDates[this.id]);
  }
}

function newsFeedUpdateInit() {
  if (!window.newsFeedItemTemplate) {
    window.newsFeedItemTemplate = Handlebars.compile($("#news-feed-item-template").html());
  }
  if (!window.feedItemDates) {
    window.feedItemDates = {};
    for (const feedItem of $(".news-feed-item")) {
      const date = new Date(feedItem.dataset.createdAt);
      window.feedItemDates[feedItem.id] = date;
    }
  } else {
    for (const feedItem of $(".news-feed-item")) {
      if (!window.feedItemDates[feedItem.id]) {
        const date = new Date(feedItem.dataset.createdAt);
        window.feedItemDates[feedItem.id] = date;
      }
    }
  }
  window.lastFeedItemID = $("#news-feed-pending + .news-feed-item").attr("id");
  window.numOfFeedItemsPending = 0;
  window.feedPendingDiv = $("#news-feed-pending").html(I18n.t("news_feed.index.update_pending",{count: window.numOfFeedItemsPending})).on("click", displayNewFeedItems);
  if (!window.newFeedUpdateInterval) {
    window.newFeedUpdateInterval = setInterval(updateNewsFeed, 60000);
  }
  window.feedIntervalSet = true;
}

function updateNewsFeed() {
  window.lastTimeFeedUpdated = new Date(Date.now());
  for (const timeSpan of $(".time-since-created")) {
    timeSpan.innerHTML = NewsFeedItem.sinceCreated(window.feedItemDates[timeSpan.parentElement.id]);
  }
  $.get(`/${I18n.locale}/news-feed.json?latest_id=${window.lastFeedItemID}`, function (newsFeedItems) {
    if (newsFeedItems.length > 0) {
      window.numOfFeedItemsPending += newsFeedItems.length;
      window.feedPendingDiv.html(I18n.t("news_feed.index.update_pending",{count: window.numOfFeedItemsPending}));
      if (window.feedPendingDiv.css("display") === "none") {
        window.feedPendingDiv.removeClass("hidden");
      }
      window.lastFeedItemID = `${newsFeedItems[0].id}`;

      itemsArray = []
      newsFeedItems.forEach(item => {
        itemsArray.push(new NewsFeedItem(item));
      });
      const newItems = $(window.newsFeedItemTemplate(itemsArray));
      newItems.insertAfter(window.feedPendingDiv);
    }
  }).fail(ajaxErrorMessage);
}

function displayNewFeedItems() {
  $(".hidden").removeClass("hidden");
  window.feedPendingDiv.addClass("hidden");
  window.numOfFeedItemsPending = 0;
  window.feedPendingDiv.html(I18n.t("news_feed.index.update_pending",{count: window.numOfFeedItemsPending}));
}

function resetFeedInterval() {
  clearInterval(window.newFeedUpdateInterval);
  window.newFeedUpdateInterval = null;
  window.feedIntervalSet = false;
}


text:
/**
 *
 */
package edu.wustl.catissue.dao;

import java.util.Collection;
import java.util.List;

import org.hibernate.Criteria;
import org.hibernate.HibernateException;
import org.hibernate.Session;
import org.hibernate.criterion.Example;
import org.hibernate.criterion.Projections;
import org.springframework.orm.hibernate3.HibernateCallback;
import org.springframework.transaction.annotation.Transactional;

import edu.wustl.catissuecore.domain.ccts.Notification;
import gov.nih.nci.cabig.ctms.dao.AbstractDomainObjectDao;

/**
 * Data Access Object for {@link Notification}s.
 *
 * @author Denis G. Krylov
 *
 */
@Transactional
public class NotificationDAOImpl extends AbstractDomainObjectDao<Notification>
		implements NotificationDAO {

	/*
	 * (non-Javadoc)
	 *
	 * @see
	 * edu.wustl.catissue.dao.NotificationDAO#save(edu.wustl.catissuecore.domain
	 * .ccts.Notification)
	 */
	public void save(Notification notification) {
		getHibernateTemplate().save(notification);
	}

	@Override
	public Class<Notification> domainClass() {
		return Notification.class;
	}

	/*
	 * (non-Javadoc)
	 *
	 * @see
	 * edu.wustl.catissue.dao.NotificationDAO#findByExample(edu.wustl.catissuecore
	 * .domain.ccts.Notification)
	 */
	public Collection<Notification> findByExample(Notification notification) {
		return getHibernateTemplate().findByExample(domainClass().getName(),
				notification);
	}

	/*
	 * (non-Javadoc)
	 *
	 * @see edu.wustl.catissue.dao.NotificationDAO#getCountByExample(edu.wustl.
	 * catissuecore.domain.ccts.Notification)
	 */
	public int getCountByExample(final Notification notification) {
		return (Integer) getHibernateTemplate().executeWithNativeSession(
				new HibernateCallback() {
					public Object doInHibernate(Session session)
							throws HibernateException {
						Criteria criteria = session
								.createCriteria(domainClass());
						criteria.add(Example.create(notification))
								.setProjection(Projections.rowCount());
						return criteria.list().get(0);
					}
				});
	}

}


text:
import { Answers, Crashlytics } from 'react-native-fabric';

Answers.logSearch('query');
Answers.logCustom('event', { customKey: 0 });

Crashlytics.crash();
Crashlytics.setUserName('name');


text:
import { Vex } from './vex';
import { Modifier } from './modifier';
import { Renderer } from './renderer';
import { StaveNote } from './stavenote';

export class StringNumber extends Modifier {
  static get CATEGORY() { return 'stringnumber'; }

  // ## Static Methods
  // Arrange string numbers inside a `ModifierContext`
  static format(nums, state) {
    const left_shift = state.left_shift;
    const right_shift = state.right_shift;
    const num_spacing = 1;

    if (!nums || nums.length === 0) return this;

    const nums_list = [];
    let prev_note = null;
    let shift_left = 0;
    let shift_right = 0;

    let i;
    let num;
    let note;
    let pos;
    let props_tmp;
    for (i = 0; i < nums.length; ++i) {
      num = nums[i];
      note = num.getNote();

      for (i = 0; i < nums.length; ++i) {
        num = nums[i];
        note = num.getNote();
        pos = num.getPosition();
        const props = note.getKeyProps()[num.getIndex()];

        if (note !== prev_note) {
          for (let n = 0; n < note.keys.length; ++n) {
            props_tmp = note.getKeyProps()[n];
            if (left_shift === 0) {
              shift_left = props_tmp.displaced ? note.getExtraLeftPx() : shift_left;
            }
            if (right_shift === 0) {
              shift_right = props_tmp.displaced ? note.getExtraRightPx() : shift_right;
            }
          }
          prev_note = note;
        }

        nums_list.push({
          pos,
          note,
          num,
          line: props.line,
          shiftL: shift_left,
          shiftR: shift_right,
        });
      }
    }

    // Sort string numbers by line number.
    nums_list.sort((a, b) => b.line - a.line);

    // TODO: This variable never gets assigned to anything. Is that a bug or can this be removed?
    let num_shiftL = 0; // eslint-disable-line
    let num_shiftR = 0;
    let x_widthL = 0;
    let x_widthR = 0;
    let last_line = null;
    let last_note = null;
    for (i = 0; i < nums_list.length; ++i) {
      let num_shift = 0;
      note = nums_list[i].note;
      pos = nums_list[i].pos;
      num = nums_list[i].num;
      const line = nums_list[i].line;
      const shiftL = nums_list[i].shiftL;
      const shiftR = nums_list[i].shiftR;

      // Reset the position of the string number every line.
      if (line !== last_line || note !== last_note) {
        num_shiftL = left_shift + shiftL;
        num_shiftR = right_shift + shiftR;
      }

      const num_width = num.getWidth() + num_spacing;
      if (pos === Modifier.Position.LEFT) {
        num.setXShift(left_shift);
        num_shift = shift_left + num_width; // spacing
        x_widthL = (num_shift > x_widthL) ? num_shift : x_widthL;
      } else if (pos === Modifier.Position.RIGHT) {
        num.setXShift(num_shiftR);
        num_shift += num_width; // spacing
        x_widthR = (num_shift > x_widthR) ? num_shift : x_widthR;
      }
      last_line = line;
      last_note = note;
    }

    state.left_shift += x_widthL;
    state.right_shift += x_widthR;
    return true;
  }

  constructor(number) {
    super();
    this.setAttribute('type', 'StringNumber');

    this.note = null;
    this.last_note = null;
    this.index = null;
    this.string_number = number;
    this.setWidth(20); // ???
    this.position = Modifier.Position.ABOVE; // Default position above stem or note head
    this.x_shift = 0;
    this.y_shift = 0;
    this.x_offset = 0; // Horizontal offset from default
    this.y_offset = 0; // Vertical offset from default
    this.dashed = true; // true - draw dashed extension  false - no extension
    this.leg = Renderer.LineEndType.NONE;   // draw upward/downward leg at the of extension line
    this.radius = 8;
    this.font = {
      family: 'sans-serif',
      size: 10,
      weight: 'bold',
    };
  }
  getCategory() { return StringNumber.CATEGORY; }
  getNote() { return this.note; }
  setNote(note) { this.note = note; return this; }
  getIndex() { return this.index; }
  setIndex(index) { this.index = index; return this; }

  setLineEndType(leg) {
    if (leg >= Renderer.LineEndType.NONE && leg <= Renderer.LineEndType.DOWN) {
      this.leg = leg;
    }
    return this;
  }

  getPosition() { return this.position; }
  setPosition(position) {
    if (position >= Modifier.Position.LEFT && position <= Modifier.Position.BELOW) {
      this.position = position;
    }
    return this;
  }

  setStringNumber(number) { this.string_number = number; return this; }
  setOffsetX(x) { this.x_offset = x; return this; }
  setOffsetY(y) { this.y_offset = y; return this; }
  setLastNote(note) { this.last_note = note; return this; }
  setDashed(dashed) { this.dashed = dashed; return this; }

  draw() {
    const ctx = this.checkContext();
    if (!(this.note && (this.index != null))) {
      throw new Vex.RERR('NoAttachedNote', "Can't draw string number without a note and index.");
    }
    this.setRendered();

    const line_space = this.note.stave.options.spacing_between_lines_px;

    const start = this.note.getModifierStartXY(this.position, this.index);
    let dot_x = (start.x + this.x_shift + this.x_offset);
    let dot_y = start.y + this.y_shift + this.y_offset;

    switch (this.position) {
      case Modifier.Position.ABOVE:
      case Modifier.Position.BELOW: {
        const stem_ext = this.note.getStemExtents();
        let top = stem_ext.topY;
        let bottom = stem_ext.baseY + 2;

        if (this.note.stem_direction === StaveNote.STEM_DOWN) {
          top = stem_ext.baseY;
          bottom = stem_ext.topY - 2;
        }

        if (this.position === Modifier.Position.ABOVE) {
          dot_y = this.note.hasStem()
            ? top - (line_space * 1.75)
            : start.y - (line_space * 1.75);
        } else {
          dot_y = this.note.hasStem()
            ? bottom + (line_space * 1.5)
            : start.y + (line_space * 1.75);
        }

        dot_y += this.y_shift + this.y_offset;

        break;
      } case Modifier.Position.LEFT:
        dot_x -= (this.radius / 2) + 5;
        break;
      case Modifier.Position.RIGHT:
        dot_x += (this.radius / 2) + 6;
        break;
      default:
        throw new Vex.RERR(
          'InvalidPosition', `The position ${this.position} is invalid`
        );
    }

    ctx.save();
    ctx.beginPath();
    ctx.arc(dot_x, dot_y, this.radius, 0, Math.PI * 2, false);
    ctx.lineWidth = 1.5;
    ctx.stroke();
    ctx.setFont(this.font.family, this.font.size, this.font.weight);
    const x = dot_x - ctx.measureText(this.string_number).width / 2;
    ctx.fillText('' + this.string_number, x, dot_y + 4.5);

    if (this.last_note != null) {
      const end = this.last_note.getStemX() - this.note.getX() + 5;
      ctx.strokeStyle = '#000000';
      ctx.lineCap = 'round';
      ctx.lineWidth = 0.6;
      if (this.dashed) {
        Renderer.drawDashedLine(ctx, dot_x + 10, dot_y, dot_x + end, dot_y, [3, 3]);
      } else {
        Renderer.drawDashedLine(ctx, dot_x + 10, dot_y, dot_x + end, dot_y, [3, 0]);
      }

      let len;
      let pattern;
      switch (this.leg) {
        case Renderer.LineEndType.UP:
          len = -10;
          pattern = this.dashed ? [3, 3] : [3, 0];
          Renderer.drawDashedLine(ctx, dot_x + end, dot_y, dot_x + end, dot_y + len, pattern);
          break;
        case Renderer.LineEndType.DOWN:
          len = 10;
          pattern = this.dashed ? [3, 3] : [3, 0];
          Renderer.drawDashedLine(ctx, dot_x + end, dot_y, dot_x + end, dot_y + len, pattern);
          break;
        default:
          break;
      }
    }

    ctx.restore();
  }
}


text:
import os
import tempfile
import unittest
import logging
from pyidf import ValidationLevel
import pyidf
from pyidf.idf import IDF
from pyidf.electric_load_center import GeneratorFuelCellWaterSupply

log = logging.getLogger(__name__)

class TestGeneratorFuelCellWaterSupply(unittest.TestCase):

    def setUp(self):
        self.fd, self.path = tempfile.mkstemp()

    def tearDown(self):
        os.remove(self.path)

    def test_create_generatorfuelcellwatersupply(self):

        pyidf.validation_level = ValidationLevel.error

        obj = GeneratorFuelCellWaterSupply()
        # alpha
        var_name = "Name"
        obj.name = var_name
        # object-list
        var_reformer_water_flow_rate_function_of_fuel_rate_curve_name = "object-list|Reformer Water Flow Rate Function of Fuel Rate Curve Name"
        obj.reformer_water_flow_rate_function_of_fuel_rate_curve_name = var_reformer_water_flow_rate_function_of_fuel_rate_curve_name
        # object-list
        var_reformer_water_pump_power_function_of_fuel_rate_curve_name = "object-list|Reformer Water Pump Power Function of Fuel Rate Curve Name"
        obj.reformer_water_pump_power_function_of_fuel_rate_curve_name = var_reformer_water_pump_power_function_of_fuel_rate_curve_name
        # real
        var_pump_heat_loss_factor = 4.4
        obj.pump_heat_loss_factor = var_pump_heat_loss_factor
        # alpha
        var_water_temperature_modeling_mode = "TemperatureFromAirNode"
        obj.water_temperature_modeling_mode = var_water_temperature_modeling_mode
        # node
        var_water_temperature_reference_node_name = "node|Water Temperature Reference Node Name"
        obj.water_temperature_reference_node_name = var_water_temperature_reference_node_name
        # object-list
        var_water_temperature_schedule_name = "object-list|Water Temperature Schedule Name"
        obj.water_temperature_schedule_name = var_water_temperature_schedule_name

        idf = IDF()
        idf.add(obj)
        idf.save(self.path, check=False)

        with open(self.path, mode='r') as f:
            for line in f:
                log.debug(line.strip())

        idf2 = IDF(self.path)
        self.assertEqual(idf2.generatorfuelcellwatersupplys[0].name, var_name)
        self.assertEqual(idf2.generatorfuelcellwatersupplys[0].reformer_water_flow_rate_function_of_fuel_rate_curve_name, var_reformer_water_flow_rate_function_of_fuel_rate_curve_name)
        self.assertEqual(idf2.generatorfuelcellwatersupplys[0].reformer_water_pump_power_function_of_fuel_rate_curve_name, var_reformer_water_pump_power_function_of_fuel_rate_curve_name)
        self.assertAlmostEqual(idf2.generatorfuelcellwatersupplys[0].pump_heat_loss_factor, var_pump_heat_loss_factor)
        self.assertEqual(idf2.generatorfuelcellwatersupplys[0].water_temperature_modeling_mode, var_water_temperature_modeling_mode)
        self.assertEqual(idf2.generatorfuelcellwatersupplys[0].water_temperature_reference_node_name, var_water_temperature_reference_node_name)
        self.assertEqual(idf2.generatorfuelcellwatersupplys[0].water_temperature_schedule_name, var_water_temperature_schedule_name)


text:
package main

import (
	"fmt"
	"strings"

	"github.com/gosexy/gettext"
	"github.com/lxc/lxd"
	"github.com/lxc/lxd/internal/gnuflag"
	"github.com/lxc/lxd/shared"
)

type launchCmd struct{}

func (c *launchCmd) showByDefault() bool {
	return true
}

func (c *launchCmd) usage() string {
	return gettext.Gettext(
		"lxc launch <image> [<name>] [--ephemeral|-e] [--profile|-p <profile>...]\n" +
			"\n" +
			"Launches a container using the specified image and name.\n" +
			"\n" +
			"Not specifying -p will result in the default profile.\n" +
			"Specifying \"-p\" with no argument will result in no profile.\n" +
			"\n" +
			"Example:\n" +
			"lxc launch ubuntu u1\n")
}

func (c *launchCmd) flags() {
	massage_args()
	gnuflag.Var(&profArgs, "profile", "Profile to apply to the new container")
	gnuflag.Var(&profArgs, "p", "Profile to apply to the new container")
	gnuflag.BoolVar(&ephem, "ephemeral", false, gettext.Gettext("Ephemeral container"))
	gnuflag.BoolVar(&ephem, "e", false, gettext.Gettext("Ephemeral container"))
}

func (c *launchCmd) run(config *lxd.Config, args []string) error {

	if len(args) > 2 || len(args) < 1 {
		return errArgs
	}

	iremote, image := config.ParseRemoteAndContainer(args[0])

	var name string
	var remote string
	if len(args) == 2 {
		remote, name = config.ParseRemoteAndContainer(args[1])
	} else {
		name = ""
		remote = ""
	}

	fmt.Printf("Creating container...")
	d, err := lxd.NewClient(config, remote)
	if err != nil {
		return err
	}

	/*
	 * requested_empty_profiles means user requested empty
	 * !requested_empty_profiles but len(profArgs) == 0 means use profile default
	 */
	var resp *lxd.Response
	profiles := []string{}
	for _, p := range profArgs {
		profiles = append(profiles, p)
	}
	if !requested_empty_profiles && len(profiles) == 0 {
		resp, err = d.Init(name, iremote, image, nil, ephem)
	} else {
		resp, err = d.Init(name, iremote, image, &profiles, ephem)
	}
	if err != nil {
		return err
	}

	if name == "" {
		if resp.Resources == nil {
			return fmt.Errorf(gettext.Gettext("didn't get any affected resources from server"))
		}

		containers, ok := resp.Resources["containers"]
		if !ok || len(containers) == 0 {
			return fmt.Errorf(gettext.Gettext("didn't get any affected resources from server"))
		}

		var version string
		toScan := strings.Replace(containers[0], "/", " ", -1)
		count, err := fmt.Sscanf(toScan, " %s containers %s", &version, &name)
		if err != nil {
			return err
		}

		if count != 2 {
			return fmt.Errorf(gettext.Gettext("bad number of things scanned from resource"))
		}

		if version != shared.APIVersion {
			return fmt.Errorf(gettext.Gettext("got bad version"))
		}
	}

	if err = d.WaitForSuccess(resp.Operation); err != nil {
		return err
	}
	fmt.Println("done")

	fmt.Printf("Starting container...")
	resp, err = d.Action(name, shared.Start, -1, false)
	if err != nil {
		return err
	}

	err = d.WaitForSuccess(resp.Operation)
	fmt.Println("done")

	return err
}