text:
namespace DX
{
    class DeviceResources;

    // Constant buffer used to send the view-projection matrices to the shader pipeline.
    struct ViewProjectionConstantBuffer
    {
        DirectX::XMFLOAT4X4 viewProjection[2];
    };

    // Assert that the constant buffer remains 16-byte aligned (best practice).
    static_assert((sizeof(ViewProjectionConstantBuffer) % (sizeof(float) * 4)) == 0, "ViewProjection constant buffer size must be 16-byte aligned (16 bytes is the length of four floats).");

    // Manages DirectX device resources that are specific to a holographic camera, such as the
    // back buffer, ViewProjection constant buffer, and viewport.
    class CameraResources
    {
    public:
        CameraResources(Windows::Graphics::Holographic::HolographicCamera^ holographicCamera);

        void CreateResourcesForBackBuffer(
            DX::DeviceResources* pDeviceResources,
            Windows::Graphics::Holographic::HolographicCameraRenderingParameters^ cameraParameters
            );
        void ReleaseResourcesForBackBuffer(
            DX::DeviceResources* pDeviceResources
            );

        void UpdateViewProjectionBuffer(
            std::shared_ptr<DX::DeviceResources> deviceResources,
            Windows::Graphics::Holographic::HolographicCameraPose^ cameraPose,
            Windows::Perception::Spatial::SpatialCoordinateSystem^ coordinateSystem);

        bool AttachViewProjectionBuffer(
            std::shared_ptr<DX::DeviceResources> deviceResources);

        // Direct3D device resources.
        ID3D11RenderTargetView* GetBackBufferRenderTargetView()     const { return m_d3dRenderTargetView.Get();     }
        ID3D11DepthStencilView* GetDepthStencilView()               const { return m_d3dDepthStencilView.Get();     }
        ID3D11Texture2D*        GetBackBufferTexture2D()            const { return m_d3dBackBuffer.Get();           }
        D3D11_VIEWPORT          GetViewport()                       const { return m_d3dViewport;                   }
        DXGI_FORMAT             GetBackBufferDXGIFormat()           const { return m_dxgiFormat;                    }
        ID3D11BlendState*       GetBlendState()                     const { return m_blendState.Get();              }

        // Render target properties.
        Windows::Foundation::Size GetRenderTargetSize()             const { return m_d3dRenderTargetSize;           }
        bool                    IsRenderingStereoscopic()           const { return m_isStereo;                      }

        // The holographic camera these resources are for.
        Windows::Graphics::Holographic::HolographicCamera^ GetHolographicCamera() const { return m_holographicCamera; }

    private:
        // Direct3D rendering objects. Required for 3D.
        Microsoft::WRL::ComPtr<ID3D11RenderTargetView>      m_d3dRenderTargetView;
        Microsoft::WRL::ComPtr<ID3D11DepthStencilView>      m_d3dDepthStencilView;
        Microsoft::WRL::ComPtr<ID3D11Texture2D>             m_d3dBackBuffer;
        Microsoft::WRL::ComPtr<ID3D11BlendState>            m_blendState;

        // Device resource to store view and projection matrices.
        Microsoft::WRL::ComPtr<ID3D11Buffer>                m_viewProjectionConstantBuffer;

        // Direct3D rendering properties.
        DXGI_FORMAT                                         m_dxgiFormat;
        Windows::Foundation::Size                           m_d3dRenderTargetSize;
        D3D11_VIEWPORT                                      m_d3dViewport;

        // Indicates whether the camera supports stereoscopic rendering.
        bool                                                m_isStereo = false;

        // Indicates whether this camera has a pending frame.
        bool                                                m_framePending = false;

        // Pointer to the holographic camera these resources are for.
        Windows::Graphics::Holographic::HolographicCamera^  m_holographicCamera = nullptr;
    };
}


text:
//
//  UIAccessibility.h
//  UIKit
//
//  Copyright (c) 2008-2014 Apple Inc. All rights reserved.
//

#import <CoreGraphics/CoreGraphics.h>
#import <Foundation/Foundation.h>
#import <UIKit/UIKitDefines.h>
#import <UIKit/UIBezierPath.h>

#import <UIKit/UIAccessibilityAdditions.h>
#import <UIKit/UIAccessibilityConstants.h>
#import <UIKit/UIAccessibilityCustomAction.h>
#import <UIKit/UIAccessibilityElement.h>
#import <UIKit/UIAccessibilityIdentification.h>
#import <UIKit/UIAccessibilityZoom.h>
#import <UIKit/UIGuidedAccessRestrictions.h>

NS_ASSUME_NONNULL_BEGIN

/*
 UIAccessibility

 UIAccessibility is implemented on all standard UIKit views and controls so
 that assistive applications can present them to users with disabilities.

 Custom items in a user interface should override aspects of UIAccessibility
 to supply details where the default value is incomplete.

 For example, a UIImageView subclass may need to override accessibilityLabel,
 but it does not need to override accessibilityFrame.

 A completely custom subclass of UIView might need to override all of the
 UIAccessibility methods except accessibilityFrame.
 */

@interface NSObject (UIAccessibility)

/*
 Return YES if the receiver should be exposed as an accessibility element.
 default == NO
 default on UIKit controls == YES
 Setting the property to YES will cause the receiver to be visible to assistive applications.
 */
@property (nonatomic) BOOL isAccessibilityElement;

/*
 Returns the localized label that represents the element.
 If the element does not display text (an icon for example), this method
 should return text that best labels the element. For example: "Play" could be used for
 a button that is used to play music. "Play button" should not be used, since there is a trait
 that identifies the control is a button.
 default == nil
 default on UIKit controls == derived from the title
 Setting the property will change the label that is returned to the accessibility client.
 */
@property (nullable, nonatomic, copy) NSString *accessibilityLabel;

/*
 Returns a localized string that describes the result of performing an action on the element, when the result is non-obvious.
 The hint should be a brief phrase.
 For example: "Purchases the item." or "Downloads the attachment."
 default == nil
 Setting the property will change the hint that is returned to the accessibility client.
 */
@property (nullable, nonatomic, copy) NSString *accessibilityHint;

/*
 Returns a localized string that represents the value of the element, such as the value
 of a slider or the text in a text field. Use only when the label of the element
 differs from a value. For example: A volume slider has a label of "Volume", but a value of "60%".
 default == nil
 default on UIKit controls == values for appropriate controls
 Setting the property will change the value that is returned to the accessibility client.
 */
@property (nullable, nonatomic, copy) NSString *accessibilityValue;

/*
 Returns a UIAccessibilityTraits mask that is the OR combination of
 all accessibility traits that best characterize the element.
 See UIAccessibilityConstants.h for a list of traits.
 When overriding this method, remember to combine your custom traits
 with [super accessibilityTraits].
 default == UIAccessibilityTraitNone
 default on UIKit controls == traits that best characterize individual controls.
 Setting the property will change the traits that are returned to the accessibility client.
 */
@property (nonatomic) UIAccessibilityTraits accessibilityTraits;

/*
 Returns the frame of the element in screen coordinates.
 default == CGRectZero
 default on UIViews == the frame of the view
 Setting the property will change the frame that is returned to the accessibility client.
 */
@property (nonatomic) CGRect accessibilityFrame;

// The accessibilityFrame is expected to be in screen coordinates.
// To help convert the frame to screen coordinates, use the following method.
// The rect should exist in the view space of the UIView argument.
UIKIT_EXTERN CGRect UIAccessibilityConvertFrameToScreenCoordinates(CGRect rect, UIView *view) NS_AVAILABLE_IOS(7_0);

/*
 Returns the path of the element in screen coordinates.
 default == nil
 Setting the property, or overriding the method, will cause the assistive technology to prefer the path over the accessibility.
 frame when highlighting the element.
 */
@property (nullable, nonatomic, copy) UIBezierPath *accessibilityPath NS_AVAILABLE_IOS(7_0);

// The accessibilityPath is expected to be in screen coordinates.
// To help convert the path to screen coordinates, use the following method.
// The path should exist in the view space of the UIView argument.
UIKIT_EXTERN UIBezierPath *UIAccessibilityConvertPathToScreenCoordinates(UIBezierPath *path, UIView *view) NS_AVAILABLE_IOS(7_0);

/*
 Returns the activation point for an accessible element in screen coordinates.
 default == Mid-point of the accessibilityFrame.
 */
@property (nonatomic) CGPoint accessibilityActivationPoint NS_AVAILABLE_IOS(5_0);

/*
 Returns the language code that the element's label, value and hint should be spoken in.
 If no language is set, the user's language is used.
 The format for the language code should follow Internet BCP 47 for language tags.
 For example, en-US specifies U.S. English.
 default == nil
 */
@property (nullable, nonatomic, strong) NSString *accessibilityLanguage;

/*
 Marks all the accessible elements contained within as hidden.
 default == NO
 */
@property (nonatomic) BOOL accessibilityElementsHidden NS_AVAILABLE_IOS(5_0);

/*
 Informs whether the receiving view should be considered modal by accessibility. If YES, then
 elements outside this view will be ignored. Only elements inside this view will be exposed.
 default == NO
 */
@property (nonatomic) BOOL accessibilityViewIsModal NS_AVAILABLE_IOS(5_0);

/*
 Forces children elements to be grouped together regardless of their position on screen.
 For example, your app may show items that are meant to be grouped together in vertical columns.
 By default, VoiceOver will navigate those items in horizontal rows. If shouldGroupAccessibilityChildren is set on
 a parent view of the items in the vertical column, VoiceOver will navigate the order correctly.
 default == NO
 */
@property (nonatomic) BOOL shouldGroupAccessibilityChildren NS_AVAILABLE_IOS(6_0);

/*
 Some assistive technologies allow the user to select a parent view or container to navigate its elements.
 This property allows an app to specify whether that behavior should apply to the receiver.
 Currently, this property only affects Switch Control, not VoiceOver or other assistive technologies.
 See UIAccessibilityConstants.h for the list of supported values.
 default == UIAccessibilityNavigationStyleAutomatic
 */
@property (nonatomic) UIAccessibilityNavigationStyle accessibilityNavigationStyle NS_AVAILABLE_IOS(8_0);
#ifndef SDK_HIDE_TIDE

/*
 The elements considered to be the headers for this element. May be set on an instance of
 UIAccessibilityElement, a View or a View Controller. The accessibility container chain,
 and associated view controllers where appropriate, will be consulted.
 To avoid retain cycles, a weak copy of the elements will be held.
 */
@property(nullable, nonatomic, copy) NSArray *accessibilityHeaderElements UIKIT_AVAILABLE_TVOS_ONLY(9_0);
#endif

@end

/*
 UIAccessibilityContainer

 UIAccessibilityContainer methods can be overridden to vend individual elements
 that are managed by a single UIView.

 For example, a single UIView might draw several items that (to an
 end user) have separate meaning and functionality.  It is important to vend
 each item as an individual accessibility element.

 Sub-elements of a container that are not represented by concrete UIView
 instances (perhaps painted text or icons) can be represented using instances
 of UIAccessibilityElement class (see UIAccessibilityElement.h).

 Accessibility containers MUST return NO to -isAccessibilityElement.
 */
@interface NSObject (UIAccessibilityContainer)

/*
 Returns the number of accessibility elements in the container.
 */
- (NSInteger)accessibilityElementCount;

/*
 Returns the accessibility element in order, based on index.
 default == nil
 */
- (nullable id)accessibilityElementAtIndex:(NSInteger)index;

/*
 Returns the ordered index for an accessibility element
 default == NSNotFound
 */
- (NSInteger)indexOfAccessibilityElement:(id)element;

// A list of container elements managed by the receiver.
// This can be used as an alternative to implementing the dynamic methods.
// default == nil
@property (nullable, nonatomic, strong) NSArray *accessibilityElements NS_AVAILABLE_IOS(8_0);

@end

/*
 UIAccessibilityFocus

 Assistive technologies, like VoiceOver, maintain a virtual focus on an element
 that allows the user to inspect an element without activating it.
 */
@interface NSObject (UIAccessibilityFocus)

// Override the following methods to know when an assistive technology has set or unset its virtual focus on the element.
- (void)accessibilityElementDidBecomeFocused NS_AVAILABLE_IOS(4_0);
- (void)accessibilityElementDidLoseFocus NS_AVAILABLE_IOS(4_0);

// Returns whether an assistive technology is focused on the element.
- (BOOL)accessibilityElementIsFocused NS_AVAILABLE_IOS(4_0);

// Returns a set of identifier keys indicating which technology is focused on this object
- (nullable NSSet<NSString *> *)accessibilityAssistiveTechnologyFocusedIdentifiers NS_AVAILABLE_IOS(9_0);

// Returns the element that is currently focused by an assistive technology.
// default = nil.
// Pass in a specific identifier (e.g. UIAccessibilityNotificationVoiceOverIdentifier) in order to choose the focused element for a specific product.
// If no argument is used, the function will returned the element that was most recently focused.
UIKIT_EXTERN __nullable id UIAccessibilityFocusedElement(NSString * __nullable assistiveTechnologyIdentifier) NS_AVAILABLE_IOS(9_0);

@end

/*
 UIAccessibilityAction

 An element should implement methods in this category if it supports the action.
 */
@interface NSObject (UIAccessibilityAction)

/*
 Implement accessibilityActivate on an element in order to handle the default action.
 For example, if a native control requires a swipe gesture, you may implement this method so that a
 VoiceOver user will perform a double-tap to activate the item.
 If your implementation successfully handles activate, return YES, otherwise return NO.
 default == NO
 */
- (BOOL)accessibilityActivate NS_AVAILABLE_IOS(7_0);

/*
 If an element has the UIAccessibilityTraitAdjustable trait, it must also implement
 the following methods. Incrementing will adjust the element so that it increases its content,
 while decrementing decreases its content. For example, accessibilityIncrement will increase the value
 of a UISlider, and accessibilityDecrement will decrease the value.
 */
- (void)accessibilityIncrement NS_AVAILABLE_IOS(4_0);
- (void)accessibilityDecrement NS_AVAILABLE_IOS(4_0);

/*
 If the user interface requires a scrolling action (e.g. turning the page of a book), a view in the view
 hierarchy should implement the following method. The return result indicates whether the action
 succeeded for that direction. If the action failed, the method will be called on a view higher
 in the hierarchy. If the action succeeds, UIAccessibilityPageScrolledNotification must be posted after
 the scrolling completes.
 default == NO
 */
typedef NS_ENUM(NSInteger, UIAccessibilityScrollDirection) {
    UIAccessibilityScrollDirectionRight = 1,
    UIAccessibilityScrollDirectionLeft,
    UIAccessibilityScrollDirectionUp,
    UIAccessibilityScrollDirectionDown,
    UIAccessibilityScrollDirectionNext NS_ENUM_AVAILABLE_IOS(5_0),
    UIAccessibilityScrollDirectionPrevious NS_ENUM_AVAILABLE_IOS(5_0),
};

- (BOOL)accessibilityScroll:(UIAccessibilityScrollDirection)direction NS_AVAILABLE_IOS(4_2);

/*
 Implement accessibilityPerformEscape on an element or containing view to exit a modal or hierarchical interface view.
 For example, UIPopoverController implements accessibilityPerformEscape on it's root view, so that when
 called (as a result of a VoiceOver user action), it dismisses the popover.
 If your implementation successfully dismisses the current UI, return YES, otherwise return NO.
 default == NO
 */
- (BOOL)accessibilityPerformEscape NS_AVAILABLE_IOS(5_0);

/*
 Implement accessibilityPerformMagicTap on an element, or the application, in order to provide a context-sensitive action.
 For example, a music player can implement this to start and stop playback, or a recording app could start and stop recording.
 Return YES to indicate that the action was handled.
 default == NO
 */
- (BOOL)accessibilityPerformMagicTap NS_AVAILABLE_IOS(6_0);

/*
 Return an array of UIAccessibilityCustomAction objects to make custom actions for an element accessible to an assistive technology.
 For example, a photo app might have a view that deletes its corresponding photo in response to a flick gesture.
 If the view returns a delete action from this property, VoiceOver and Switch Control users will be able to delete photos without performing the flick gesture.
 default == nil
 */
@property (nullable, nonatomic, strong) NSArray <UIAccessibilityCustomAction *> *accessibilityCustomActions NS_AVAILABLE_IOS(8_0);
@end

/*
 UIAccessibilityReadingContent

 Implemented on an element that represents content meant to be read, like a book or periodical.
 Use in conjuction with UIAccessibilityTraitCausesPageTurn to provide a continuous reading experience with VoiceOver.
 */
@protocol UIAccessibilityReadingContent
@required

// Returns the line number given a point in the view's coordinate space.
- (NSInteger)accessibilityLineNumberForPoint:(CGPoint)point NS_AVAILABLE_IOS(5_0);

// Returns the content associated with a line number as a string.
- (nullable NSString *)accessibilityContentForLineNumber:(NSInteger)lineNumber NS_AVAILABLE_IOS(5_0);

// Returns the on-screen rectangle for a line number.
- (CGRect)accessibilityFrameForLineNumber:(NSInteger)lineNumber NS_AVAILABLE_IOS(5_0);

// Returns a string representing the text displayed on the current page.
- (nullable NSString *)accessibilityPageContent NS_AVAILABLE_IOS(5_0);

@end

/*
 UIAccessibilityPostNotification

 This function posts a notification to assistive applications.
 Some notifications specify a required or optional argument.
 Pass nil for the argument if the notification does not specify otherwise.
 See UIAccessibilityConstants.h for a list of notifications.
 */
UIKIT_EXTERN void UIAccessibilityPostNotification(UIAccessibilityNotifications notification, __nullable id argument);

/*
 Assistive Technology

 Use UIAccessibilityIsVoiceOverRunning() to determine if VoiceOver is running.
 Listen for UIAccessibilityVoiceOverStatusChanged to know when VoiceOver starts or stops.
 */
UIKIT_EXTERN BOOL UIAccessibilityIsVoiceOverRunning() NS_AVAILABLE_IOS(4_0);
UIKIT_EXTERN NSString *const UIAccessibilityVoiceOverStatusChanged NS_AVAILABLE_IOS(4_0);

// Returns whether system audio is mixed down from stereo to mono.
UIKIT_EXTERN BOOL UIAccessibilityIsMonoAudioEnabled() NS_AVAILABLE_IOS(5_0);
UIKIT_EXTERN NSString *const UIAccessibilityMonoAudioStatusDidChangeNotification NS_AVAILABLE_IOS(5_0);

// Returns whether the system preference for closed captioning is enabled.
UIKIT_EXTERN BOOL UIAccessibilityIsClosedCaptioningEnabled() NS_AVAILABLE_IOS(5_0);
UIKIT_EXTERN NSString *const UIAccessibilityClosedCaptioningStatusDidChangeNotification NS_AVAILABLE_IOS(5_0);

// Returns whether the system preference for invert colors is enabled.
UIKIT_EXTERN BOOL UIAccessibilityIsInvertColorsEnabled() NS_AVAILABLE_IOS(6_0);
UIKIT_EXTERN NSString *const UIAccessibilityInvertColorsStatusDidChangeNotification NS_AVAILABLE_IOS(6_0);

// Returns whether the app is running under Guided Access mode.
UIKIT_EXTERN BOOL UIAccessibilityIsGuidedAccessEnabled() NS_AVAILABLE_IOS(6_0);
UIKIT_EXTERN NSString *const UIAccessibilityGuidedAccessStatusDidChangeNotification NS_AVAILABLE_IOS(6_0);

// Returns whether the system preference for bold text is enabled
UIKIT_EXTERN BOOL UIAccessibilityIsBoldTextEnabled() NS_AVAILABLE_IOS(8_0);
UIKIT_EXTERN NSString *const UIAccessibilityBoldTextStatusDidChangeNotification NS_AVAILABLE_IOS(8_0);

// Returns whether the system preference for grayscale is enabled
UIKIT_EXTERN BOOL UIAccessibilityIsGrayscaleEnabled() NS_AVAILABLE_IOS(8_0);
UIKIT_EXTERN NSString *const UIAccessibilityGrayscaleStatusDidChangeNotification NS_AVAILABLE_IOS(8_0);

// Returns whether the system preference for reduce transparency is enabled
UIKIT_EXTERN BOOL UIAccessibilityIsReduceTransparencyEnabled() NS_AVAILABLE_IOS(8_0);
UIKIT_EXTERN NSString *const UIAccessibilityReduceTransparencyStatusDidChangeNotification NS_AVAILABLE_IOS(8_0);

// Returns whether the system preference for reduce motion is enabled
UIKIT_EXTERN BOOL UIAccessibilityIsReduceMotionEnabled() NS_AVAILABLE_IOS(8_0);
UIKIT_EXTERN NSString *const UIAccessibilityReduceMotionStatusDidChangeNotification NS_AVAILABLE_IOS(8_0);

// Returns whether the system preference for darker colors is enabled
UIKIT_EXTERN BOOL UIAccessibilityDarkerSystemColorsEnabled() NS_AVAILABLE_IOS(8_0);
UIKIT_EXTERN NSString *const UIAccessibilityDarkerSystemColorsStatusDidChangeNotification NS_AVAILABLE_IOS(8_0);

/*
 Use UIAccessibilityIsSwitchControlRunning() to determine if Switch Control is running.
 Listen for UIAccessibilitySwitchControlStatusDidChangeNotification to know when Switch Control starts or stops.
*/
UIKIT_EXTERN BOOL UIAccessibilityIsSwitchControlRunning() NS_AVAILABLE_IOS(8_0);
UIKIT_EXTERN NSString *const UIAccessibilitySwitchControlStatusDidChangeNotification NS_AVAILABLE_IOS(8_0);

// Returns whether the system preference for Speak Selection is enabled
UIKIT_EXTERN BOOL UIAccessibilityIsSpeakSelectionEnabled() NS_AVAILABLE_IOS(8_0);
UIKIT_EXTERN NSString *const UIAccessibilitySpeakSelectionStatusDidChangeNotification NS_AVAILABLE_IOS(8_0);

// Returns whether the system preference for Speak Screen is enabled
UIKIT_EXTERN BOOL UIAccessibilityIsSpeakScreenEnabled() NS_AVAILABLE_IOS(8_0);
UIKIT_EXTERN NSString *const UIAccessibilitySpeakScreenStatusDidChangeNotification NS_AVAILABLE_IOS(8_0);

// Returns whether the system preference for Shake to Undo is enabled
UIKIT_EXTERN BOOL UIAccessibilityIsShakeToUndoEnabled() NS_AVAILABLE_IOS(9_0);
UIKIT_EXTERN NSString *const UIAccessibilityShakeToUndoDidChangeNotification NS_AVAILABLE_IOS(9_0);

/*
 Use UIAccessibilityRequestGuidedAccessSession() to request this app be locked into or released
 from Single App mode. The request to lock this app into Single App mode will only succeed if the device is Supervised,
 and the app's bundle identifier has been whitelisted using Mobile Device Management. If you successfully request Single
 App mode, it is your responsibility to release the device by balancing this call.
 */
UIKIT_EXTERN void UIAccessibilityRequestGuidedAccessSession(BOOL enable, void(^completionHandler)(BOOL didSucceed)) NS_AVAILABLE_IOS(7_0);

NS_ASSUME_NONNULL_END

redpajama_set_name: RedPajamaGithub


text:
namespace Poly2Tri.Triangulation
{
    public enum TriangulationMode
    {
        Unconstrained,
        Constrained,
        Polygon
    }
}


text:
package org.squbs.streams;

import akka.NotUsed;
import akka.actor.ActorSystem;
import akka.japi.Pair;
import akka.stream.ActorMaterializer;
import akka.stream.Materializer;
import akka.stream.javadsl.BidiFlow;
import akka.stream.javadsl.Flow;
import akka.stream.javadsl.Sink;
import akka.stream.javadsl.Source;
import akka.stream.testkit.javadsl.TestSink;
import org.junit.Test;
import org.squbs.metrics.MetricsExtension;
import scala.concurrent.duration.Duration;
import scala.util.Failure;
import scala.util.Success;
import scala.util.Try;

import javax.management.ObjectName;
import java.lang.management.ManagementFactory;
import java.util.Arrays;
import java.util.List;
import java.util.UUID;
import java.util.concurrent.CompletionStage;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicBoolean;
import java.util.function.Function;

import static junit.framework.TestCase.assertTrue;
import static org.junit.Assert.assertEquals;
import static scala.compat.java8.JFunction.*;

public class RetryTest {

    final private ActorSystem system = ActorSystem.create("RetryTest");
    final private Materializer mat = ActorMaterializer.create(system);
    final private Try<String> failure = Failure.apply(new Exception("failed"));

    final class MyContext {
        private String s;
        private UUID uuid;

        public MyContext(String s, UUID uuid) {
            this.s = s;
            this.uuid = uuid;
        }
    }

    @Test
    public void testRetryBidi() throws Exception {

        final Flow<Pair<String, UUID>, Pair<Try<String>, UUID>, NotUsed> flow =
                Flow.<Pair<String, UUID>>create()
                        .map(elem -> new Pair<Try<String>, UUID>(Success.apply(elem.first()), elem.second()));

        final BidiFlow<Pair<String, UUID>, Pair<String, UUID>, Pair<Try<String>, UUID>, Pair<Try<String>, UUID>,
                NotUsed> retry = Retry.create(2);

        final CompletionStage<List<Try<String>>> result =
                Source.from(Arrays.asList("a", "b", "c"))
                        .map(s -> new Pair<>(s, UUID.randomUUID()))
                        .via(retry.join(flow))
                        .map(Pair::first)
                        .runWith(Sink.seq(), mat);

        final List<Try<String>> expected = Arrays.asList(Success.apply("a"), Success.apply("b"), Success.apply("c"));
        List<Try<String>> actual = result.toCompletableFuture().get();
        assertEquals(3, actual.size());
        assertTrue("Did not get the expected elements from retry stage", actual.containsAll(expected));
    }

    @Test
    public void testRetryBidiWithFailures() throws Exception {

        final Flow<Pair<String, UUID>, Pair<Try<String>, UUID>, NotUsed> bottom =
                Flow.<Pair<String, UUID>>create()
                        .map(elem -> {
                            if (elem.first().equals("a") || elem.first().equals("c"))
                                return new Pair<>(failure, elem.second());
                            else
                                return new Pair<>(Success.apply(elem.first()), elem.second());
                        });
        final BidiFlow<Pair<String, UUID>, Pair<String, UUID>, Pair<Try<String>, UUID>,
                Pair<Try<String>, UUID>, NotUsed> retry = Retry.create(2);

        final CompletionStage<List<Try<String>>> result =
                Source.from(Arrays.asList("a", "b", "c"))
                        .map(s -> new Pair<>(s, UUID.randomUUID()))
                        .via(retry.join(bottom))
                        .map(Pair::first)
                        .runWith(Sink.seq(), mat);

        final List<Try<String>> expected = Arrays.asList(failure, Success.apply("b"), failure);
        List<Try<String>> actual = result.toCompletableFuture().get();
        assertEquals(3, actual.size());
        assertTrue("Did not get the expected elements from retry stage", actual.containsAll(expected));
    }

    @Test
    public void testRetryBidiWithRetryFlow() throws Exception {

        final Flow<Pair<String, UUID>, Pair<Try<String>, UUID>, NotUsed> flow =
                Flow.<Pair<String, UUID>>create()
                        .map(elem -> new Pair<Try<String>, UUID>(Success.apply(elem.first()), elem.second()));

        final BidiFlow<Pair<String, UUID>, Pair<String, UUID>, Pair<Try<String>, UUID>, Pair<Try<String>, UUID>,
                NotUsed> retry = Retry.create(3);

        final CompletionStage<List<Try<String>>> result =
                Source.from(Arrays.asList("a", "b", "c"))
                        .map(s -> new Pair<>(s, UUID.randomUUID()))
                        .via(retry.join(flow))
                        .map(Pair::first)
                        .runWith(Sink.seq(), mat);

        final List<Try<String>> expected = Arrays.asList(Success.apply("a"), Success.apply("b"), Success.apply("c"));
        List<Try<String>> actual = result.toCompletableFuture().get();
        assertEquals(3, actual.size());
        assertTrue("Did not get the expected elements from retry stage", actual.containsAll(expected));
    }

    @Test
    public void testRetryBidiWithUniqueIdMapper() throws Exception {
        final Flow<Pair<String, MyContext>, Pair<Try<String>, MyContext>, NotUsed> bottom =
                Flow.<Pair<String, MyContext>>create()
            .map(elem -> {
                if (elem.first().equals("b"))
                    return new Pair<>(failure, elem.second());
                else
                    return new Pair<>(Success.apply(elem.first()), elem.second());
            });

        RetrySettings settings = RetrySettings.<String, String, MyContext>create(3)
                .withUniqueIdMapper(func(context -> context.uuid));
        final BidiFlow<Pair<String, MyContext>, Pair<String, MyContext>, Pair<Try<String>, MyContext>,
                Pair<Try<String>, MyContext>, NotUsed> retryFlow =
                Retry.create(settings);

        final CompletionStage<List<Try<String>>> result =
                Source.from(Arrays.asList("a", "b", "c"))
                        .map(s -> new Pair<>(s, new MyContext("dummy", UUID.randomUUID())))
                        .via(retryFlow.join(bottom))
                        .map(Pair::first)
                        .runWith(Sink.seq(), mat);

        final List<Try<String>> expected = Arrays.asList(Success.apply("a"), Success.apply("c"), failure);
        assertTrue("Did not get the expected elements from retry stage",
            result.toCompletableFuture().get().containsAll(expected));
    }

    @Test
    public void testRetryBidiWithFailureDecider() {
        final Flow<Pair<String, UUID>, Pair<Try<String>, UUID>, NotUsed> bottom =
                Flow.<Pair<String, UUID>>create()
                        .map(elem -> new Pair<Try<String>, UUID>(Success.apply(elem.first()), elem.second()));

        final Function<Try<String>, Boolean> failureDecider =
                out -> out.isFailure() || out.equals(Success.apply("a")); // treat "a" as a failure for retry

        RetrySettings settings = RetrySettings.<String, String, UUID>create(1).withFailureDecider(failureDecider);
        final BidiFlow<Pair<String, UUID>, Pair<String, UUID>, Pair<Try<String>, UUID>,
                Pair<Try<String>, UUID>, NotUsed> retry = Retry.create(settings);

        Source.from(Arrays.asList("a", "b"))
                .map(s -> new Pair<>(s, UUID.randomUUID()))
                .via(retry.join(bottom))
                .map(Pair::first)
                .runWith(TestSink.probe(system), mat)
                .request(2)
                .expectNext(Success.apply("a"), Success.apply("b"));
    }

    @Test
    public void testRetryBidiWithDelay() throws Exception {
        final Flow<Pair<String, UUID>, Pair<Try<String>, UUID>, NotUsed> bottom = Flow.<Pair<String, UUID>>create()
                .map(elem -> {
                    if (elem.first().equals("b"))
                        return new Pair<>(failure, elem.second());
                    else
                        return new Pair<>(Success.apply(elem.first()), elem.second());
                });

        final RetrySettings retrySettings =
                RetrySettings.<String, Try<String>, UUID>create(3)
                        .withDelay(Duration.create(1, TimeUnit.SECONDS));

        final BidiFlow<Pair<String, UUID>, Pair<String, UUID>, Pair<Try<String>, UUID>,
                Pair<Try<String>, UUID>, NotUsed> retry = Retry.create(retrySettings);

        Source.from(Arrays.asList("a", "b", "c"))
                .map(s -> new Pair<>(s, UUID.randomUUID()))
                .via(retry.join(bottom))
                .map(Pair::first)
                .runWith(TestSink.probe(system), mat)
                .request(3)
                .expectNext(Success.apply("a"), Success.apply("c"))
                .expectNoMessage(Duration.create(3, TimeUnit.SECONDS))
                .expectNext(failure);
    }

    @Test
    public void testRetryBidiWithBackoffAndMaxDelay() throws Exception {
        final Flow<Pair<String, UUID>, Pair<Try<String>, UUID>, NotUsed> bottom = Flow.<Pair<String, UUID>>create()
                .map(elem -> {
                    if (elem.first().equals("b"))
                        return new Pair<>(failure, elem.second());
                    else
                        return new Pair<>(Success.apply(elem.first()), elem.second());
                });

        final RetrySettings retrySettings = RetrySettings.<String, Try<String>, UUID>create(3)
                .withDelay(Duration.create(1, TimeUnit.SECONDS))
                .withExponentialBackoff(2.0)
                .withMaxDelay(Duration.create(2, TimeUnit.SECONDS));

        final BidiFlow<Pair<String, UUID>, Pair<String, UUID>, Pair<Try<String>, UUID>,
                Pair<Try<String>, UUID>, NotUsed> retry = Retry.create(retrySettings);

        Source.from(Arrays.asList("a", "b", "c"))
                .map(s -> new Pair<>(s, UUID.randomUUID()))
                .via(retry.join(bottom))
                .map(t -> t.first())
                .runWith(TestSink.probe(system), mat)
                .request(3)
                .expectNext(Success.apply("a"), Success.apply("c"))
                .expectNoMessage(Duration.create(5, TimeUnit.SECONDS)) //1s + 2s + 2s
                .expectNext(failure);
    }

    @Test
    public void testRetryBidiWithMapperDecider() throws Exception {

        final Flow<Pair<String, MyContext>, Pair<Try<String>, MyContext>, NotUsed> bottom =
                Flow.<Pair<String, MyContext>>create()
                        .map(elem -> {
                            if (elem.first().equals("b"))
                                return new Pair<>(failure, elem.second());
                            else
                                return new Pair<>(Success.apply(elem.first()), elem.second());
                        });

        final Function<Try<String>, Boolean> failureDecider =
                out -> out.isFailure() || out.equals(Success.apply("a")); // treat "a" as a failure for retry

        RetrySettings settings = RetrySettings.<String, String, MyContext>create(3)
                .withUniqueIdMapper(func(context -> context.uuid))
                .withFailureDecider(failureDecider);
        final BidiFlow<Pair<String, MyContext>, Pair<String, MyContext>, Pair<Try<String>, MyContext>,
                Pair<Try<String>, MyContext>, NotUsed> retryFlow = Retry.create(settings);

        final CompletionStage<List<Try<String>>> result =
                Source.from(Arrays.asList("a", "b", "c"))
                        .map(s -> new Pair<>(s, new MyContext("dummy", UUID.randomUUID())))
                        .via(retryFlow.join(bottom))
                        .map(t -> t.first())
                        .runWith(Sink.seq(), mat);

        final List<Try<String>> expected = Arrays.asList(Success.apply("a"), Success.apply("c"), failure);
        assertTrue("Did not get the expected elements from retry stage",
            result.toCompletableFuture().get().containsAll(expected));
    }

    @Test
    public void testRetryBidiWithSettingsMapperDecider() throws Exception {
        final Flow<Pair<String, MyContext>, Pair<Try<String>, MyContext>, NotUsed> bottom =
                Flow.<Pair<String, MyContext>>create()
                        .map(elem -> {
                            if (elem.first().equals("b"))
                                return new Pair<>(failure, elem.second());
                            else
                                return new Pair<>(Success.apply(elem.first()), elem.second());
                        });

        final Function<Try<String>, Boolean> failureDecider =
                out -> out.isFailure() || out.equals(Success.apply("a")); // treat "a" as failure

        final RetrySettings<String, String, MyContext> retrySettings =
                RetrySettings.<String, String, MyContext>create(3)
                    .withFailureDecider(failureDecider)
                    .withUniqueIdMapper(func(context -> context.uuid));

        final BidiFlow<Pair<String, MyContext>, Pair<String, MyContext>, Pair<Try<String>, MyContext>,
                Pair<Try<String>, MyContext>, NotUsed> retryFlow =
                Retry.create(retrySettings);

        final CompletionStage<List<Try<String>>> result =
                Source.from(Arrays.asList("a", "b", "c"))
                        .map(s -> new Pair<>(s, new MyContext("dummy", UUID.randomUUID())))
                        .via(retryFlow.join(bottom))
                        .map(Pair::first)
                        .runWith(Sink.seq(), mat);

        final List<Try<String>> expected = Arrays.asList(Success.apply("a"), Success.apply("c"), failure);
        assertTrue("Did not get the expected elements from retry stage",
            result.toCompletableFuture().get().containsAll(expected));
    }

    @Test
    public void testRetryWithMetrics() throws Exception {
        AtomicBoolean first = new AtomicBoolean(true);
        final Flow<Pair<String, UUID>, Pair<Try<String>, UUID>, NotUsed> bottom =
            Flow.<Pair<String, UUID>>create()
                .map(elem -> {
                    if (elem.first().equals("a"))
                        return new Pair<>(failure, elem.second());
                    else if (elem.first().equals("b") && first.get()) {
                        first.set(false);
                        return new Pair<>(failure, elem.second());
                    } else {
                        first.set(true);
                        return new Pair<>(Success.apply(elem.first()), elem.second());
                    }
                });

        final RetrySettings retrySettings =
            RetrySettings.<String, Try<String>, UUID>create(1)
                .withMetrics("myRetry", system);

        final BidiFlow<Pair<String, UUID>, Pair<String, UUID>, Pair<Try<String>, UUID>,
            Pair<Try<String>, UUID>, NotUsed> retry = Retry.create(retrySettings);

        final CompletionStage<List<Try<String>>> result = Source.from(Arrays.asList("a", "b", "c"))
            .map(s -> new Pair<>(s, UUID.randomUUID()))
            .via(retry.join(bottom))
            .map(Pair::first)
            .runWith(Sink.seq(), mat);

        final List<Try<String>> expected = Arrays.asList(failure, Success.apply("b"), Success.apply("c"));
        assertTrue("Did not get the expected elements from retry stage",
            result.toCompletableFuture().get().containsAll(expected));

        assertEquals(2, metricsJmxValue("myRetry.retry-count", "Count"));
        assertEquals(1, metricsJmxValue("myRetry.failed-count", "Count"));
        assertEquals(2, metricsJmxValue("myRetry.success-count", "Count"));
    }

    private int metricsJmxValue(String name, String key) throws Exception {
        ObjectName oName = ObjectName.getInstance(MetricsExtension.get(system).Domain() + ":name=" + name);
        return Integer.parseInt(ManagementFactory.getPlatformMBeanServer().getAttribute(oName, key).toString());
    }
}


text:
class AddPreferredLocaleToUsers < ActiveRecord::Migration[5.2]
  def change
    add_column :users, :preferred_locale, :string
  end
end


text:
package fake

import (
	"k8s.io/kubernetes/pkg/api"
	"k8s.io/kubernetes/pkg/api/v1"
	"k8s.io/kubernetes/pkg/client/testing/core"
	"k8s.io/kubernetes/pkg/fields"
	"k8s.io/kubernetes/pkg/runtime"
)

func (c *FakeEvents) CreateWithEventNamespace(event *v1.Event) (*v1.Event, error) {
	action := core.NewRootCreateAction(eventsResource, event)
	if c.ns != "" {
		action = core.NewCreateAction(eventsResource, c.ns, event)
	}
	obj, err := c.Fake.Invokes(action, event)
	if obj == nil {
		return nil, err
	}

	return obj.(*v1.Event), err
}

// Update replaces an existing event. Returns the copy of the event the server returns, or an error.
func (c *FakeEvents) UpdateWithEventNamespace(event *v1.Event) (*v1.Event, error) {
	action := core.NewRootUpdateAction(eventsResource, event)
	if c.ns != "" {
		action = core.NewUpdateAction(eventsResource, c.ns, event)
	}
	obj, err := c.Fake.Invokes(action, event)
	if obj == nil {
		return nil, err
	}

	return obj.(*v1.Event), err
}

// Patch patches an existing event. Returns the copy of the event the server returns, or an error.
func (c *FakeEvents) Patch(event *v1.Event, data []byte) (*v1.Event, error) {
	action := core.NewRootPatchAction(eventsResource, event)
	if c.ns != "" {
		action = core.NewPatchAction(eventsResource, c.ns, event)
	}
	obj, err := c.Fake.Invokes(action, event)
	if obj == nil {
		return nil, err
	}

	return obj.(*v1.Event), err
}

// Search returns a list of events matching the specified object.
func (c *FakeEvents) Search(objOrRef runtime.Object) (*v1.EventList, error) {
	action := core.NewRootListAction(eventsResource, api.ListOptions{})
	if c.ns != "" {
		action = core.NewListAction(eventsResource, c.ns, api.ListOptions{})
	}
	obj, err := c.Fake.Invokes(action, &v1.EventList{})
	if obj == nil {
		return nil, err
	}

	return obj.(*v1.EventList), err
}

func (c *FakeEvents) GetFieldSelector(involvedObjectName, involvedObjectNamespace, involvedObjectKind, involvedObjectUID *string) fields.Selector {
	action := core.GenericActionImpl{}
	action.Verb = "get-field-selector"
	action.Resource = eventsResource

	c.Fake.Invokes(action, nil)
	return fields.Everything()
}


text:
using System;
using System.ComponentModel;
using System.Linq;
using System.Linq.Expressions;
using System.Reflection;
using System.Threading;
using System.Threading.Tasks;
using Microsoft.EntityFrameworkCore;
using PhantomNet.Entities.EntityFrameworkCore.Properties;

namespace PhantomNet.Entities.EntityFrameworkCore
{
    public static partial class QueryableEntityStoreExtensions
    {
        public static Task<T> FindEntityOrSubEntityByIdAsync<TEntity, TSubEntity, TContext, TKey, T>(
            this IQueryableEntityStoreMarker<TEntity, TSubEntity, TContext, TKey> store,
            string id,
            CancellationToken cancellationToken)
            where TEntity : class, IIdWiseEntity<TKey>
            where TSubEntity : class, IIdWiseEntity<TKey>
            where TContext : DbContext
            where TKey : IEquatable<TKey>
            where T : class
        {
            store.ThrowIfDisposed();
            return store.FindEntityOrSubEntityByIdAsync<TEntity, TSubEntity, TContext, TKey, T>(store.Entities, store.SubEntities, id, cancellationToken);
        }

        public static Task<T> FindEntityOrSubEntityByIdAsync<TEntity, TSubEntity, TContext, TKey, T>(
            this IQueryableEntityStoreMarker<TEntity, TSubEntity, TContext, TKey> store,
            string id,
            Expression<Func<TEntity, TKey>> entityIdSelector,
            Expression<Func<TSubEntity, TKey>> subEntityIdSelector,
            CancellationToken cancellationToken)
            where TEntity : class, IIdWiseEntity<TKey>
            where TSubEntity : class, IIdWiseEntity<TKey>
            where TContext : DbContext
            where TKey : IEquatable<TKey>
            where T : class
        {
            store.ThrowIfDisposed();
            return store.FindEntityOrSubEntityByIdAsync<TEntity, TSubEntity, TContext, TKey, T>(store.Entities, store.SubEntities, id, entityIdSelector, subEntityIdSelector, cancellationToken);
        }
    }

    public static partial class QueryableEntityStoreExtensions
    {
        public static Task<T> FindEntityByIdAsync<TEntity, TContext, TKey, T>(
            this IQueryableEntityStoreMarker<TEntity, TContext, TKey> store,
            string id,
            CancellationToken cancellationToken)
            where TEntity : class, IIdWiseEntity<TKey>
            where TContext : DbContext
            where TKey : IEquatable<TKey>
            where T : class
        {
            store.ThrowIfDisposed();
            return store.FindEntityByIdAsync<TEntity, TContext, TKey, T>(store.Entities, id, cancellationToken);
        }

        public static Task<T> FindEntityByIdAsync<TEntity, TContext, TKey, T>(
            this IQueryableEntityStoreMarker<TEntity, TContext, TKey> store,
            string id,
            Expression<Func<TEntity, TKey>> idSelector,
            CancellationToken cancellationToken)
            where TEntity : class, IIdWiseEntity<TKey>
            where TContext : DbContext
            where TKey : IEquatable<TKey>
            where T : class
        {
            store.ThrowIfDisposed();
            return store.FindEntityByIdAsync<TEntity, TContext, TKey, T>(store.Entities, id, idSelector, cancellationToken);
        }
    }

    public static partial class EntityStoreExtensions
    {
        public static Task<T> FindEntityOrSubEntityByIdAsync<TEntity, TSubEntity, TContext, TKey, T>(
            this IEntityStoreMarker<TEntity, TSubEntity, TContext, TKey> store,
            IQueryable<TEntity> entities,
            IQueryable<TSubEntity> subEntities,
            string id,
            CancellationToken cancellationToken)
            where TEntity : class, IIdWiseEntity<TKey>
            where TSubEntity : class, IIdWiseEntity<TKey>
            where TContext : DbContext
            where TKey : IEquatable<TKey>
            where T : class
        {
            return FindEntityOrSubEntityByIdInternalAsync<TEntity, TSubEntity, TKey, T>(store, entities, subEntities, id, null, null, cancellationToken);
        }

        public static Task<T> FindEntityOrSubEntityByIdAsync<TEntity, TSubEntity, TContext, TKey, T>(
            this IEntityStoreMarker<TEntity, TSubEntity, TContext, TKey> store,
            IQueryable<TEntity> entities,
            IQueryable<TSubEntity> subEntities,
            string id,
            Expression<Func<TEntity, TKey>> entityIdSelector,
            Expression<Func<TSubEntity, TKey>> subEntityIdSelector,
            CancellationToken cancellationToken)
            where TEntity : class, IIdWiseEntity<TKey>
            where TSubEntity : class, IIdWiseEntity<TKey>
            where TContext : DbContext
            where TKey : IEquatable<TKey>
            where T : class
        {
            if (typeof(T) == typeof(TEntity) && entityIdSelector == null)
            {
                throw new ArgumentNullException(nameof(entityIdSelector));
            }
            if (typeof(T) == typeof(TSubEntity) && subEntityIdSelector == null)
            {
                throw new ArgumentNullException(nameof(subEntityIdSelector));
            }

            return FindEntityOrSubEntityByIdInternalAsync<TEntity, TSubEntity, TKey, T>(store, entities, subEntities, id, entityIdSelector, subEntityIdSelector, cancellationToken);
        }

        #region Helpers

        private static async Task<T> FindEntityOrSubEntityByIdInternalAsync<TEntity, TSubEntity, TKey, T>(
            object store,
            IQueryable<TEntity> entities,
            IQueryable<TSubEntity> subEntities,
            string id,
            Expression<Func<TEntity, TKey>> entityIdSelector,
            Expression<Func<TSubEntity, TKey>> subEntityIdSelector,
            CancellationToken cancellationToken)
            where TEntity : class
            where TSubEntity : class
            where TKey : IEquatable<TKey>
            where T : class
        {
            cancellationToken.ThrowIfCancellationRequested();
            if (id == null)
            {
                throw new ArgumentNullException(nameof(id));
            }

            var key = ConvertIdFromString<TKey>(id);

            if (typeof(T) == typeof(TEntity))
            {
                if (entities == null)
                {
                    throw new ArgumentNullException(nameof(entities));
                }

                if (store is IEagerLoadingEntityStore<TEntity>)
                {
                    entities = ((IEagerLoadingEntityStore<TEntity>)store).EagerLoad(entities);
                }

                TEntity entity;

                if (entityIdSelector != null)
                {
                    entity = await entities.SingleOrDefaultAsync(entityIdSelector, key, cancellationToken);
                }
                else if (typeof(IIdWiseEntity<TKey>).IsAssignableFrom(typeof(TEntity)))
                {
                    entity = await entities.SingleOrDefaultAsync(x => ((IIdWiseEntity<TKey>)x).Id.Equals(key), cancellationToken);
                }
                else
                {
                    throw new InvalidOperationException();
                }

                if (store is IExplicitLoadingEntityStore<TEntity> && entity != null)
                {
                    await ((IExplicitLoadingEntityStore<TEntity>)store).ExplicitLoadAsync(entity, cancellationToken);
                }

                return entity as T;
            }
            else if (typeof(T) == typeof(TSubEntity))
            {
                if (subEntities == null)
                {
                    throw new ArgumentNullException(nameof(subEntities));
                }

                if (store is IEagerLoadingEntityStore<TSubEntity>)
                {
                    subEntities = ((IEagerLoadingEntityStore<TSubEntity>)store).EagerLoad(subEntities);
                }

                TSubEntity subEntity;

                if (subEntityIdSelector != null)
                {
                    subEntity = await subEntities.SingleOrDefaultAsync(subEntityIdSelector, key, cancellationToken);
                }
                else if (typeof(IIdWiseEntity<TKey>).IsAssignableFrom(typeof(TSubEntity)))
                {
                    subEntity = await subEntities.SingleOrDefaultAsync(x => ((IIdWiseEntity<TKey>)x).Id.Equals(key), cancellationToken);
                }
                else
                {
                    throw new InvalidOperationException();
                }

                if (store is IExplicitLoadingEntityStore<TSubEntity> && subEntity != null)
                {
                    await ((IExplicitLoadingEntityStore<TSubEntity>)store).ExplicitLoadAsync(subEntity, cancellationToken);
                }

                return subEntity as T;
            }

            throw new InvalidOperationException(string.Format(Strings.EntityTypeOrSubEntityTypeNotSupported, nameof(T), nameof(TEntity), nameof(TSubEntity)));
        }

        #endregion
    }

    public static partial class EntityStoreExtensions
    {
        #region Create

        public static async Task<GenericResult> CreateEntityAsync<TEntity, TContext, TKey>(
            this IEntityStoreMarker<TEntity, TContext, TKey> store,
            TEntity entity, CancellationToken cancellationToken)
            where TEntity : class
            where TContext : DbContext
            where TKey : IEquatable<TKey>
        {
            cancellationToken.ThrowIfCancellationRequested();
            store.ThrowIfDisposed();
            if (entity == null)
            {
                throw new ArgumentNullException(nameof(entity));
            }

            await store.PrepareEntityForSaving(entity);

            store.Context.Add(entity);

            await store.SaveChangesAsync(cancellationToken);

            return GenericResult.Success;
        }

        #endregion

        #region Update

        public static Task<GenericResult> UpdateEntityAsync<TEntity, TContext, TKey>(
            this IEntityStoreMarker<TEntity, TContext, TKey> store,
            TEntity entity,
            CancellationToken cancellationToken)
            where TEntity : class, IConcurrencyStampWiseEntity
            where TContext : DbContext
            where TKey : IEquatable<TKey>
        {
            return UpdateEntityAsync(store, entity, null, cancellationToken);
        }

        public static Task<GenericResult> UpdateEntityAsync<TEntity, TContext, TKey>(
            this IEntityStoreMarker<TEntity, TContext, TKey> store,
            TEntity entity,
            Func<GenericError> describeConcurrencyFailureError,
            CancellationToken cancellationToken)
            where TEntity : class, IConcurrencyStampWiseEntity
            where TContext : DbContext
            where TKey : IEquatable<TKey>
        {
            return UpdateEntityInternalAsync(store, entity, null, describeConcurrencyFailureError, cancellationToken);
        }

        public static Task<GenericResult> UpdateEntityAsync<TEntity, TContext, TKey>(
            this IEntityStoreMarker<TEntity, TContext, TKey> store,
            TEntity entity,
            Action<string> setConcurrencyStamp,
            CancellationToken cancellationToken)
            where TEntity : class
            where TContext : DbContext
            where TKey : IEquatable<TKey>
        {
            return UpdateEntityAsync(store, entity, setConcurrencyStamp, null, cancellationToken);
        }

        public static Task<GenericResult> UpdateEntityAsync<TEntity, TContext, TKey>(
            this IEntityStoreMarker<TEntity, TContext, TKey> store,
            TEntity entity,
            Action<string> setConcurrencyStamp,
            Func<GenericError> describeConcurrencyFailureError,
            CancellationToken cancellationToken)
            where TEntity : class
            where TContext : DbContext
            where TKey : IEquatable<TKey>
        {
            if (setConcurrencyStamp == null)
            {
                throw new ArgumentNullException(nameof(setConcurrencyStamp));
            }

            return UpdateEntityInternalAsync(store, entity, setConcurrencyStamp, describeConcurrencyFailureError, cancellationToken);
        }

        #endregion

        #region Delete

        public static Task<GenericResult> DeleteEntityAsync<TEntity, TContext, TKey>(
            this IEntityStoreMarker<TEntity, TContext, TKey> store,
            TEntity entity, CancellationToken cancellationToken)
            where TEntity : class
            where TContext : DbContext
            where TKey : IEquatable<TKey>
        {
            return DeleteEntityAsync(store, entity, cancellationToken, null);
        }

        public static async Task<GenericResult> DeleteEntityAsync<TEntity, TContext, TKey>(
            this IEntityStoreMarker<TEntity, TContext, TKey> store,
            TEntity entity, CancellationToken cancellationToken,
            Func<GenericError> describeConcurrencyFailureError)
            where TEntity : class
            where TContext : DbContext
            where TKey : IEquatable<TKey>
        {
            cancellationToken.ThrowIfCancellationRequested();
            store.ThrowIfDisposed();
            if (entity == null)
            {
                throw new ArgumentNullException(nameof(entity));
            }

            store.Context.Remove(entity);

            try
            {
                await store.SaveChangesAsync(cancellationToken);
            }
            catch (DbUpdateConcurrencyException)
            {
                return GenericResult.Failed(describeConcurrencyFailureError == null ?
                    new EntityErrorDescriber().ConcurrencyFailure() :
                    describeConcurrencyFailureError());
            }

            return GenericResult.Success;
        }

        #endregion

        public static Task<T> FindEntityByIdAsync<TEntity, TContext, TKey, T>(
            this IEntityStoreMarker<TEntity, TContext, TKey> store,
            IQueryable<TEntity> entities,
            string id,
            CancellationToken cancellationToken)
            where TEntity : class, IIdWiseEntity<TKey>
            where TContext : DbContext
            where TKey : IEquatable<TKey>
            where T : class
        {
            return FindEntityByIdInternalAsync<TEntity, TKey, T>(store, entities, id, null, cancellationToken);
        }

        public static Task<T> FindEntityByIdAsync<TEntity, TContext, TKey, T>(
            this IEntityStoreMarker<TEntity, TContext, TKey> store,
            IQueryable<TEntity> entities,
            string id,
            Expression<Func<TEntity, TKey>> idSelector,
            CancellationToken cancellationToken)
            where TEntity : class, IIdWiseEntity<TKey>
            where TContext : DbContext
            where TKey : IEquatable<TKey>
            where T : class
        {
            if (idSelector == null)
            {
                throw new ArgumentNullException(nameof(idSelector));
            }

            return FindEntityByIdInternalAsync<TEntity, TKey, T>(store, entities, id, idSelector, cancellationToken);
        }

        public static Task<int> CountEntitiesAsync<TEntity, TContext, TKey>(
            this IEntityStoreMarker<TEntity, TContext, TKey> store,
            IQueryable<TEntity> query, CancellationToken cancellationToken)
            where TEntity : class
            where TContext : DbContext
            where TKey : IEquatable<TKey>
        {
            cancellationToken.ThrowIfCancellationRequested();
            store.ThrowIfDisposed();
            if (query == null)
            {
                throw new ArgumentNullException(nameof(query));
            }

            return query.CountAsync(cancellationToken);
        }

        #region Helpers

        private static async Task<GenericResult> UpdateEntityInternalAsync<TEntity, TContext, TKey>(
            IEntityStoreMarker<TEntity, TContext, TKey> store,
            TEntity entity,
            Action<string> setConcurrencyStamp,
            Func<GenericError> describeConcurrencyFailureError,
            CancellationToken cancellationToken)
            where TEntity : class
            where TContext : DbContext
            where TKey : IEquatable<TKey>
        {
            cancellationToken.ThrowIfCancellationRequested();
            store.ThrowIfDisposed();
            if (entity == null)
            {
                throw new ArgumentNullException(nameof(entity));
            }

            await store.PrepareEntityForSaving(entity);

            store.Context.Attach(entity);

            if (setConcurrencyStamp != null)
            {
                setConcurrencyStamp(Guid.NewGuid().ToString());
            }
            else if (entity is IConcurrencyStampWiseEntity)
            {
                ((IConcurrencyStampWiseEntity)entity).ConcurrencyStamp = Guid.NewGuid().ToString();
            }

            store.Context.Update(entity);

            try
            {
                await store.SaveChangesAsync(cancellationToken);
            }
            catch (DbUpdateConcurrencyException)
            {
                return GenericResult.Failed(describeConcurrencyFailureError == null ?
                    new EntityErrorDescriber().ConcurrencyFailure() :
                    describeConcurrencyFailureError());
            }

            return GenericResult.Success;
        }

        private static async Task<T> FindEntityByIdInternalAsync<TEntity, TKey, T>(
            object store,
            IQueryable<TEntity> entities,
            string id,
            Expression<Func<TEntity, TKey>> idSelector,
            CancellationToken cancellationToken)
            where TEntity : class
            where TKey : IEquatable<TKey>
            where T : class
        {
            cancellationToken.ThrowIfCancellationRequested();
            if (entities == null)
            {
                throw new ArgumentNullException(nameof(entities));
            }
            if (id == null)
            {
                throw new ArgumentNullException(nameof(id));
            }
            if (typeof(T) != typeof(TEntity))
            {
                throw new InvalidOperationException(string.Format(Strings.EntityTypeNotSupported, nameof(T), nameof(TEntity)));
            }

            var key = ConvertIdFromString<TKey>(id);

            if (store is IEagerLoadingEntityStore<TEntity>)
            {
                entities = ((IEagerLoadingEntityStore<TEntity>)store).EagerLoad(entities);
            }

            TEntity entity;

            if (idSelector != null)
            {
                entity = await entities.SingleOrDefaultAsync(idSelector, key, cancellationToken);
            }
            else if (typeof(IIdWiseEntity<TKey>).IsAssignableFrom(typeof(TEntity)))
            {
                entity = await entities.SingleOrDefaultAsync(x => ((IIdWiseEntity<TKey>)x).Id.Equals(key), cancellationToken);
            }
            else
            {
                throw new InvalidOperationException();
            }

            if (store is IExplicitLoadingEntityStore<TEntity> && entity != null)
            {
                await ((IExplicitLoadingEntityStore<TEntity>)store).ExplicitLoadAsync(entity, cancellationToken);
            }

            return entity as T;
        }

        private static TKey ConvertIdFromString<TKey>(string id)
            where TKey : IEquatable<TKey>
        {
            if (id == null)
            {
                return default(TKey);
            }

            return (TKey)TypeDescriptor.GetConverter(typeof(TKey)).ConvertFromInvariantString(id);
        }

        #endregion
    }
}


text:
#pragma once
#include <iostream>
#include "util/interruptable_ptr.h"
#include "frontends/lean/frontend.h"

namespace lean {
/** \brief Functional object for parsing commands and expressions */
class parser {
    class imp;
    std::unique_ptr<imp> m_ptr;
public:
    parser(frontend const & fe, std::istream & in, bool use_exceptions = true, bool interactive = false);
    ~parser();

    /** \brief Parse a sequence of commands */
    bool operator()();

    /** \brief Parse a single expression */
    expr parse_expr();

    void set_interrupt(bool flag);
    void interrupt() { set_interrupt(true); }
    void reset_interrupt() { set_interrupt(false); }
};

/** \brief Implements the Read Eval Print loop */
class shell {
    frontend                  m_frontend;
    interruptable_ptr<parser> m_parser;
public:
    shell(frontend const & fe);
    ~shell();

    bool operator()();

    void set_interrupt(bool flag);
    void interrupt() { set_interrupt(true); }
    void reset_interrupt() { set_interrupt(false); }
};

inline bool parse_commands(frontend & fe, std::istream & in, bool use_exceptions = true, bool interactive = false) {
    return parser(fe, in, use_exceptions, interactive)();
}
inline expr parse_expr(frontend const & fe, std::istream & in) {
    return parser(fe, in).parse_expr();
}
}


text:
require 'spec_helper'

describe Compass::Rose do

  describe '::VERSION' do
    subject { Compass::Rose::VERSION }

    it { should be_an_instance_of String }

    it 'should match a simple semver regex' do
      m = /^\d+\.\d+\.\d+$/
      expect(m.match(subject)).not_to be_nil
    end
  end

  describe '.direction' do
    it 'should take no more than two args' do
      expect do
        Compass::Rose.direction(nil, nil, nil)
      end.to raise_error ArgumentError
    end

    it 'should take no less than two args' do
      expect do
        Compass::Rose.direction(nil)
      end.to raise_error ArgumentError
    end

    context 'when given valid bearing' do
      subject { Compass::Rose.direction(42, 32) }

      it { should be_an_instance_of Hash }
    end
  end
end


text:
//
//  UIViewController+YNCategory.h
//  YNPageScrollViewController
//
//  Created by ZYN on 16/7/24.
//  Copyright © 2016年 Yongneng Zheng. All rights reserved.
//

#import <UIKit/UIKit.h>

@class YNPageScrollViewController;

@interface UIViewController (YNCategory)

/** YNPageScrollViewController子类可以直接获取*/
- (YNPageScrollViewController *)ynPageScrollViewController;

@end


text:
@class Restaurant;

@protocol Images

@end

@interface Images : JSONModel
    @property (strong, nonatomic) NSString *id;
    @property (strong, nonatomic) NSString *url;
    @property (strong, nonatomic) Restaurant *restaurant;
    @property (strong, nonatomic) Dishes *dish;
@end


text:
<?xml version="1.0" encoding="UTF-8"?>

<!-- config.xml reference: https://build.phonegap.com/docs/config-xml -->
<widget xmlns                   = "http://www.w3.org/ns/widgets"
        xmlns:gap               = "http://phonegap.com/ns/1.0"
        id                      = "air.se.hotmat.orderstatus"
        versionCode	        = "2000000"
        ios-CFBundleVersion     = "2000000"
        version                 = "2.0.0">

        <!-- App ID for Android: air.se.hotmat.orderstatus -->
        <!-- App ID for iOS: air.se.hotmat.orderstatus -->

    <name>Orderstatus</name>

    <description>
        This is an app to manage restaurant orders
    </description>

    <author href="http://www.hotmat.se" email="info@hotmat.se">
        Behzad Rostami
    </author>

    <!-- Define the main entry-point to the application -->
    <content src="index.html" />

    <!-- Customize your app and platform with the preference element. -->
    <preference name="DisallowOverscroll"         value="true" />
    <!-- android: MIN SDK version supported on the target device. MAX version is blank by default. -->
    <!--preference name="android-minSdkVersion"      value="14" /-->

    <!-- Define a specific version of PhoneGap to build into your app. -->
    <!--preference name="phonegap-version"       value="cli-6.5.0" /-->

    <!-- Plugins -->
    <!-- Core plugins -->

    <plugin name="cordova-plugin-battery-status"/>
    <plugin name="cordova-plugin-device"/>
    <plugin name="cordova-plugin-device-orientation"/>
    <plugin name="cordova-plugin-dialogs"/>
    <plugin name="cordova-plugin-inappbrowser"/>
    <plugin name="cordova-plugin-media"/>
    <plugin name="cordova-plugin-statusbar"/>
    <plugin name="cordova-plugin-vibration"/>
    <plugin name="cordova-plugin-file"/>
    <plugin name="cordova-plugin-insomnia" />
    <plugin name="cordova-plugin-background-mode" />
    <plugin name="cordova-plugin-splashscreen"/>
    <plugin name="cordova-plugin-device-motion"/>
    <plugin name="cordova-plugin-geolocation"/>
    <plugin name="cordova-plugin-network-information"/>
    <!--plugin name="cordova-plugin-ble-central" source="npm" /-->
    <gap:plugin name="cordova-plugin-bluetoothle" source="npm" />
    <plugin name="cordova-plugin-whitelist" spec="1" />
    <plugin name="phonegap-plugin-push"  spec="1.9.0">
        <variable name="SENDER_ID" value="812663353807" />
    </plugin>
    <plugin name="cordova-plugin-kiosk"/>

    <!--
    <plugin name="cordova-plugin-camera"              source="npm" spec="~2.1.1" />
    <plugin name="cordova-plugin-media-capture"       source="npm" spec="~1.2.0" />
    <plugin name="cordova-plugin-console"             source="npm" spec="~1.0.2" />
    <plugin name="cordova-plugin-contacts"            source="npm" spec="~2.0.1" />
    <plugin name="cordova-plugin-file-transfer"       source="npm" spec="~1.5.0" />
    <plugin name="cordova-plugin-globalization"       source="npm" spec="~1.0.3" />
    <plugin name="cordova-plugin-whitelist"           source="npm" spec="~1.2.1" />
    -->

    <!-- Define app icon and splashscreen for each platform. -->
    <platform name="android">
        <icon   src="www/res/icon/android/drawable-ldpi-icon.png"               density="ldpi" />
        <icon   src="www/res/icon/android/drawable-mdpi-icon.png"               density="mdpi" />
        <icon   src="www/res/icon/android/drawable-hdpi-icon.png"               density="hdpi" />
        <icon   src="www/res/icon/android/drawable-xhdpi-icon.png"              density="xhdpi" />
        <icon   src="www/res/icon/android/drawable-xxhdpi-icon.png"             density="xxhdpi" />
        <icon   src="www/res/icon/android/drawable-xxxhdpi-icon.png"            density="xxxhdpi" />
        <splash src="www/res/screen/android/drawable-land-ldpi-screen.png"      density="land-ldpi" />
        <splash src="www/res/screen/android/drawable-land-mdpi-screen.png"      density="land-mdpi" />
        <splash src="www/res/screen/android/drawable-land-hdpi-screen.png"      density="land-hdpi" />
        <splash src="www/res/screen/android/drawable-land-xhdpi-screen.png"     density="land-xhdpi" />
        <splash src="www/res/screen/android/drawable-land-xxhdpi-screen.png"    density="land-xxhdpi" />
        <splash src="www/res/screen/android/drawable-land-xxxhdpi-screen.png"   density="land-xxxhdpi" />
        <splash src="www/res/screen/android/drawable-port-ldpi-screen.png"      density="port-ldpi" />
        <splash src="www/res/screen/android/drawable-port-mdpi-screen.png"      density="port-mdpi" />
        <splash src="www/res/screen/android/drawable-port-hdpi-screen.png"      density="port-hdpi" />
        <splash src="www/res/screen/android/drawable-port-xhdpi-screen.png"     density="port-xhdpi" />
        <splash src="www/res/screen/android/drawable-port-xxhdpi-screen.png"    density="port-xxhdpi" />
        <splash src="www/res/screen/android/drawable-port-xxxhdpi-screen.png"   density="port-xxxhdpi" />
        <resource-file src="google-services.json" target="google-services.json" />
    </platform>

    <platform name="ios">
        <icon   src="www/res/icon/ios/icon.png"                         platform="ios" width="57"   height="57" />
        <icon   src="www/res/icon/ios/icon@2x.png"                      platform="ios" width="114"  height="114" />
        <icon   src="www/res/icon/ios/icon-40.png"                      platform="ios" width="40"   height="40" />
        <icon   src="www/res/icon/ios/icon-40@2x.png"                   platform="ios" width="80"   height="80" />
        <icon   src="www/res/icon/ios/icon-50.png"                      platform="ios" width="50"   height="50" />
        <icon   src="www/res/icon/ios/icon-50@2x.png"                   platform="ios" width="100"  height="100" />
        <icon   src="www/res/icon/ios/icon-60.png"                      platform="ios" width="60"   height="60" />
        <icon   src="www/res/icon/ios/icon-60@2x.png"                   platform="ios" width="120"  height="120" />
        <icon   src="www/res/icon/ios/icon-60@3x.png"                   platform="ios" width="180"  height="180" />
        <icon   src="www/res/icon/ios/icon-72.png"                      platform="ios" width="72"   height="72" />
        <icon   src="www/res/icon/ios/icon-72@2x.png"                   platform="ios" width="144"  height="144" />
        <icon   src="www/res/icon/ios/icon-76.png"                      platform="ios" width="76"   height="76" />
        <icon   src="www/res/icon/ios/icon-76@2x.png"                   platform="ios" width="152"  height="152" />
        <icon   src="www/res/icon/ios/icon-small.png"                   platform="ios" width="29"   height="29" />
        <icon   src="www/res/icon/ios/icon-small@2x.png"                platform="ios" width="58"   height="58" />
        <icon   src="www/res/icon/ios/icon-small@3x.png"                platform="ios" width="87"   height="87" />
        <splash src="www/res/screen/ios/Default-568h@2x~iphone.png"     platform="ios" width="640"  height="1136" />
        <splash src="www/res/screen/ios/Default-667h.png"               platform="ios" width="750"  height="1334" />
        <splash src="www/res/screen/ios/Default-736h.png"               platform="ios" width="1242" height="2208" />
        <splash src="www/res/screen/ios/Default-Landscape-736h.png"     platform="ios" width="2208" height="1242" />
        <splash src="www/res/screen/ios/Default-Landscape@2x~ipad.png"  platform="ios" width="2048" height="1536" />
        <splash src="www/res/screen/ios/Default-Landscape~ipad.png"     platform="ios" width="1024" height="768" />
        <splash src="www/res/screen/ios/Default-Portrait@2x~ipad.png"   platform="ios" width="1536" height="2048" />
        <splash src="www/res/screen/ios/Default-Portrait~ipad.png"      platform="ios" width="768"  height="1024" />
        <splash src="www/res/screen/ios/Default@2x~iphone.png"          platform="ios" width="640"  height="960" />
        <splash src="www/res/screen/ios/Default~iphone.png"             platform="ios" width="320"  height="480" />
        <resource-file src="GoogleService-Info.plist" />
    </platform>

    <!--
        Define access to external domains.
        <access />            - a blank access tag denies access to all external resources.
        <access origin="*" /> - a wildcard access tag allows access to all external resource.
        Otherwise, you can specify specific domains:
    -->
    <access origin="*" />
    <!--
       <access origin="http://phonegap.com" />                    - allow any secure requests to http://phonegap.com/
       <access origin="http://phonegap.com" subdomains="true" />  - same as above, but including subdomains, such as http://build.phonegap.com/
       <access origin="http://phonegap.com" browserOnly="true" /> - only allows http://phonegap.com to be opened by the child browser.
    -->

    <!-- Added the following intents to support the removal of whitelist code from base cordova to a plugin -->
    <!-- Whitelist configuration. Refer to https://cordova.apache.org/docs/en/edge/guide_appdev_whitelist_index.md.html -->

    <allow-intent href="http://*/*" />
    <allow-intent href="https://*/*" />
    <allow-intent href="tel:*" />
    <allow-intent href="sms:*" />
    <allow-intent href="mailto:*" />
    <allow-intent href="geo:*" />
    <platform name="android">
        <resource-file src="test.mp3" target="res/raw/test.mp3" />
        <allow-intent href="market:*" />
    </platform>
    <platform name="ios">
        <allow-intent href="itms:*" />
        <allow-intent href="itms-apps:*" />
    </platform>
</widget>


text:
<?php

if (!defined('_PS_VERSION_'))
	exit;

class ProductifyUpdateModuleFrontController extends ModuleFrontController
{
	public function initContent()
	{
		parent::initContent();

        $result = Productify::startCronUpdate();

        if($result != null)
        {
            //echo "send email";
            $cron_status = Db::getInstance()->executeS("select * from "._DB_PREFIX_."productify_import where import_id = $result");
            $detail = $cron_status[0];
            $added = $detail['imported'];
            $failed = $detail['failed'];
            $updated_prds = $detail['updated_products'];
            $updated_prds = explode(", ",$updated_prds);
            if($updated_prds[0]!='')
            {
                $total_updated = count($updated_prds);
                $total_added = $added - $total_updated;
            }
            else
            {
                $total_added = $added;
                $total_updated = 0;
            }

            $total_failed = $failed;

            if($total_updated > 0)
            {
                $updated_products_string = "

Updated products:
";
                $updated_products_string .= implode("
",$updated_prds);
                $updated_products_string .= "

";
            }
            else
            {
                $updated_products_string = "

";
            }

            $message = "

                            <title>Data imported successfully</title>

                            Hi there,

                            The Productify Import has been successfully completed.

                            Details:

                            Total records imported: ".$total_added."

                            Total records updated: ".$total_updated."

                            Total records failed: ".$total_failed.$updated_products_string."
                            Please login into your store to see the imported Products.
                            Note, depending on preferences chosen, you may have to enable the Products
                            or Categories within the admin to display the products in your store.

                            Regards

                        ";
            $to = $detail['email'];
            $subject = "Data Imported Successfully";

            $headers = 'MIME-Version: 1.0' . "\r\n";
            $headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
            $headers .= "From: Productify.com<noreply@productify.com> \r\n";

            $sendig_mail = mail($to,$subject,$message,$headers);
            //$id_lang = new Language((int)(Configuration::get('PS_LANG_DEFAULT')));
            //Mail::Send($id_lang,$message,$subject,'',$to,'','noreply@productify.com','Productify.com');

        }
        else
        {

        }
    }

}

?>


text:
# Generate uniform-distributed random 0,1
# Generate Bernoulli-distributed random binary numbers
# Generate Poisson-distributed random integers
# Generate integers randomly distributed in range [0, M-1]
# Generate Barker Code
# Generate Gold sequence from set of sequences
# Generate Hadamard code from orthogonal set of codes
# Generate Kasami sequence from set of Kasami sequences
# Generate orthogonal variable spreading factor (OVSF) code from set of orthogonal codes
# Generate pseudonoise sequence
# Generate Walsh code from orthogonal set of codes
# Read baseband signals from file

# ---------------------------------
import numpy as np

def uniform(n):
	bits=np.random.randint(2,size=n)
	return bits

#generate uniform distribution ranodm 0,1

#


text:
import subprocess
import sys

from geopandas._compat import PANDAS_GE_10

def test_no_additional_imports():
    # test that 'import geopandas' does not import any of the optional or
    # development dependencies
    blacklist = {
        "pytest",
        "py",
        "ipython",
        # fiona actually gets imported if installed (but error suppressed until used)
        # "fiona",
        # "matplotlib",  # matplotlib gets imported by pandas, see below
        "mapclassify",
        # 'rtree',  # rtree actually gets imported if installed
        "sqlalchemy",
        "psycopg2",
        "geopy",
        "geoalchemy2",
    }
    if PANDAS_GE_10:
        # pandas > 0.25 stopped importing matplotlib by default
        blacklist.add("matplotlib")

    code = """
import sys
import geopandas
blacklist = {0!r}

mods = blacklist & set(m.split('.')[0] for m in sys.modules)
if mods:
    sys.stderr.write('err: geopandas should not import: {{}}'.format(', '.join(mods)))
    sys.exit(len(mods))
""".format(
        blacklist
    )
    call = [sys.executable, "-c", code]
    returncode = subprocess.run(call).returncode
    assert returncode == 0


text:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

    <meta http-equiv="content-type" content="text/html; charset=utf-8"/>
    <title>Statistics of Number in UD_Manx-Cadhan</title>
    <link rel="root" href=""/>
    <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.4.0/css/font-awesome.min.css">
    <link rel="stylesheet" type="text/css" href="../../css/jquery-ui-redmond.css"/>
    <link rel="stylesheet" type="text/css" href="../../css/style.css"/>
    <link rel="stylesheet" type="text/css" href="../../css/style-vis.css"/>
    <link rel="stylesheet" type="text/css" href="../../css/hint.css"/>

          home

          edit page
          issue tracker

          <gcse:search></gcse:search>

        This page pertains to UD version 2.

            It appears that you have Javascript disabled.
            Please consider enabling Javascript for this page to see the visualizations.

Treebank Statistics: UD_Manx-Cadhan: Features: Number

This feature is universal.
It occurs with 2 different values: Plur, Sing.

5016 tokens (24%) have a non-empty value of Number.
147 types (5%) occur at least once with a non-empty value of Number.
89 lemmas (4%) occur at least once with a non-empty value of Number.
The feature is used with 4 part-of-speech tags: <tt>PRON</tt> (3051; 15% instances), <tt>DET</tt> (1731; 8% instances), <tt>VERB</tt> (218; 1% instances), <tt>ADJ</tt> (16; 0% instances).

PRON

3051 <tt>PRON</tt> tokens (92% of all PRON tokens) have a non-empty value of Number.

The most frequent other feature values with which PRON and Number co-occurred: <tt>Person</tt><tt>=3</tt> (2571; 84%), <tt>Gender</tt><tt>=Masc</tt> (2297; 75%).

PRON tokens may have the following values of Number:

Plur (230; 8% of non-empty Number): ad, shin, shiu, adsyn, shiuish, mayd, shinyn

Sing (2821; 92% of non-empty Number): eh, mee, oo, ee, eshyn, mish, ou, uss, ish, m'

EMPTY (259): hene, shen, shoh, cre, ny, quoi, Cuin, c'raad, c'red, hen

DET

1731 <tt>DET</tt> tokens (91% of all DET tokens) have a non-empty value of Number.

The most frequent other feature values with which DET and Number co-occurred: <tt>Gender</tt><tt>=EMPTY</tt> (1312; 76%), <tt>Definite</tt><tt>=Def</tt> (1155; 67%), <tt>Person</tt><tt>=EMPTY</tt> (1155; 67%), <tt>Poss</tt><tt>=EMPTY</tt> (1155; 67%), <tt>PronType</tt><tt>=Art</tt> (1155; 67%).

DET tokens may have the following values of Number:

Plur (186; 11% of non-empty Number): ny, nyn

Sing (1545; 89% of non-empty Number): yn, y, e, ny, 'n, my, dty, n', dt', m'

EMPTY (176): dagh, ooilley, shoh, shen, chooilley, dy, gagh, y

Paradigm yn	<tt>Sing</tt>	<tt>Plur</tt>

<tt><tt>Case</tt><tt>=Gen</tt></tt>	ny

<tt></tt>	yn, y, 'n	ny

VERB

218 <tt>VERB</tt> tokens (8% of all VERB tokens) have a non-empty value of Number.

The most frequent other feature values with which VERB and Number co-occurred: <tt>Form</tt><tt>=EMPTY</tt> (196; 90%), <tt>Tense</tt><tt>=EMPTY</tt> (186; 85%), <tt>Mood</tt><tt>=Imp</tt> (181; 83%).

VERB tokens may have the following values of Number:

Plur (16; 7% of non-empty Number): bee-jee, insh-jee, Ettyl-jee, Iu-jee, Jeeagh-jee, gow-jee, moyllee'jee, saue-jee, shass-jee, vaikmayd

Sing (202; 93% of non-empty Number): cur, jean, lhig, tar, gow, immee, Verym, Smooinee, bee, insh

EMPTY (2515): t', ta, ren, hug, va, vel, haink, v', nel, hooar

Paradigm bee	<tt>Sing</tt>	<tt>Plur</tt>

<tt><tt>Form</tt><tt>=Emp</tt>|<tt>Mood</tt><tt>=Cnd</tt>|<tt>Person</tt><tt>=1</tt></tt>	beigns

<tt><tt>Form</tt><tt>=Emp</tt>|<tt>Mood</tt><tt>=Ind</tt>|<tt>Person</tt><tt>=1</tt>|<tt>Tense</tt><tt>=Fut</tt></tt>	beem's

<tt><tt>Form</tt><tt>=Len</tt>|<tt>Mood</tt><tt>=Cnd</tt>|<tt>Person</tt><tt>=1</tt></tt>	Veign

<tt><tt>Mood</tt><tt>=Cnd</tt>|<tt>Person</tt><tt>=1</tt></tt>	beign

<tt><tt>Mood</tt><tt>=Imp</tt>|<tt>Person</tt><tt>=2</tt></tt>	bee	bee-jee

<tt><tt>Mood</tt><tt>=Ind</tt>|<tt>Person</tt><tt>=1</tt>|<tt>Tense</tt><tt>=Fut</tt></tt>	bee'm

Number seems to be lexical feature of VERB. 93% lemmas (62) occur only with one value of Number.

ADJ

16 <tt>ADJ</tt> tokens (2% of all ADJ tokens) have a non-empty value of Number.

ADJ tokens may have the following values of Number:

Plur (16; 100% of non-empty Number): beggey, aegey, baney, seyrey, cammey, liauyrey, mooarey

EMPTY (983): mie, erbee, mooar, elley, vie, share, beg, currit, drogh, jeant

Relations with Agreement in Number

The 10 most frequent relations where parent and child node agree in Number:
<tt>VERB –[<tt>conj</tt>]–> VERB</tt> (19; 70%),
<tt>PRON –[<tt>fixed</tt>]–> PRON</tt> (3; 100%),
<tt>PRON –[<tt>conj</tt>]–> PRON</tt> (1; 100%).

© 2014–2021
            Universal Dependencies contributors.
            Site powered by Annodoc and brat
.


text:
'use strict';

var _ = require('lodash');

class ParticipantGroup {
  constructor(id, label, category, participantList=[]) {
    this.id = id;
    this.label = label;
    this.category = category;
    this.participantList = participantList;
  }

  addParticipant(participant) {
    if(!_.includes(this.participantList, participant)){
    this.participantList.push(participant);
    }
  }

  removeParticipant(participant) {
    var index = this.participantList.indexOf(participant);
    if (index > -1) {
      this.participantList.splice(index, 1);
    }
    return index > -1;
  }
}

module.exports = ParticipantGroup;


text:
<?php

namespace Phinx\Console\Command;

use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Output\OutputInterface;

class Status extends AbstractCommand
{
    /**
     * {@inheritdoc}
     */
    protected function configure()
    {
        parent::configure();

        $this->addOption('--environment', '-e', InputOption::VALUE_REQUIRED, 'The target environment.');

        $this->setName('status')
             ->setDescription('Show migration status')
             ->addOption('--format', '-f', InputOption::VALUE_REQUIRED, 'The output format: text or json. Defaults to text.')
             ->setHelp(
<<<EOT
The <info>status</info> command prints a list of all migrations, along with their current status

<info>phinx status -e development</info>
<info>phinx status -e development -f json</info>
EOT
             );
    }

    /**
     * Show the migration status.
     *
     * @param InputInterface $input
     * @param OutputInterface $output
     * @return void
     */
    protected function execute(InputInterface $input, OutputInterface $output)
    {
        $this->bootstrap($input, $output);

        $environment = $input->getOption('environment');
        $format = $input->getOption('format');

        if (null === $environment) {
            $environment = $this->getConfig()->getDefaultEnvironment();
            $output->writeln('<comment>warning</comment> no environment specified, defaulting to: ' . $environment);
        } else {
            $output->writeln('<info>using environment</info> ' . $environment);
        }
        if (null !== $format) {
            $output->writeln('<info>using format</info> ' . $format);
        }

        // print the status
        $this->getManager()->printStatus($environment, $format);
    }
}


text:
package org.elasticsearch.index.fielddata.fieldcomparator;

import org.apache.lucene.search.FieldComparator;
import org.apache.lucene.search.SortField;
import org.elasticsearch.common.Nullable;
import org.elasticsearch.index.fielddata.IndexFieldData;
import org.elasticsearch.index.fielddata.IndexNumericFieldData;

import java.io.IOException;

/**
 */
public class FloatValuesComparatorSource extends IndexFieldData.XFieldComparatorSource {

    private final IndexNumericFieldData<?> indexFieldData;
    private final Object missingValue;
    private final SortMode sortMode;

    public FloatValuesComparatorSource(IndexNumericFieldData<?> indexFieldData, @Nullable Object missingValue, SortMode sortMode) {
        this.indexFieldData = indexFieldData;
        this.missingValue = missingValue;
        this.sortMode = sortMode;
    }

    @Override
    public SortField.Type reducedType() {
        return SortField.Type.FLOAT;
    }

    @Override
    public FieldComparator<?> newComparator(String fieldname, int numHits, int sortPos, boolean reversed) throws IOException {
        assert fieldname.equals(indexFieldData.getFieldNames().indexName());

        float dMissingValue;
        if (missingValue == null || "_last".equals(missingValue)) {
            dMissingValue = reversed ? Float.NEGATIVE_INFINITY : Float.POSITIVE_INFINITY;
        } else if ("_first".equals(missingValue)) {
            dMissingValue = reversed ? Float.POSITIVE_INFINITY : Float.NEGATIVE_INFINITY;
        } else {
            dMissingValue = missingValue instanceof Number ? ((Number) missingValue).floatValue() : Float.parseFloat(missingValue.toString());
        }

        return new FloatValuesComparator(indexFieldData, dMissingValue, numHits, sortMode);
    }
}


text:
<!Doctype html>

    <meta charset='utf-8'>
    <title>1. Hello World!</title>

Hello World!


text:
jpa-core
========

jpa-core is a frameword to facilitate JPA entity integration in Java EE projects


text:
// create a set of shared classes
var remotes = require('../').create();

// expose a simple object
var user = remotes.exports.user = {
  greet: function (fn) {
    fn(null, {msg: 'hello, world!'});
  }
};

// share the greet method
user.greet.shared = true;

// expose it over http
require('http')
  .createServer(remotes.handler('rest'))
  .listen(3000);

/*

Test the above with curl or a rest client:

  $ node simple.js
  $ curl http://localhost:3000/user/greet
  {
    "msg": "hello, world!"
  }

*/


text:
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE element [
<!ENTITY % ent>
]>
<element>wrong entity declaration</element>