text:
namespace Humanizer.Localisation.NumberToWords
{
    abstract class GenderlessNumberToWordsConverter : INumberToWordsConverter
    {
        /// <summary>
        /// Converts the number to string
        /// </summary>
        /// <param name="number"></param>
        /// <returns></returns>
        public abstract string Convert(int number);

        /// <summary>
        /// Converts the number to string ignoring the provided grammatical gender
        /// </summary>
        /// <param name="number"></param>
        /// <param name="gender"></param>
        /// <returns></returns>
        public string Convert(int number, GrammaticalGender gender)
        {
            return Convert(number);
        }

        /// <summary>
        /// Converts the number to ordinal string
        /// </summary>
        /// <param name="number"></param>
        /// <returns></returns>
        public abstract string ConvertToOrdinal(int number);

        /// <summary>
        /// Converts the number to ordinal string ignoring  the provided grammatical gender
        /// </summary>
        /// <param name="number"></param>
        /// <param name="gender"></param>
        /// <returns></returns>
        public string ConvertToOrdinal(int number, GrammaticalGender gender)
        {
            return ConvertToOrdinal(number);
        }
    }
}


text:
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
  <modelVersion>4.0.0</modelVersion>
  <groupId>com.quakearts.webtools</groupId>
  <artifactId>qa-appbase-resteasy-orm-archetype</artifactId>
  <version>1.0.5</version>
  <name>An Archetype for creating new QA-Appbase JAX-RS ORM applications</name>
  <url>http://maven.apache.org</url>
</project>

redpajama_set_name: RedPajamaGithub


text:
title: "Raspberry Pi Pir Motion Python Nodejs"
date: 2015-08-12
template: "post.hbs"
---

Wiring:
GND -> 39
D01 -> GPIO21 #40
V -> 5v #2
picture

`npm i --save johnny-five raspi-io`

```js
var raspi = require('raspi-io');
var five = require("johnny-five");
var board = new five.Board({
  io: new raspi()
});

board.on("ready", function() {

  // Create a new `motion` hardware instance.
  var motion = new five.Motion('GPIO21');

  // "calibrated" occurs once, at the beginning of a session,
  motion.on("calibrated", function() {
    console.log("calibrated");
  });

  // "motionstart" events are fired when the "calibrated"
  // proximal area is disrupted, generally by some form of movement
  motion.on("motionstart", function() {
    console.log("motionstart");
  });

  // "motionend" events are fired following a "motionstart" event
  // when no movement has occurred in X ms
  motion.on("motionend", function() {
    console.log("motionend");
  });
});
```

python:

```python
import RPi.GPIO as GPIO

import time

GPIO.setmode(GPIO.BCM)
GPIO.setwarnings(False)
#GPIO.setup(10, GPIO.OUT)
GPIO.setup(21, GPIO.IN)

while True:
    input_state = GPIO.input(21)
    if input_state == True:
       print "Motion Detected"
       time.sleep(2)
```


text:
# Copyright (c) 2016, LE GOFF Vincent
# All rights reserved.

# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:

# * Redistributions of source code must retain the above copyright notice, this
#   list of conditions and the following disclaimer.

# * Redistributions in binary form must reproduce the above copyright notice,
#   this list of conditions and the following disclaimer in the documentation
#   and/or other materials provided with the distribution.

# * Neither the name of ytranslate nor the names of its
#   contributors may be used to endorse or promote products derived from
#   this software without specific prior written permission.

# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

"""Module containing the Repeat function class."""

import wx
from ytranslate import t

from sharp import Function

class Repeat(Function):

    """Function SharpScript '#repeat'.

    This function can be used to repeat a command, once or several
    times.  It has different syntax:

    Repeat the last command:
        #repeat 1
    Repeat three times the 'look' command:
        #repeat look 3

    """

    description = "Repeat a command X times"

    def run(self, times, command=None):
        """Repeat a command."""
        if not self.client:
            return

        client = self.client
        panel = client.window
        if command is None:
            for last in reversed(panel.extensions["history"].commands):
                if not last.startswith("#") or last.startswith("##"):
                    command = last
                    break

        times = int(times)
        if command:
            for time in range(times):
                self.client.write(command)

    def display(self, dialog, times="1", command=""):
        """Display the function's arguments."""
        l_times = self.t("times", "Number of times to repeat the command")
        l_command = self.t("command", "Command to repeat (leave blank " \
                "to send the last command in your history")

        # Times
        l_times = wx.StaticText(dialog, label=l_times)
        t_times = wx.TextCtrl(dialog, value=times)
        dialog.times = t_times
        dialog.top.Add(l_times)
        dialog.top.Add(t_times)

        # Command
        l_command = wx.StaticText(dialog, label=l_command)
        t_command = wx.TextCtrl(dialog, value=command)
        dialog.command = t_command
        dialog.top.Add(l_command)
        dialog.top.Add(t_command)

    def complete(self, dialog):
        """The user pressed 'ok' in the dialog."""
        times = dialog.times.GetValue()
        empty_times = self.t("empty_times",
                "You didn't specify the number of times you want " \
                "this command to repeat. Specify 1 at least.")
        invalid_times = self.t("invalid_times",
                "The number of times you specified isn't a valid number.")

        if not times:
            wx.MessageBox(empty_times, t("ui.alert.error"),
                    wx.OK | wx.ICON_ERROR)
            dialog.times.SetFocus()
            return None

        if not times.isdigit():
            wx.MessageBox(invalid_times, t("ui.alert.error"),
                    wx.OK | wx.ICON_ERROR)
            dialog.times.SetFocus()
            return None

        command = dialog.command.GetValue()

        arguments = [times]
        if command:
            arguments.append(command)

        return tuple(arguments)


text:
package io.bootique.resource;

import io.bootique.BootiqueException;

import java.io.File;
import java.io.IOException;
import java.net.URI;
import java.net.URL;
import java.util.Objects;

/**
 * A value object representing a resource URL. Supports 3 common resource
 * representations:
 *

 *

 *
resource as a URL using protocols recognized by Java (http:, https:,
 * jar:, file:, etc).

 *
resource as URL with "classpath:" protocol that allows to identify
 * resources on classpath in a portable manner. E.g. the same URL would identify
 * the resource regardless of whether it is packaged in a jar or resides in a
 * source folder in an IDE.

 *
resource as absolute or relative file path.

 *

 *
 * @since 0.15
 */
public class ResourceFactory {

    protected static final String CLASSPATH_URL_PREFIX = "classpath:";

    protected String resourceId;

    /**
     * Creates a ResourceFactory passing it a String resource identifier. It can
     * be one of
     *

     *
resource as a URL using protocols recognized by Java (http:, https:,
     * jar:, file:, etc).

     *
resource as URL with "classpath:" protocol that allows to identify
     * resources on classpath in a portable manner. E.g. the same URL would
     * identify the resource regardless of whether it is packaged in a jar or
     * resides in a source folder in an IDE.

     *
resource as absolute or relative file path.

     *

     *
     * @param resourceId a String identifier of the resource.
     */
    public ResourceFactory(String resourceId) {
        this.resourceId = Objects.requireNonNull(resourceId);
    }

    /**
     * Returns a URL to access resource contents.
     *
     * @return a URL to access resource contents.
     */
    public URL getUrl() {
        return resolveUrl(this.resourceId);
    }

    /**
     * Returns resource ID string used to initialize this ResourceFactory.
     *
     * @return resource ID string used to initialize this ResourceFactory.
     * @since 0.21
     */
    public String getResourceId() {
        return resourceId;
    }

    protected URL resolveUrl(String resourceId) {

        // resourceId can be either a file path or a URL or a classpath: URL

        if (resourceId.startsWith(CLASSPATH_URL_PREFIX)) {

            String path = resourceId.substring(CLASSPATH_URL_PREFIX.length());

            // classpath URLs must not start with a slash. This does not work
            // with ClassLoader.
            if (path.length() > 0 && path.charAt(0) == '/') {
                throw new RuntimeException(CLASSPATH_URL_PREFIX + " URLs must not start with a slash: " + resourceId);
            }

            URL cpUrl = ResourceFactory.class.getClassLoader().getResource(path);

            if (cpUrl == null) {
                throw new IllegalArgumentException("Classpath URL not found: " + resourceId);
            }

            return cpUrl;
        }

        URI uri;
        try {
            uri = URI.create(resourceId);
        } catch (IllegalArgumentException e) {
            throw new BootiqueException(1, "Invalid config resource url: " + resourceId, e);
        }
        try {
            return uri.isAbsolute() ? uri.toURL() : getCanonicalFile(resourceId).toURI().toURL();
        } catch (IOException e) {
            throw new BootiqueException(1, "Invalid config resource url: " + resourceId, e);
        }
    }

    /**
     * Converts resource ID to a canonical file.
     *
     * @return canonical file produced from resource id.
     * @throws IOException
     */
    // using canonical file avoids downstream bugs like this:
    // https://github.com/bootique/bootique-jetty/issues/29
    protected File getCanonicalFile(String resourceId) throws IOException {
        return new File(resourceId).getCanonicalFile();
    }

    @Override
    public String toString() {
        return "ResourceFactory:" + resourceId;
    }

}


text:
package org.apache.beam.examples;

import static org.hamcrest.Matchers.equalTo;

import com.google.common.base.MoreObjects;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.Lists;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Date;
import java.util.List;
import java.util.SortedMap;
import java.util.TreeMap;
import java.util.concurrent.ThreadLocalRandom;
import org.apache.beam.examples.common.ExampleUtils;
import org.apache.beam.examples.common.WriteOneFilePerWindow.PerWindowFiles;
import org.apache.beam.sdk.PipelineResult;
import org.apache.beam.sdk.io.FileBasedSink;
import org.apache.beam.sdk.io.FileSystems;
import org.apache.beam.sdk.io.fs.ResolveOptions.StandardResolveOptions;
import org.apache.beam.sdk.io.fs.ResourceId;
import org.apache.beam.sdk.options.PipelineOptionsFactory;
import org.apache.beam.sdk.options.StreamingOptions;
import org.apache.beam.sdk.testing.SerializableMatcher;
import org.apache.beam.sdk.testing.StreamingIT;
import org.apache.beam.sdk.testing.TestPipeline;
import org.apache.beam.sdk.testing.TestPipelineOptions;
import org.apache.beam.sdk.transforms.windowing.IntervalWindow;
import org.apache.beam.sdk.util.ExplicitShardedFile;
import org.apache.beam.sdk.util.FluentBackoff;
import org.apache.beam.sdk.util.NumberedShardedFile;
import org.apache.beam.sdk.util.ShardedFile;
import org.apache.beam.sdk.util.Sleeper;
import org.hamcrest.Description;
import org.hamcrest.TypeSafeMatcher;
import org.joda.time.Duration;
import org.joda.time.Instant;
import org.junit.BeforeClass;
import org.junit.Rule;
import org.junit.Test;
import org.junit.experimental.categories.Category;
import org.junit.rules.TestName;
import org.junit.runner.RunWith;
import org.junit.runners.JUnit4;

/** End-to-end integration test of {@link WindowedWordCount}. */
@RunWith(JUnit4.class)
public class WindowedWordCountIT {

  @Rule public TestName testName = new TestName();

  private static final String DEFAULT_INPUT = "gs://apache-beam-samples/shakespeare/sonnets.txt";
  static final int MAX_READ_RETRIES = 4;
  static final Duration DEFAULT_SLEEP_DURATION = Duration.standardSeconds(10L);
  static final FluentBackoff BACK_OFF_FACTORY =
      FluentBackoff.DEFAULT
          .withInitialBackoff(DEFAULT_SLEEP_DURATION)
          .withMaxRetries(MAX_READ_RETRIES);

  /** Options for the {@link WindowedWordCount} Integration Test. */
  public interface WindowedWordCountITOptions
      extends WindowedWordCount.Options, TestPipelineOptions, StreamingOptions {}

  @BeforeClass
  public static void setUp() {
    PipelineOptionsFactory.register(TestPipelineOptions.class);
  }

  @Test
  public void testWindowedWordCountInBatchDynamicSharding() throws Exception {
    WindowedWordCountITOptions options = batchOptions();
    // This is the default value, but make it explicit.
    options.setNumShards(null);
    testWindowedWordCountPipeline(options);
  }

  @Test
  public void testWindowedWordCountInBatchStaticSharding() throws Exception {
    WindowedWordCountITOptions options = batchOptions();
    options.setNumShards(3);
    testWindowedWordCountPipeline(options);
  }

  // TODO: add a test with streaming and dynamic sharding after resolving
  // https://issues.apache.org/jira/browse/BEAM-1438

  @Test
  @Category(StreamingIT.class)
  public void testWindowedWordCountInStreamingStaticSharding() throws Exception {
    WindowedWordCountITOptions options = streamingOptions();
    options.setNumShards(3);
    testWindowedWordCountPipeline(options);
  }

  private WindowedWordCountITOptions defaultOptions() throws Exception {
    WindowedWordCountITOptions options =
        TestPipeline.testingPipelineOptions().as(WindowedWordCountITOptions.class);
    options.setInputFile(DEFAULT_INPUT);
    options.setTestTimeoutSeconds(1200L);

    options.setMinTimestampMillis(0L);
    options.setMinTimestampMillis(Duration.standardHours(1).getMillis());
    options.setWindowSize(10);

    options.setOutput(
        FileSystems.matchNewResource(options.getTempRoot(), true)
            .resolve(
                String.format(
                    "WindowedWordCountIT.%s-%tFT%<tH:%<tM:%<tS.%<tL+%s",
                    testName.getMethodName(), new Date(), ThreadLocalRandom.current().nextInt()),
                StandardResolveOptions.RESOLVE_DIRECTORY)
            .resolve("output", StandardResolveOptions.RESOLVE_DIRECTORY)
            .resolve("results", StandardResolveOptions.RESOLVE_FILE)
            .toString());
    return options;
  }

  private WindowedWordCountITOptions streamingOptions() throws Exception {
    WindowedWordCountITOptions options = defaultOptions();
    options.setStreaming(true);
    return options;
  }

  private WindowedWordCountITOptions batchOptions() throws Exception {
    WindowedWordCountITOptions options = defaultOptions();
    // This is the default value, but make it explicit
    options.setStreaming(false);
    return options;
  }

  private void testWindowedWordCountPipeline(WindowedWordCountITOptions options) throws Exception {

    ResourceId output = FileBasedSink.convertToFileResourceIfPossible(options.getOutput());
    PerWindowFiles filenamePolicy = new PerWindowFiles(output);

    List<ShardedFile> expectedOutputFiles = Lists.newArrayListWithCapacity(6);

    for (int startMinute : ImmutableList.of(0, 10, 20, 30, 40, 50)) {
      final Instant windowStart =
          new Instant(options.getMinTimestampMillis()).plus(Duration.standardMinutes(startMinute));
      String filePrefix =
          filenamePolicy.filenamePrefixForWindow(
              new IntervalWindow(windowStart, windowStart.plus(Duration.standardMinutes(10))));
      expectedOutputFiles.add(
          new NumberedShardedFile(
              output
                      .getCurrentDirectory()
                      .resolve(filePrefix, StandardResolveOptions.RESOLVE_FILE)
                      .toString()
                  + "*"));
    }

    ShardedFile inputFile = new ExplicitShardedFile(Collections.singleton(options.getInputFile()));

    // For this integration test, input is tiny and we can build the expected counts
    SortedMap<String, Long> expectedWordCounts = new TreeMap<>();
    for (String line :
        inputFile.readFilesWithRetries(Sleeper.DEFAULT, BACK_OFF_FACTORY.backoff())) {
      String[] words = line.split(ExampleUtils.TOKENIZER_PATTERN, -1);

      for (String word : words) {
        if (!word.isEmpty()) {
          expectedWordCounts.put(
              word, MoreObjects.firstNonNull(expectedWordCounts.get(word), 0L) + 1L);
        }
      }
    }

    options.setOnSuccessMatcher(new WordCountsMatcher(expectedWordCounts, expectedOutputFiles));

    WindowedWordCount.runWindowedWordCount(options);
  }

  /**
   * A matcher that bakes in expected word counts, so they can be read directly via some other
   * mechanism, and compares a sharded output file with the result.
   */
  private static class WordCountsMatcher extends TypeSafeMatcher<PipelineResult>
      implements SerializableMatcher<PipelineResult> {

    private final SortedMap<String, Long> expectedWordCounts;
    private final List<ShardedFile> outputFiles;
    private SortedMap<String, Long> actualCounts;

    public WordCountsMatcher(
        SortedMap<String, Long> expectedWordCounts, List<ShardedFile> outputFiles) {
      this.expectedWordCounts = expectedWordCounts;
      this.outputFiles = outputFiles;
    }

    @Override
    public boolean matchesSafely(PipelineResult pipelineResult) {
      try {
        // Load output data
        List<String> outputLines = new ArrayList<>();
        for (ShardedFile outputFile : outputFiles) {
          outputLines.addAll(
              outputFile.readFilesWithRetries(Sleeper.DEFAULT, BACK_OFF_FACTORY.backoff()));
        }

        // Since the windowing is nondeterministic we only check the sums
        actualCounts = new TreeMap<>();
        for (String line : outputLines) {
          String[] splits = line.split(": ", -1);
          String word = splits[0];
          long count = Long.parseLong(splits[1]);
          actualCounts.merge(word, count, (a, b) -> a + b);
        }

        return actualCounts.equals(expectedWordCounts);
      } catch (Exception e) {
        throw new RuntimeException(
            String.format("Failed to read from sharded output: %s due to exception", outputFiles),
            e);
      }
    }

    @Override
    public void describeTo(Description description) {
      equalTo(expectedWordCounts).describeTo(description);
    }

    @Override
    public void describeMismatchSafely(PipelineResult pResult, Description description) {
      equalTo(expectedWordCounts).describeMismatch(actualCounts, description);
    }
  }
}


text:
<?xml version="1.0" encoding="iso-8859-1"?>
<GraphicOpts>
  <!--<ScreenResolution Width="1920" Height="1080" />-->
  <ScreenResolution Width="1280" Height="720" />
  <RenderMode FullScreenMode="false" WindowFormat="DXGI_FORMAT_R8G8B8A8_UNORM" FullScreenFormat="DXGI_FORMAT_R8G8B8A8_UNORM" />
  <SingleThreaded />
</GraphicOpts>


text:
package policy

import (
	"sync"

	"github.com/cilium/cilium/pkg/identity"

	. "gopkg.in/check.v1"
)

type DummyEndpoint struct {
	rev      uint64
	Endpoint // Implement methods of the interface that need to mock out real behavior.
}

func (d *DummyEndpoint) GetSecurityIdentity() (*identity.Identity, error) {
	return nil, nil
}

func (d *DummyEndpoint) PolicyRevisionBumpEvent(rev uint64) {
	d.rev = rev
}

func (d *DummyEndpoint) RLockAlive() error {
	return nil
}

func (d *DummyEndpoint) RUnlock() {
}

func (ds *PolicyTestSuite) TestNewEndpointSet(c *C) {
	d := &DummyEndpoint{}
	epSet := NewEndpointSet(map[Endpoint]struct{}{
		d: {},
	})
	c.Assert(epSet.Len(), Equals, 1)
	epSet.Delete(d)
	c.Assert(epSet.Len(), Equals, 0)
}

func (ds *PolicyTestSuite) TestForEach(c *C) {
	var wg sync.WaitGroup

	d0 := &DummyEndpoint{}
	d1 := &DummyEndpoint{}

	epSet := NewEndpointSet(map[Endpoint]struct{}{
		d0: {},
		d1: {},
	})
	epSet.ForEachGo(&wg, func(e Endpoint) {
		e.PolicyRevisionBumpEvent(100)
	})

	wg.Wait()

	c.Assert(d0.rev, Equals, uint64(100))
	c.Assert(d1.rev, Equals, uint64(100))
}


text:
package com.amazonaws.services.cloudformation.model.transform;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import com.amazonaws.AmazonClientException;
import com.amazonaws.Request;
import com.amazonaws.DefaultRequest;
import com.amazonaws.internal.ListWithAutoConstructFlag;
import com.amazonaws.services.cloudformation.model.*;
import com.amazonaws.transform.Marshaller;
import com.amazonaws.util.StringUtils;

/**
 * Create Stack Request Marshaller
 */
public class CreateStackRequestMarshaller implements Marshaller<Request<CreateStackRequest>, CreateStackRequest> {

    public Request<CreateStackRequest> marshall(CreateStackRequest createStackRequest) {

        if (createStackRequest == null) {
            throw new AmazonClientException("Invalid argument passed to marshall(...)");
        }

        Request<CreateStackRequest> request = new DefaultRequest<CreateStackRequest>(createStackRequest, "AmazonCloudFormation");
        request.addParameter("Action", "CreateStack");
        request.addParameter("Version", "2010-05-15");

        if (createStackRequest.getStackName() != null) {
            request.addParameter("StackName", StringUtils.fromString(createStackRequest.getStackName()));
        }
        if (createStackRequest.getTemplateBody() != null) {
            request.addParameter("TemplateBody", StringUtils.fromString(createStackRequest.getTemplateBody()));
        }
        if (createStackRequest.getTemplateURL() != null) {
            request.addParameter("TemplateURL", StringUtils.fromString(createStackRequest.getTemplateURL()));
        }

        java.util.List<Parameter> parametersList = createStackRequest.getParameters();
        int parametersListIndex = 1;

        for (Parameter parametersListValue : parametersList) {
            Parameter parameterMember = parametersListValue;
            if (parameterMember != null) {
                if (parameterMember.getParameterKey() != null) {
                    request.addParameter("Parameters.member." + parametersListIndex + ".ParameterKey", StringUtils.fromString(parameterMember.getParameterKey()));
                }
                if (parameterMember.getParameterValue() != null) {
                    request.addParameter("Parameters.member." + parametersListIndex + ".ParameterValue", StringUtils.fromString(parameterMember.getParameterValue()));
                }
                if (parameterMember.isUsePreviousValue() != null) {
                    request.addParameter("Parameters.member." + parametersListIndex + ".UsePreviousValue", StringUtils.fromBoolean(parameterMember.isUsePreviousValue()));
                }
            }

            parametersListIndex++;
        }
        if (createStackRequest.isDisableRollback() != null) {
            request.addParameter("DisableRollback", StringUtils.fromBoolean(createStackRequest.isDisableRollback()));
        }
        if (createStackRequest.getTimeoutInMinutes() != null) {
            request.addParameter("TimeoutInMinutes", StringUtils.fromInteger(createStackRequest.getTimeoutInMinutes()));
        }

        java.util.List<String> notificationARNsList = createStackRequest.getNotificationARNs();
        int notificationARNsListIndex = 1;

        for (String notificationARNsListValue : notificationARNsList) {
            if (notificationARNsListValue != null) {
                request.addParameter("NotificationARNs.member." + notificationARNsListIndex, StringUtils.fromString(notificationARNsListValue));
            }

            notificationARNsListIndex++;
        }

        java.util.List<String> capabilitiesList = createStackRequest.getCapabilities();
        int capabilitiesListIndex = 1;

        for (String capabilitiesListValue : capabilitiesList) {
            if (capabilitiesListValue != null) {
                request.addParameter("Capabilities.member." + capabilitiesListIndex, StringUtils.fromString(capabilitiesListValue));
            }

            capabilitiesListIndex++;
        }

        java.util.List<String> resourceTypesList = createStackRequest.getResourceTypes();
        int resourceTypesListIndex = 1;

        for (String resourceTypesListValue : resourceTypesList) {
            if (resourceTypesListValue != null) {
                request.addParameter("ResourceTypes.member." + resourceTypesListIndex, StringUtils.fromString(resourceTypesListValue));
            }

            resourceTypesListIndex++;
        }
        if (createStackRequest.getOnFailure() != null) {
            request.addParameter("OnFailure", StringUtils.fromString(createStackRequest.getOnFailure()));
        }
        if (createStackRequest.getStackPolicyBody() != null) {
            request.addParameter("StackPolicyBody", StringUtils.fromString(createStackRequest.getStackPolicyBody()));
        }
        if (createStackRequest.getStackPolicyURL() != null) {
            request.addParameter("StackPolicyURL", StringUtils.fromString(createStackRequest.getStackPolicyURL()));
        }

        java.util.List<Tag> tagsList = createStackRequest.getTags();
        int tagsListIndex = 1;

        for (Tag tagsListValue : tagsList) {
            Tag tagMember = tagsListValue;
            if (tagMember != null) {
                if (tagMember.getKey() != null) {
                    request.addParameter("Tags.member." + tagsListIndex + ".Key", StringUtils.fromString(tagMember.getKey()));
                }
                if (tagMember.getValue() != null) {
                    request.addParameter("Tags.member." + tagsListIndex + ".Value", StringUtils.fromString(tagMember.getValue()));
                }
            }

            tagsListIndex++;
        }

        return request;
    }
}


text:
#ifndef __ESP_PARTITION_H__
#define __ESP_PARTITION_H__

#include <stdint.h>
#include <stdbool.h>
#include <stddef.h>
#include "esp_err.h"

#ifdef __cplusplus
extern "C" {
#endif

/**
 * @file esp_partition.h
 * @brief Partition APIs
 */

/** @cond */
typedef struct esp_flash_t esp_flash_t;
/** @endcond */

/**
 * @brief Enumeration which specifies memory space requested in an mmap call
 */
typedef enum {
    ESP_PARTITION_MMAP_DATA,    /**< map to data memory (Vaddr0), allows byte-aligned access, 4 MB total */
    ESP_PARTITION_MMAP_INST,    /**< map to instruction memory (Vaddr1-3), allows only 4-byte-aligned access, 11 MB total */
} esp_partition_mmap_memory_t;

/**
 * @brief Opaque handle for memory region obtained from esp_partition_mmap.
 */
typedef uint32_t esp_partition_mmap_handle_t;

/**
 * @brief Partition type
 *
 * @note Partition types with integer value 0x00-0x3F are reserved for partition types defined by ESP-IDF.
 * Any other integer value 0x40-0xFE can be used by individual applications, without restriction.
 *
 * @internal Keep this enum in sync with PartitionDefinition class gen_esp32part.py @endinternal
 *
 */
typedef enum {
    ESP_PARTITION_TYPE_APP = 0x00,       //!< Application partition type
    ESP_PARTITION_TYPE_DATA = 0x01,      //!< Data partition type

    ESP_PARTITION_TYPE_ANY = 0xff,       //!< Used to search for partitions with any type
} esp_partition_type_t;

/**
 * @brief Partition subtype
 *
 * @note These ESP-IDF-defined partition subtypes apply to partitions of type ESP_PARTITION_TYPE_APP
 * and ESP_PARTITION_TYPE_DATA.
 *
 * Application-defined partition types (0x40-0xFE) can set any numeric subtype value.
 *
 * @internal Keep this enum in sync with PartitionDefinition class gen_esp32part.py @endinternal
 */
typedef enum {
    ESP_PARTITION_SUBTYPE_APP_FACTORY = 0x00,                                 //!< Factory application partition
    ESP_PARTITION_SUBTYPE_APP_OTA_MIN = 0x10,                                 //!< Base for OTA partition subtypes
    ESP_PARTITION_SUBTYPE_APP_OTA_0 = ESP_PARTITION_SUBTYPE_APP_OTA_MIN + 0,  //!< OTA partition 0
    ESP_PARTITION_SUBTYPE_APP_OTA_1 = ESP_PARTITION_SUBTYPE_APP_OTA_MIN + 1,  //!< OTA partition 1
    ESP_PARTITION_SUBTYPE_APP_OTA_2 = ESP_PARTITION_SUBTYPE_APP_OTA_MIN + 2,  //!< OTA partition 2
    ESP_PARTITION_SUBTYPE_APP_OTA_3 = ESP_PARTITION_SUBTYPE_APP_OTA_MIN + 3,  //!< OTA partition 3
    ESP_PARTITION_SUBTYPE_APP_OTA_4 = ESP_PARTITION_SUBTYPE_APP_OTA_MIN + 4,  //!< OTA partition 4
    ESP_PARTITION_SUBTYPE_APP_OTA_5 = ESP_PARTITION_SUBTYPE_APP_OTA_MIN + 5,  //!< OTA partition 5
    ESP_PARTITION_SUBTYPE_APP_OTA_6 = ESP_PARTITION_SUBTYPE_APP_OTA_MIN + 6,  //!< OTA partition 6
    ESP_PARTITION_SUBTYPE_APP_OTA_7 = ESP_PARTITION_SUBTYPE_APP_OTA_MIN + 7,  //!< OTA partition 7
    ESP_PARTITION_SUBTYPE_APP_OTA_8 = ESP_PARTITION_SUBTYPE_APP_OTA_MIN + 8,  //!< OTA partition 8
    ESP_PARTITION_SUBTYPE_APP_OTA_9 = ESP_PARTITION_SUBTYPE_APP_OTA_MIN + 9,  //!< OTA partition 9
    ESP_PARTITION_SUBTYPE_APP_OTA_10 = ESP_PARTITION_SUBTYPE_APP_OTA_MIN + 10,//!< OTA partition 10
    ESP_PARTITION_SUBTYPE_APP_OTA_11 = ESP_PARTITION_SUBTYPE_APP_OTA_MIN + 11,//!< OTA partition 11
    ESP_PARTITION_SUBTYPE_APP_OTA_12 = ESP_PARTITION_SUBTYPE_APP_OTA_MIN + 12,//!< OTA partition 12
    ESP_PARTITION_SUBTYPE_APP_OTA_13 = ESP_PARTITION_SUBTYPE_APP_OTA_MIN + 13,//!< OTA partition 13
    ESP_PARTITION_SUBTYPE_APP_OTA_14 = ESP_PARTITION_SUBTYPE_APP_OTA_MIN + 14,//!< OTA partition 14
    ESP_PARTITION_SUBTYPE_APP_OTA_15 = ESP_PARTITION_SUBTYPE_APP_OTA_MIN + 15,//!< OTA partition 15
    ESP_PARTITION_SUBTYPE_APP_OTA_MAX = ESP_PARTITION_SUBTYPE_APP_OTA_MIN + 16,//!< Max subtype of OTA partition
    ESP_PARTITION_SUBTYPE_APP_TEST = 0x20,                                    //!< Test application partition

    ESP_PARTITION_SUBTYPE_DATA_OTA = 0x00,                                    //!< OTA selection partition
    ESP_PARTITION_SUBTYPE_DATA_PHY = 0x01,                                    //!< PHY init data partition
    ESP_PARTITION_SUBTYPE_DATA_NVS = 0x02,                                    //!< NVS partition
    ESP_PARTITION_SUBTYPE_DATA_COREDUMP = 0x03,                               //!< COREDUMP partition
    ESP_PARTITION_SUBTYPE_DATA_NVS_KEYS = 0x04,                               //!< Partition for NVS keys
    ESP_PARTITION_SUBTYPE_DATA_EFUSE_EM = 0x05,                               //!< Partition for emulate eFuse bits
    ESP_PARTITION_SUBTYPE_DATA_UNDEFINED = 0x06,                              //!< Undefined (or unspecified) data partition

    ESP_PARTITION_SUBTYPE_DATA_ESPHTTPD = 0x80,                               //!< ESPHTTPD partition
    ESP_PARTITION_SUBTYPE_DATA_FAT = 0x81,                                    //!< FAT partition
    ESP_PARTITION_SUBTYPE_DATA_SPIFFS = 0x82,                                 //!< SPIFFS partition

#if __has_include("extra_partition_subtypes.inc")
    #include "extra_partition_subtypes.inc"
#endif

    ESP_PARTITION_SUBTYPE_ANY = 0xff,                                         //!< Used to search for partitions with any subtype
} esp_partition_subtype_t;

/**
 * @brief Convenience macro to get esp_partition_subtype_t value for the i-th OTA partition
 */
#define ESP_PARTITION_SUBTYPE_OTA(i) ((esp_partition_subtype_t)(ESP_PARTITION_SUBTYPE_APP_OTA_MIN + ((i) & 0xf)))

/**
 * @brief Opaque partition iterator type
 */
typedef struct esp_partition_iterator_opaque_* esp_partition_iterator_t;

/**
 * @brief partition information structure
 *
 * This is not the format in flash, that format is esp_partition_info_t.
 *
 * However, this is the format used by this API.
 */
typedef struct {
    esp_flash_t* flash_chip;            /*!< SPI flash chip on which the partition resides */
    esp_partition_type_t type;          /*!< partition type (app/data) */
    esp_partition_subtype_t subtype;    /*!< partition subtype */
    uint32_t address;                   /*!< starting address of the partition in flash */
    uint32_t size;                      /*!< size of the partition, in bytes */
    uint32_t erase_size;                /*!< size the erase operation should be aligned to */
    char label[17];                     /*!< partition label, zero-terminated ASCII string */
    bool encrypted;                     /*!< flag is set to true if partition is encrypted */
} esp_partition_t;

/**
 * @brief Find partition based on one or more parameters
 *
 * @param type Partition type, one of esp_partition_type_t values or an 8-bit unsigned integer.
 *             To find all partitions, no matter the type, use ESP_PARTITION_TYPE_ANY, and set
 *             subtype argument to ESP_PARTITION_SUBTYPE_ANY.
 * @param subtype Partition subtype, one of esp_partition_subtype_t values or an 8-bit unsigned integer.
 *                To find all partitions of given type, use ESP_PARTITION_SUBTYPE_ANY.
 * @param label (optional) Partition label. Set this value if looking
 *             for partition with a specific name. Pass NULL otherwise.
 *
 * @return iterator which can be used to enumerate all the partitions found,
 *         or NULL if no partitions were found.
 *         Iterator obtained through this function has to be released
 *         using esp_partition_iterator_release when not used any more.
 */
esp_partition_iterator_t esp_partition_find(esp_partition_type_t type, esp_partition_subtype_t subtype, const char* label);

/**
 * @brief Find first partition based on one or more parameters
 *
 * @param type Partition type, one of esp_partition_type_t values or an 8-bit unsigned integer.
 *             To find all partitions, no matter the type, use ESP_PARTITION_TYPE_ANY, and set
 *             subtype argument to ESP_PARTITION_SUBTYPE_ANY.
 * @param subtype Partition subtype, one of esp_partition_subtype_t values or an 8-bit unsigned integer
 *                To find all partitions of given type, use ESP_PARTITION_SUBTYPE_ANY.
 * @param label (optional) Partition label. Set this value if looking
 *             for partition with a specific name. Pass NULL otherwise.
 *
 * @return pointer to esp_partition_t structure, or NULL if no partition is found.
 *         This pointer is valid for the lifetime of the application.
 */
const esp_partition_t* esp_partition_find_first(esp_partition_type_t type, esp_partition_subtype_t subtype, const char* label);

/**
 * @brief Get esp_partition_t structure for given partition
 *
 * @param iterator  Iterator obtained using esp_partition_find. Must be non-NULL.
 *
 * @return pointer to esp_partition_t structure. This pointer is valid for the lifetime
 *         of the application.
 */
const esp_partition_t* esp_partition_get(esp_partition_iterator_t iterator);

/**
 * @brief Move partition iterator to the next partition found
 *
 * Any copies of the iterator will be invalid after this call.
 *
 * @param iterator Iterator obtained using esp_partition_find. Must be non-NULL.
 *
 * @return NULL if no partition was found, valid esp_partition_iterator_t otherwise.
 */
esp_partition_iterator_t esp_partition_next(esp_partition_iterator_t iterator);

/**
 * @brief Release partition iterator
 *
 * @param iterator Iterator obtained using esp_partition_find.
 *                 The iterator is allowed to be NULL, so it is not necessary to check its value
 *                 before calling this function.
 *
 */
void esp_partition_iterator_release(esp_partition_iterator_t iterator);

/**
 * @brief Verify partition data
 *
 * Given a pointer to partition data, verify this partition exists in the partition table (all fields match.)
 *
 * This function is also useful to take partition data which may be in a RAM buffer and convert it to a pointer to the
 * permanent partition data stored in flash.
 *
 * Pointers returned from this function can be compared directly to the address of any pointer returned from
 * esp_partition_get(), as a test for equality.
 *
 * @param partition Pointer to partition data to verify. Must be non-NULL. All fields of this structure must match the
 * partition table entry in flash for this function to return a successful match.
 *
 * @return
 * - If partition not found, returns NULL.
 * - If found, returns a pointer to the esp_partition_t structure in flash. This pointer is always valid for the lifetime of the application.
 */
const esp_partition_t* esp_partition_verify(const esp_partition_t* partition);

/**
 * @brief Read data from the partition
 *
 * Partitions marked with an encryption flag will automatically be
 * be read and decrypted via a cache mapping.
 *
 * @param partition Pointer to partition structure obtained using
 *                  esp_partition_find_first or esp_partition_get.
 *                  Must be non-NULL.
 * @param dst Pointer to the buffer where data should be stored.
 *            Pointer must be non-NULL and buffer must be at least 'size' bytes long.
 * @param src_offset Address of the data to be read, relative to the
 *                   beginning of the partition.
 * @param size Size of data to be read, in bytes.
 *
 * @return ESP_OK, if data was read successfully;
 *         ESP_ERR_INVALID_ARG, if src_offset exceeds partition size;
 *         ESP_ERR_INVALID_SIZE, if read would go out of bounds of the partition;
 *         or one of error codes from lower-level flash driver.
 */
esp_err_t esp_partition_read(const esp_partition_t* partition,
                             size_t src_offset, void* dst, size_t size);

/**
 * @brief Write data to the partition
 *
 * Before writing data to flash, corresponding region of flash needs to be erased.
 * This can be done using esp_partition_erase_range function.
 *
 * Partitions marked with an encryption flag will automatically be
 * written via the esp_flash_write_encrypted() function. If writing to
 * an encrypted partition, all write offsets and lengths must be
 * multiples of 16 bytes. See the esp_flash_write_encrypted() function
 * for more details. Unencrypted partitions do not have this
 * restriction.
 *
 * @param partition Pointer to partition structure obtained using
 *                  esp_partition_find_first or esp_partition_get.
 *                  Must be non-NULL.
 * @param dst_offset Address where the data should be written, relative to the
 *                   beginning of the partition.
 * @param src Pointer to the source buffer.  Pointer must be non-NULL and
 *            buffer must be at least 'size' bytes long.
 * @param size Size of data to be written, in bytes.
 *
 * @note Prior to writing to flash memory, make sure it has been erased with
 *       esp_partition_erase_range call.
 *
 * @return ESP_OK, if data was written successfully;
 *         ESP_ERR_INVALID_ARG, if dst_offset exceeds partition size;
 *         ESP_ERR_INVALID_SIZE, if write would go out of bounds of the partition;
 *         or one of error codes from lower-level flash driver.
 */
esp_err_t esp_partition_write(const esp_partition_t* partition,
                              size_t dst_offset, const void* src, size_t size);

/**
 * @brief Read data from the partition without any transformation/decryption.
 *
 * @note This function is essentially the same as \c esp_partition_read() above.
 *       It just never decrypts data but returns it as is.
 *
 * @param partition Pointer to partition structure obtained using
 *                  esp_partition_find_first or esp_partition_get.
 *                  Must be non-NULL.
 * @param dst Pointer to the buffer where data should be stored.
 *            Pointer must be non-NULL and buffer must be at least 'size' bytes long.
 * @param src_offset Address of the data to be read, relative to the
 *                   beginning of the partition.
 * @param size Size of data to be read, in bytes.
 *
 * @return ESP_OK, if data was read successfully;
 *         ESP_ERR_INVALID_ARG, if src_offset exceeds partition size;
 *         ESP_ERR_INVALID_SIZE, if read would go out of bounds of the partition;
 *         or one of error codes from lower-level flash driver.
 */
esp_err_t esp_partition_read_raw(const esp_partition_t* partition,
                                 size_t src_offset, void* dst, size_t size);

/**
 * @brief Write data to the partition without any transformation/encryption.
 *
 * @note This function is essentially the same as \c esp_partition_write() above.
 *       It just never encrypts data but writes it as is.
 *
 * Before writing data to flash, corresponding region of flash needs to be erased.
 * This can be done using esp_partition_erase_range function.
 *
 * @param partition Pointer to partition structure obtained using
 *                  esp_partition_find_first or esp_partition_get.
 *                  Must be non-NULL.
 * @param dst_offset Address where the data should be written, relative to the
 *                   beginning of the partition.
 * @param src Pointer to the source buffer.  Pointer must be non-NULL and
 *            buffer must be at least 'size' bytes long.
 * @param size Size of data to be written, in bytes.
 *
 * @note Prior to writing to flash memory, make sure it has been erased with
 *       esp_partition_erase_range call.
 *
 * @return ESP_OK, if data was written successfully;
 *         ESP_ERR_INVALID_ARG, if dst_offset exceeds partition size;
 *         ESP_ERR_INVALID_SIZE, if write would go out of bounds of the partition;
 *         or one of the error codes from lower-level flash driver.
 */
esp_err_t esp_partition_write_raw(const esp_partition_t* partition,
                                  size_t dst_offset, const void* src, size_t size);

/**
 * @brief Erase part of the partition
 *
 * @param partition Pointer to partition structure obtained using
 *                  esp_partition_find_first or esp_partition_get.
 *                  Must be non-NULL.
 * @param offset Offset from the beginning of partition where erase operation
 *               should start. Must be aligned to partition->erase_size.
 * @param size Size of the range which should be erased, in bytes.
 *                   Must be divisible by partition->erase_size.
 *
 * @return ESP_OK, if the range was erased successfully;
 *         ESP_ERR_INVALID_ARG, if iterator or dst are NULL;
 *         ESP_ERR_INVALID_SIZE, if erase would go out of bounds of the partition;
 *         or one of error codes from lower-level flash driver.
 */
esp_err_t esp_partition_erase_range(const esp_partition_t* partition,
                                    size_t offset, size_t size);

/**
 * @brief Configure MMU to map partition into data memory
 *
 * Unlike spi_flash_mmap function, which requires a 64kB aligned base address,
 * this function doesn't impose such a requirement.
 * If offset results in a flash address which is not aligned to 64kB boundary,
 * address will be rounded to the lower 64kB boundary, so that mapped region
 * includes requested range.
 * Pointer returned via out_ptr argument will be adjusted to point to the
 * requested offset (not necessarily to the beginning of mmap-ed region).
 *
 * To release mapped memory, pass handle returned via out_handle argument to
 * esp_partition_munmap function.
 *
 * @param partition Pointer to partition structure obtained using
 *                  esp_partition_find_first or esp_partition_get.
 *                  Must be non-NULL.
 * @param offset Offset from the beginning of partition where mapping should start.
 * @param size Size of the area to be mapped.
 * @param memory  Memory space where the region should be mapped
 * @param out_ptr  Output, pointer to the mapped memory region
 * @param out_handle  Output, handle which should be used for esp_partition_munmap call
 *
 * @return ESP_OK, if successful
 */
esp_err_t esp_partition_mmap(const esp_partition_t* partition, size_t offset, size_t size,
                             esp_partition_mmap_memory_t memory,
                             const void** out_ptr, esp_partition_mmap_handle_t* out_handle);

/**
 * @brief Release region previously obtained using esp_partition_mmap
 *
 * @note Calling this function will not necessarily unmap memory region.
 *       Region will only be unmapped when there are no other handles which
 *       reference this region. In case of partially overlapping regions
 *       it is possible that memory will be unmapped partially.
 *
 * @param handle  Handle obtained from spi_flash_mmap
 */
void esp_partition_munmap(esp_partition_mmap_handle_t handle);

/**
 * @brief Get SHA-256 digest for required partition.
 *
 * For apps with SHA-256 appended to the app image, the result is the appended SHA-256 value for the app image content.
 * The hash is verified before returning, if app content is invalid then the function returns ESP_ERR_IMAGE_INVALID.
 * For apps without SHA-256 appended to the image, the result is the SHA-256 of all bytes in the app image.
 * For other partition types, the result is the SHA-256 of the entire partition.
 *
 * @param[in]  partition    Pointer to info for partition containing app or data. (fields: address, size and type, are required to be filled).
 * @param[out] sha_256      Returned SHA-256 digest for a given partition.
 *
 * @return
 *          - ESP_OK: In case of successful operation.
 *          - ESP_ERR_INVALID_ARG: The size was 0 or the sha_256 was NULL.
 *          - ESP_ERR_NO_MEM: Cannot allocate memory for sha256 operation.
 *          - ESP_ERR_IMAGE_INVALID: App partition doesn't contain a valid app image.
 *          - ESP_FAIL: An allocation error occurred.
 */
esp_err_t esp_partition_get_sha256(const esp_partition_t* partition, uint8_t* sha_256);

/**
 * @brief Check for the identity of two partitions by SHA-256 digest.
 *
 * @param[in] partition_1 Pointer to info for partition 1 containing app or data. (fields: address, size and type, are required to be filled).
 * @param[in] partition_2 Pointer to info for partition 2 containing app or data. (fields: address, size and type, are required to be filled).
 *
 * @return
 *         - True:  In case of the two firmware is equal.
 *         - False: Otherwise
 */
bool esp_partition_check_identity(const esp_partition_t* partition_1, const esp_partition_t* partition_2);

/**
 * @brief Register a partition on an external flash chip
 *
 * This API allows designating certain areas of external flash chips (identified by the esp_flash_t structure)
 * as partitions. This allows using them with components which access SPI flash through the esp_partition API.
 *
 * @param flash_chip  Pointer to the structure identifying the flash chip
 * @param offset  Address in bytes, where the partition starts
 * @param size  Size of the partition in bytes
 * @param label  Partition name
 * @param type  One of the partition types (ESP_PARTITION_TYPE_*), or an integer. Note that applications can not be booted from external flash
 *              chips, so using ESP_PARTITION_TYPE_APP is not supported.
 * @param subtype  One of the partition subtypes (ESP_PARTITION_SUBTYPE_*), or an integer.
 * @param[out] out_partition  Output, if non-NULL, receives the pointer to the resulting esp_partition_t structure
 * @return
 *      - ESP_OK on success
 *      - ESP_ERR_NO_MEM if memory allocation has failed
 *      - ESP_ERR_INVALID_ARG if the new partition overlaps another partition on the same flash chip
 *      - ESP_ERR_INVALID_SIZE if the partition doesn't fit into the flash chip size
 */
esp_err_t esp_partition_register_external(esp_flash_t* flash_chip, size_t offset, size_t size,
                                          const char* label, esp_partition_type_t type, esp_partition_subtype_t subtype,
                                          const esp_partition_t** out_partition);

/**
 * @brief Deregister the partition previously registered using esp_partition_register_external
 * @param partition  pointer to the partition structure obtained from esp_partition_register_external,
 * @return
 *      - ESP_OK on success
 *      - ESP_ERR_NOT_FOUND if the partition pointer is not found
 *      - ESP_ERR_INVALID_ARG if the partition comes from the partition table
 *      - ESP_ERR_INVALID_ARG if the partition was not registered using
 *        esp_partition_register_external function.
 */
esp_err_t esp_partition_deregister_external(const esp_partition_t* partition);

#ifdef __cplusplus
}
#endif

#endif /* __ESP_PARTITION_H__ */


text:
using System.Text.Json;
using System.Threading;
using System.Threading.Tasks;
using Azure;
using Azure.Core;
using Azure.ResourceManager.ApiManagement.Models;

namespace Azure.ResourceManager.ApiManagement
{
    internal class GitOperationResultContractDataOperationSource : IOperationSource<GitOperationResultContractData>
    {
        GitOperationResultContractData IOperationSource<GitOperationResultContractData>.CreateResult(Response response, CancellationToken cancellationToken)
        {
            using var document = JsonDocument.Parse(response.ContentStream);
            return GitOperationResultContractData.DeserializeGitOperationResultContractData(document.RootElement);
        }

        async ValueTask<GitOperationResultContractData> IOperationSource<GitOperationResultContractData>.CreateResultAsync(Response response, CancellationToken cancellationToken)
        {
            using var document = await JsonDocument.ParseAsync(response.ContentStream, default, cancellationToken).ConfigureAwait(false);
            return GitOperationResultContractData.DeserializeGitOperationResultContractData(document.RootElement);
        }
    }
}


text:
import React from "react";
import {connect} from "react-redux";
import CourseList from "../../components/CourseList/CourseList";

class Courses extends React.Component {

  render() {
    return (

My Courses

        <CourseList courses={this.props.courses}/>

    );
  }
}

Courses.propTypes = {
  courses: React.PropTypes.object.isRequired
};

const mapStateToProps = state => {
  return {
    courses: state.courses
  };
};

export default connect(mapStateToProps)(Courses);


text:
package com.manniwood.cl4pg.v1.typeconverters;

import java.lang.reflect.Method;

import com.manniwood.cl4pg.v1.typeconverters.types.TypeConverter;

/**
 * Holds a setter method for a bean, and a typeConverter that will convert a
 * result-set's column into the Java type required by the setter method for the
 * bean.
 *
 * @author mwood
 *
 */
public class SetterAndTypeConverter {

    private final TypeConverter<?> typeConverter;
    private final Method setter;

    public SetterAndTypeConverter(TypeConverter<?> converter, Method setter) {
        super();
        this.typeConverter = converter;
        this.setter = setter;
    }

    public TypeConverter<?> getConverter() {
        return typeConverter;
    }

    public Method getSetter() {
        return setter;
    }

}


text:
using System;
using NCmdLiner.Attributes;
using NMultiTool.Library.Infrastructure;
using NMultiTool.Library.Module.Commands.FindDuplicateFiles;

namespace NMultiTool.Module.Commands
{
    public class FindDuplicateFilesCommand: CommandDefinition
    {
        private readonly IFindDuplicateFilesCommandProvider _findDuplicateFilesCommandProvider;

        public FindDuplicateFilesCommand(IFindDuplicateFilesCommandProvider findDuplicateFilesCommandProvider)
        {
            _findDuplicateFilesCommandProvider = findDuplicateFilesCommandProvider;
        }

        [CLSCompliant(false)]
        [Command(Summary = "Find duplicate files in one or more locations. ", Description = "Find duplicate files in one or more locations. Use rules to suggest wich duplicate files to keep and which to delete. The rules defined first have priority over rules defined after. The provided example values will search the 'd:' drive and 'e:' drive for duplicate files and suggest deleting files on the the 'e:' drive since the regular expression for the e drive is listed first.")]
        public int FindDuplicateFiles(
            [RequiredCommandParameter(Description = "Array of paths to search for duplicate files.", ExampleValue = new string[]{@"d:\Dev", @"e:\Dev"}, AlternativeName = "ps")]
                string[] pathsToSearch,
            [RequiredCommandParameter(Description = "Regular expression based rules for wich file locations to keep. Files in locations defined last or not defined  will be marked for deletion. The provided example value instructs to keep files on d: and mark any duplicates on e: for deletion.", ExampleValue = new string[] { "^d:.+", "^e:.+" },AlternativeName = "flk")]string[] fileLocationsToKeep,
            [RequiredCommandParameter(Description = "Result file containing the suggestions for which files to keep.",ExampleValue = @"c:\temp\DeleteDuplicateFiles.cmd.txt", AlternativeName = "rf")]string resultFile
            )
        {
            var returnValue = _findDuplicateFilesCommandProvider.FindDuplicateFiles(pathsToSearch, fileLocationsToKeep, resultFile);
            return returnValue;
        }
    }
}


text:
/**
 * define CELL_MODE if not present
 */
process.env.CELL_MODE = process.env.CELL_MODE || '_test'

var path = require('path')
var chai = require('chai')
var $require = require(process.cwd() + '/server/lib/require')
var replacePlaceholders = $require('lib/replace-placeholders')

global.expect = chai.expect

chai.config.includeStack = true

var test = global.test = {}
var variables = test.variables = {
  cell: null,
  dna: null,
  httpendpoint: 'http://127.0.0.1:13371',
  apiendpoint: 'http://127.0.0.1:13371/api',
  uploadsDir: path.join(process.cwd(), '/test/uploads')
}

require('./clean-uploads')
require('./clean-db')

require('./factories')

test.initTestEnv = function (done) {
  var loadDna = require('organic-dna-loader')
  loadDna(function (err, dna) {
    if (err) return done(err)

    replacePlaceholders(dna.fronturls, dna.fronturls)

    test.variables.dna = dna
    test.getToken = $require('lib/jwt-token')(dna.secrets.JWT)

    test.cleanUploads(function (err) {
      if (err) return done(err)
      test.cleanDB(dna.server.database.name, function () {
        process.nextTick(done)
      })
    })
  })
}

test.startServer = function (next) {
  test.initTestEnv(function (err) {
    if (err) return next(err)
    var cell = variables.cell = $require('index').start()
    cell.plasma.on(['ApiRoutesReady', 'SiteRoutesReady'], function (err) {
      if (err instanceof Error) return next(err)
      next && next()
    })
  })
}

test.stopServer = function (next) {
  variables.cell.stop(next)
}

test.connectDB = function (next) {
  test.initTestEnv(function (err) {
    if (err) return next(err)
    var dbName = test.variables.dna.server.database.name
    process.nextTick(function () {
      var mongoose = require('mongoose')
      if (global.Promise) {
        mongoose.Promise = global.Promise
      } else {
        mongoose.Promise = require('bluebird')
      }

      mongoose.connect('localhost', dbName, next)
    })
  })
}

test.disconnectDB = function (next) {
  require('mongoose').disconnect(next)
}