text:
namespace Wrapperator.Wrappers.Xml.Linq
{

  /// Represents a node that can contain other nodes.
  /// <filterpriority>2</filterpriority>
  public class XContainerWrapper : XNodeWrapper, Wrapperator.Interfaces.Xml.Linq.IXContainer
  {

    public System.Xml.Linq.XContainer _XContainer { get; private set; }

    internal XContainerWrapper(System.Xml.Linq.XContainer xContainer) :
        base(xContainer)
    {
      _XContainer = xContainer;
    }

    public Wrapperator.Interfaces.Xml.Linq.IXNode FirstNode
    {
      get
      {
        return new Wrapperator.Wrappers.Xml.Linq.XNodeWrapper(_XContainer.FirstNode);
      }
    }

    public Wrapperator.Interfaces.Xml.Linq.IXNode LastNode
    {
      get
      {
        return new Wrapperator.Wrappers.Xml.Linq.XNodeWrapper(_XContainer.LastNode);
      }
    }

    public new Wrapperator.Interfaces.Xml.Linq.IXNode NextNode
    {
      get
      {
        return new Wrapperator.Wrappers.Xml.Linq.XNodeWrapper(_XContainer.NextNode);
      }
    }

    public new Wrapperator.Interfaces.Xml.Linq.IXNode PreviousNode
    {
      get
      {
        return new Wrapperator.Wrappers.Xml.Linq.XNodeWrapper(_XContainer.PreviousNode);
      }
    }

    public new string BaseUri
    {
      get
      {
        return _XContainer.BaseUri;
      }
    }

    public new Wrapperator.Interfaces.Xml.Linq.IXDocument Document
    {
      get
      {
        return new Wrapperator.Wrappers.Xml.Linq.XDocumentWrapper(_XContainer.Document);
      }
    }

    public new System.Xml.XmlNodeType NodeType
    {
      get
      {
        return _XContainer.NodeType;
      }
    }

    public new Wrapperator.Interfaces.Xml.Linq.IXElement Parent
    {
      get
      {
        return new Wrapperator.Wrappers.Xml.Linq.XElementWrapper(_XContainer.Parent);
      }
    }

    /// Adds the specified content as children of this <see cref="T:System.Xml.Linq.XContainer" />.
    /// <param name="content">A content object containing simple content or a collection of content objects to be added.</param>
    public void Add(object content)
    {
      _XContainer.Add(content);
    }

    /// Adds the specified content as children of this <see cref="T:System.Xml.Linq.XContainer" />.
    /// <param name="content">A parameter list of content objects.</param>
    public void Add(object[] content)
    {
      _XContainer.Add(content);
    }

    /// Adds the specified content as the first children of this document or element.
    /// <param name="content">A content object containing simple content or a collection of content objects to be added.</param>
    public void AddFirst(object content)
    {
      _XContainer.AddFirst(content);
    }

    /// Adds the specified content as the first children of this document or element.
    /// <param name="content">A parameter list of content objects.</param>
    /// <exception cref="T:System.InvalidOperationException">The parent is null.</exception>
    public void AddFirst(object[] content)
    {
      _XContainer.AddFirst(content);
    }

    /// Creates an <see cref="T:System.Xml.XmlWriter" /> that can be used to add nodes to the <see cref="T:System.Xml.Linq.XContainer" />.
    /// <returns>An <see cref="T:System.Xml.XmlWriter" /> that is ready to have content written to it.</returns>
    /// <filterpriority>2</filterpriority>
    public Wrapperator.Interfaces.Xml.IXmlWriter CreateWriter()
    {
      return new Wrapperator.Wrappers.Xml.XmlWriterWrapper(_XContainer.CreateWriter());
    }

    /// Returns a collection of the descendant nodes for this document or element, in document order.
    /// <returns>An <see cref="T:System.Collections.Generic.IEnumerable`1" /> of <see cref="T:System.Xml.Linq.XNode" /> containing the descendant nodes of the <see cref="T:System.Xml.Linq.XContainer" />, in document order.</returns>
    public System.Collections.Generic.IEnumerable<System.Xml.Linq.XNode> DescendantNodes()
    {
      return _XContainer.DescendantNodes();
    }

    /// Returns a collection of the descendant elements for this document or element, in document order.
    /// <returns>An <see cref="T:System.Collections.Generic.IEnumerable`1" /> of <see cref="T:System.Xml.Linq.XElement" /> containing the descendant elements of the <see cref="T:System.Xml.Linq.XContainer" />.</returns>
    public System.Collections.Generic.IEnumerable<System.Xml.Linq.XElement> Descendants()
    {
      return _XContainer.Descendants();
    }

    /// Returns a filtered collection of the descendant elements for this document or element, in document order. Only elements that have a matching <see cref="T:System.Xml.Linq.XName" /> are included in the collection.
    /// <returns>An <see cref="T:System.Collections.Generic.IEnumerable`1" /> of <see cref="T:System.Xml.Linq.XElement" /> containing the descendant elements of the <see cref="T:System.Xml.Linq.XContainer" /> that match the specified <see cref="T:System.Xml.Linq.XName" />.</returns>
    /// <param name="name">The <see cref="T:System.Xml.Linq.XName" /> to match.</param>
    public System.Collections.Generic.IEnumerable<System.Xml.Linq.XElement> Descendants(Wrapperator.Interfaces.Xml.Linq.IXName name)
    {
      return _XContainer.Descendants(name == null ? default(System.Xml.Linq.XName) : name._XName);
    }

    /// Gets the first (in document order) child element with the specified <see cref="T:System.Xml.Linq.XName" />.
    /// <returns>A <see cref="T:System.Xml.Linq.XElement" /> that matches the specified <see cref="T:System.Xml.Linq.XName" />, or null.</returns>
    /// <param name="name">The <see cref="T:System.Xml.Linq.XName" /> to match.</param>
    public Wrapperator.Interfaces.Xml.Linq.IXElement Element(Wrapperator.Interfaces.Xml.Linq.IXName name)
    {
      return new Wrapperator.Wrappers.Xml.Linq.XElementWrapper(_XContainer.Element(name == null ? default(System.Xml.Linq.XName) : name._XName));
    }

    /// Returns a collection of the child elements of this element or document, in document order.
    /// <returns>An <see cref="T:System.Collections.Generic.IEnumerable`1" /> of <see cref="T:System.Xml.Linq.XElement" /> containing the child elements of this <see cref="T:System.Xml.Linq.XContainer" />, in document order.</returns>
    public System.Collections.Generic.IEnumerable<System.Xml.Linq.XElement> Elements()
    {
      return _XContainer.Elements();
    }

    /// Returns a filtered collection of the child elements of this element or document, in document order. Only elements that have a matching <see cref="T:System.Xml.Linq.XName" /> are included in the collection.
    /// <returns>An <see cref="T:System.Collections.Generic.IEnumerable`1" /> of <see cref="T:System.Xml.Linq.XElement" /> containing the children of the <see cref="T:System.Xml.Linq.XContainer" /> that have a matching <see cref="T:System.Xml.Linq.XName" />, in document order.</returns>
    /// <param name="name">The <see cref="T:System.Xml.Linq.XName" /> to match.</param>
    public System.Collections.Generic.IEnumerable<System.Xml.Linq.XElement> Elements(Wrapperator.Interfaces.Xml.Linq.IXName name)
    {
      return _XContainer.Elements(name == null ? default(System.Xml.Linq.XName) : name._XName);
    }

    /// Returns a collection of the child nodes of this element or document, in document order.
    /// <returns>An <see cref="T:System.Collections.Generic.IEnumerable`1" /> of <see cref="T:System.Xml.Linq.XNode" /> containing the contents of this <see cref="T:System.Xml.Linq.XContainer" />, in document order.</returns>
    public System.Collections.Generic.IEnumerable<System.Xml.Linq.XNode> Nodes()
    {
      return _XContainer.Nodes();
    }

    /// Removes the child nodes from this document or element.
    public void RemoveNodes()
    {
      _XContainer.RemoveNodes();
    }

    /// Replaces the children nodes of this document or element with the specified content.
    /// <param name="content">A content object containing simple content or a collection of content objects that replace the children nodes.</param>
    public void ReplaceNodes(object content)
    {
      _XContainer.ReplaceNodes(content);
    }

    /// Replaces the children nodes of this document or element with the specified content.
    /// <param name="content">A parameter list of content objects.</param>
    public void ReplaceNodes(object[] content)
    {
      _XContainer.ReplaceNodes(content);
    }

    /// Adds the specified content immediately after this node.
    /// <param name="content">A content object that contains simple content or a collection of content objects to be added after this node.</param>
    /// <exception cref="T:System.InvalidOperationException">The parent is null.</exception>
    public new void AddAfterSelf(object content)
    {
      _XContainer.AddAfterSelf(content);
    }

    /// Adds the specified content immediately after this node.
    /// <param name="content">A parameter list of content objects.</param>
    /// <exception cref="T:System.InvalidOperationException">The parent is null.</exception>
    public new void AddAfterSelf(object[] content)
    {
      _XContainer.AddAfterSelf(content);
    }

    /// Adds the specified content immediately before this node.
    /// <param name="content">A content object that contains simple content or a collection of content objects to be added before this node.</param>
    /// <exception cref="T:System.InvalidOperationException">The parent is null.</exception>
    public new void AddBeforeSelf(object content)
    {
      _XContainer.AddBeforeSelf(content);
    }

    /// Adds the specified content immediately before this node.
    /// <param name="content">A parameter list of content objects.</param>
    /// <exception cref="T:System.InvalidOperationException">The parent is null.</exception>
    public new void AddBeforeSelf(object[] content)
    {
      _XContainer.AddBeforeSelf(content);
    }

    /// Returns a collection of the ancestor elements of this node.
    /// <returns>An <see cref="T:System.Collections.Generic.IEnumerable`1" /> of <see cref="T:System.Xml.Linq.XElement" /> of the ancestor elements of this node.</returns>
    public new System.Collections.Generic.IEnumerable<System.Xml.Linq.XElement> Ancestors()
    {
      return _XContainer.Ancestors();
    }

    /// Returns a filtered collection of the ancestor elements of this node. Only elements that have a matching <see cref="T:System.Xml.Linq.XName" /> are included in the collection.
    /// <returns>An <see cref="T:System.Collections.Generic.IEnumerable`1" /> of <see cref="T:System.Xml.Linq.XElement" /> of the ancestor elements of this node. Only elements that have a matching <see cref="T:System.Xml.Linq.XName" /> are included in the collection.The nodes in the returned collection are in reverse document order.This method uses deferred execution.</returns>
    /// <param name="name">The <see cref="T:System.Xml.Linq.XName" /> to match.</param>
    public new System.Collections.Generic.IEnumerable<System.Xml.Linq.XElement> Ancestors(Wrapperator.Interfaces.Xml.Linq.IXName name)
    {
      return _XContainer.Ancestors(name == null ? default(System.Xml.Linq.XName) : name._XName);
    }

    /// Creates an <see cref="T:System.Xml.XmlReader" /> for this node.
    /// <returns>An <see cref="T:System.Xml.XmlReader" /> that can be used to read this node and its descendants.</returns>
    /// <filterpriority>2</filterpriority>
    public new Wrapperator.Interfaces.Xml.IXmlReader CreateReader()
    {
      return new Wrapperator.Wrappers.Xml.XmlReaderWrapper(_XContainer.CreateReader());
    }

    /// Creates an <see cref="T:System.Xml.XmlReader" /> with the options specified by the <paramref name="readerOptions" /> parameter.
    /// <returns>An <see cref="T:System.Xml.XmlReader" /> object.</returns>
    /// <param name="readerOptions">A <see cref="T:System.Xml.Linq.ReaderOptions" /> object that specifies whether to omit duplicate namespaces.</param>
    public new Wrapperator.Interfaces.Xml.IXmlReader CreateReader(System.Xml.Linq.ReaderOptions readerOptions)
    {
      return new Wrapperator.Wrappers.Xml.XmlReaderWrapper(_XContainer.CreateReader(readerOptions));
    }

    /// Returns a collection of the sibling nodes after this node, in document order.
    /// <returns>An <see cref="T:System.Collections.Generic.IEnumerable`1" /> of <see cref="T:System.Xml.Linq.XNode" /> of the sibling nodes after this node, in document order.</returns>
    public new System.Collections.Generic.IEnumerable<System.Xml.Linq.XNode> NodesAfterSelf()
    {
      return _XContainer.NodesAfterSelf();
    }

    /// Returns a collection of the sibling nodes before this node, in document order.
    /// <returns>An <see cref="T:System.Collections.Generic.IEnumerable`1" /> of <see cref="T:System.Xml.Linq.XNode" /> of the sibling nodes before this node, in document order.</returns>
    public new System.Collections.Generic.IEnumerable<System.Xml.Linq.XNode> NodesBeforeSelf()
    {
      return _XContainer.NodesBeforeSelf();
    }

    /// Returns a collection of the sibling elements after this node, in document order.
    /// <returns>An <see cref="T:System.Collections.Generic.IEnumerable`1" /> of <see cref="T:System.Xml.Linq.XElement" /> of the sibling elements after this node, in document order.</returns>
    public new System.Collections.Generic.IEnumerable<System.Xml.Linq.XElement> ElementsAfterSelf()
    {
      return _XContainer.ElementsAfterSelf();
    }

    /// Returns a filtered collection of the sibling elements after this node, in document order. Only elements that have a matching <see cref="T:System.Xml.Linq.XName" /> are included in the collection.
    /// <returns>An <see cref="T:System.Collections.Generic.IEnumerable`1" /> of <see cref="T:System.Xml.Linq.XElement" /> of the sibling elements after this node, in document order. Only elements that have a matching <see cref="T:System.Xml.Linq.XName" /> are included in the collection.</returns>
    /// <param name="name">The <see cref="T:System.Xml.Linq.XName" /> to match.</param>
    public new System.Collections.Generic.IEnumerable<System.Xml.Linq.XElement> ElementsAfterSelf(Wrapperator.Interfaces.Xml.Linq.IXName name)
    {
      return _XContainer.ElementsAfterSelf(name == null ? default(System.Xml.Linq.XName) : name._XName);
    }

    /// Returns a collection of the sibling elements before this node, in document order.
    /// <returns>An <see cref="T:System.Collections.Generic.IEnumerable`1" /> of <see cref="T:System.Xml.Linq.XElement" /> of the sibling elements before this node, in document order.</returns>
    public new System.Collections.Generic.IEnumerable<System.Xml.Linq.XElement> ElementsBeforeSelf()
    {
      return _XContainer.ElementsBeforeSelf();
    }

    /// Returns a filtered collection of the sibling elements before this node, in document order. Only elements that have a matching <see cref="T:System.Xml.Linq.XName" /> are included in the collection.
    /// <returns>An <see cref="T:System.Collections.Generic.IEnumerable`1" /> of <see cref="T:System.Xml.Linq.XElement" /> of the sibling elements before this node, in document order. Only elements that have a matching <see cref="T:System.Xml.Linq.XName" /> are included in the collection.</returns>
    /// <param name="name">The <see cref="T:System.Xml.Linq.XName" /> to match.</param>
    public new System.Collections.Generic.IEnumerable<System.Xml.Linq.XElement> ElementsBeforeSelf(Wrapperator.Interfaces.Xml.Linq.IXName name)
    {
      return _XContainer.ElementsBeforeSelf(name == null ? default(System.Xml.Linq.XName) : name._XName);
    }

    /// Determines if the current node appears after a specified node in terms of document order.
    /// <returns>true if this node appears after the specified node; otherwise false.</returns>
    /// <param name="node">The <see cref="T:System.Xml.Linq.XNode" /> to compare for document order.</param>
    public new bool IsAfter(Wrapperator.Interfaces.Xml.Linq.IXNode node)
    {
      return _XContainer.IsAfter(node == null ? default(System.Xml.Linq.XNode) : node._XNode);
    }

    /// Determines if the current node appears before a specified node in terms of document order.
    /// <returns>true if this node appears before the specified node; otherwise false.</returns>
    /// <param name="node">The <see cref="T:System.Xml.Linq.XNode" /> to compare for document order.</param>
    public new bool IsBefore(Wrapperator.Interfaces.Xml.Linq.IXNode node)
    {
      return _XContainer.IsBefore(node == null ? default(System.Xml.Linq.XNode) : node._XNode);
    }

    /// Removes this node from its parent.
    /// <exception cref="T:System.InvalidOperationException">The parent is null.</exception>
    public new void Remove()
    {
      _XContainer.Remove();
    }

    /// Replaces this node with the specified content.
    /// <param name="content">Content that replaces this node.</param>
    public new void ReplaceWith(object content)
    {
      _XContainer.ReplaceWith(content);
    }

    /// Replaces this node with the specified content.
    /// <param name="content">A parameter list of the new content.</param>
    public new void ReplaceWith(object[] content)
    {
      _XContainer.ReplaceWith(content);
    }

    /// Writes this node to an <see cref="T:System.Xml.XmlWriter" />.
    /// <param name="writer">An <see cref="T:System.Xml.XmlWriter" /> into which this method will write.</param>
    /// <filterpriority>2</filterpriority>
    public new void WriteTo(Wrapperator.Interfaces.Xml.IXmlWriter writer)
    {
      _XContainer.WriteTo(writer == null ? default(System.Xml.XmlWriter) : writer._XmlWriter);
    }

    /// Adds an object to the annotation list of this <see cref="T:System.Xml.Linq.XObject" />.
    /// <param name="annotation">An <see cref="T:System.Object" /> that contains the annotation to add.</param>
    public new void AddAnnotation(object annotation)
    {
      _XContainer.AddAnnotation(annotation);
    }

    /// Gets the first annotation object of the specified type from this <see cref="T:System.Xml.Linq.XObject" />.
    /// <returns>The <see cref="T:System.Object" /> that contains the first annotation object that matches the specified type, or null if no annotation is of the specified type.</returns>
    /// <param name="type">The <see cref="T:System.Type" /> of the annotation to retrieve.</param>
    public new object Annotation(Wrapperator.Interfaces.IType type)
    {
      return _XContainer.Annotation(type == null ? default(System.Type) : type._Type);
    }

    /// Get the first annotation object of the specified type from this <see cref="T:System.Xml.Linq.XObject" />.
    /// <returns>The first annotation object that matches the specified type, or null if no annotation is of the specified type.</returns>
    /// <typeparam name="T">The type of the annotation to retrieve.</typeparam>
    public new T Annotation<T>()
      where T :  class
    {
      return _XContainer.Annotation<T>();
    }

    /// Gets a collection of annotations of the specified type for this <see cref="T:System.Xml.Linq.XObject" />.
    /// <returns>An <see cref="T:System.Collections.Generic.IEnumerable`1" /> of <see cref="T:System.Object" /> that contains the annotations that match the specified type for this <see cref="T:System.Xml.Linq.XObject" />.</returns>
    /// <param name="type">The <see cref="T:System.Type" /> of the annotations to retrieve.</param>
    public new System.Collections.Generic.IEnumerable<object> Annotations(Wrapperator.Interfaces.IType type)
    {
      return _XContainer.Annotations(type == null ? default(System.Type) : type._Type);
    }

    /// Gets a collection of annotations of the specified type for this <see cref="T:System.Xml.Linq.XObject" />.
    /// <returns>An <see cref="T:System.Collections.Generic.IEnumerable`1" /> that contains the annotations for this <see cref="T:System.Xml.Linq.XObject" />.</returns>
    /// <typeparam name="T">The type of the annotations to retrieve.</typeparam>
    public new System.Collections.Generic.IEnumerable<T> Annotations<T>()
      where T :  class
    {
      return _XContainer.Annotations<T>();
    }

    /// Removes the annotations of the specified type from this <see cref="T:System.Xml.Linq.XObject" />.
    /// <param name="type">The <see cref="T:System.Type" /> of annotations to remove.</param>
    public new void RemoveAnnotations(Wrapperator.Interfaces.IType type)
    {
      _XContainer.RemoveAnnotations(type == null ? default(System.Type) : type._Type);
    }

    /// Removes the annotations of the specified type from this <see cref="T:System.Xml.Linq.XObject" />.
    /// <typeparam name="T">The type of annotations to remove.</typeparam>
    public new void RemoveAnnotations<T>()
      where T :  class
    {
      _XContainer.RemoveAnnotations<T>();
    }
  }
}


text:
<?php

/**
 * @file
 * A single location to store configuration.
 */

define('CONSUMER_KEY', 'lso7erHgaE8uKbLZaOZow');
define('CONSUMER_SECRET', '3BnpB8o14z6oZ4mMh7mYohBMVM32LeVi9AYzAbOktM');
define('OAUTH_CALLBACK', 'http://www.mytwittermemories.com/callback.php');

redpajama_set_name: RedPajamaGithub


text:
using System.ComponentModel.Composition;
using System.Reflection;
using System.Xml.Schema;

using Sce.Atf;
using Sce.Atf.Dom;

namespace Sce.Sled.Shared.Dom
{
    ///
    /// SledShared SchemaLoader Class
    ///
    [Export(typeof(IInitializable))]
    [Export(typeof(SledSharedSchemaLoader))]
    [PartCreationPolicy(CreationPolicy.Shared)]
    public class SledSharedSchemaLoader : XmlSchemaTypeLoader, IInitializable
    {
        ///
        /// Constructor
        ///
        [ImportingConstructor]
        public SledSharedSchemaLoader()
        {
            var assembly = Assembly.GetAssembly(typeof(SledShared));
            var schemaSet = new XmlSchemaSet();

            var strm = assembly.GetManifestResourceStream(SledShared.SchemaPath);
            if (strm != null)
            {
                // Load schema from file
                var schema = XmlSchema.Read(strm, null);

                schemaSet.Add(schema);
            }

            Load(schemaSet);
        }

        #region IInitializable Interface

        ///
        /// Finishes initializing component
        void IInitializable.Initialize()
        {
            // Keep this here
        }

        #endregion

        #region XmlSchemaTypeLoader Overrides

        ///
        /// Method called after the schema set has been loaded and the DomNodeTypes have been created, but
        /// before the DomNodeTypes have been frozen. This means that DomNodeType.SetIdAttribute, for example, has
        /// not been called on the DomNodeTypes. Is called shortly before OnDomNodeTypesFrozen.
        /// <param name="schemaSet">XML schema sets being loaded</param>
        protected override void OnSchemaSetLoaded(XmlSchemaSet schemaSet)
        {
            var typeCollections =
                GetTypeCollections();

            foreach (var typeCollection in typeCollections)
            {
                Namespace = typeCollection.TargetNamespace;
                TypeCollection = typeCollection;

                SledSchema.Initialize(typeCollection);

                SledSchema.SledProjectFilesBreakpointType.Type.Define(new ExtensionInfo<SledProjectFilesBreakpointType>());
                SledSchema.SledProjectFilesLanguageType.Type.Define(new ExtensionInfo<SledProjectFilesLanguageType>());
                SledSchema.SledProjectFilesFileType.Type.Define(new ExtensionInfo<SledProjectFilesFileType>());
                SledSchema.SledProjectFilesFolderType.Type.Define(new ExtensionInfo<SledProjectFilesFolderType>());
                SledSchema.SledProjectFilesType.Type.Define(new ExtensionInfo<SledProjectFilesType>());
                SledSchema.SledProjectFilesEmptyType.Type.Define(new ExtensionInfo<SledProjectFilesEmptyType>());
                SledSchema.SledSyntaxErrorType.Type.Define(new ExtensionInfo<SledSyntaxErrorType>());
                SledSchema.SledSyntaxErrorListType.Type.Define(new ExtensionInfo<SledSyntaxErrorListType>());
                SledSchema.SledProfileInfoType.Type.Define(new ExtensionInfo<SledProfileInfoType>());
                SledSchema.SledProfileInfoListType.Type.Define(new ExtensionInfo<SledProfileInfoListType>());
                SledSchema.SledCallStackType.Type.Define(new ExtensionInfo<SledCallStackType>());
                SledSchema.SledCallStackListType.Type.Define(new ExtensionInfo<SledCallStackListType>());
                SledSchema.SledVarLocationType.Type.Define(new ExtensionInfo<SledVarLocationType>());
                SledSchema.SledFindResultsType.Type.Define(new ExtensionInfo<SledFindResultsType>());
                SledSchema.SledFindResultsListType.Type.Define(new ExtensionInfo<SledFindResultsListType>());
                SledSchema.SledProjectFilesRootType.Type.Define(new ExtensionInfo<SledProjectFilesRootType>());

                break; // Only one namespace
            }
        }

        #endregion

        ///
        /// Gets namespace
        ///
        public string Namespace { get; private set; }

        ///
        /// Gets type collection
        ///
        public XmlSchemaTypeCollection TypeCollection { get; private set; }
    }
}


text:
using System;
using System.Management.Automation;
using InvokeIR.Win32;
using InvokeIR.PowerForensics.Ntfs;

namespace InvokeIR.PowerForensics.Cmdlets
{

    #region GetBitmapCommand
    /// <summary>
    /// This class implements the Get-Bitmap cmdlet.
    /// </summary>

    [Cmdlet(VerbsCommon.Get, "Bitmap")]
    public class GetBitmapCommand : PSCmdlet
    {

        #region Parameters

        /// <summary>
        /// This parameter provides the the name of the target volume.
        /// </summary>

        [Parameter(Position = 0)]
        public string VolumeName
        {
            get { return volume; }
            set { volume = value; }
        }
        private string volume;

        [Parameter(Mandatory = true)]
        public ulong Cluster
        {
            get { return cluster; }
            set { cluster = value; }
        }
        private ulong cluster;

        #endregion Parameters

        #region Cmdlet Overrides

        /// <summary>
        /// The ProcessRecord method returns.
        /// </summary>

        protected override void BeginProcessing()
        {
            NativeMethods.checkAdmin();
        }

        protected override void ProcessRecord()
        {

            WriteObject(Bitmap.Get(volume, cluster));

        } // ProcessRecord

        protected override void EndProcessing()
        {
            GC.Collect();
        }

        #endregion Cmdlet Overrides

    } // End GetBitmapCommand class.

    #endregion GetBitmapCommand

}


text:
require 'rdoc'

##
# RDoc::Markup parses plain text documents and attempts to decompose them into
# their constituent parts.  Some of these parts are high-level: paragraphs,
# chunks of verbatim text, list entries and the like.  Other parts happen at
# the character level: a piece of bold text, a word in code font.  This markup
# is similar in spirit to that used on WikiWiki webs, where folks create web
# pages using a simple set of formatting rules.
#
# RDoc::Markup itself does no output formatting: this is left to a different
# set of classes.
#
# RDoc::Markup is extendable at runtime: you can add \new markup elements to
# be recognised in the documents that RDoc::Markup parses.
#
# RDoc::Markup is intended to be the basis for a family of tools which share
# the common requirement that simple, plain-text should be rendered in a
# variety of different output formats and media.  It is envisaged that
# RDoc::Markup could be the basis for formatting RDoc style comment blocks,
# Wiki entries, and online FAQs.
#
# == Synopsis
#
# This code converts +input_string+ to HTML.  The conversion takes place in
# the +convert+ method, so you can use the same RDoc::Markup converter to
# convert multiple input strings.
#
#   require 'rdoc/markup/to_html'
#
#   h = RDoc::Markup::ToHtml.new
#
#   puts h.convert(input_string)
#
# You can extend the RDoc::Markup parser to recognise new markup
# sequences, and to add special processing for text that matches a
# regular expression.  Here we make WikiWords significant to the parser,
# and also make the sequences {word} and \<no>text...</no> signify
# strike-through text.  We then subclass the HTML output class to deal
# with these:
#
#   require 'rdoc/markup'
#   require 'rdoc/markup/to_html'
#
#   class WikiHtml < RDoc::Markup::ToHtml
#     def handle_special_WIKIWORD(special)
#       "" + special.text + ""
#     end
#   end
#
#   markup = RDoc::Markup.new
#   markup.add_word_pair("{", "}", :STRIKE)
#   markup.add_html("no", :STRIKE)
#
#   markup.add_special(/\b([A-Z][a-z]+[A-Z]\w+)/, :WIKIWORD)
#
#   wh = WikiHtml.new markup
#   wh.add_tag(:STRIKE, "", "")
#
#   puts "#{wh.convert ARGF.read}"
#
# == Encoding
#
# Where Encoding support is available, RDoc will automatically convert all
# documents to the same output encoding.  The output encoding can be set via
# RDoc::Options#encoding and defaults to Encoding.default_external.
#
# = \RDoc Markup Reference
#
# == Block Markup
#
# === Paragraphs and Verbatim
#
# The markup engine looks for a document's natural left margin.  This is
# used as the initial margin for the document.
#
# Consecutive lines starting at this margin are considered to be a
# paragraph. Empty lines separate paragraphs.
#
# Any line that starts to the right of the current margin is treated
# as verbatim text.  This is useful for code listings:
#
#   3.times { puts "Ruby" }
#
# In verbatim text, two or more blank lines are collapsed into one,
# and trailing blank lines are removed:
#
#   This is the first line
#
#
#   This is the second non-blank line,
#   after 2 blank lines in the source markup.
#
#
# There were two trailing blank lines right above this paragraph, that
# have been removed. In addition, the verbatim text has been shifted
# left, so the amount of indentation of verbatim text is unimportant.
#
# === Headers and Rules
#
# A line starting with an equal sign (=) is treated as a
# heading.  Level one headings have one equals sign, level two headings
# have two, and so on until level six, which is the maximum
# (seven hyphens or more result in a level six heading).
#
# For example, the above header was obtained with:
#   == Headers and Rules
#
# A line starting with three or more hyphens (at the current indent)
# generates a horizontal rule.  The more hyphens, the thicker the rule
# (within reason, and if supported by the output device).
#
# In the case of HTML output, three dashes generate a 1-pixel high rule,
# four dashes result in 2 pixels, and so on. The actual height is limited
# to 10 pixels:
#
#   ---
#   -----
#   -----------------------------------------------------
#
# produces:
#
# ---
# -----
# -----------------------------------------------------
#
# === Simple Lists
#
# If a paragraph starts with a "*", "-", "<digit>." or "<letter>.",
# then it is taken to be the start of a list.  The margin is increased to be
# the first non-space following the list start flag.  Subsequent lines
# should be indented to this new margin until the list ends.  For example:
#
#   * this is a list with three paragraphs in
#     the first item.  This is the first paragraph.
#
#     And this is the second paragraph.
#
#     1. This is an indented, numbered list.
#     2. This is the second item in that list
#
#     This is the third conventional paragraph in the
#     first list item.
#
#   * This is the second item in the original list
#
# produces:
#
# * this is a list with three paragraphs in
#   the first item.  This is the first paragraph.
#
#   And this is the second paragraph.
#
#   1. This is an indented, numbered list.
#   2. This is the second item in that list
#
#   This is the third conventional paragraph in the
#   first list item.
#
# * This is the second item in the original list
#
# === Labeled Lists
#
# You can also construct labeled lists, sometimes called description
# or definition lists.  Do this by putting the label in square brackets
# and indenting the list body:
#
#   [cat]  a small furry mammal
#          that seems to sleep a lot
#
#   [ant]  a little insect that is known
#          to enjoy picnics
#
# produces:
#
# [cat]  a small furry mammal
#        that seems to sleep a lot
#
# [ant]  a little insect that is known
#        to enjoy picnics
#
# If you want the list bodies to line up to the left of the labels,
# use two colons:
#
#   cat::  a small furry mammal
#          that seems to sleep a lot
#
#   ant::  a little insect that is known
#          to enjoy picnics
#
# produces:
#
# cat::  a small furry mammal
#        that seems to sleep a lot
#
# ant::  a little insect that is known
#        to enjoy picnics
#
# Notice that blank lines right after the label are ignored in labeled lists:
#
#   [one]
#
#       definition 1
#
#   [two]
#
#       definition 2
#
# produces the same output as
#
#   [one]  definition 1
#   [two]  definition 2
#
#
# === Lists and Verbatim
#
# If you want to introduce a verbatim section right after a list, it has to be
# less indented than the list item bodies, but more indented than the list
# label, letter, digit or bullet. For instance:
#
#   *   point 1
#
#   *   point 2, first paragraph
#
#       point 2, second paragraph
#         verbatim text inside point 2
#       point 2, third paragraph
#     verbatim text outside of the list (the list is therefore closed)
#   regular paragraph after the list
#
# produces:
#
# *   point 1
#
# *   point 2, first paragraph
#
#     point 2, second paragraph
#       verbatim text inside point 2
#     point 2, third paragraph
#   verbatim text outside of the list (the list is therefore closed)
# regular paragraph after the list
#
#
# == Text Markup
#
# === Bold, Italic, Typewriter Text
#
# You can use markup within text (except verbatim) to change the
# appearance of parts of that text.  Out of the box, RDoc::Markup
# supports word-based and general markup.
#
# Word-based markup uses flag characters around individual words:
#
# <tt>\*_word_\*</tt>::  displays _word_ in a *bold* font
# <tt>\__word_\_</tt>::  displays _word_ in an _emphasized_ font
# <tt>\+_word_\+</tt>::  displays _word_ in a +code+ font
#
# General markup affects text between a start delimiter and an end
# delimiter.  Not surprisingly, these delimiters look like HTML markup.
#
# <tt>\_text_</tt>::    displays _text_ in a *bold* font
# <tt>\_text_</tt>::  displays _text_ in an _emphasized_ font
#                              (alternate tag: <tt>\</tt>)
# <tt>\<tt>_text_\</tt></tt>:: displays _text_ in a +code+ font
#                              (alternate tag: <tt>\</tt>)
#
# Unlike conventional Wiki markup, general markup can cross line
# boundaries.  You can turn off the interpretation of markup by
# preceding the first character with a backslash (see Escaping
# Text Markup, below).
#
# === Links
#
# Links to starting with +http:+, +https:+, +mailto:+, +ftp:+ or +www.+
# are recognized.  An HTTP url that references an external image file is
# converted into an inline image element.
#
# Links starting with <tt>rdoc-ref:</tt> will link to the referenced class,
# module, method, file, etc.  If the referenced item is not documented the
# text will be and no link will be generated.
#
# Links starting with +link:+ refer to local files whose path is relative to
# the <tt>--op</tt> directory.
#
# Links can also be of the form <tt>label[url]</tt>, in which case +label+ is
# used in the displayed text, and +url+ is used as the target.  If +label+
# contains multiple words, put it in braces: <tt>{multi word label}[url]</tt>.
# The +url+ may be an +http:+-type link or a cross-reference to a class,
# module or method with a label.
#
# Links with the <tt>rdoc-ref:</tt> scheme will link to the referenced class,
# module, method, file, etc.  If the referenced item is does not exist
# no link will be generated and <tt>rdoc-ref:</tt> will be removed from the
# resulting text.
#
# Links starting with +link:+ refer to local files whose path is relative to
# the <tt>--op</tt> directory.  Use <tt>rdoc-ref:</tt> instead of
# <tt>link:</tt> to link to files generated by RDoc as the link target may
# be different across RDoc generators.
#
# Example links:
#
#   https://github.com/rdoc/rdoc
#   mailto:user@example.com
#   {RDoc Documentation}[http://rdoc.rubyforge.org]
#   {RDoc Markup}[rdoc-ref:RDoc::Markup]
#
# === Escaping Text Markup
#
# Text markup can be escaped with a backslash, as in \<tt>, which was obtained
# with <tt>\\<tt></tt>.  Except in verbatim sections and between \<tt> tags,
# to produce a backslash you have to double it unless it is followed by a
# space, tab or newline. Otherwise, the HTML formatter will discard it, as it
# is used to escape potential links:
#
#   * The \ must be doubled if not followed by white space: \\.
#   * But not in \<tt> tags: in a Regexp, <tt>\S</tt> matches non-space.
#   * This is a link to {ruby-lang}[www.ruby-lang.org].
#   * This is not a link, however: \{ruby-lang.org}[www.ruby-lang.org].
#   * This will not be linked to \RDoc::RDoc#document
#
# generates:
#
# * The \ must be doubled if not followed by white space: \\.
# * But not in \<tt> tags: in a Regexp, <tt>\S</tt> matches non-space.
# * This is a link to {ruby-lang}[www.ruby-lang.org]
# * This is not a link, however: \{ruby-lang.org}[www.ruby-lang.org]
# * This will not be linked to \RDoc::RDoc#document
#
# Inside \<tt> tags, more precisely, leading backslashes are removed only if
# followed by a markup character (<tt><*_+</tt>), a backslash, or a known link
# reference (a known class or method). So in the example above, the backslash
# of <tt>\S</tt> would be removed if there was a class or module named +S+ in
# the current context.
#
# This behavior is inherited from RDoc version 1, and has been kept for
# compatibility with existing RDoc documentation.
#
# === Conversion of characters
#
# HTML will convert two/three dashes to an em-dash. Other common characters are
# converted as well:
#
#   em-dash::  -- or ---
#   ellipsis:: ...
#
#   single quotes:: 'text' or `text'
#   double quotes:: "text" or ``text''
#
#   copyright:: (c)
#   registered trademark:: (r)
#
# produces:
#
# em-dash::  -- or ---
# ellipsis:: ...
#
# single quotes:: 'text' or `text'
# double quotes:: "text" or ``text''
#
# copyright:: (c)
# registered trademark:: (r)
#
#
# == Documenting Source Code
#
# Comment blocks can be written fairly naturally, either using <tt>#</tt> on
# successive lines of the comment, or by including the comment in
# a <tt>=begin</tt>/<tt>=end</tt> block.  If you use the latter form,
# the <tt>=begin</tt> line _must_ be flagged with an +rdoc+ tag:
#
#   =begin rdoc
#   Documentation to be processed by RDoc.
#
#   ...
#   =end
#
# RDoc stops processing comments if it finds a comment line starting
# with <tt>--</tt> right after the <tt>#</tt> character (otherwise,
# it will be treated as a rule if it has three dashes or more).
# This can be used to separate external from internal comments,
# or to stop a comment being associated with a method, class, or module.
# Commenting can be turned back on with a line that starts with <tt>++</tt>.
#
#   ##
#   # Extract the age and calculate the date-of-birth.
#   #--
#   # FIXME: fails if the birthday falls on February 29th
#   #++
#   # The DOB is returned as a Time object.
#
#   def get_dob(person)
#     # ...
#   end
#
# Names of classes, files, and any method names containing an underscore or
# preceded by a hash character are automatically linked from comment text to
# their description. This linking works inside the current class or module,
# and with ancestor methods (in included modules or in the superclass).
#
# Method parameter lists are extracted and displayed with the method
# description.  If a method calls +yield+, then the parameters passed to yield
# will also be displayed:
#
#   def fred
#     ...
#     yield line, address
#
# This will get documented as:
#
#   fred() { |line, address| ... }
#
# You can override this using a comment containing ':yields: ...' immediately
# after the method definition
#
#   def fred # :yields: index, position
#     # ...
#
#     yield line, address
#
# which will get documented as
#
#    fred() { |index, position| ... }
#
# +:yields:+ is an example of a documentation directive.  These appear
# immediately after the start of the document element they are modifying.
#
# RDoc automatically cross-references words with underscores or camel-case.
# To suppress cross-references, prefix the word with a \ character.  To
# include special characters like "<tt>\n</tt>", you'll need to use
# two \ characters in normal text, but only one in \<tt> text:
#
#   "\\n" or "<tt>\n</tt>"
#
# produces:
#
# "\\n" or "<tt>\n</tt>"
#
# == Directives
#
# Directives are keywords surrounded by ":" characters.
#
# === Controlling what is documented
#
# [+:nodoc:+ / <tt>:nodoc: all</tt>]
#   This directive prevents documentation for the element from
#   being generated.  For classes and modules, methods, aliases,
#   constants, and attributes directly within the affected class or
#   module also will be omitted.  By default, though, modules and
#   classes within that class or module _will_ be documented.  This is
#   turned off by adding the +all+ modifier.
#
#     module MyModule # :nodoc:
#       class Input
#       end
#     end
#
#     module OtherModule # :nodoc: all
#       class Output
#       end
#     end
#
#   In the above code, only class <tt>MyModule::Input</tt> will be documented.
#
#   The +:nodoc:+ directive, like +:enddoc:+, +:stopdoc:+ and +:startdoc:+
#   presented below, is local to the current file: if you do not want to
#   document a module that appears in several files, specify +:nodoc:+ on each
#   appearance, at least once per file.
#
# [+:stopdoc:+ / +:startdoc:+]
#   Stop and start adding new documentation elements to the current container.
#   For example, if a class has a number of constants that you don't want to
#   document, put a +:stopdoc:+ before the first, and a +:startdoc:+ after the
#   last.  If you don't specify a +:startdoc:+ by the end of the container,
#   disables documentation for the rest of the current file.
#
# [+:doc:+]
#   Forces a method or attribute to be documented even if it wouldn't be
#   otherwise.  Useful if, for example, you want to include documentation of a
#   particular private method.
#
# [+:enddoc:+]
#   Document nothing further at the current level: directives +:startdoc:+ and
#   +:doc:+ that appear after this will not be honored for the current container
#   (file, class or module), in the current file.
#
# [+:notnew:+ / +:not_new:+ / +:not-new:+ ]
#   Only applicable to the +initialize+ instance method.  Normally RDoc
#   assumes that the documentation and parameters for +initialize+ are
#   actually for the +new+ method, and so fakes out a +new+ for the class.
#   The +:notnew:+ directive stops this.  Remember that +initialize+ is private,
#   so you won't see the documentation unless you use the +-a+ command line
#   option.
#
# === Other directives
#
# [+:include:+ _filename_]
#   Include the contents of the named file at this point. This directive
#   must appear alone on one line, possibly preceded by spaces. In this
#   position, it can be escaped with a \ in front of the first colon.
#
#   The file will be searched for in the directories listed by the +--include+
#   option, or in the current directory by default.  The contents of the file
#   will be shifted to have the same indentation as the ':' at the start of
#   the +:include:+ directive.
#
# [+:title:+ _text_]
#   Sets the title for the document.  Equivalent to the <tt>--title</tt>
#   command line parameter.  (The command line parameter overrides any :title:
#   directive in the source).
#
# [+:main:+ _name_]
#   Equivalent to the <tt>--main</tt> command line parameter.
#
# [<tt>:category: section</tt>]
#   Adds this item to the named +section+ overriding the current section.  Use
#   this to group methods by section in RDoc output while maintaining a
#   sensible ordering (like alphabetical).
#
#     # :category: Utility Methods
#     #
#     # CGI escapes +text+
#
#     def convert_string text
#       CGI.escapeHTML text
#     end
#
#   An empty category will place the item in the default category:
#
#     # :category:
#     #
#     # This method is in the default category
#
#     def some_method
#       # ...
#     end
#
#   Unlike the :section: directive, :category: is not sticky.  The category
#   only applies to the item immediately following the comment.
#
#   Use the :section: directive to provide introductory text for a section of
#   documentation.
#
# [<tt>:section: title</tt>]
#   Provides section introductory text in RDoc output.  The title following
#   +:section:+ is used as the section name and the remainder of the comment
#   containing the section is used as introductory text.  A section's comment
#   block must be separated from following comment blocks.  Use an empty title
#   to switch to the default section.
#
#   The :section: directive is sticky, so subsequent methods, aliases,
#   attributes, and classes will be contained in this section until the
#   section is changed.  The :category: directive will override the :section:
#   directive.
#
#   A :section: comment block may have one or more lines before the :section:
#   directive.  These will be removed, and any identical lines at the end of
#   the block are also removed.  This allows you to add visual cues to the
#   section.
#
#   Example:
#
#     # ----------------------------------------
#     # :section: My Section
#     # This is the section that I wrote.
#     # See it glisten in the noon-day sun.
#     # ----------------------------------------
#
#     ##
#     # Comment for some_method
#
#     def some_method
#       # ...
#     end
#
# [+:call-seq:+]
#   Lines up to the next blank line in the comment are treated as the method's
#   calling sequence, overriding the default parsing of method parameters and
#   yield arguments.
#
# Further directives can be found in RDoc::Parser::Ruby and RDoc::Parser::C.
#--
# Original Author:: Dave Thomas,  dave@pragmaticprogrammer.com
# License:: Ruby license

class RDoc::Markup

  ##
  # An AttributeManager which handles inline markup.

  attr_reader :attribute_manager

  ##
  # Take a block of text and use various heuristics to determine its
  # structure (paragraphs, lists, and so on).  Invoke an event handler as we
  # identify significant chunks.

  def initialize attribute_manager = nil
    @attribute_manager = attribute_manager || RDoc::Markup::AttributeManager.new
    @output = nil
  end

  ##
  # Add to the sequences used to add formatting to an individual word (such
  # as *bold*).  Matching entries will generate attributes that the output
  # formatters can recognize by their +name+.

  def add_word_pair(start, stop, name)
    @attribute_manager.add_word_pair(start, stop, name)
  end

  ##
  # Add to the sequences recognized as general markup.

  def add_html(tag, name)
    @attribute_manager.add_html(tag, name)
  end

  ##
  # Add to other inline sequences.  For example, we could add WikiWords using
  # something like:
  #
  #    parser.add_special(/\b([A-Z][a-z]+[A-Z]\w+)/, :WIKIWORD)
  #
  # Each wiki word will be presented to the output formatter via the
  # accept_special method.

  def add_special(pattern, name)
    @attribute_manager.add_special(pattern, name)
  end

  ##
  # We take +input+, parse it if necessary, then invoke the output +formatter+
  # using a Visitor to render the result.

  def convert input, formatter
    document = case input
               when RDoc::Markup::Document then
                 input
               else
                 RDoc::Markup::Parser.parse input
               end

    document.accept formatter
  end

end

require 'rdoc/markup/parser'
require 'rdoc/markup/attribute_manager'
require 'rdoc/markup/inline'


text:
from __future__ import unicode_literals

from django.db import models, migrations

class Migration(migrations.Migration):

    dependencies = [
        ('api', '0011_auto_20150402_0304'),
    ]

    operations = [
        migrations.AddField(
            model_name='problemassignment',
            name='done_at',
            field=models.DateTimeField(null=True, blank=True),
            preserve_default=True,
        ),
    ]


text:
package gobblin.data.management.convertion.hive;

import java.io.IOException;

import org.apache.hadoop.fs.FileSystem;

import gobblin.configuration.State;
import gobblin.util.HadoopUtils;

/**
 * A factory class to create {@link HdfsBasedUpdateProvider}s
 */
public class HdfsBasedUpdateProviderFactory implements HiveUnitUpdateProviderFactory {

  @Override
  public HiveUnitUpdateProvider create(State state) {
    try {
      return new HdfsBasedUpdateProvider(FileSystem.get(HadoopUtils.getConfFromState(state)));
    } catch (IOException e) {
      throw new RuntimeException(e);
    }
  }

}


text:
package healthcheck

import (
	"fmt"
	"net"
	"net/http"

	"github.com/golang/glog"
	"k8s.io/apimachinery/pkg/types"
	"k8s.io/apimachinery/pkg/util/sets"
	"k8s.io/kubernetes/pkg/client/cache"
)

// proxyMutationRequest: Message to request addition/deletion of endpoints for a service
type proxyMutationRequest struct {
	serviceName  types.NamespacedName
	endpointUids *sets.String
}

// proxyListenerRequest: Message to request addition/deletion of a service responder on a listening port
type proxyListenerRequest struct {
	serviceName     types.NamespacedName
	listenPort      uint16
	add             bool
	responseChannel chan bool
}

// serviceEndpointsList: A list of endpoints for a service
type serviceEndpointsList struct {
	serviceName types.NamespacedName
	endpoints   *sets.String
}

// serviceResponder: Contains net/http datastructures necessary for responding to each Service's health check on its aux nodePort
type serviceResponder struct {
	serviceName types.NamespacedName
	listenPort  uint16
	listener    *net.Listener
	server      *http.Server
}

// proxyHC: Handler structure for health check, endpoint add/delete and service listener add/delete requests
type proxyHC struct {
	serviceEndpointsMap    cache.ThreadSafeStore
	serviceResponderMap    map[types.NamespacedName]serviceResponder
	mutationRequestChannel chan *proxyMutationRequest
	listenerRequestChannel chan *proxyListenerRequest
}

// handleHealthCheckRequest - received a health check request - lookup and respond to HC.
func (h *proxyHC) handleHealthCheckRequest(rw http.ResponseWriter, serviceName string) {
	s, ok := h.serviceEndpointsMap.Get(serviceName)
	if !ok {
		glog.V(4).Infof("Service %s not found or has no local endpoints", serviceName)
		sendHealthCheckResponse(rw, http.StatusServiceUnavailable, "No Service Endpoints Found")
		return
	}
	numEndpoints := len(*s.(*serviceEndpointsList).endpoints)
	if numEndpoints > 0 {
		sendHealthCheckResponse(rw, http.StatusOK, fmt.Sprintf("%d Service Endpoints found", numEndpoints))
		return
	}
	sendHealthCheckResponse(rw, http.StatusServiceUnavailable, "0 local Endpoints are alive")
}

// handleMutationRequest - receive requests to mutate the table entry for a service
func (h *proxyHC) handleMutationRequest(req *proxyMutationRequest) {
	numEndpoints := len(*req.endpointUids)
	glog.V(4).Infof("LB service health check mutation request Service: %s - %d Endpoints %v",
		req.serviceName, numEndpoints, (*req.endpointUids).List())
	if numEndpoints == 0 {
		if _, ok := h.serviceEndpointsMap.Get(req.serviceName.String()); ok {
			glog.V(4).Infof("Deleting endpoints map for service %s, all local endpoints gone", req.serviceName.String())
			h.serviceEndpointsMap.Delete(req.serviceName.String())
		}
		return
	}
	var entry *serviceEndpointsList
	e, exists := h.serviceEndpointsMap.Get(req.serviceName.String())
	if exists {
		entry = e.(*serviceEndpointsList)
		if entry.endpoints.Equal(*req.endpointUids) {
			return
		}
		// Compute differences just for printing logs about additions and removals
		deletedEndpoints := entry.endpoints.Difference(*req.endpointUids)
		newEndpoints := req.endpointUids.Difference(*entry.endpoints)
		for _, e := range newEndpoints.List() {
			glog.V(4).Infof("Adding local endpoint %s to LB health check for service %s",
				e, req.serviceName.String())
		}
		for _, d := range deletedEndpoints.List() {
			glog.V(4).Infof("Deleted endpoint %s from service %s LB health check (%d endpoints left)",
				d, req.serviceName.String(), len(*entry.endpoints))
		}
	}
	entry = &serviceEndpointsList{serviceName: req.serviceName, endpoints: req.endpointUids}
	h.serviceEndpointsMap.Add(req.serviceName.String(), entry)
}

// proxyHealthCheckRequest - Factory method to instantiate the health check handler
func proxyHealthCheckFactory() *proxyHC {
	glog.V(2).Infof("Initializing kube-proxy health checker")
	phc := &proxyHC{
		serviceEndpointsMap:    cache.NewThreadSafeStore(cache.Indexers{}, cache.Indices{}),
		serviceResponderMap:    make(map[types.NamespacedName]serviceResponder),
		mutationRequestChannel: make(chan *proxyMutationRequest, 1024),
		listenerRequestChannel: make(chan *proxyListenerRequest, 1024),
	}
	return phc
}


text:
author: "Arty-chan"
---
"I heard there was a festival. People have fun here right?"


text:
namespace Merchello.Core.Services
{
    using System;
    using System.Collections.Generic;

    using Merchello.Core.Models;

    /// <summary>
    /// Defines the InvoiceService
    /// </summary>
    public interface IInvoiceService : IStaticCollectionService<IInvoice>, IPageCachedService<IInvoice>
    {
        /// <summary>
        /// Creates a <see cref="IInvoice"/> without saving it to the database
        /// </summary>
        /// <param name="invoiceStatusKey">The <see cref="IInvoiceStatus"/> key</param>
        /// <param name="raiseEvents">Optional boolean indicating whether or not to raise events</param>
        /// <returns><see cref="IInvoice"/></returns>
        IInvoice CreateInvoice(Guid invoiceStatusKey, bool raiseEvents = true);

        /// <summary>
        /// Creates a <see cref="IInvoice"/> with an assigned invoice number without saving it to the database
        /// </summary>
        /// <param name="invoiceStatusKey">
        /// The <see cref="IInvoiceStatus"/> key
        /// </param>
        /// <param name="invoiceNumber">
        /// The invoice Number
        /// </param>
        /// <param name="raiseEvents">
        /// Optional boolean indicating whether or not to raise events
        /// </param>
        /// <returns>
        /// <see cref="IInvoice"/>
        /// </returns>
        /// <remarks>
        /// Invoice number must be a positive integer value or zero
        /// </remarks>
        IInvoice CreateInvoice(Guid invoiceStatusKey, int invoiceNumber, bool raiseEvents = true);

        /// <summary>
        /// Saves a single <see cref="IInvoice"/>
        /// </summary>
        /// <param name="invoice">The <see cref="IInvoice"/> to save</param>
        /// <param name="raiseEvents">Optional boolean indicating whether or not to raise events</param>
        void Save(IInvoice invoice, bool raiseEvents = true);

        /// <summary>
        /// Saves a collection of <see cref="IInvoice"/>
        /// </summary>
        /// <param name="invoices">The collection of <see cref="IInvoice"/></param>
        /// <param name="raiseEvents">Optional boolean indicating whether or not to raise events</param>
        void Save(IEnumerable<IInvoice> invoices, bool raiseEvents = true);

        /// <summary>
        /// Deletes a single <see cref="IInvoice"/>
        /// </summary>
        /// <param name="invoice">The <see cref="IInvoice"/> to be deleted</param>
        /// <param name="raiseEvents">Optional boolean indicating whether or not to raise events</param>
        void Delete(IInvoice invoice, bool raiseEvents = true);

        /// <summary>
        /// Deletes a collection <see cref="IInvoice"/>
        /// </summary>
        /// <param name="invoices">The collection of <see cref="IInvoice"/> to be deleted</param>
        /// <param name="raiseEvents">Optional boolean indicating whether or not to raise events</param>
        void Delete(IEnumerable<IInvoice> invoices, bool raiseEvents = true);

        /// <summary>
        /// Gets a <see cref="IInvoice"/> given it's unique 'key' (GUID)
        /// </summary>
        /// <param name="key">The <see cref="IInvoice"/>'s unique 'key' (GUID)</param>
        /// <returns><see cref="IInvoice"/></returns>
        IInvoice GetByKey(Guid key);

        /// <summary>
        /// Gets a <see cref="IInvoice"/> given it's unique 'InvoiceNumber'
        /// </summary>
        /// <param name="invoiceNumber">The invoice number of the <see cref="IInvoice"/> to be retrieved</param>
        /// <returns><see cref="IInvoice"/></returns>
        IInvoice GetByInvoiceNumber(int invoiceNumber);

        /// <summary>
        /// Gets list of <see cref="IInvoice"/> objects given a list of Keys
        /// </summary>
        /// <param name="keys">List of GUID 'key' for the invoices to retrieve</param>
        /// <returns>List of <see cref="IInvoice"/></returns>
        IEnumerable<IInvoice> GetByKeys(IEnumerable<Guid> keys);

        /// <summary>
        /// Gets a collection of <see cref="IInvoice"/> objects that are associated with a <see cref="IPayment"/> by the payments 'key'
        /// </summary>
        /// <param name="paymentKey">The <see cref="IPayment"/> key (GUID)</param>
        /// <returns>A collection of <see cref="IInvoice"/></returns>
        IEnumerable<IInvoice> GetInvoicesByPaymentKey(Guid paymentKey);

        /// <summary>
        /// Get invoices by a customer key.
        /// </summary>
        /// <param name="customeryKey">
        /// The customer key.
        /// </param>
        /// <returns>
        /// The collection of <see cref="IInvoice"/>.
        /// </returns>
        IEnumerable<IInvoice> GetInvoicesByCustomerKey(Guid customeryKey);

        /// <summary>
        /// Get a collection invoices by date range.
        /// </summary>
        /// <param name="startDate">
        /// The start date.
        /// </param>
        /// <param name="endDate">
        /// The end date.
        /// </param>
        /// <returns>
        /// The collection of <see cref="IInvoice"/>.
        /// </returns>
        IEnumerable<IInvoice> GetInvoicesByDateRange(DateTime startDate, DateTime endDate);

        /// <summary>
        /// Gets the total count of all invoices
        /// </summary>
        /// <returns>
        /// The <see cref="int"/> representing the count of invoices.
        /// </returns>
        int CountInvoices();

        /// <summary>
        /// Gets the total count of all invoices within a date range.
        /// </summary>
        /// <param name="startDate">
        /// The start date.
        /// </param>
        /// <param name="endDate">
        /// The end date.
        /// </param>
        /// <returns>
        /// The <see cref="int"/> representing the count of invoices.
        /// </returns>
        int CountInvoices(DateTime startDate, DateTime endDate);

        /// <summary>
        /// The count invoices by customer type
        /// </summary>
        /// <param name="startDate">
        /// The start date.
        /// </param>
        /// <param name="endDate">
        /// The end date.
        /// </param>
        /// <param name="customerType">
        /// The customer type.
        /// </param>
        /// <returns>
        /// The <see cref="int"/>.
        /// </returns>
        int CountInvoices(DateTime startDate, DateTime endDate, CustomerType customerType);

        /// <summary>
        /// Gets the totals of invoices in a date range for a specific currency code.
        /// </summary>
        /// <param name="startDate">
        /// The start date.
        /// </param>
        /// <param name="endDate">
        /// The end date.
        /// </param>
        /// <param name="currencyCode">
        /// The currency code.
        /// </param>
        /// <returns>
        /// The sum of the invoice totals.
        /// </returns>
        decimal SumInvoiceTotals(DateTime startDate, DateTime endDate, string currencyCode);

        /// <summary>
        /// Gets the total of line items for a give SKU invoiced in a specific currency across the date range.
        /// </summary>
        /// <param name="startDate">
        /// The start date.
        /// </param>
        /// <param name="endDate">
        /// The end date.
        /// </param>
        /// <param name="currencyCode">
        /// The currency code.
        /// </param>
        /// <param name="sku">
        /// The SKU.
        /// </param>
        /// <returns>
        /// The total of line items for a give SKU invoiced in a specific currency across the date range.
        /// </returns>
        decimal SumLineItemTotalsBySku(DateTime startDate, DateTime endDate, string currencyCode, string sku);

        /// <summary>
        /// Gets distinct currency codes used in invoices.
        /// </summary>
        /// <returns>
        /// The <see cref="IEnumerable{String}"/>.
        /// </returns>
        IEnumerable<string> GetDistinctCurrencyCodes();

        ///// <summary>
        ///// Gets a <see cref="Page{IInvoice}"/>
        ///// </summary>
        ///// <param name="page">
        ///// The page.
        ///// </param>
        ///// <param name="itemsPerPage">
        ///// The items per page.
        ///// </param>
        ///// <param name="sortBy">
        ///// The sort by.
        ///// </param>
        ///// <param name="sortDirection">
        ///// The sort direction.
        ///// </param>
        ///// <returns>
        ///// The <see cref="Page{IInvoice}"/>.
        ///// </returns>
        //Page<IInvoice> GetPage(long page, long itemsPerPage, string sortBy = "", SortDirection sortDirection = SortDirection.Descending);

        #region InvoiceStatus

        /// <summary>
        /// Gets an <see cref="IInvoiceStatus"/> by it's key
        /// </summary>
        /// <param name="key">The <see cref="IInvoiceStatus"/> key</param>
        /// <returns><see cref="IInvoiceStatus"/></returns>
        IInvoiceStatus GetInvoiceStatusByKey(Guid key);

        /// <summary>
        /// Returns a collection of all <see cref="IInvoiceStatus"/>
        /// </summary>
        /// <returns>
        /// The collection of <see cref="IInvoiceStatus"/>.
        /// </returns>
        IEnumerable<IInvoiceStatus> GetAllInvoiceStatuses();

        #endregion
    }
}


text:
package com.github.nscala_time.time

import java.util.{Calendar, Date}
import org.joda.time._
import com.github.nscala_time.time.Implicits._

object StaticLocalTime extends StaticLocalTime

trait StaticLocalTime {
  type Property = LocalTime.Property

  final val MIDNIGHT = LocalTime.MIDNIGHT
  final val Midnight = LocalTime.MIDNIGHT

  def fromCalendarFields(calendar: Calendar) =
    LocalTime.fromCalendarFields(calendar)
  def fromDateFields(date: Date) =
    LocalTime.fromDateFields(date)
  def fromMillisOfDay(millis: Long) =
    LocalTime.fromMillisOfDay(millis)
  def fromMillisOfDay(millis: Long, chrono: Chronology) =
    LocalTime.fromMillisOfDay(millis, chrono)

  def now        = new LocalTime

  def nextSecond = now + 1.second
  def nextMinute = now + 1.minute
  def nextHour   = now + 1.hour

  def lastSecond = now - 1.second
  def lastMinute = now - 1.minute
  def lastHour   = now - 1.hour
}


text:
module.exports = LazyArgument;

// A LazyArgument is a declaration to override the given dependency id
// with an argument specified at the time the lazy resolution function is called.
function LazyArgument(dependencyId) {
    this.dependencyId = dependencyId;
}


text:
const axios = require('axios').default;
const debug = require('debug')('tilloo:notifier:mandrill');

function Mandrill(pluginConfig, generalConfig) {
    this.pluginConfig = pluginConfig;
    this.generalConfig = generalConfig;
}

Mandrill.prototype.notify = async function notify(message, lastErrorTime, failureCount, job) {
    if (!message.manualStop) {
        const jobId = message.jobId;
        const runId = message.runId;
        const toEmail = job?.alternateFailureEmail && job?.alternateFailureEmail?.length > 0 ? job.alternateFailureEmail : this.pluginConfig.to_email;

        let html;
        if (job && job.name) {
            html = `<b>${message.statusDescription}.</b> View job: <a href="http://${this.pluginConfig.web_host}/run/${runId}">${job.name}.</a>`;
        }
        else {
            html = `<b>${message.statusDescription}.</b> <a href="http://${this.pluginConfig.web_host}/run/${runId}">Click here to view job.</a>`;
        }

        const body = {
            'key': this.pluginConfig.key,
            'message': {
                'from_email': this.pluginConfig.from_email,
                'to': [
                    {
                        'email': toEmail,
                        'name': this.pluginConfig.from_name,
                        'type': 'to'
                    }
                ],
                'autotext': 'true',
                'subject': message.statusDescription,
                'html': html
            }
        };

        try {
            debug(`Sending message body: ${body}`);
            await axios.post('https://mandrillapp.com/api/1.0/messages/send.json', body);
            debug(`Sent message to: ${toEmail}, jobId: ${jobId}, statusDescription: ${message.statusDescription}`);
        }
        catch (err) {
            debug('Error sending message err: %O', err);
            console.error('Mandrill error: ', err);
        }
    }
};

module.exports = Mandrill;


text:
Note: This project doesn't work. It is a spike working off of an idea as if the idea were real to help flesh out the requirements and if the idea would work.

function-injection:

require('function-injection') should return a function.
this function is equivelent to fi.define

fi.define(functionDefinition)
functionDefinition: {
  implements: string, (implementationKey) this represents the function that is being implemented. this will be the key you use to get the function injected into other functions
  dependsOn: string/Array/Object/fi.function,
    if it's a string- the string represents a function and will be of the same name. (The key is defined by the functions "implements" field when it is defined)
    if array, the array can contain strings or fi.function's
    if object- the key of each object represents what the key will be in the injected object passed, each value can be a string or fi.function
    if fi.function: this is returned by either fi.function('implementationKey') or fi.with('model') and represents
  requirements: string/Array/Object/fi.model - same as above, but representing models.
  function: the function that implements the given implementationKey. function signature must be function(injected, requirements)
    where injects will contain the functions of the dependencies listed in "dependsOn". The functions in inject will always return a promise, and always take an object for requirements.
    example: bar requires ['fooModel', 'barModel'], foo dependsOn ['bar'], so the injected object passed to foo will contain a function 'bar' that accepts an object. the object must fufill bar's requirements
  cloneInput: boolean - defaults to true, when true input will be cloned
  cloneOutput: boolean - defaults to false, when true, output is cloned. if a function clones it's output and another function clones it's input, the data will be cloned twice.
    (reason: output clone to prevent writing back to the source data if input could not be cloned. Input clone to prevent writing back to the source data, if output is cloned but the promise is .then'd by
    multiple function, then the siblings could inadvertently modify the data)
  canCache: boolean - defaults to false. If true, results are saved the first time the function is called. if a call is made that matches the arguments supplied, will return the same value.
}

fi.with(object: {(requirementKey): (modelKey) or object {modelKey: fieldKey}}) - this returns an fi.function where the requirementKey specified will map the given model to the dependency's requirementKey type.
  if this is passed to functionDefinition, this will change the requirements type to the type specified. (See vehicle/applyVehicleCount.define.js for example)
  object modelKey:fieldKey only need be supplied if the given model has multiple fields that meet the nessisary requirements, otherwise this will resort to using priority for mapping.
  Priority will go by model's type, field's directly referencing the requirement's field, fields indirectly referencing the requirements field (chained references), then the fields type.
  when attached to an object, the implementationKey will be the propertyKey of the results of fi.with()
    example: fi({
      implements: 'foo',
      function: foo, (for purposes of this example, foo is defined elsewhere)
      dependsOn: {
        bar: fi.with({ barId: 'fooModel' }) // context here would be 'bar', this is functionally the same as fi.function('bar').with({ barId: 'fooModel' })
      }
    })

  returns a with definition that is missing the function impementationKey. Can be used when the implementationKey of the function can be determined by context

fi.function(implementationKey)
returns: fi's object representing a function(fi.function)
{
  with: same as fi.with, but the implementationKey is defined so context is not required.
}

fi.ennumerable(modelKey)
returns: an object representing an ennumerable who's value's are of the given model. Example: fi.ennumerable('foo') could represent an array of fi.model('foo')

fi.model(string (modelKey))
  returns an fi.model representation.
  representation:
  {
    $field: function(string propertyName) -creates a representation of a field of the given model. This is what should be used when one model references another models field.
    $validate: - function(\*) - validates that the given value is a model of (modelKey)
    $isDefined: - boolean, true when the model has been defined
    {propertyName}: fi.field - when the model is defined, the named properties will exist in the object returned by fi.model. This property will be a reference to the type as well as the parent of this field.
      this exists to allow for automatic mapping from one object to another, so that if one object contains a reference to a field, and another object either is that field, is that field's type, or contains a reference to that field, than that will be used.
  }

fi.model({  - function you call to define a model.
  defines: string (modelKey) - the key of the model being defined.
  test: string (implementationKey) - the key of the method to validate the given value. Must be a function who's requirement is 'value' of type '\*'.
    the test must either throw an error or otherwise break the promise chain (assert is one of the supplied ways). Should be able to build a list of all failed tests
  modelDefinition: string (modelKey) OR object
  {
    fieldKey: modelKey
  }
    if string (modelKey), the given object is the modelKey. it can be a more specific implementation of that model though (validated through the test),
    if object, then the model is defined as an object with the given fieldKey's where each fieldKey is a type of the modelKey supplied. Calling validate will call the test function supplied if it exists,
      and will call validate on each of the fields.
  })

fi.entry(object { - returns a function matching the signature of the function supplied minus the first argument (inject), returns promise
    dependsOn: string (implementationKey) - Array, Object, fi.function. Same requirements as dependsOn for fi.define,
    function: function(injected, \* ...) -a function that takes injected and N arguments of any type. injected is populated with dependencies from dependsOn,
  })

fi.map(object { -- explicitly defines a mapping from one type to another for use with the fi.with

  })


text:
import React from 'react';
import extractContent from '../../../helpers/extract_content';
import { Row, Col} from 'react-bootstrap';

const RenderBody = (props) => (
  <Row>
      <Col sm={7} style={{ letterSpacing: "-0.2px"}}>
        {extractContent(props.content,props.key)}
      </Col>
  </Row>
);

export default RenderBody;


text:
import tensorflow as tf
from hanlp.optimizers.adamw import create_optimizer
from hanlp.utils.log_util import logger

def config_is(config, model='bert'):
    return model in type(config).__name__.lower()

def convert_examples_to_features(
        words,
        max_seq_length,
        tokenizer,
        labels=None,
        label_map=None,
        cls_token_at_end=False,
        cls_token="[CLS]",
        cls_token_segment_id=1,
        sep_token="[SEP]",
        sep_token_extra=False,
        pad_on_left=False,
        pad_token_id=0,
        pad_token_segment_id=0,
        pad_token_label_id=0,
        sequence_a_segment_id=0,
        mask_padding_with_zero=True,
        unk_token='[UNK]',
        do_padding=True
):
    """Loads a data file into a list of `InputBatch`s
        `cls_token_at_end` define the location of the CLS token:
            - False (Default, BERT/XLM pattern): [CLS] + A + [SEP] + B + [SEP]
            - True (XLNet/GPT pattern): A + [SEP] + B + [SEP] + [CLS]
        `cls_token_segment_id` define the segment id associated to the CLS token (0 for BERT, 2 for XLNet)

    Args:
      words:
      max_seq_length:
      tokenizer:
      labels:  (Default value = None)
      label_map:  (Default value = None)
      cls_token_at_end:  (Default value = False)
      cls_token:  (Default value = "[CLS]")
      cls_token_segment_id:  (Default value = 1)
      sep_token:  (Default value = "[SEP]")
      sep_token_extra:  (Default value = False)
      pad_on_left:  (Default value = False)
      pad_token_id:  (Default value = 0)
      pad_token_segment_id:  (Default value = 0)
      pad_token_label_id:  (Default value = 0)
      sequence_a_segment_id:  (Default value = 0)
      mask_padding_with_zero:  (Default value = True)
      unk_token:  (Default value = '[UNK]')
      do_padding:  (Default value = True)

    Returns:

    """
    args = locals()
    if not labels:
        labels = words
        pad_token_label_id = False

    tokens = []
    label_ids = []
    for word, label in zip(words, labels):
        word_tokens = tokenizer.tokenize(word)
        if not word_tokens:
            # some wired chars cause the tagger to return empty list
            word_tokens = [unk_token] * len(word)
        tokens.extend(word_tokens)
        # Use the real label id for the first token of the word, and padding ids for the remaining tokens
        label_ids.extend([label_map[label] if label_map else True] + [pad_token_label_id] * (len(word_tokens) - 1))

    # Account for [CLS] and [SEP] with "- 2" and with "- 3" for RoBERTa.
    special_tokens_count = 3 if sep_token_extra else 2
    if len(tokens) > max_seq_length - special_tokens_count:
        logger.warning(
            f'Input tokens {words} exceed the max sequence length of {max_seq_length - special_tokens_count}. '
            f'The exceeded part will be truncated and ignored. '
            f'You are recommended to split your long text into several sentences within '
            f'{max_seq_length - special_tokens_count} tokens beforehand.')
        tokens = tokens[: (max_seq_length - special_tokens_count)]
        label_ids = label_ids[: (max_seq_length - special_tokens_count)]

    # The convention in BERT is:
    # (a) For sequence pairs:
    #  tokens:   [CLS] is this jack ##son ##ville ? [SEP] no it is not . [SEP]
    #  token_type_ids:   0   0  0    0    0     0       0   0   1  1  1  1   1   1
    # (b) For single sequences:
    #  tokens:   [CLS] the dog is hairy . [SEP]
    #  token_type_ids:   0   0   0   0  0     0   0
    #
    # Where "token_type_ids" are used to indicate whether this is the first
    # sequence or the second sequence. The embedding vectors for `type=0` and
    # `type=1` were learned during pre-training and are added to the wordpiece
    # embedding vector (and position vector). This is not *strictly* necessary
    # since the [SEP] token unambiguously separates the sequences, but it makes
    # it easier for the model to learn the concept of sequences.
    #
    # For classification tasks, the first vector (corresponding to [CLS]) is
    # used as as the "sentence vector". Note that this only makes sense because
    # the entire model is fine-tuned.
    tokens += [sep_token]
    label_ids += [pad_token_label_id]
    if sep_token_extra:
        # roberta uses an extra separator b/w pairs of sentences
        tokens += [sep_token]
        label_ids += [pad_token_label_id]
    segment_ids = [sequence_a_segment_id] * len(tokens)

    if cls_token_at_end:
        tokens += [cls_token]
        label_ids += [pad_token_label_id]
        segment_ids += [cls_token_segment_id]
    else:
        tokens = [cls_token] + tokens
        label_ids = [pad_token_label_id] + label_ids
        segment_ids = [cls_token_segment_id] + segment_ids

    input_ids = tokenizer.convert_tokens_to_ids(tokens)

    # The mask has 1 for real tokens and 0 for padding tokens. Only real
    # tokens are attended to.
    input_mask = [1 if mask_padding_with_zero else 0] * len(input_ids)

    if do_padding:
        # Zero-pad up to the sequence length.
        padding_length = max_seq_length - len(input_ids)
        if pad_on_left:
            input_ids = ([pad_token_id] * padding_length) + input_ids
            input_mask = ([0 if mask_padding_with_zero else 1] * padding_length) + input_mask
            segment_ids = ([pad_token_segment_id] * padding_length) + segment_ids
            label_ids = ([pad_token_label_id] * padding_length) + label_ids
        else:
            input_ids += [pad_token_id] * padding_length
            input_mask += [0 if mask_padding_with_zero else 1] * padding_length
            segment_ids += [pad_token_segment_id] * padding_length
            label_ids += [pad_token_label_id] * padding_length

        assert len(input_ids) == max_seq_length
        assert len(input_mask) == max_seq_length
        assert len(segment_ids) == max_seq_length
        assert len(label_ids) == max_seq_length, f'failed for:\n {args}'
    else:
        assert len(set(len(x) for x in [input_ids, input_mask, segment_ids, label_ids])) == 1
    return input_ids, input_mask, segment_ids, label_ids

def build_adamw_optimizer(config, learning_rate, epsilon, clipnorm, train_steps, use_amp, warmup_steps,
                          weight_decay_rate):
    opt = create_optimizer(init_lr=learning_rate,
                           epsilon=epsilon,
                           weight_decay_rate=weight_decay_rate,
                           clipnorm=clipnorm,
                           num_train_steps=train_steps, num_warmup_steps=warmup_steps)
    # opt = tfa.optimizers.AdamW(learning_rate=3e-5, epsilon=1e-08, weight_decay=0.01)
    # opt = tf.keras.optimizers.Adam(learning_rate=3e-5, epsilon=1e-08)
    config.optimizer = tf.keras.utils.serialize_keras_object(opt)
    lr_config = config.optimizer['config']['learning_rate']['config']
    if 'decay_schedule_fn' in lr_config:
        lr_config['decay_schedule_fn'] = dict(
            (k, v) for k, v in lr_config['decay_schedule_fn'].items() if not k.startswith('_'))
    if use_amp:
        # loss scaling is currently required when using mixed precision
        opt = tf.keras.mixed_precision.experimental.LossScaleOptimizer(opt, 'dynamic')
    return opt

def adjust_tokens_for_transformers(sentence):
    """Adjust tokens for BERT
    See https://github.com/DoodleJZ/HPSG-Neural-Parser/blob/master/src_joint/Zparser.py#L1204

    Args:
      sentence:

    Returns:

    """
    cleaned_words = []
    for word in sentence:
        # word = BERT_TOKEN_MAPPING.get(word, word)
        if word == "n't" and cleaned_words:
            cleaned_words[-1] = cleaned_words[-1] + "n"
            word = "'t"
        cleaned_words.append(word)
    return cleaned_words


text:
.. _devguide_xml-parsing:

=================
XML Input Parsing
=================

OpenMC relies on the FoX_ Fortran XML library for reading and intrepreting the
XML input files for geometry, materials, settings, tallies, etc. The use of an
XML format makes writing input files considerably more flexible than would
otherwise be possible.

With the FoX library, extending the user input files to include new tags is
fairly straightforward. The steps for modifying/adding input are as follows:

1. Add appropriate calls to procedures from the `xml_interface module`_, such as
   ``check_for_node``, ``get_node_value``, and ``get_node_array``. All input
   reading is performed in the `input_xml module`_.

2. Make sure that your input can be categorized as one of the datatypes from
   `XML Schema Part 2`_ and that parsing of the data appropriately reflects
   this. For example, for a boolean_ value, true can be represented either by
   "true" or by "1".

3. Add code to check the variable for any possible errors.

A set of `RELAX NG`_ schemata exists that enables real-time validation of input
files when using the GNU Emacs text editor. You should also modify the RELAX NG
schema for the file you changed (e.g. src/relaxng/geometry.rnc) so that
those who use Emacs can confirm whether their input is valid before they
run. You will need to be familiar with RELAX NG `compact syntax`_.

Working with the FoX Submodule
==============================

The FoX_ library is included as a submodule_ in OpenMC. This means that for a
given commit in OpenMC, there is an associated commit id that links to FoX.
The actual FoX source code is maintained at mit-crpg/fox, branch openmc. When
cloning the OpenMC repo for the first time, you will notice that the directory
*src/xml/fox* is empty. To fetch the submodule source code, you can manually
enter the following from the root directory of OpenMC:

.. code-block:: sh

    git submodule init
    git submodule update

It should be noted that if the submodule is not initialized and updated, *cmake*
will automatically perform these commands if it cannot file the FoX source code.

If you navigate into the FoX source code in OpenMC, src/xml/fox, and check git
information, you will notice that you are in a completely different repo. Actually,
you are in a clone of mit-crpg/fox. If you have write access to this repo, you can
make changes to the FoX source code, commit and push just like any other repo.
Just because you make changes to the FoX source code in OpenMC or in a standalone
repo, this does not mean that OpenMC will automatically fetch these changes. The
way submodules work is that they are just stored as a commit id. To save FoX xml
source changes to your OpenMC branch, do the following:

1. Go into src/xml/fox and check out the appropriate source code state

2. Navigate back out of fox subdirectory and type:

.. code-block:: sh

    git status

3. Make sure you see that git recognized that the state of FoX changed:

::

    # On branch fox_submodule
    # Changes not staged for commit:
    #   (use "git add <file>..." to update what will be committed)
    #   (use "git checkout -- <file>..." to discard changes in working directory)
    #
    #   modified:   fox (new commits)

4. Commit and push this change

Editing FoX on Personal Fork
============================

If you don't have write access to mit-crpg/fox and thus can't make a branch off of the openmc
branch there, you will need to fork mit-crpg/fox to your personal account. You need to then
link your branch in your OpenMC repo, to the *openmc* branch on your own personal FoX fork.
To do this, edit the *.gitmodules* file in the root folder of the repo. It contains the
following information:

::

    [submodule "src/xml/fox"]
        path = src/xml/fox
        url = git@github.com:mit-crpg/fox

Change the url remote to your own fork. The commit id should stay constant until you start
making modification to FoX yourself. Once you have made changes to your FoX fork and linked
the new commit id to your OpenMC branch, you can pull request your changes in by peforming
the following steps:

1. Create a pull request from your fork of FoX to mit-crpg/fox and wait until it
   is merged into the openmc branch.

2. In your OpenMC repo, change your *.gitmodules* file back to point at mit-crpg/fox.

3. Submit a pull request to mit-crpg/openmc

.. warning:: If you make changes to your FoX submodule inside of an OpenMC repo and do not
    commit, do **not** run *git submodule update*. This may throw away any changes that
    were not committed.

.. _FoX: https://github.com/mit-crpg/fox
.. _xml_interface module: https://github.com/mit-crpg/openmc/blob/develop/src/xml_interface.F90
.. _input_xml module: https://github.com/mit-crpg/openmc/blob/develop/src/input_xml.F90
.. _XML Schema Part 2: http://www.w3.org/TR/xmlschema-2/
.. _boolean: http://www.w3.org/TR/xmlschema-2/#boolean
.. _RELAX NG: http://relaxng.org/
.. _compact syntax: http://relaxng.org/compact-tutorial-20030326.html
.. _submodule: http://git-scm.com/book/en/Git-Tools-Submodules