text:
Thread communication queues that group items/requests that occur close together
in time.

## Example

Chunked queues allow grouping together items that may be too granular to
process one-by-one. In the following example, the listening thread receives
chunks of items by allowing the queue to settle for 2 ms.

```haskell
import  Control.Concurrent
import  Control.Concurrent.Async
import  Control.Concurrent.STM
import  Control.Concurrent.STM.TMChunkedQueue

-- | delay in microseconds
millisecond :: Int
millisecond = 1000

main :: IO ()
main = do
    queue <- newTMChunkedQueueIO
    -- start listening thread
    finished <- async $ (2 * millisecond) `settleAndPrint` queue

    let enqueue = atomically . writeManyTMChunkedQueue queue

    -- queue groups enqueues below
    enqueue [1, 2]
    enqueue [3, 4]
    threadDelay millisecond
    enqueue [5, 6]

    -- longer delay so listening thread settles
    threadDelay (4 * millisecond)

    -- listening thread starts new group
    enqueue [7, 8]

    -- close queue and wait for child to finish
    atomically $ closeTMChunkedQueue queue
    wait finished

-- | repeatedly drain a queue with a settle period, and print the resulting
-- chunks
settleAndPrint :: Int -> TMChunkedQueue Int -> IO ()
settleAndPrint delay queue = go

    where go = do
            maybeItems <- drainAndSettleTMChunkedQueue delay queue

            case maybeItems of
                Nothing -> return () -- queue closed
                Just items -> print (consumeQueue items) >> go
```

Which prints the following:

```
[1,2,3,4,5,6]
[7,8]
```

redpajama_set_name: RedPajamaGithub


text:
"""Amazon boto3 interface."""
from __future__ import absolute_import, unicode_literals

try:
    import boto3
    from botocore import exceptions
    from botocore.awsrequest import AWSRequest
    from botocore.response import get_response
except ImportError:
    boto3 = None

    class _void(object):
        pass

    class BotoCoreError(Exception):
        pass
    exceptions = _void()
    exceptions.BotoCoreError = BotoCoreError
    AWSRequest = _void()
    get_response = _void()

__all__ = (
    'exceptions', 'AWSRequest', 'get_response'
)


text:
<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

			<title></title>
			<link rel="stylesheet" href="media/stylesheet.css" />
			<meta http-equiv='Content-Type' content='text/html; charset=iso-8859-1'/>

phpCollab3

Description

			Class trees

			Index of elements

idRepositoryPlugin

Classes

Command

DiffBlock

DiffBlockLine

DiffCommandFactory

DiffLine

DiffParser

FactoryLine

FileLogData

GitDiffCommand

GitLogCommand

GitLogFileHandler

GitLogFormat

GitRepository

LogCommandFactory

LogData

repositoryAdapter

RepositoryFactory

repositoryTestFunctional

ShowDiffListForm

SvnDiffCommand

SvnLogCommand

SvnProxy

SvnRepository

SvnXmlReader

XmlLogData

Files

Command.interface.php

DiffBlock.class.php

DiffBlockLine.class.php

DiffCommandFactory.class.php

DiffLine.class.php

DiffParser.class.php

FactoryLine.class.php

FileLogData.class.php

GitDiffCommand.class.php

GitLogCommand.class.php

GitLogFileHandler.class.php

GitLogFormat.class.php

GitRepository.class.php

LogCommandFactory.class.php

LogData.interface.php

Repository.interface.php

RepositoryFactory.class.php

repositoryTestFunctional.class.php

ShowDiffListForm.class.php

SvnDiffCommand.class.php

SvnLogCommand.class.php

SvnProxy.class.php

SvnRepository.class.php

SvnXmlReader.class.php

XmlLogData.class.php

phpDocumentor v 1.4.2


text:
package com.wdullaer.materialdatetimepicker.date;

import android.annotation.SuppressLint;
import android.content.Context;
import android.os.Build;
import android.os.Bundle;
import android.os.Handler;
import android.support.annotation.NonNull;
import android.util.AttributeSet;
import android.util.Log;
import android.view.View;
import android.view.ViewConfiguration;
import android.view.accessibility.AccessibilityEvent;
import android.view.accessibility.AccessibilityNodeInfo;
import android.widget.AbsListView;
import android.widget.AbsListView.OnScrollListener;
import android.widget.ListView;

import com.wdullaer.materialdatetimepicker.Utils;
import com.wdullaer.materialdatetimepicker.date.DatePickerDialog.OnDateChangedListener;

import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Locale;

/**
 * This displays a list of months in a calendar format with selectable days.
 */
public abstract class DayPickerView extends ListView implements OnScrollListener,
    OnDateChangedListener {

    private static final String TAG = "MonthFragment";

    // Affects when the month selection will change while scrolling up
    protected static final int SCROLL_HYST_WEEKS = 2;
    // How long the GoTo fling animation should last
    protected static final int GOTO_SCROLL_DURATION = 250;
    // How long to wait after receiving an onScrollStateChanged notification
    // before acting on it
    protected static final int SCROLL_CHANGE_DELAY = 40;
    // The number of days to display in each week
    public static final int DAYS_PER_WEEK = 7;
    public static int LIST_TOP_OFFSET = -1; // so that the top line will be
                                            // under the separator
    // You can override these numbers to get a different appearance
    protected int mNumWeeks = 6;
    protected boolean mShowWeekNumber = false;
    protected int mDaysPerWeek = 7;
    private static SimpleDateFormat YEAR_FORMAT = new SimpleDateFormat("yyyy", Locale.getDefault());

    // These affect the scroll speed and feel
    protected float mFriction = 1.0f;

    protected Context mContext;
    protected Handler mHandler;

    // highlighted time
    protected MonthAdapter.CalendarDay mSelectedDay = new MonthAdapter.CalendarDay();
    protected MonthAdapter mAdapter;

    protected MonthAdapter.CalendarDay mTempDay = new MonthAdapter.CalendarDay();

    // When the week starts; numbered like Time.<WEEKDAY> (e.g. SUNDAY=0).
    protected int mFirstDayOfWeek;
    // The last name announced by accessibility
    protected CharSequence mPrevMonthName;
    // which month should be displayed/highlighted [0-11]
    protected int mCurrentMonthDisplayed;
    // used for tracking during a scroll
    protected long mPreviousScrollPosition;
    // used for tracking what state listview is in
    protected int mPreviousScrollState = OnScrollListener.SCROLL_STATE_IDLE;
    // used for tracking what state listview is in
    protected int mCurrentScrollState = OnScrollListener.SCROLL_STATE_IDLE;

    private DatePickerController mController;
    private boolean mPerformingScroll;

    public DayPickerView(Context context, AttributeSet attrs) {
        super(context, attrs);
        init(context);
    }

    public DayPickerView(Context context, DatePickerController controller) {
        super(context);
        init(context);
        setController(controller);
    }

    public void setController(DatePickerController controller) {
        mController = controller;
        mController.registerOnDateChangedListener(this);
        refreshAdapter();
        onDateChanged();
    }

    public void init(Context context) {
        mHandler = new Handler();
        setLayoutParams(new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT));
        setDrawSelectorOnTop(false);

        mContext = context;
        setUpListView();
    }

    public void onChange() {
        refreshAdapter();
    }

    /**
     * Creates a new adapter if necessary and sets up its parameters. Override
     * this method to provide a custom adapter.
     */
    protected void refreshAdapter() {
        if (mAdapter == null) {
            mAdapter = createMonthAdapter(getContext(), mController);
        } else {
            mAdapter.setSelectedDay(mSelectedDay);
        }
        // refresh the view with the new parameters
        setAdapter(mAdapter);
    }

    public abstract MonthAdapter createMonthAdapter(Context context,
            DatePickerController controller);

    /*
     * Sets all the required fields for the list view. Override this method to
     * set a different list view behavior.
     */
    protected void setUpListView() {
        // Transparent background on scroll
        setCacheColorHint(0);
        // No dividers
        setDivider(null);
        // Items are clickable
        setItemsCanFocus(true);
        // The thumb gets in the way, so disable it
        setFastScrollEnabled(false);
        setVerticalScrollBarEnabled(false);
        setOnScrollListener(this);
        setFadingEdgeLength(0);
        // Make the scrolling behavior nicer
        setFriction(ViewConfiguration.getScrollFriction() * mFriction);
    }

    /**
     * This moves to the specified time in the view. If the time is not already
     * in range it will move the list so that the first of the month containing
     * the time is at the top of the view. If the new time is already in view
     * the list will not be scrolled unless forceScroll is true. This time may
     * optionally be highlighted as selected as well.
     *
     * @param day The day to move to
     * @param animate Whether to scroll to the given time or just redraw at the
     *            new location
     * @param setSelected Whether to set the given time as selected
     * @param forceScroll Whether to recenter even if the time is already
     *            visible
     * @return Whether or not the view animated to the new location
     */
    public boolean goTo(MonthAdapter.CalendarDay day, boolean animate, boolean setSelected, boolean forceScroll) {

        // Set the selected day
        if (setSelected) {
            mSelectedDay.set(day);
        }

        mTempDay.set(day);
        int minMonth = mController.getStartDate().get(Calendar.MONTH);
        final int position = (day.year - mController.getMinYear())
                * MonthAdapter.MONTHS_IN_YEAR + day.month - minMonth;

        View child;
        int i = 0;
        int top = 0;
        // Find a child that's completely in the view
        do {
            child = getChildAt(i++);
            if (child == null) {
                break;
            }
            top = child.getTop();
            if (Log.isLoggable(TAG, Log.DEBUG)) {
                Log.d(TAG, "child at " + (i - 1) + " has top " + top);
            }
        } while (top < 0);

        // Compute the first and last position visible
        int selectedPosition;
        if (child != null) {
            selectedPosition = getPositionForView(child);
        } else {
            selectedPosition = 0;
        }

        if (setSelected) {
            mAdapter.setSelectedDay(mSelectedDay);
        }

        if (Log.isLoggable(TAG, Log.DEBUG)) {
            Log.d(TAG, "GoTo position " + position);
        }
        // Check if the selected day is now outside of our visible range
        // and if so scroll to the month that contains it
        if (position != selectedPosition || forceScroll) {
            setMonthDisplayed(mTempDay);
            mPreviousScrollState = OnScrollListener.SCROLL_STATE_FLING;
            if (animate) {
                smoothScrollToPositionFromTop(
                        position, LIST_TOP_OFFSET, GOTO_SCROLL_DURATION);
                return true;
            } else {
                postSetSelection(position);
            }
        } else if (setSelected) {
            setMonthDisplayed(mSelectedDay);
        }
        return false;
    }

    public void postSetSelection(final int position) {
        clearFocus();
        post(new Runnable() {

            @Override
            public void run() {
                setSelection(position);
            }
        });
        onScrollStateChanged(this, OnScrollListener.SCROLL_STATE_IDLE);
    }

    /**
     * Updates the title and selected month if the view has moved to a new
     * month.
     */
    @Override
    public void onScroll(
            AbsListView view, int firstVisibleItem, int visibleItemCount, int totalItemCount) {
        MonthView child = (MonthView) view.getChildAt(0);
        if (child == null) {
            return;
        }

        // Figure out where we are
        long currScroll = view.getFirstVisiblePosition() * child.getHeight() - child.getBottom();
        mPreviousScrollPosition = currScroll;
        mPreviousScrollState = mCurrentScrollState;
    }

    /**
     * Sets the month displayed at the top of this view based on time. Override
     * to add custom events when the title is changed.
     */
    protected void setMonthDisplayed(MonthAdapter.CalendarDay date) {
        mCurrentMonthDisplayed = date.month;
        invalidateViews();
    }

    @Override
    public void onScrollStateChanged(AbsListView view, int scrollState) {
        // use a post to prevent re-entering onScrollStateChanged before it
        // exits
        mScrollStateChangedRunnable.doScrollStateChange(view, scrollState);
    }

    protected ScrollStateRunnable mScrollStateChangedRunnable = new ScrollStateRunnable();

    protected class ScrollStateRunnable implements Runnable {
        private int mNewState;

        /**
         * Sets up the runnable with a short delay in case the scroll state
         * immediately changes again.
         *
         * @param view The list view that changed state
         * @param scrollState The new state it changed to
         */
        public void doScrollStateChange(AbsListView view, int scrollState) {
            mHandler.removeCallbacks(this);
            mNewState = scrollState;
            mHandler.postDelayed(this, SCROLL_CHANGE_DELAY);
        }

        @Override
        public void run() {
            mCurrentScrollState = mNewState;
            if (Log.isLoggable(TAG, Log.DEBUG)) {
                Log.d(TAG,
                        "new scroll state: " + mNewState + " old state: " + mPreviousScrollState);
            }
            // Fix the position after a scroll or a fling ends
            if (mNewState == OnScrollListener.SCROLL_STATE_IDLE
                    && mPreviousScrollState != OnScrollListener.SCROLL_STATE_IDLE
                    && mPreviousScrollState != OnScrollListener.SCROLL_STATE_TOUCH_SCROLL) {
                mPreviousScrollState = mNewState;
                int i = 0;
                View child = getChildAt(i);
                while (child != null && child.getBottom() <= 0) {
                    child = getChildAt(++i);
                }
                if (child == null) {
                    // The view is no longer visible, just return
                    return;
                }
                int firstPosition = getFirstVisiblePosition();
                int lastPosition = getLastVisiblePosition();
                boolean scroll = firstPosition != 0 && lastPosition != getCount() - 1;
                final int top = child.getTop();
                final int bottom = child.getBottom();
                final int midpoint = getHeight() / 2;
                if (scroll && top < LIST_TOP_OFFSET) {
                    if (bottom > midpoint) {
                        smoothScrollBy(top, GOTO_SCROLL_DURATION);
                    } else {
                        smoothScrollBy(bottom, GOTO_SCROLL_DURATION);
                    }
                }
            } else {
                mPreviousScrollState = mNewState;
            }
        }
    }

    /**
     * Gets the position of the view that is most prominently displayed within the list view.
     */
    public int getMostVisiblePosition() {
        final int firstPosition = getFirstVisiblePosition();
        final int height = getHeight();

        int maxDisplayedHeight = 0;
        int mostVisibleIndex = 0;
        int i=0;
        int bottom = 0;
        while (bottom < height) {
            View child = getChildAt(i);
            if (child == null) {
                break;
            }
            bottom = child.getBottom();
            int displayedHeight = Math.min(bottom, height) - Math.max(0, child.getTop());
            if (displayedHeight > maxDisplayedHeight) {
                mostVisibleIndex = i;
                maxDisplayedHeight = displayedHeight;
            }
            i++;
        }
        return firstPosition + mostVisibleIndex;
    }

    @Override
    public void onDateChanged() {
        goTo(mController.getSelectedDay(), false, true, true);
    }

    /**
     * Attempts to return the date that has accessibility focus.
     *
     * @return The date that has accessibility focus, or {@code null} if no date
     *         has focus.
     */
    private MonthAdapter.CalendarDay findAccessibilityFocus() {
        final int childCount = getChildCount();
        for (int i = 0; i < childCount; i++) {
            final View child = getChildAt(i);
            if (child instanceof MonthView) {
                final MonthAdapter.CalendarDay focus = ((MonthView) child).getAccessibilityFocus();
                if (focus != null) {
                    if (Build.VERSION.SDK_INT == Build.VERSION_CODES.JELLY_BEAN_MR1) {
                        // Clear focus to avoid ListView bug in Jelly Bean MR1.
                        ((MonthView) child).clearAccessibilityFocus();
                    }
                    return focus;
                }
            }
        }

        return null;
    }

    /**
     * Attempts to restore accessibility focus to a given date. No-op if
     * {@code day} is {@code null}.
     *
     * @param day The date that should receive accessibility focus
     * @return {@code true} if focus was restored
     */
    private boolean restoreAccessibilityFocus(MonthAdapter.CalendarDay day) {
        if (day == null) {
            return false;
        }

        final int childCount = getChildCount();
        for (int i = 0; i < childCount; i++) {
            final View child = getChildAt(i);
            if (child instanceof MonthView) {
                if (((MonthView) child).restoreAccessibilityFocus(day)) {
                    return true;
                }
            }
        }

        return false;
    }

    @Override
    protected void layoutChildren() {
        final MonthAdapter.CalendarDay focusedDay = findAccessibilityFocus();
        super.layoutChildren();
        if (mPerformingScroll) {
            mPerformingScroll = false;
        } else {
            restoreAccessibilityFocus(focusedDay);
        }
    }

    @Override
    public void onInitializeAccessibilityEvent(@NonNull AccessibilityEvent event) {
        super.onInitializeAccessibilityEvent(event);
        event.setItemCount(-1);
   }

    private static String getMonthAndYearString(MonthAdapter.CalendarDay day) {
        Calendar cal = Calendar.getInstance();
        cal.set(day.year, day.month, day.day);

        String sbuf = "";
        sbuf += cal.getDisplayName(Calendar.MONTH, Calendar.LONG, Locale.getDefault());
        sbuf += " ";
        sbuf += YEAR_FORMAT.format(cal.getTime());
        return sbuf;
    }

    /**
     * Necessary for accessibility, to ensure we support "scrolling" forward and backward
     * in the month list.
     */
    @Override
    @SuppressWarnings("deprecation")
    public void onInitializeAccessibilityNodeInfo(@NonNull AccessibilityNodeInfo info) {
        super.onInitializeAccessibilityNodeInfo(info);
        if(Build.VERSION.SDK_INT >= 21) {
            info.addAction(AccessibilityNodeInfo.AccessibilityAction.ACTION_SCROLL_BACKWARD);
            info.addAction(AccessibilityNodeInfo.AccessibilityAction.ACTION_SCROLL_FORWARD);
        }
        else {
            info.addAction(AccessibilityNodeInfo.ACTION_SCROLL_FORWARD);
            info.addAction(AccessibilityNodeInfo.ACTION_SCROLL_BACKWARD);
        }
    }

    /**
     * When scroll forward/backward events are received, announce the newly scrolled-to month.
     */
    @SuppressLint("NewApi")
    @Override
    public boolean performAccessibilityAction(int action, Bundle arguments) {
        if (action != AccessibilityNodeInfo.ACTION_SCROLL_FORWARD &&
                action != AccessibilityNodeInfo.ACTION_SCROLL_BACKWARD) {
            return super.performAccessibilityAction(action, arguments);
        }

        // Figure out what month is showing.
        int firstVisiblePosition = getFirstVisiblePosition();
        int minMonth = mController.getStartDate().get(Calendar.MONTH);
        int month = (firstVisiblePosition + minMonth) % MonthAdapter.MONTHS_IN_YEAR;
        int year = (firstVisiblePosition + minMonth) / MonthAdapter.MONTHS_IN_YEAR + mController.getMinYear();
        MonthAdapter.CalendarDay day = new MonthAdapter.CalendarDay(year, month, 1);

        // Scroll either forward or backward one month.
        if (action == AccessibilityNodeInfo.ACTION_SCROLL_FORWARD) {
            day.month++;
            if (day.month == 12) {
                day.month = 0;
                day.year++;
            }
        } else if (action == AccessibilityNodeInfo.ACTION_SCROLL_BACKWARD) {
            View firstVisibleView = getChildAt(0);
            // If the view is fully visible, jump one month back. Otherwise, we'll just jump
            // to the first day of first visible month.
            if (firstVisibleView != null && firstVisibleView.getTop() >= -1) {
                // There's an off-by-one somewhere, so the top of the first visible item will
                // actually be -1 when it's at the exact top.
                day.month--;
                if (day.month == -1) {
                    day.month = 11;
                    day.year--;
                }
            }
        }

        // Go to that month.
        Utils.tryAccessibilityAnnounce(this, getMonthAndYearString(day));
        goTo(day, true, false, true);
        mPerformingScroll = true;
        return true;
    }
}


text:
<!DOCTYPE html>

<meta charset="utf-8"/>
<title>Unicorn Library: Regular Expressions</title>
<link type="text/css" rel="stylesheet" href="style.css"/>

Unicorn Library: Regular Expressions

Unicode library for C++ by Ross Smith

#include "unicorn/regex.hpp"

Contents

Unicorn Library: Regular Expressions

Contents

Introduction

Unicorn::Regex vs std::regex

Regex class

Regex flags

Member types

Member functions

Exceptions

Regex match class

Regex transform class

Introduction

This module provides Unicode-aware regular expressions, and related classes
and functions. It calls the widely available PCRE2
(Perl Compatible Regular Expressions) library. The Regex class uses the
8-bit version of the PCRE library, which must have been built with the
optional UTF-8 support enabled (PCRE2 can also be built as 16 and 32-bit
libraries, but these are not used here).

Refer to the PCRE2 documentation for details of the regular expression syntax.

The Regex class supports both UTF-8 and byte oriented matching. Byte regexes
(selected with the Regex::byte flag) simply treat a string as a sequence of
arbitrary bytes, with no assumptions about content encoding, and will work
with non-Unicode strings. The \xHH escape code (where H is a hexadecimal
digit) always matches a single byte even if the value is greater than \x7f
(in a UTF-8 regex this would match a multibyte encoded character); the
\x{hex} escape code can still be used, but it will be treated as a syntax
error if the value is greater than \x{ff}.

Unicorn::Regex vs std::regex

It would have been convenient to use standard C++11 regular expressions here,
in the same way as the standard string classes have been used instead of
creating a new custom string class. Unfortunately, this turns out to be
impractical; for several reasons, standard regular expressions are inadequate
for use with Unicode strings.

The most obvious reason is that standard C++ regexes are not actually required
to support Unicode strings at all. Unlike std::basic_string, for which
specializations for 8, 16, and 32 bit characters are required to exist, only
two specializations of std::basic_regex are mandated, for char (the
system's native multibyte encoding, which may or may not be UTF-8, but see
below for a caveat on this) and wchar_t (the system's wide character
encoding, which can reasonably be expected to be either UTF-16 or UTF-32, but
which one varies with the OS). In short, standard regexes can only be relied
on to support one of the three UTF encodings, and we don't know which one.

Strictly speaking, not even that is required; the C++ standard does not
actually require the wide character encoding to be UTF-16 or 32. It is on all
systems I know of, though, and my code explicitly does not support systems on
which it is not one of those.

An implementation is allowed to instantiate std::basic_regex for other
character types, but in practise most do not, and in any case even an
implementation that supplied specializations for all four character types
would still not be reliably usable with UTF-8 (since the 8-bit encoding is not
guaranteed to be UTF-8).

The second problem with standard regexes is that, by the rules of the C++
standard, they cannot properly support UTF-8 strings. The regex grammar
(based on that of JavaScript/EcmaScript, with a few changes) matches on an
element by element basis; a "character", as far as regex matching is
concerned, is a single code unit, not a Unicode scalar value that may be
represented by more than one code unit. This still allows literal matching of
multi-unit UTF-8 characters (the encoding will be the same in the regex and
the subject string, so they will match unit for unit), but makes it impossible
to match multi-unit characters to non-literal regex elements; for example,
even if the system encoding is UTF-8, std::regex(".") will still not match
"€" (which is three bytes long). For the same reason, it is impossible to
specify a character range that includes multibyte characters; for example,
std::regex("[à-ÿ]") will not do what you probably expected, regardless of
encoding.

Finally, standard regexes don't support the \p{...} and \P{...} character
classes, which match on Unicode properties. This may be a minor obstacle
compared to either of the above showstoppers, but even by itself it would be a
serious handicap in a library dedicated to Unicode support.

For all of the above reasons, I felt I had no choice but to abandon standard
C++ regexes, and base my regular expressions on PCRE2 instead.

Regex class

Regex flags

Flag
Description

Pattern compilation flags

Regex::ascii
Character classes match only ASCII

Regex::byte
Treat the pattern and subject string as bytes instead of UTF-8

Regex::crlf
Lines end with CR+LF instead of just LF

Regex::dollar_end
$ does not match line breaks at the end of the subject string

Regex::dot_all
. matches all characters including line breaks

Regex::extended
Free-form layout, ignore whitespace and comments starting with #

Regex::first_line
The match must start in the first line of the subject string

Regex::icase
Matching is case insensitive

Regex::line
Only match a complete line

Regex::multiline
^ and $ match the beginning and end of every line

Regex::no_capture
Parenthesized groups are not captured (named captures still work)

Regex::optimize
Optimize the regex using PCRE's JIT compiler

Regex::word
Only match a complete word

Pattern matching flags

Regex::anchor
Anchor the match at the start of the subject string

Regex::full
Match the complete subject string

Regex::not_empty
Do not match an empty string

Regex::not_empty_start
Do not match an empty string at the start of the subject string

Regex::not_line
Do not match ^ or $ at the start or end of the subject string

Regex::partial_hard
Enable hard partial matching (prefer partial match to full match)

Regex::partial_soft
Enable soft partial matching (prefer full match to partial match)

Other flags

Regex::global
Replace all matches instead of only the first

Regex::no_utf_check
Assume the pattern or subject string is valid UTF-8

These are bitmasks of the Regex::flag_type type. Wherever a regex function
takes a flags argument, the value is expected to be a bitwise-or combination
of these.

The pattern compilation flags must be supplied when the Regex object is
constructed, while the pattern matching flags can be supplied later, in a call
to a matching or substitution function. However, any flag can be supplied at
construction time; matching flags will be saved and applied at match time.
Flags supplied at construction time cannot be overridden at match time.

Notes on specific flags:

The ascii flag causes backslash character classes (\[BbDdRSsWw]), and
some Posix character classes, to match only ASCII characters instead of
matching Unicode properties. This has no effect when combined with the byte
flag, since only ASCII characters are matched in byte mode anyway.

The optimize flag will enable PCRE2's JIT compiler if possible, but this
can be silently blocked under some circumstances (see the PCRE2 documentation
for details). In particular, specifying any of the partial matching flags at
match time will disable the optimizer if the same flag was not present at
compile time.

The global flag causes all matches to be replaced in Regex::replace()
and Regex::transform::operator(). It has no effect in any other context.

The no_utf_check flag has a slightly different effect depending on where
it is used: it skips the normal UTF-8 validity check for the pattern string
when used at compile time, for the subject string at match time, and for the
subject and replacement strings at replacement time. In all cases, behaviour
is undefined if the string is not valid UTF-8. This flag has no effect in byte
mode.

Member types

class Regex::error

class Regex::match

class Regex::transform

These are individually described below.

using Regex::flag_type = [unsigned integer type]

The type used for bitmask flags.

class Regex::match_iterator

Const forward iterator

Value type is Regex::match

using Regex::match_range = Irange<match_iterator>

An iterator over the non-overlapping matches found within a subject string for
a given regex, returned by Regex::grep().

class Regex::split_iterator

Const forward iterator

Value type is std::string_view

using Regex::split_range = Irange<split_iterator>

An iterator over the substrings between matches for a given regex, returned by
Regex::split().

struct Regex::partition_type

std::string_view partition_type::left

std::string_view partition_type::mid

std::string_view partition_type::right

The result type returned from Regex::partition().

Member functions

Regex::Regex()

explicit Regex::Regex(std::string_view pattern, flag_type flags = 0)

Regex::Regex(const Regex& r)

Regex::Regex(Regex&& r) noexcept

Regex::~Regex() noexcept

Regex& Regex::operator=(const Regex& r)

Regex& Regex::operator=(Regex&& r) noexcept

Life cycle operations. The default constructor creates a null regex that will
never match anything. The second constructor takes the pattern string and
optionally a flags bitmask, and will throw Regex::error if the pattern is
invalid or an invalid combination of flags is passed.

std::string Regex::pattern() const

Regex::flag_type Regex::flags() const noexcept

std::string to_str(const Regex& re)

std::ostream& operator<<(std::ostream& out, const Regex& re)

Return the pattern string or flags supplied to the constructor. The to_str()
function and the output operator return the same string as pattern(). If the
Regex object was default constructed, pattern() is empty and flags() is
zero, but this is not equivalent to a regex constructed from an empty string.

bool Regex::empty() const noexcept

bool Regex::is_null() const noexcept

The is_null() function is true if the regex was default constructed;
empty() is true if is_null() is true or the pattern is an empty string.

size_t Regex::groups() const noexcept

Returns the number of capture groups in the pattern, including the complete
match ($0).

size_t Regex::named(std::string_view name) const

Returns the capture group number corresponding to the given group name, or
npos if the name was not present.

Regex::match Regex::search(std::string_view str, size_t pos = 0, flag_type flags = 0) const

Regex::match Regex::search(const Utf8Iterator& start, flag_type flags = 0) const

Regex::match Regex::operator()(std::string_view str, size_t pos = 0, flag_type flags = 0) const

Regex::match Regex::operator()(const Utf8Iterator& start, flag_type flags = 0) const

This is the basic regex matching function (the operator is a synonym for the
search() function). When a non-zero offset is passed, or an iterator that
does not point to the beginning of the string, the search begins at the
specified point in the string, but the text preceding it will still be taken
into account in lookbehind assertions. Matching will always fail if the
starting position is beyond the end of the subject string (but may succeed if
it is at the end and the pattern can match an empty substring). This will
throw Regex::error if the flags are inconsistent, if the starting offset is
not at a character boundary in a UTF-8 string (in the absence of either the
byte or no_utf_check flags), if the UTF iterator version is called on a
byte-mode regex, or if a very complicated matching task exceeds PCRE2's
internal limits.

size_t Regex::count(std::string_view str, size_t pos = 0, flag_type flags = 0) const

size_t Regex::count(const Utf8Iterator& start, flag_type flags = 0) const

Returns the number of non-overlapping matches in the subject string.

Regex::match_range Regex::grep(std::string_view str, size_t pos = 0, flag_type flags = 0) const

Regex::match_range Regex::grep(const Utf8Iterator& start, flag_type flags = 0) const

Returns a pair of iterators over all matches in the subject string, optionally
starting at a given byte offset. It can throw the same exceptions as
search().

Regex::partition_type Regex::partition(std::string_view str, size_t pos = 0, flag_type flags = 0) const

Finds the first match in the string, and returns three string views covering
the part of the subject string before the match (including anything before the
starting offset), the match itself, and the part after the match. If there is
no match, the first field in the return value will be the full subject string,
and the other two will be empty (but will point to the end of the string
instead of being null). This can throw the same exceptions as search().

std::string Regex::replace(std::string_view str, std::string_view fmt, size_t pos = 0, flag_type flags = 0) const

void Regex::replace_in(std::string& str, std::string_view fmt, size_t pos = 0, flag_type flags = 0) const

Replace the first match (if any) with the given format string, following
PCRE2's full set of replacement rules. The replace() function returns the
modified string, while replace_in() modifies the string in place. If the
global flag is used, this will replace all matches instead of only the
first. This can throw the same exceptions as search().

Regex::split_range Regex::split(std::string_view str, size_t pos = 0, flag_type flags = 0) const

Returns a pair of iterators over the parts of the string between matches. This
can throw the same exceptions as search().

static Version Regex::compile_version() noexcept - PCRE2 version used when this library was compiled

static Version Regex::runtime_version() noexcept - Current PCRE2 version available at runtime

static Version Regex::unicode_version() noexcept - Latest Unicode version supported by PCRE2

Version number queries. Because the PCRE2 library is built separately, the
Unicode version reported here will not necessarily be the same as the version
supported by the rest of my library.

static std::string Regex::escape(std::string_view str)

Inserts escape characters (backslashes) where necessary to return a pattern
that will match the argument string literally.

Exceptions

class Regex::error: public std::runtime_error

explicit error::error(int code)

int error::code() const noexcept

static std::string error::translate(int code)

This is thrown from a regex constructor or matching function when the
underlying PCRE2 call reports an error. The translate() function converts a
PCRE2 error code to a string.

Regex match class

class Regex::match

The regex matching functions return a Regex::match object to report the
result of a matching attempt.

match::match() noexcept

match::match(const match& m) noexcept

match::match(match&& m) noexcept

match::~match() noexcept

match& match::operator=(const match& m) noexcept

match& match::operator=(match&& m) noexcept

Life cycle operations. The default constructor returns the equivalent of a
failed match. Normally a match object will not be constructed explicitly by
users (apart from default construction), but returned from matching functions
in the Regex class.

bool match::matched(size_t i = 0) const noexcept

bool match::full() const noexcept

bool match::partial() const noexcept

explicit match::operator bool() const noexcept

These report whether the match was successful. If a non-zero index is
supplied, the result indicates whether a specific capture group was matched.
The full() and partial() functions can be used to distinguish between full
and partial matches; matched() is equivalent to full() || partial(). If
neither of the partial matching flags was used, partial() is always false
and matched() is equivalent to full().

const char* match::begin(size_t i = 0) const noexcept

const char* match::end(size_t i = 0) const noexcept

size_t match::offset(size_t i = 0) const noexcept

size_t match::endpos(size_t i = 0) const noexcept

size_t match::count(size_t i = 0) const noexcept

These report the position of the match, or of a numbered capture group, in the
subject string. The offset() and endpos() functions return the start and
end positions; count() returns the length of the match (offsets are measured
in code units, not characters, from the start of the subject string, not the
position from which matching was started). If the match failed, or if a
specific capture group was not matched, begin() and end() return null
pointers, offset() and endpos() return npos, and count() returns zero.

size_t match::first() const noexcept

size_t match::last() const noexcept

These return the indices of the first and last non-empty capture group (not
counting the complete match), or npos if the match failed or there are no
non-empty captures.

std::string_view match::mark() const noexcept

Returns the name of the most recent named (*COMMIT), (*MARK), (*PRUNE),
or (*THEN) tag in the pattern, or an empty string if no suitable tag was
found.

std::string_view match::str(size_t i = 0) const noexcept

std::string_view match::operator[](size_t i) const noexcept

match::operator std::string_view() const noexcept

These return the matching substring, for the complete match or a specific
capture group. All of these will return an empty string view if the match
failed, or the capture group was not matched (note that an empty string can
also be the legitimate result of a successful match).

bool match::matched(std::string_view name) const

const char* match::begin(std::string_view name) const

const char* match::end(std::string_view name) const

size_t match::offset(std::string_view name) const

size_t match::endpos(std::string_view name) const

size_t match::count(std::string_view name) const

std::string_view match::str(std::string_view name) const

std::string_view match::operator[](std::string_view name) const

These return the same result as the functions that take a numeric index
argument, except that the capture group is identified by name instead of
number. If the named group does not exist in the pattern, the result is the
same as if the match failed.

Regex transform class

class Regex::transform

The Regex::transform class contains both a regex and a format string. It
provides operations equivalent to the Regex::replace[_in]() functions, but
may be more efficient if the same formatting operation is going to be applied
many times.

transform::transform() noexcept

transform::transform(const Regex& pattern, std::string_view fmt, flag_type flags = 0)

transform::transform(std::string_view pattern, std::string_view fmt, flag_type flags = 0)

transform::transform(const transform& t)

transform::transform(transform&& t) noexcept

transform::~transform() noexcept

transform& transform::operator=(const transform& t)

transform& transform::operator=(transform&& t) noexcept

Life cycle functions. The object is constructed from a regex (supplied either
as a precompiled regex or a pattern string), a format string, and optionally a
flag bitmask. In the second constructor, only matching and replacement flags
can be supplied; the third constructor can also take regex compilation flags,
and can throw the same exceptions as the corresponding regex constructor.

std::string transform::pattern() const

std::string transform::format() const

Regex::flag_type transform::flags() const noexcept

These return the construction parameters.

std::string transform::replace(std::string_view str, size_t pos = 0, flag_type flags = 0) const

void transform::replace_in(std::string& str, size_t pos = 0, flag_type flags = 0) const

std::string transform::operator()(std::string_view str, size_t pos = 0, flag_type flags = 0) const

The replacement functions, which perform the equivalent of
Regex::replace[_in](). The function call operator is equivalent to
replace().


text:
package net.twasi.core.application;

/**
 * Static class that holds and manages the state of the application.
 */
public class AppState {

    /**
     * Current state of the application
     */
    private ApplicationState state = ApplicationState.STARTING;

    /**
     * Checks if the application is starting. If this is the case, no changes or operations should be accepted.
     *
     * @return if the application is starting up
     */
    public boolean isStarting() {
        return state == ApplicationState.STARTING;
    }

    /**
     * Checks if the application is operating and ready for further operations
     *
     * @return if the application is ready for operations
     */
    public boolean isOperating() {
        return state == ApplicationState.OPERATING;
    }

    /**
     * Checks if the application is shutting down. If this is the case, no changes or new operatinons should be accepted.
     *
     * @return if the application is closing
     */
    public boolean isClosing() {
        return state == ApplicationState.CLOSING;
    }

    /**
     * Sets the application state
     */
    public void setState(ApplicationState state) {
        this.state = state;
    }

}


text:
package test

import (
	"context"
	"fmt"
	"os"
	"testing"
	"time"

	"github.com/kevinburke/rickover/models/db"
	"github.com/kevinburke/rickover/setup"
)

func SetUp(t testing.TB) {
	t.Helper()
	if os.Getenv("DATABASE_URL") == "" {
		os.Setenv("DATABASE_URL", "postgres://rickover@localhost:5432/rickover_test?sslmode=disable&timezone=UTC")
	}
	ctx, cancel := context.WithTimeout(context.Background(), 1*time.Second)
	defer cancel()
	if err := setup.DB(ctx, db.DefaultConnection, 10); err != nil {
		t.Fatal(err)
	}
}

// TruncateTables deletes all records from the database.
func TruncateTables(t testing.TB) error {
	getTableDelete := func(table string) string {
		return "DELETE FROM " + table
	}
	var name string
	if t == nil {
		name = "TruncateTables"
	} else {
		name = t.Name()
	}
	_, err := db.Conn.Exec(fmt.Sprintf("-- %s\n%s;\n%s;\n%s",
		name,
		getTableDelete("archived_jobs"),
		getTableDelete("queued_jobs"),
		getTableDelete("jobs"),
	))
	return err
}

// TearDown deletes all records from the database, and marks the test as failed
// if this was unsuccessful.
func TearDown(t testing.TB) {
	t.Helper()
	if db.Connected() {
		if err := TruncateTables(t); err != nil {
			t.Fatalf("%s: could not truncate tables, got %v", t.Name(), err)
		}
	}
}


text:
#pragma once
#include <aws/storagegateway/StorageGateway_EXPORTS.h>
#include <aws/storagegateway/StorageGatewayRequest.h>
#include <aws/core/utils/memory/stl/AWSString.h>
#include <utility>

namespace Aws
{
namespace StorageGateway
{
namespace Model
{

  /**
   *
CreateTapesInput

See Also:
   AWS
   * API Reference

   */
  class AWS_STORAGEGATEWAY_API CreateTapesRequest : public StorageGatewayRequest
  {
  public:
    CreateTapesRequest();

    // Service request name is the Operation name which will send this request out,
    // each operation should has unique request name, so that we can get operation's name from this request.
    // Note: this is not true for response, multiple operations may have the same response name,
    // so we can not get operation's name from response.
    inline virtual const char* GetServiceRequestName() const override { return "CreateTapes"; }

    Aws::String SerializePayload() const override;

    Aws::Http::HeaderValueCollection GetRequestSpecificHeaders() const override;

    /**
     *
The unique Amazon Resource Name (ARN) that represents the gateway to
     * associate the virtual tapes with. Use the ListGateways operation to
     * return a list of gateways for your account and region.

     */
    inline const Aws::String& GetGatewayARN() const{ return m_gatewayARN; }

    /**
     *
The unique Amazon Resource Name (ARN) that represents the gateway to
     * associate the virtual tapes with. Use the ListGateways operation to
     * return a list of gateways for your account and region.

     */
    inline void SetGatewayARN(const Aws::String& value) { m_gatewayARNHasBeenSet = true; m_gatewayARN = value; }

    /**
     *
The unique Amazon Resource Name (ARN) that represents the gateway to
     * associate the virtual tapes with. Use the ListGateways operation to
     * return a list of gateways for your account and region.

     */
    inline void SetGatewayARN(Aws::String&& value) { m_gatewayARNHasBeenSet = true; m_gatewayARN = std::move(value); }

    /**
     *
The unique Amazon Resource Name (ARN) that represents the gateway to
     * associate the virtual tapes with. Use the ListGateways operation to
     * return a list of gateways for your account and region.

     */
    inline void SetGatewayARN(const char* value) { m_gatewayARNHasBeenSet = true; m_gatewayARN.assign(value); }

    /**
     *
The unique Amazon Resource Name (ARN) that represents the gateway to
     * associate the virtual tapes with. Use the ListGateways operation to
     * return a list of gateways for your account and region.

     */
    inline CreateTapesRequest& WithGatewayARN(const Aws::String& value) { SetGatewayARN(value); return *this;}

    /**
     *
The unique Amazon Resource Name (ARN) that represents the gateway to
     * associate the virtual tapes with. Use the ListGateways operation to
     * return a list of gateways for your account and region.

     */
    inline CreateTapesRequest& WithGatewayARN(Aws::String&& value) { SetGatewayARN(std::move(value)); return *this;}

    /**
     *
The unique Amazon Resource Name (ARN) that represents the gateway to
     * associate the virtual tapes with. Use the ListGateways operation to
     * return a list of gateways for your account and region.

     */
    inline CreateTapesRequest& WithGatewayARN(const char* value) { SetGatewayARN(value); return *this;}

    /**
     *
The size, in bytes, of the virtual tapes that you want to create.
 <note>
     *
The size must be aligned by gigabyte (1024*1024*1024 byte).
 </note>
     */
    inline long long GetTapeSizeInBytes() const{ return m_tapeSizeInBytes; }

    /**
     *
The size, in bytes, of the virtual tapes that you want to create.
 <note>
     *
The size must be aligned by gigabyte (1024*1024*1024 byte).
 </note>
     */
    inline void SetTapeSizeInBytes(long long value) { m_tapeSizeInBytesHasBeenSet = true; m_tapeSizeInBytes = value; }

    /**
     *
The size, in bytes, of the virtual tapes that you want to create.
 <note>
     *
The size must be aligned by gigabyte (1024*1024*1024 byte).
 </note>
     */
    inline CreateTapesRequest& WithTapeSizeInBytes(long long value) { SetTapeSizeInBytes(value); return *this;}

    /**
     *
A unique identifier that you use to retry a request. If you retry a request,
     * use the same ClientToken you specified in the initial request.

     * <note>
Using the same ClientToken prevents creating the tape
     * multiple times.
 </note>
     */
    inline const Aws::String& GetClientToken() const{ return m_clientToken; }

    /**
     *
A unique identifier that you use to retry a request. If you retry a request,
     * use the same ClientToken you specified in the initial request.

     * <note>
Using the same ClientToken prevents creating the tape
     * multiple times.
 </note>
     */
    inline void SetClientToken(const Aws::String& value) { m_clientTokenHasBeenSet = true; m_clientToken = value; }

    /**
     *
A unique identifier that you use to retry a request. If you retry a request,
     * use the same ClientToken you specified in the initial request.

     * <note>
Using the same ClientToken prevents creating the tape
     * multiple times.
 </note>
     */
    inline void SetClientToken(Aws::String&& value) { m_clientTokenHasBeenSet = true; m_clientToken = std::move(value); }

    /**
     *
A unique identifier that you use to retry a request. If you retry a request,
     * use the same ClientToken you specified in the initial request.

     * <note>
Using the same ClientToken prevents creating the tape
     * multiple times.
 </note>
     */
    inline void SetClientToken(const char* value) { m_clientTokenHasBeenSet = true; m_clientToken.assign(value); }

    /**
     *
A unique identifier that you use to retry a request. If you retry a request,
     * use the same ClientToken you specified in the initial request.

     * <note>
Using the same ClientToken prevents creating the tape
     * multiple times.
 </note>
     */
    inline CreateTapesRequest& WithClientToken(const Aws::String& value) { SetClientToken(value); return *this;}

    /**
     *
A unique identifier that you use to retry a request. If you retry a request,
     * use the same ClientToken you specified in the initial request.

     * <note>
Using the same ClientToken prevents creating the tape
     * multiple times.
 </note>
     */
    inline CreateTapesRequest& WithClientToken(Aws::String&& value) { SetClientToken(std::move(value)); return *this;}

    /**
     *
A unique identifier that you use to retry a request. If you retry a request,
     * use the same ClientToken you specified in the initial request.

     * <note>
Using the same ClientToken prevents creating the tape
     * multiple times.
 </note>
     */
    inline CreateTapesRequest& WithClientToken(const char* value) { SetClientToken(value); return *this;}

    /**
     *
The number of virtual tapes that you want to create.

     */
    inline int GetNumTapesToCreate() const{ return m_numTapesToCreate; }

    /**
     *
The number of virtual tapes that you want to create.

     */
    inline void SetNumTapesToCreate(int value) { m_numTapesToCreateHasBeenSet = true; m_numTapesToCreate = value; }

    /**
     *
The number of virtual tapes that you want to create.

     */
    inline CreateTapesRequest& WithNumTapesToCreate(int value) { SetNumTapesToCreate(value); return *this;}

    /**
     *
A prefix that you append to the barcode of the virtual tape you are creating.
     * This prefix makes the barcode unique.
 <note>
The prefix must be 1 to 4
     * characters in length and must be one of the uppercase letters from A to Z.

     * </note>
     */
    inline const Aws::String& GetTapeBarcodePrefix() const{ return m_tapeBarcodePrefix; }

    /**
     *
A prefix that you append to the barcode of the virtual tape you are creating.
     * This prefix makes the barcode unique.
 <note>
The prefix must be 1 to 4
     * characters in length and must be one of the uppercase letters from A to Z.

     * </note>
     */
    inline void SetTapeBarcodePrefix(const Aws::String& value) { m_tapeBarcodePrefixHasBeenSet = true; m_tapeBarcodePrefix = value; }

    /**
     *
A prefix that you append to the barcode of the virtual tape you are creating.
     * This prefix makes the barcode unique.
 <note>
The prefix must be 1 to 4
     * characters in length and must be one of the uppercase letters from A to Z.

     * </note>
     */
    inline void SetTapeBarcodePrefix(Aws::String&& value) { m_tapeBarcodePrefixHasBeenSet = true; m_tapeBarcodePrefix = std::move(value); }

    /**
     *
A prefix that you append to the barcode of the virtual tape you are creating.
     * This prefix makes the barcode unique.
 <note>
The prefix must be 1 to 4
     * characters in length and must be one of the uppercase letters from A to Z.

     * </note>
     */
    inline void SetTapeBarcodePrefix(const char* value) { m_tapeBarcodePrefixHasBeenSet = true; m_tapeBarcodePrefix.assign(value); }

    /**
     *
A prefix that you append to the barcode of the virtual tape you are creating.
     * This prefix makes the barcode unique.
 <note>
The prefix must be 1 to 4
     * characters in length and must be one of the uppercase letters from A to Z.

     * </note>
     */
    inline CreateTapesRequest& WithTapeBarcodePrefix(const Aws::String& value) { SetTapeBarcodePrefix(value); return *this;}

    /**
     *
A prefix that you append to the barcode of the virtual tape you are creating.
     * This prefix makes the barcode unique.
 <note>
The prefix must be 1 to 4
     * characters in length and must be one of the uppercase letters from A to Z.

     * </note>
     */
    inline CreateTapesRequest& WithTapeBarcodePrefix(Aws::String&& value) { SetTapeBarcodePrefix(std::move(value)); return *this;}

    /**
     *
A prefix that you append to the barcode of the virtual tape you are creating.
     * This prefix makes the barcode unique.
 <note>
The prefix must be 1 to 4
     * characters in length and must be one of the uppercase letters from A to Z.

     * </note>
     */
    inline CreateTapesRequest& WithTapeBarcodePrefix(const char* value) { SetTapeBarcodePrefix(value); return *this;}

    /**
     *
True to use Amazon S3 server side encryption with your own AWS KMS key, or
     * false to use a key managed by Amazon S3. Optional.

     */
    inline bool GetKMSEncrypted() const{ return m_kMSEncrypted; }

    /**
     *
True to use Amazon S3 server side encryption with your own AWS KMS key, or
     * false to use a key managed by Amazon S3. Optional.

     */
    inline void SetKMSEncrypted(bool value) { m_kMSEncryptedHasBeenSet = true; m_kMSEncrypted = value; }

    /**
     *
True to use Amazon S3 server side encryption with your own AWS KMS key, or
     * false to use a key managed by Amazon S3. Optional.

     */
    inline CreateTapesRequest& WithKMSEncrypted(bool value) { SetKMSEncrypted(value); return *this;}

    /**
     *
The Amazon Resource Name (ARN) of the AWS KMS key used for Amazon S3 server
     * side encryption. This value can only be set when KMSEncrypted is true.
     * Optional.

     */
    inline const Aws::String& GetKMSKey() const{ return m_kMSKey; }

    /**
     *
The Amazon Resource Name (ARN) of the AWS KMS key used for Amazon S3 server
     * side encryption. This value can only be set when KMSEncrypted is true.
     * Optional.

     */
    inline void SetKMSKey(const Aws::String& value) { m_kMSKeyHasBeenSet = true; m_kMSKey = value; }

    /**
     *
The Amazon Resource Name (ARN) of the AWS KMS key used for Amazon S3 server
     * side encryption. This value can only be set when KMSEncrypted is true.
     * Optional.

     */
    inline void SetKMSKey(Aws::String&& value) { m_kMSKeyHasBeenSet = true; m_kMSKey = std::move(value); }

    /**
     *
The Amazon Resource Name (ARN) of the AWS KMS key used for Amazon S3 server
     * side encryption. This value can only be set when KMSEncrypted is true.
     * Optional.

     */
    inline void SetKMSKey(const char* value) { m_kMSKeyHasBeenSet = true; m_kMSKey.assign(value); }

    /**
     *
The Amazon Resource Name (ARN) of the AWS KMS key used for Amazon S3 server
     * side encryption. This value can only be set when KMSEncrypted is true.
     * Optional.

     */
    inline CreateTapesRequest& WithKMSKey(const Aws::String& value) { SetKMSKey(value); return *this;}

    /**
     *
The Amazon Resource Name (ARN) of the AWS KMS key used for Amazon S3 server
     * side encryption. This value can only be set when KMSEncrypted is true.
     * Optional.

     */
    inline CreateTapesRequest& WithKMSKey(Aws::String&& value) { SetKMSKey(std::move(value)); return *this;}

    /**
     *
The Amazon Resource Name (ARN) of the AWS KMS key used for Amazon S3 server
     * side encryption. This value can only be set when KMSEncrypted is true.
     * Optional.

     */
    inline CreateTapesRequest& WithKMSKey(const char* value) { SetKMSKey(value); return *this;}

  private:

    Aws::String m_gatewayARN;
    bool m_gatewayARNHasBeenSet;

    long long m_tapeSizeInBytes;
    bool m_tapeSizeInBytesHasBeenSet;

    Aws::String m_clientToken;
    bool m_clientTokenHasBeenSet;

    int m_numTapesToCreate;
    bool m_numTapesToCreateHasBeenSet;

    Aws::String m_tapeBarcodePrefix;
    bool m_tapeBarcodePrefixHasBeenSet;

    bool m_kMSEncrypted;
    bool m_kMSEncryptedHasBeenSet;

    Aws::String m_kMSKey;
    bool m_kMSKeyHasBeenSet;
  };

} // namespace Model
} // namespace StorageGateway
} // namespace Aws


text:
package org.apache.reef.tang;

import org.apache.reef.tang.exceptions.BindException;
import org.apache.reef.tang.exceptions.InjectionException;
import org.apache.reef.tang.exceptions.NameResolutionException;
import org.apache.reef.tang.types.ClassNode;
import org.junit.Assert;

import java.io.File;
import java.net.MalformedURLException;

public class TestClassLoaders {

  //  @Test
  public void testOneJar() throws MalformedURLException,
      ClassNotFoundException, NameResolutionException, BindException {
    Tang.Factory
        .getTang()
        .newConfigurationBuilder(
            new File("../tang-test-jarA/target/tang-test-jarA-1.0-SNAPSHOT.jar")
                .toURI().toURL()).getClassHierarchy().getNode("org.apache.reef.tang.examples.A");

  }

  //  @Test
  public void testTwoJars() throws MalformedURLException,
      ClassNotFoundException, BindException, InjectionException, NameResolutionException {
    Tang t = Tang.Factory.getTang();

    JavaConfigurationBuilder cbA = t.newConfigurationBuilder(new File(
        "../tang-test-jarA/target/tang-test-jarA-1.0-SNAPSHOT.jar").toURI()
        .toURL());
    JavaConfigurationBuilder cbB = t.newConfigurationBuilder(new File(
        "../tang-test-jarB/target/tang-test-jarB-1.0-SNAPSHOT.jar").toURI()
        .toURL());
    cbA.addConfiguration(cbB.build());

    cbA.getClassHierarchy().getNode("org.apache.reef.tang.examples.A");
    cbA.getClassHierarchy().getNode("org.apache.reef.tang.examples.B");

    t.newInjector(cbA.build());
  }

  //  @Test
  public void testTwoClasses() throws MalformedURLException,
      ClassNotFoundException, BindException, InjectionException, NameResolutionException {
    Tang t = Tang.Factory.getTang();
    JavaConfigurationBuilder cbA = t.newConfigurationBuilder(new File(
        "../tang-test-jarAB/target/tang-test-jarAB-1.0-SNAPSHOT.jar").toURI()
        .toURL());
    JavaConfigurationBuilder cbB = t.newConfigurationBuilder(new File(
        "../tang-test-jarAB/target/tang-test-jarAB-1.0-SNAPSHOT.jar").toURI()
        .toURL());
    cbA.addConfiguration(cbB.build());

    cbA.getClassHierarchy().getNode("org.apache.reef.tang.examples.A");
    cbA.getClassHierarchy().getNode("org.apache.reef.tang.examples.B");

    t.newInjector(cbA.build());
  }

  //  @Test
  public void aliasingNameSameDifferentTypes()
      throws MalformedURLException, InjectionException, BindException,
      ClassNotFoundException, NameResolutionException {
    Tang t = Tang.Factory.getTang();
    JavaConfigurationBuilder cbA1 = t.newConfigurationBuilder(new File(
        "../tang-test-jarAB/target/tang-test-jarAB-1.0-SNAPSHOT.jar").toURI()
        .toURL());
    JavaConfigurationBuilder cbA2 = t.newConfigurationBuilder(new File(
        "../tang-test-jarAB/target/tang-test-jarAB-1.0-SNAPSHOT.jar").toURI()
        .toURL());
    cbA1.getClassHierarchy().getNode("org.apache.reef.tang.examples.A");
    cbA1.bind("org.apache.reef.tang.examples.A", "org.apache.reef.tang.examples.B");
    cbA2.bind("org.apache.reef.tang.examples.A", "org.apache.reef.tang.examples.B");
    Object o = t.newInjector(cbA1.build()).getInstance("org.apache.reef.tang.examples.A");
    Object p = t.newInjector(cbA2.build()).getInstance("org.apache.reef.tang.examples.A");
    Assert.assertSame(o.getClass(), p.getClass());
    JavaConfigurationBuilder cbAother = t.newConfigurationBuilder(new File(
        "../tang-test-jarA/target/tang-test-jarA-1.0-SNAPSHOT.jar").toURI()
        .toURL());

    Assert.assertEquals(1, ((ClassNode<?>) (cbA1.getClassHierarchy().getNode("org.apache.reef.tang.examples.A"))).getInjectableConstructors().length);
    Assert.assertEquals(0, ((ClassNode<?>) (cbAother.getClassHierarchy().getNode("org.apache.reef.tang.examples.A"))).getInjectableConstructors().length);

  }

  //  @Test
  public void testOneClassOneJar()
      throws MalformedURLException, InjectionException, BindException,
      ClassNotFoundException, NameResolutionException {
    Tang t = Tang.Factory.getTang();
    JavaConfigurationBuilder cbA1 = t.newConfigurationBuilder(new File(
        "../tang-test-jarAB/target/tang-test-jarAB-1.0-SNAPSHOT.jar").toURI()
        .toURL());
    cbA1.bind("org.apache.reef.tang.examples.A", "org.apache.reef.tang.examples.B");
    cbA1.getClassHierarchy().getNode("org.apache.reef.tang.examples.A");
    t.newInjector(cbA1.build()).getInstance("org.apache.reef.tang.examples.B");
  }
}


text:
using AllReady.Features.Tasks;
using AllReady.Models;
using AllReady.ViewModels;
using MediatR;
using Moq;
using System;
using System.Linq;
using System.Threading.Tasks;
using AllReady.ViewModels.Shared;
using Xunit;

namespace AllReady.UnitTest.Features.Tasks
{
    public class TaskSignupHandlerShould : InMemoryContextTest
    {
        [Fact]
        public async Task Result_ShouldBe_ClosedTaskFailure_IfTaskIsClosed()
        {
            var mockMediator = new Mock<IMediator>();
            var message = new TaskSignupCommand { TaskSignupModel = new TaskSignupViewModel { TaskId = 1, EventId = 1, UserId = "abc" } };

            var sut = new TaskSignupCommandHandler(mockMediator.Object, Context);
            var result = await sut.Handle(message);

            Assert.Equal(TaskSignupResult.FAILURE_CLOSEDTASK, result.Status);
            Assert.Equal(0, Context.TaskSignups.Count());
        }

        [Fact]
        public async Task Result_ShouldBe_CampaignNotFound_IfCampaignIdDoesNotExist()
        {
            var mockMediator = new Mock<IMediator>();
            var message = new TaskSignupCommand { TaskSignupModel = new TaskSignupViewModel { TaskId = 1, EventId = 100, UserId = "abc" } };

            var sut = new TaskSignupCommandHandler(mockMediator.Object, Context);
            var result = await sut.Handle(message);

            Assert.Equal(TaskSignupResult.FAILURE_EVENTNOTFOUND, result.Status);
            Assert.Equal(0, Context.TaskSignups.Count());
        }

        [Fact]
        public async Task Result_ShouldBe_TaskNotFound_IfTaskIdDoesNotExist()
        {
            var mockMediator = new Mock<IMediator>();
            var message = new TaskSignupCommand { TaskSignupModel = new TaskSignupViewModel { TaskId = 100, EventId = 1, UserId = "abc" } };

            var sut = new TaskSignupCommandHandler(mockMediator.Object, Context);
            var result = await sut.Handle(message);

            Assert.Equal(TaskSignupResult.FAILURE_TASKNOTFOUND, result.Status);
            Assert.Equal(0, Context.TaskSignups.Count());
        }

        [Fact]
        public async Task Result_ShouldBe_Success_IfTaskIsNotClosed()
        {
            var mockMediator = new Mock<IMediator>();
            var message = new TaskSignupCommand { TaskSignupModel = new TaskSignupViewModel { TaskId = 2, EventId = 1, UserId = "abc" } };

            var sut = new TaskSignupCommandHandler(mockMediator.Object, Context);
            var result = await sut.Handle(message);

            Assert.Equal(TaskSignupResult.SUCCESS, result.Status);
            Assert.Equal(1, Context.TaskSignups.Count());
        }

        protected override void LoadTestData()
        {
            Context.Users.Add(new ApplicationUser { Id = "abc" });

            var campaignEvent = new Models.Event { Id = 1, Name = "Some Event" };
            Context.Events.Add(campaignEvent);

            Context.Tasks.Add(new AllReadyTask { Id = 1, Name = "Closed Task", EndDateTime = DateTime.UtcNow.AddDays(-100), Event = campaignEvent });
            Context.Tasks.Add(new AllReadyTask { Id = 2, Name = "Open Task", EndDateTime = DateTime.UtcNow.AddDays(100), Event = campaignEvent });

            Context.SaveChanges();
        }
    }
}


text:
require 'json'

module Convection
  module Model
    ##
    # CloudFormation ResourceTag set
    ##
    class Tags < Hash
      def render
        map do |t|
          {
            'Key' => t[0].to_s,
            'Value' => t[1]
          }
        end
      end
    end

    module Mixin
      ##
      # Add tag helpers to taddable resources
      ##
      module Taggable
        def tags
          @tags ||= Tags.new
        end

        def tag(key, value)
          tags[key] = value
        end

        ## Helper for Asgard
        def immutable_metadata(purpose, target = '')
          tag('immutable_metadata', JSON.generate(
            :purpose => purpose,
            :target => target
          ))
        end

        def render_tags(resource)
          resource.tap do |r|
            r['Properties']['Tags'] = tags.render unless tags.empty?
          end
        end
      end
    end
  end
end


text:
<?php

require_once 'SplunkTest.php';

class IndexTest extends SplunkTest
{
    public function testSubmit()
    {
        $service = $this->loginToRealService();
        $index = $service->getIndexes()->get('_internal');

        // (Only test that this code path appears to work.
        //  The ReceiverTest checks whether submitted events actually show up.)
        $index->submit('DELETEME', array(
            'sourcetype' => 'php_unit_test',
        ));
    }

    public function testAttach()
    {
        $service = $this->loginToRealService();
        $index = $service->getIndexes()->get('_internal');

        // (Only test that this code path appears to work.
        //  The ReceiverTest checks whether submitted events actually show up.)
        $eventOutputStream = $index->attach(array(
            'sourcetype' => 'php_unit_test',
        ));
        Splunk_Util::fwriteall($eventOutputStream, 'DELETEME');
        fclose($eventOutputStream);
    }
}


text:
<?xml version="1.0" encoding="UTF-8"?>
<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/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>

    <groupId>com.whitefes</groupId>
    <artifactId>utility</artifactId>
    <version>1.0-SNAPSHOT</version>
    <build>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <configuration>
                    <source>1.8</source>
                    <target>1.8</target>
                </configuration>
            </plugin>
        </plugins>
    </build>

    <properties>
        <spring.version>4.3.0.RELEASE</spring.version>
    </properties>

    <dependencies>
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-core</artifactId>
            <version>${spring.version}</version>
        </dependency>

        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-web</artifactId>
            <version>${spring.version}</version>
        </dependency>

        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-webmvc</artifactId>
            <version>${spring.version}</version>
        </dependency>

        <dependency>
            <groupId>org.springframework.security</groupId>
            <artifactId>spring-security-core</artifactId>
            <version>4.2.0.RELEASE</version>
        </dependency>

        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <version>4.7</version>
            <scope>test</scope>
        </dependency>

    </dependencies>

</project>


text:
using System;
using NUnit.Framework;

public class Test09
{
    [TestCase]
    public void Count_Should_RemainCorrect_AfterRemoving()
    {
        //Arrange
        IArena RA = new RoyaleArena();
        Battlecard cd1 = new Battlecard(5, CardType.SPELL, "joro", 10, 5);
        Battlecard cd2 = new Battlecard(6, CardType.SPELL, "joro", 10, 5);
        Battlecard cd3 = new Battlecard(7, CardType.SPELL, "joro", 10, 5);
        //Act
        RA.Add(cd1);
        RA.Add(cd2);
        RA.Add(cd3);
        RA.RemoveById(cd1.Id);
        RA.RemoveById(cd3.Id);
        //Assert
        Assert.AreEqual(1, RA.Count);
        Assert.AreNotSame(cd1, RA.GetById(cd2.Id));
    }

}


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

#include "components/offline_items_collection/core/utilities/file_existence_checker.h"

#include <vector>

#include "base/bind.h"
#include "base/files/file_path.h"
#include "base/files/file_util.h"
#include "base/files/scoped_temp_dir.h"
#include "base/sequenced_task_runner.h"
#include "base/test/test_simple_task_runner.h"
#include "base/threading/thread_task_runner_handle.h"
#include "testing/gtest/include/gtest/gtest.h"

namespace offline_items_collection {

using FileIdPairVector = FileExistenceChecker::FileWithIdCollection<int64_t>;
using FileIdPairSet = std::set<std::pair<base::FilePath, int64_t>>;
namespace {

FileIdPairSet CheckForMissingFiles(
    const scoped_refptr<base::TestSimpleTaskRunner>& task_runner,
    FileIdPairVector file_paths) {
  FileIdPairSet missing_files;
  FileExistenceChecker::CheckForMissingFiles(
      task_runner, std::move(file_paths),
      base::BindOnce(
          [](FileIdPairSet* set_alias, FileIdPairVector result) {
            set_alias->insert(result.begin(), result.end());
          },
          &missing_files));
  task_runner->RunUntilIdle();
  return missing_files;
}

}  // namespace

class FileExistenceCheckerTest : public testing::Test {
 public:
  FileExistenceCheckerTest();
  ~FileExistenceCheckerTest() override;

  FileIdPairVector CreateTestFiles(int64_t count);

  base::TestSimpleTaskRunner* task_runner() { return task_runner_.get(); }
  scoped_refptr<base::TestSimpleTaskRunner>& task_runner_ref() {
    return task_runner_;
  }

 private:
  base::ScopedTempDir temp_directory_;
  scoped_refptr<base::TestSimpleTaskRunner> task_runner_;
  base::ThreadTaskRunnerHandle task_runner_handle_;
};

FileExistenceCheckerTest::FileExistenceCheckerTest()
    : task_runner_(new base::TestSimpleTaskRunner),
      task_runner_handle_(task_runner_) {
  EXPECT_TRUE(temp_directory_.CreateUniqueTempDir());
}

FileExistenceCheckerTest::~FileExistenceCheckerTest() {}

FileIdPairVector FileExistenceCheckerTest::CreateTestFiles(int64_t count) {
  base::FilePath file_path;
  FileIdPairVector created_files;
  for (int64_t i = 0; i < count; i++) {
    EXPECT_TRUE(
        base::CreateTemporaryFileInDir(temp_directory_.GetPath(), &file_path));
    created_files.push_back(std::make_pair(file_path, i));
  }

  return created_files;
}

TEST_F(FileExistenceCheckerTest, NoFilesMissing) {
  FileIdPairVector files = CreateTestFiles(2);
  FileIdPairSet missing_files = CheckForMissingFiles(task_runner_ref(), files);
  EXPECT_TRUE(missing_files.empty());
}

TEST_F(FileExistenceCheckerTest, MissingFileFound) {
  FileIdPairVector files = CreateTestFiles(2);

  base::DeleteFile(files[0].first, false /* recursive */);

  FileIdPairSet missing_files = CheckForMissingFiles(task_runner_ref(), files);

  EXPECT_EQ(1UL, missing_files.size());
  EXPECT_EQ(1UL, missing_files.count(files[0]));
  EXPECT_EQ(0UL, missing_files.count(files[1]));
}

}  // namespace offline_items_collection


text:
module MassRecord
  VERSION = "0.0.4.9" # implemented a custom Array#pretty_inspect method, as well as error handling in case it doesn't work, and fixed gem dependancy versions for integracore update
  # VERSION = "0.0.4.8" # added a temporary fix for sqlserver bit type conversion from false
end


text:
from typing import Tuple

from pydantic import BaseSettings
from pydantic.env_settings import SettingsSourceCallable

class Settings(BaseSettings):
    my_api_key: str

    class Config:
        @classmethod
        def customise_sources(
            cls,
            init_settings: SettingsSourceCallable,
            env_settings: SettingsSourceCallable,
            file_secret_settings: SettingsSourceCallable,
        ) -> Tuple[SettingsSourceCallable, ...]:
            # here we choose to ignore arguments from init_settings
            return env_settings, file_secret_settings

print(Settings(my_api_key='this is ignored'))


text:
@interface JTWrapNavigationController : UINavigationController

@end

@implementation JTWrapNavigationController

- (void)viewDidLoad
{
    [super viewDidLoad];

    [self.navigationBar setBarTintColor:FNColor(200, 0, 0)];
}

- (UIViewController *)popViewControllerAnimated:(BOOL)animated {
    return [self.navigationController popViewControllerAnimated:animated];
}

- (NSArray<UIViewController *> *)popToRootViewControllerAnimated:(BOOL)animated {
    return [self.navigationController popToRootViewControllerAnimated:animated];
}

- (NSArray<UIViewController *> *)popToViewController:(UIViewController *)viewController animated:(BOOL)animated {
    JTNavigationController *jt_navigationController = viewController.jt_navigationController;
    NSInteger index = [jt_navigationController.jt_viewControllers indexOfObject:viewController];
    return [self.navigationController popToViewController:jt_navigationController.viewControllers[index] animated:animated];
}

- (void)pushViewController:(UIViewController *)viewController animated:(BOOL)animated {

    viewController.jt_navigationController = (JTNavigationController *)self.navigationController;
    viewController.jt_fullScreenPopGestureEnabled = viewController.jt_navigationController.fullScreenPopGestureEnabled;

    UIImage *backButtonImage = viewController.jt_navigationController.backButtonImage;

    if (!backButtonImage) {
        backButtonImage = [UIImage imageNamed:kDefaultBackImageName];
    }

    viewController.navigationItem.leftBarButtonItem = [[UIBarButtonItem alloc] initWithImage:backButtonImage style:UIBarButtonItemStylePlain target:self action:@selector(didTapBackButton)];

    [self.navigationController pushViewController:[JTWrapViewController wrapViewControllerWithViewController:viewController] animated:animated];
}

- (void)didTapBackButton {
    // 发出设置控制器出栈的通知
    [[NSNotificationCenter defaultCenter] postNotificationName:FNSettingBackBtnClick object:nil];
    [self.navigationController popViewControllerAnimated:YES];
}

-(void)dismissViewControllerAnimated:(BOOL)flag completion:(void (^)(void))completion{
    [self.navigationController dismissViewControllerAnimated:flag completion:completion];
    self.viewControllers.firstObject.jt_navigationController=nil;
}

- (void)dealloc
{
}

@end

#pragma mark - JTWrapViewController

static NSValue *jt_tabBarRectValue;

@implementation JTWrapViewController

+ (JTWrapViewController *)wrapViewControllerWithViewController:(UIViewController *)viewController {

    JTWrapNavigationController *wrapNavController = [[JTWrapNavigationController alloc] init];
    wrapNavController.viewControllers = @[viewController];

    JTWrapViewController *wrapViewController = [[JTWrapViewController alloc] init];
    [wrapViewController.view addSubview:wrapNavController.view];
    [wrapViewController addChildViewController:wrapNavController];

    return wrapViewController;
}

- (void)viewDidLayoutSubviews {
    [super viewDidLayoutSubviews];

    if (self.tabBarController && !jt_tabBarRectValue) {
        jt_tabBarRectValue = [NSValue valueWithCGRect:self.tabBarController.tabBar.frame];
    }

}

//- (void)viewDidAppear:(BOOL)animated {
//    [super viewDidAppear:animated];
//
//    if (self.tabBarController && [self rootViewController].hidesBottomBarWhenPushed) {
//        self.tabBarController.tabBar.frame = CGRectZero;
//    }
//}

- (void)viewWillAppear:(BOOL)animated {
    [super viewWillAppear:animated];
    self.tabBarController.tabBar.translucent = YES;
    if (self.tabBarController && !self.tabBarController.tabBar.hidden && jt_tabBarRectValue) {
        self.tabBarController.tabBar.frame = jt_tabBarRectValue.CGRectValue;
    }
}

- (BOOL)jt_fullScreenPopGestureEnabled {
    return [self rootViewController].jt_fullScreenPopGestureEnabled;
}

//- (BOOL)hidesBottomBarWhenPushed {
//    return [self rootViewController].hidesBottomBarWhenPushed;
//}

- (UITabBarItem *)tabBarItem {
    return [self rootViewController].tabBarItem;
}

- (NSString *)title {
    return [self rootViewController].title;
}

- (UIViewController *)childViewControllerForStatusBarStyle {
    return [self rootViewController];
}

- (UIViewController *)childViewControllerForStatusBarHidden {
    return [self rootViewController];
}

- (UIViewController *)rootViewController {
    JTWrapNavigationController *wrapNavController = self.childViewControllers.firstObject;
    return wrapNavController.viewControllers.firstObject;
}
- (void)dealloc
{
}
@end

#pragma mark - JTNavigationController

@interface JTNavigationController () <UINavigationControllerDelegate, UIGestureRecognizerDelegate>

@property (nonatomic, strong) UIPanGestureRecognizer *popPanGesture;

@property (nonatomic, strong) id popGestureDelegate;

@end

@implementation JTNavigationController

- (instancetype)initWithRootViewController:(UIViewController *)rootViewController {
    if (self = [super init]) {
        rootViewController.jt_navigationController = self;
        self.viewControllers = @[[JTWrapViewController wrapViewControllerWithViewController:rootViewController]];
    }
    return self;
}

- (instancetype)initWithCoder:(NSCoder *)aDecoder {
    if (self = [super initWithCoder:aDecoder]) {
        self.viewControllers.firstObject.jt_navigationController = self;
        self.viewControllers = @[[JTWrapViewController wrapViewControllerWithViewController:self.viewControllers.firstObject]];
    }
    return self;
}

- (void)viewDidLoad {
    [super viewDidLoad];

    [self setNavigationBarHidden:YES];
    self.delegate = self;

    self.popGestureDelegate = self.interactivePopGestureRecognizer.delegate;
    SEL action = NSSelectorFromString(@"handleNavigationTransition:");
    self.popPanGesture = [[UIPanGestureRecognizer alloc] initWithTarget:self.popGestureDelegate action:action];
    self.popPanGesture.maximumNumberOfTouches = 1;

}

#pragma mark - UINavigationControllerDelegate

- (void)navigationController:(UINavigationController *)navigationController didShowViewController:(UIViewController *)viewController animated:(BOOL)animated {

    BOOL isRootVC = viewController == navigationController.viewControllers.firstObject;

    if (viewController.jt_fullScreenPopGestureEnabled) {
        if (isRootVC) {
            [self.view removeGestureRecognizer:self.popPanGesture];
        } else {
            [self.view addGestureRecognizer:self.popPanGesture];
        }
        self.interactivePopGestureRecognizer.delegate = self.popGestureDelegate;
        self.interactivePopGestureRecognizer.enabled = NO;
    } else {
        [self.view removeGestureRecognizer:self.popPanGesture];
        self.interactivePopGestureRecognizer.delegate = self;
        self.interactivePopGestureRecognizer.enabled = !isRootVC;
    }

}

#pragma mark - UIGestureRecognizerDelegate

//修复有水平方向滚动的ScrollView时边缘返回手势失效的问题
-(BOOL)gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer shouldRecognizeSimultaneouslyWithGestureRecognizer:(UIGestureRecognizer *)otherGestureRecognizer {
    return YES;
}

- (BOOL)gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer shouldBeRequiredToFailByGestureRecognizer:(UIGestureRecognizer *)otherGestureRecognizer {
    return [gestureRecognizer isKindOfClass:UIScreenEdgePanGestureRecognizer.class];
}

#pragma mark - Getter

- (NSArray *)jt_viewControllers {
    NSMutableArray *viewControllers = [NSMutableArray array];
    for (JTWrapViewController *wrapViewController in self.viewControllers) {
        [viewControllers addObject:wrapViewController.rootViewController];
    }
    return viewControllers.copy;
}

@end


text:
import { UsersService } from "./users.service";

export const SERVICES = [
	UsersService
]


text:
package com.steelhouse.twitter.ads.enums;

public enum Events {
	MUSIC_AND_ENTERTAINMENT, SPORTS, HOLIDAY, CONFERENCE, OTHER
}


text:
@implementation AKSinusoidBursts
{
    AKTable *iFnA;
    AKTable *iFnB;
    AKConstant *iOlaps;
    AKConstant *iTotDur;
    AKControl *kOct;
    AKControl *kBand;
    AKControl *kRis;
    AKControl *kDur;
    AKControl *kDec;
    AKParameter *xAmp;
    AKParameter *xFund;
    AKParameter *xForm;
}

- (instancetype)initWithSineTable:(AKTable *)sineburstSynthesisTable
                   riseShapeTable:(AKTable *)riseShapeTable
                         overlaps:(AKConstant *)numberOfOverlaps
                        totalTime:(AKConstant *)totalTime
                  octavationIndex:(AKControl *)octavationIndex
                 formantBandwidth:(AKControl *)formantBandwidth
                    burstRiseTime:(AKControl *)burstRiseTime
                    burstDuration:(AKControl *)burstDuration
                   burstDecayTime:(AKControl *)burstDecayTime
                    peakAmplitude:(AKParameter *)peakAmplitude
             fundamentalFrequency:(AKParameter *)fundamentalFrequency
                 formantFrequency:(AKParameter *)formantFrequency;
{
    self = [super initWithString:[self operationName]];
    if (self) {
        iFnA = sineburstSynthesisTable;
        iFnB = riseShapeTable;
        iOlaps = numberOfOverlaps;
        iTotDur = totalTime;
        kOct = octavationIndex;
        kBand = formantBandwidth;
        kRis = burstRiseTime;
        kDur = burstDuration;
        kDec = burstDecayTime;
        xAmp = peakAmplitude;
        xFund = fundamentalFrequency;
        xForm = formantFrequency;
        self.state = @"connectable";
        self.dependencies = @[iFnA, iFnB, iOlaps, iTotDur, kOct, kBand, kRis, kDur, kDec, xAmp, xFund, xForm];
    }
    return self;
}

- (NSString *)stringForCSD {
    return [NSString stringWithFormat:
            @"%@ fof %@, %@, %@, %@, %@, %@, %@, %@, %@, %@, %@, %@",
            self, xAmp, xFund, xForm, kOct, kBand, kRis, kDur, kDec, iOlaps, iFnA, iFnB, iTotDur];
}
@end


text:
@extends('layouts.app')
@section('title', 'Registration')

@section('head')
<link href="{{ URL::asset('css/registration.css') }}" rel="stylesheet" type="text/css">
@endsection

@section('content')

  @include('subviews/messages')
            <form method="POST" action="{{ url('/register') }}" class="form-horizontal" role="form">
               {{ csrf_field() }}

Registration Form

                    First Name*

                        <input type="text" name="first" class="form-control" value="@if(old('first') != null){{old('first')}}@endif" autofocus required>

                    Last Name*

                        <input type="text" name="last" class="form-control" value="@if(old('last') != null){{old('last')}}@endif" required>

                    Email*

                        <input type="email" name="email" class="form-control" value="@if(old('email') != null){{old('email')}}@endif" required>

                    Phone*

                        <input type="text" name="phone" class="form-control" value="@if(old('phone') != null){{old('phone')}}@endif" required>

                    Username*

                        <input type="text" name="username" class="form-control" value="@if(old('username') != null){{old('username')}}@endif" required>

                    Password*

                        <input type="password" name="password" class="form-control" required>

                    Confirm Password*

                        <input type="password" name="password_confirmation" class="form-control" required>

                    Date of Birth

                        <input type="date" name="birthday" value="@if(old('birthday') != null){{old('birthday')}}@endif" class="form-control">

                    School*

                        <input type="text" name="school" value="@if(old('school') != null){{old('school')}}@endif" class="form-control" required>

                    Major

                        <input type="text" name="major" value="@if(old('major') != null){{old('major')}}@endif" class="form-control">

                    School Year*

                        <select name="school_year" class="form-control" required>
                            <option value> -- select a grade -- </option>
                            <option>High School Student</option>
                            <option>Freshman</option>
                            <option>Sophomore</option>
                            <option>Junior</option>
                            <option>Senior</option>
                            <option>Graduate Student</option>
                        </select>

                    Gender*

                      <select name="gender" class="form-control" required>
                          <option value> -- select a gender -- </option>
                          <option>Male</option>
                          <option>Female</option>
                          <option>Other</option>
                      </select>

                    Shirt Size*

                      <select name="shirt_size" class="form-control" required>
                          <option value> -- select a size -- </option>
                          <option>XS</option>
                          <option>S</option>
                          <option>M</option>
                          <option>L</option>
                          <option>XL</option>
                          <option>XXL</option>
                      </select>

                    Dietary Restrictions

                        <input type="text" name="dietary_restrictions" value="@if(old('dietary_restrictions') != null){{old('dietary_restrictions')}}@endif" class="form-control">

                    Special Needs

                        <input type="text" name="special_needs" value="@if(old('special_needs') != null){{old('special_needs')}}@endif" class="form-control">

                                <input type="checkbox" name="accept" required>I accept terms

                <div class="form-group"

                        <button type="submit" class="btn btn-primary btn-block">Register</button>

            </form>

@endsection


text:
"""
Unit tests for the Constant2D class.
"""

import unittest
from raysect.core.math.function.float.function2d.constant import Constant2D

# TODO: expand tests to cover the cython interface
class TestConstant2D(unittest.TestCase):

    def test_constant(self):
        v = [-1e10, -7, -0.001, 0.0, 0.00003, 10, 2.3e49]
        for x in v:
            constant = Constant2D(x)
            self.assertEqual(constant(500, -1.5), x, "Constant2D call did not match reference value.")


text:
Public Class ChildForm

End Class