text:
@interface SBLMatcherTestBlockRunner : NSObject

- (id)initAndPassBlockToMock:(SBLTestingClass *)mock;

@property (nonatomic, readonly) SBLTestingClass *mock;
@property (nonatomic) NSObject *objectPassedToBlock;

@end

@implementation SBLMatcherTestBlockRunner

- (id)initAndPassBlockToMock:(SBLTestingClass *)mock {
    if (self = [super init]) {
        _mock = mock;
        [self passBlockToMock];
    }
    return self;
}

- (void)passBlockToMock {
    __weak SBLMatcherTestBlockRunner *weakSelf = self;
    [self.mock methodWithBlock:^(int integer, NSObject *object) {
        weakSelf.objectPassedToBlock = object;
    }];
}

@end

@interface SBLMatcherTest : XCTestCase

@property (nonatomic) NSObject *capturedObject;

@end

@implementation SBLMatcherTest

- (void)testWhenMethodStubbedWithAnyMatcherThenCorrectValueIsReturned {
    SBLTestingClass *mock = mock(SBLTestingClass.class);

	[when([mock methodWithObject:any()]) thenReturn:@"one"];
	[when([mock methodWithInteger:any(NSInteger)]) thenReturn:@"two"];

	XCTAssertEqualObjects([mock methodWithObject:@11], @"one");
	XCTAssertEqualObjects([mock methodWithObject:@42], @"one");
	XCTAssertEqualObjects([mock methodWithObject:nil], @"one");

	XCTAssertEqualObjects([mock methodWithInteger:11], @"two");
	XCTAssertEqualObjects([mock methodWithInteger:42], @"two");
	XCTAssertEqualObjects([mock methodWithInteger:0], @"two");
}

- (void)testWhenMultipleArgumentMethodHasMatcherForOneArgumentThenOtherArgumentIsUsedForMatching {
    SBLTestingClass *mock = mock(SBLTestingClass.class);

	[when([mock methodWithArgument1:@"arg1" argument2:any()]) thenReturn:@"one"];
	[when([mock methodWithArgument1:@"arg2" argument2:any()]) thenReturn:@"two"];
	[when([mock methodWithArgument1:any() argument2:@"arg3"]) thenReturn:@"three"];
	[when([mock methodWithArgument1:any() argument2:@"arg4"]) thenReturn:@"four"];

	XCTAssertEqualObjects([mock methodWithArgument1:@"arg1" argument2:@"other stuff"], @"one");
	XCTAssertEqualObjects([mock methodWithArgument1:@"arg2" argument2:@"other stuff"], @"two");
	XCTAssertEqualObjects([mock methodWithArgument1:@"stuff" argument2:@"arg3"], @"three");
	XCTAssertEqualObjects([mock methodWithArgument1:@"stuff" argument2:@"arg4"], @"four");
	XCTAssertNil([mock methodWithArgument1:@"stuff" argument2:@"other stuff"]);
}

- (void)testAnyMatcherWorksForManyArgumentTypes {
    SBLTestingClass *mock = mock(SBLTestingClass.class);
    SBLTestingClass *mock2 = mock(SBLTestingClass.class);
	[when([mock methodWithBool:any(BOOL)]) thenReturn:@"return"];
	[when([mock methodWithInteger:any(NSInteger)]) thenReturn:@"return"];
	[when([mock methodWithPrimitiveReference:any(NSInteger *)]) thenReturn:@"return"];
	[when([mock methodWithReference:any(__autoreleasing NSString **)]) thenReturn:@"return"];
	[when([mock methodWithSelector:any(SEL)]) thenReturn:@"return"];
	[when([mock methodWithCGRect:any(CGRect)]) thenReturn:@"return"];
	[when([mock methodWithStruct:any(SBLTestingStruct)]) thenReturn:@"return"];
	[when([mock methodWithStructReference:any(SBLTestingStruct *)]) thenReturn:@"return"];
	[when([mock methodWithBlock:any()]) thenReturn:@"return"];
	[when([mock2 methodWithBlock:any(SBLTestingBlock)]) thenReturn:@"return"];
	[when([mock methodWithObject:any()]) thenReturn:@"return"];
	[when([mock2 methodWithObject:any(NSNumber *)]) thenReturn:@"return"];
	[when([mock methodWithClass:any()]) thenReturn:@"return"];
	[when([mock2 methodWithClass:any(Class)]) thenReturn:@"return"];

	XCTAssertEqualObjects([mock methodWithInteger:23], @"return");
	XCTAssertEqualObjects([mock methodWithBool:YES], @"return");
	NSInteger integer = 42;
	XCTAssertEqualObjects([mock methodWithPrimitiveReference:&integer], @"return");
	NSString *string = @"42";
	XCTAssertEqualObjects([mock methodWithReference:&string], @"return");
	XCTAssertEqualObjects([mock methodWithSelector:@selector(testAnyMatcherWorksForManyArgumentTypes)], @"return");
	XCTAssertEqualObjects([mock methodWithCGRect:CGRectMake(10, 1, 30, 50)], @"return");
	SBLTestingStruct testingStruct = { 1, YES, "other stuff" };
	XCTAssertEqualObjects([mock methodWithStruct:testingStruct], @"return");
	XCTAssertEqualObjects([mock methodWithStructReference:&testingStruct], @"return");
	SBLTestingBlock block = ^(int integer, NSObject *object) {
		NSLog(@"block");
	};
	XCTAssertEqualObjects([mock methodWithBlock:block], @"return");
	XCTAssertEqualObjects([mock methodWithClass:[NSArray class]], @"return");
	XCTAssertEqualObjects([mock2 methodWithClass:[NSArray class]], @"return");
	XCTAssertEqualObjects([mock methodWithObject:@2], @"return");
	XCTAssertEqualObjects([mock2 methodWithObject:@2], @"return");
}

- (void)testCaptureCapturesArgumentInWhen {
    SBLTestingClass *mock = mock(SBLTestingClass.class);
    BOOL capturedBool = NO;
    NSInteger capturedInteger = 0;
    NSNumber *capturedObject = nil;
    __block BOOL capturedBlockRun = NO;
	SBLTestingBlock capturedBlock = nil;
	NSTimeInterval capturedTimeInterval;
	CGRect capturedRect;

	when([mock methodWithBool:capture(&capturedBool)]);
	when([mock methodWithTimeInterval:capture(&capturedTimeInterval)]);
	when([mock methodWithInteger:capture(&capturedInteger)]);
	when([mock methodWithObject:capture(&capturedObject)]);
	when([mock methodWithBlock:capture(&capturedBlock)]);
	when([mock methodWithCGRect:capture(&capturedRect)]);

    [mock methodWithBool:YES];
    XCTAssertTrue(capturedBool);
    [mock methodWithTimeInterval:1337.0423];
    XCTAssertEqual(capturedTimeInterval, 1337.0423);
    [mock methodWithInteger:42];
    XCTAssertEqual(capturedInteger, (NSInteger)42);
    [mock methodWithObject:@42];
    XCTAssertEqualObjects(capturedObject, @42);
    [mock methodWithBlock:^(int integer, NSObject *object) {
        capturedBlockRun = YES;
    }];
    if (capturedBlock) {
        capturedBlock(1, @1);
    }
    XCTAssertTrue(capturedBlockRun);
}

- (void)testCaptureCapturesArgumentInVerify {
    SBLTestingClass *mock = mock(SBLTestingClass.class);
    BOOL capturedBool = NO;
    NSInteger capturedInteger = 0;
    NSNumber *capturedObject = nil;
    __block BOOL capturedBlockRun = NO;
    SBLTestingBlock capturedBlock = nil;

    [mock methodWithBool:YES];
    [mock methodWithInteger:42];
    [mock methodWithObject:@42];
    [mock methodWithBlock:^(int integer, NSObject *object) {
        capturedBlockRun = YES;
    }];

	verifyTimes(atLeast(1), [mock methodWithBool:capture(&capturedBool)]);
	verifyTimes(atLeast(1), [mock methodWithInteger:capture(&capturedInteger)]);
	verifyTimes(atLeast(1), [mock methodWithObject:capture(&capturedObject)]);
	verifyTimes(atLeast(1), [mock methodWithBlock:capture(&capturedBlock)]);

    XCTAssertTrue(capturedBool);
    XCTAssertEqual(capturedInteger, (NSInteger)42);
    XCTAssertEqualObjects(capturedObject, @42);
    if (capturedBlock) {
        capturedBlock(1, @1);
    }
    XCTAssertTrue(capturedBlockRun);
}

- (void)testBlockCaptureWorksWhenWeakReferenceIsUsedInBlock {
    SBLTestingBlock capturedBlock = nil;
    SBLTestingClass *mock = mock(SBLTestingClass.class);

    SBLMatcherTestBlockRunner *runner = [[SBLMatcherTestBlockRunner alloc] initAndPassBlockToMock:mock];

	verifyTimes(atLeast(1), [mock methodWithBlock:capture(&capturedBlock)]);

    if (capturedBlock) {
        capturedBlock(1, @(42));
    }

    XCTAssertEqualObjects(runner.objectPassedToBlock, @(42));
}

- (void)testBlockCaptureCapturesTwoBlocks {
    NSString *capturedString1 = nil;
    NSString *capturedString2 = nil;
    SBLTestingClass *mock = mock(SBLTestingClass.class);

    [mock methodWithArgument1:@"abc" argument2:@"Capture1"];
    [mock methodWithArgument1:@"xyz" argument2:@"Capture2"];

    verify([mock methodWithArgument1:@"abc" argument2:capture(&capturedString1)]);
    verify([mock methodWithArgument1:@"xyz" argument2:capture(&capturedString2)]);

    XCTAssertEqualObjects(capturedString1, @"Capture1");
    XCTAssertEqualObjects(capturedString2, @"Capture2");
}

- (void)testWhenVerificationIsMadeThenMockNoLongerCapturesArgumentsForThatVerify {
    NSString *capturedString = nil;
    SBLTestingClass *mock = mock(SBLTestingClass.class);

    [mock methodWithArgument1:@"abc" argument2:@"original"];

    verify([mock methodWithArgument1:@"abc" argument2:capture(&capturedString)]);

    [mock methodWithArgument1:@"abc" argument2:@"new"];

    XCTAssertEqualObjects(capturedString, @"original");
}

- (void)testWhenABlockIsCapturedAndThenTheBlockLeavesOriginalScopeThenItIsStillAvailableToCall {
    SBLTestingBlockCreator *creator = [[SBLTestingBlockCreator alloc] init];
    SBLTestingClass *sender = mock(SBLTestingClass.class);
    SBLTestingClass *receiver = mock(SBLTestingClass.class);
    creator.sender = sender;
    creator.receiver = receiver;
    SBLTestingBlock capturedBlock;

    when([sender methodWithBlock:capture(&capturedBlock)]);

    [creator runInBlockWithNumber:1337];

    capturedBlock(0, nil);

    verify([receiver methodWithInteger:1337]);
}

@end


text:
"""File and Cloud URL representation classes."""

from __future__ import absolute_import
from __future__ import print_function
from __future__ import division
from __future__ import unicode_literals

import os
import re
import stat

from gslib.exception import InvalidUrlError
from gslib.utils import system_util
from gslib.utils import text_util

# Matches provider strings of the form 'gs://'
PROVIDER_REGEX = re.compile(r'(?P<provider>[^:]*)://$')
# Matches bucket strings of the form 'gs://bucket'
BUCKET_REGEX = re.compile(r'(?P<provider>[^:]*)://(?P<bucket>[^/]*)/{0,1}$')
# Matches object strings of the form 'gs://bucket/obj'
OBJECT_REGEX = re.compile(
    r'(?P<provider>[^:]*)://(?P<bucket>[^/]*)/(?P<object>.*)')
# Matches versioned object strings of the form 'gs://bucket/obj#1234'
GS_GENERATION_REGEX = re.compile(r'(?P<object>.+)#(?P<generation>[0-9]+)$')
# Matches versioned object strings of the form 's3://bucket/obj#NULL'
S3_VERSION_REGEX = re.compile(r'(?P<object>.+)#(?P<version_id>.+)$')
# Matches file strings of the form 'file://dir/filename'
FILE_OBJECT_REGEX = re.compile(r'([^:]*://)(?P<filepath>.*)')
# Regex to determine if a string contains any wildcards.
WILDCARD_REGEX = re.compile(r'[*?\[\]]')

class StorageUrl(object):
  """Abstract base class for file and Cloud Storage URLs."""

  def Clone(self):
    raise NotImplementedError('Clone not overridden')

  def IsFileUrl(self):
    raise NotImplementedError('IsFileUrl not overridden')

  def IsCloudUrl(self):
    raise NotImplementedError('IsCloudUrl not overridden')

  def IsStream():
    raise NotImplementedError('IsStream not overridden')

  def IsFifo(self):
    raise NotImplementedError('IsFifo not overridden')

  def CreatePrefixUrl(self, wildcard_suffix=None):
    """Returns a prefix of this URL that can be used for iterating.

    Args:
      wildcard_suffix: If supplied, this wildcard suffix will be appended to the
                       prefix with a trailing slash before being returned.

    Returns:
      A prefix of this URL that can be used for iterating.

    If this URL contains a trailing slash, it will be stripped to create the
    prefix. This helps avoid infinite looping when prefixes are iterated, but
    preserves other slashes so that objects with '/' in the name are handled
    properly.

    For example, when recursively listing a bucket with the following contents:
      gs://bucket// <-- object named slash
      gs://bucket//one-dir-deep
    a top-level expansion with '/' as a delimiter will result in the following
    URL strings:
      'gs://bucket//' : OBJECT
      'gs://bucket//' : PREFIX
    If we right-strip all slashes from the prefix entry and add a wildcard
    suffix, we will get 'gs://bucket/*' which will produce identical results
    (and infinitely recurse).

    Example return values:
      ('gs://bucket/subdir/', '*') becomes 'gs://bucket/subdir/*'
      ('gs://bucket/', '*') becomes 'gs://bucket/*'
      ('gs://bucket/', None) becomes 'gs://bucket'
      ('gs://bucket/subdir//', '*') becomes 'gs://bucket/subdir//*'
      ('gs://bucket/subdir///', '**') becomes 'gs://bucket/subdir///**'
      ('gs://bucket/subdir/', '*') where 'subdir/' is an object becomes
           'gs://bucket/subdir/*', but iterating on this will return 'subdir/'
           as a BucketListingObject, so we will not recurse on it as a subdir
           during listing.
    """
    raise NotImplementedError('CreatePrefixUrl not overridden')

  @property
  def url_string(self):
    raise NotImplementedError('url_string not overridden')

  @property
  def versionless_url_string(self):
    raise NotImplementedError('versionless_url_string not overridden')

  def __eq__(self, other):
    return isinstance(other, StorageUrl) and self.url_string == other.url_string

  def __hash__(self):
    return hash(self.url_string)

class _FileUrl(StorageUrl):
  """File URL class providing parsing and convenience methods.

    This class assists with usage and manipulation of an
    (optionally wildcarded) file URL string.  Depending on the string
    contents, this class represents one or more directories or files.

    For File URLs, scheme is always file, bucket_name is always blank,
    and object_name contains the file/directory path.
  """

  def __init__(self, url_string, is_stream=False, is_fifo=False):
    self.scheme = 'file'
    self.delim = os.sep
    self.bucket_name = ''
    # If given a URI that starts with "<scheme>://", the object name should not
    # include that prefix.
    match = FILE_OBJECT_REGEX.match(url_string)
    if match and match.lastindex == 2:
      self.object_name = match.group(2)
    else:
      self.object_name = url_string
    # On Windows, the pathname component separator is "\" instead of "/". If we
    # find an occurrence of "/", replace it with "\" so that other logic can
    # rely on being able to split pathname components on `os.sep`.
    if system_util.IS_WINDOWS:
      self.object_name = self.object_name.replace('/', '\\')
    self.generation = None
    self.is_stream = is_stream
    self.is_fifo = is_fifo

  def Clone(self):
    return _FileUrl(self.url_string)

  def IsFileUrl(self):
    return True

  def IsCloudUrl(self):
    return False

  def IsStream(self):
    return self.is_stream

  def IsFifo(self):
    return self.is_fifo

  def IsDirectory(self):
    return (not self.IsStream() and not self.IsFifo() and
            os.path.isdir(self.object_name))

  def CreatePrefixUrl(self, wildcard_suffix=None):
    return self.url_string

  @property
  def url_string(self):
    return '%s://%s' % (self.scheme, self.object_name)

  @property
  def versionless_url_string(self):
    return self.url_string

  def __str__(self):
    return self.url_string

class _CloudUrl(StorageUrl):
  """Cloud URL class providing parsing and convenience methods.

    This class assists with usage and manipulation of an
    (optionally wildcarded) cloud URL string.  Depending on the string
    contents, this class represents a provider, bucket(s), or object(s).

    This class operates only on strings.  No cloud storage API calls are
    made from this class.
  """

  def __init__(self, url_string):
    self.scheme = None
    self.delim = '/'
    self.bucket_name = None
    self.object_name = None
    self.generation = None
    provider_match = PROVIDER_REGEX.match(url_string)
    bucket_match = BUCKET_REGEX.match(url_string)
    if provider_match:
      self.scheme = provider_match.group('provider')
    elif bucket_match:
      self.scheme = bucket_match.group('provider')
      self.bucket_name = bucket_match.group('bucket')
    else:
      object_match = OBJECT_REGEX.match(url_string)
      if object_match:
        self.scheme = object_match.group('provider')
        self.bucket_name = object_match.group('bucket')
        self.object_name = object_match.group('object')
        if self.object_name == '.' or self.object_name == '..':
          raise InvalidUrlError('%s is an invalid root-level object name' %
                                self.object_name)
        if self.scheme == 'gs':
          generation_match = GS_GENERATION_REGEX.match(self.object_name)
          if generation_match:
            self.object_name = generation_match.group('object')
            self.generation = generation_match.group('generation')
        elif self.scheme == 's3':
          version_match = S3_VERSION_REGEX.match(self.object_name)
          if version_match:
            self.object_name = version_match.group('object')
            self.generation = version_match.group('version_id')
      else:
        raise InvalidUrlError(
            'CloudUrl: URL string %s did not match URL regex' % url_string)

  def Clone(self):
    return _CloudUrl(self.url_string)

  def IsFileUrl(self):
    return False

  def IsCloudUrl(self):
    return True

  def IsStream(self):
    raise NotImplementedError('IsStream not supported on CloudUrl')

  def IsFifo(self):
    raise NotImplementedError('IsFifo not supported on CloudUrl')

  def IsBucket(self):
    return bool(self.bucket_name and not self.object_name)

  def IsObject(self):
    return bool(self.bucket_name and self.object_name)

  def HasGeneration(self):
    return bool(self.generation)

  def IsProvider(self):
    return bool(self.scheme and not self.bucket_name)

  def CreatePrefixUrl(self, wildcard_suffix=None):
    prefix = StripOneSlash(self.versionless_url_string)
    if wildcard_suffix:
      prefix = '%s/%s' % (prefix, wildcard_suffix)
    return prefix

  @property
  def bucket_url_string(self):
    return '%s://%s/' % (self.scheme, self.bucket_name)

  @property
  def url_string(self):
    url_str = self.versionless_url_string
    if self.HasGeneration():
      url_str += '#%s' % self.generation
    return url_str

  @property
  def versionless_url_string(self):
    if self.IsProvider():
      return '%s://' % self.scheme
    elif self.IsBucket():
      return self.bucket_url_string
    return '%s://%s/%s' % (self.scheme, self.bucket_name, self.object_name)

  def __str__(self):
    return self.url_string

def _GetSchemeFromUrlString(url_str):
  """Returns scheme component of a URL string."""

  end_scheme_idx = url_str.find('://')
  if end_scheme_idx == -1:
    # File is the default scheme.
    return 'file'
  else:
    return url_str[0:end_scheme_idx].lower()

def _GetPathFromUrlString(url_str):
  """Returns path component of a URL string."""

  end_scheme_idx = url_str.find('://')
  if end_scheme_idx == -1:
    return url_str
  else:
    return url_str[end_scheme_idx + 3:]

def ContainsWildcard(url_string):
  """Checks whether url_string contains a wildcard.

  Args:
    url_string: URL string to check.

  Returns:
    bool indicator.
  """
  return bool(WILDCARD_REGEX.search(url_string))

def GenerationFromUrlAndString(url, generation):
  """Decodes a generation from a StorageURL and a generation string.

  This is used to represent gs and s3 versioning.

  Args:
    url: StorageUrl representing the object.
    generation: Long or string representing the object's generation or
                version.

  Returns:
    Valid generation string for use in URLs.
  """
  if url.scheme == 's3' and generation:
    return text_util.DecodeLongAsString(generation)
  return generation

def HaveFileUrls(args_to_check):
  """Checks whether args_to_check contain any file URLs.

  Args:
    args_to_check: Command-line argument subset to check.

  Returns:
    True if args_to_check contains any file URLs.
  """
  for url_str in args_to_check:
    storage_url = StorageUrlFromString(url_str)
    if storage_url.IsFileUrl():
      return True
  return False

def HaveProviderUrls(args_to_check):
  """Checks whether args_to_check contains any provider URLs (like 'gs://').

  Args:
    args_to_check: Command-line argument subset to check.

  Returns:
    True if args_to_check contains any provider URLs.
  """
  for url_str in args_to_check:
    storage_url = StorageUrlFromString(url_str)
    if storage_url.IsCloudUrl() and storage_url.IsProvider():
      return True
  return False

def IsCloudSubdirPlaceholder(url, blr=None):
  """Determines if a StorageUrl is a cloud subdir placeholder.

  This function is needed because GUI tools (like the GCS cloud console) allow
  users to create empty "folders" by creating a placeholder object; and parts
  of gsutil need to treat those placeholder objects specially. For example,
  gsutil rsync needs to avoid downloading those objects because they can cause
  conflicts (see comments in rsync command for details).

  We currently detect two cases:
    - Cloud objects whose name ends with '_$folder$'
    - Cloud objects whose name ends with '/'

  Args:
    url: (gslib.storage_url.StorageUrl) The URL to be checked.
    blr: (gslib.BucketListingRef or None) The blr to check, or None if not
        available. If `blr` is None, size won't be checked.

  Returns:
    (bool) True if the URL is a cloud subdir placeholder, otherwise False.
  """
  if not url.IsCloudUrl():
    return False
  url_str = url.url_string
  if url_str.endswith('_$folder$'):
    return True
  if blr and blr.IsObject():
    size = blr.root_object.size
  else:
    size = 0
  return size == 0 and url_str.endswith('/')

def IsFileUrlString(url_str):
  """Returns whether a string is a file URL."""

  return _GetSchemeFromUrlString(url_str) == 'file'

def StorageUrlFromString(url_str):
  """Static factory function for creating a StorageUrl from a string."""

  scheme = _GetSchemeFromUrlString(url_str)

  if scheme not in ('file', 's3', 'gs'):
    raise InvalidUrlError('Unrecognized scheme "%s"' % scheme)
  if scheme == 'file':
    path = _GetPathFromUrlString(url_str)
    is_stream = (path == '-')
    is_fifo = False
    try:
      is_fifo = stat.S_ISFIFO(os.stat(path).st_mode)
    except OSError:
      pass
    return _FileUrl(url_str, is_stream=is_stream, is_fifo=is_fifo)
  return _CloudUrl(url_str)

def StripOneSlash(url_str):
  if url_str and url_str.endswith('/'):
    return url_str[:-1]
  return url_str

def UrlsAreForSingleProvider(url_args):
  """Tests whether the URLs are all for a single provider.

  Args:
    url_args: (Iterable[str]) Collection of strings to check.

  Returns:
    True if all URLs are for single provider; False if `url_args` was empty (as
    this would not result in a single unique provider) or URLs targeted multiple
    unique providers.
  """
  provider = None
  url = None
  for url_str in url_args:
    url = StorageUrlFromString(url_str)
    if not provider:
      provider = url.scheme
    elif url.scheme != provider:
      return False
  return provider is not None

redpajama_set_name: RedPajamaGithub


text:
<?xml version="1.0" ?>
<ivy-module version="1.0">
  <info organisation="org.apache.hadoop" module="${ant.project.name}">
    <license name="Apache 2.0"/>
    <ivyauthor name="Apache Hadoop Team" url="http://hadoop.apache.org"/>
    <description>
        Apache Hadoop contrib
    </description>
  </info>
  <configurations defaultconfmapping="default">
    <!--these match the Maven configurations-->
    <conf name="default" extends="master,runtime"/>
    <conf name="master" description="contains the artifact but no dependencies"/>
    <conf name="runtime" description="runtime but not the artifact" />

    <conf name="common" visibility="private"
      description="artifacts needed to compile/test the application"/>
  </configurations>

  <publications>
    <!--get the artifact from our module name-->
    <artifact conf="master"/>
  </publications>
  <dependencies>
    <dependency org="commons-logging"
      name="commons-logging"
      rev="${commons-logging.version}"
      conf="common->default"/>
    <dependency org="commons-collections"
      name="commons-collections"
      rev="${commons-collections.version}"
      conf="common->default"/>
    <dependency org="commons-cli"
      name="commons-cli"
      rev="${commons-cli.version}"
      conf="common->default"/>
    <dependency org="log4j"
      name="log4j"
      rev="${log4j.version}"
      conf="common->master"/>
   <dependency org="junit"
      name="junit"
      rev="${junit.version}"
      conf="common->default"/>
    <dependency org="org.mortbay.jetty"
      name="jetty-util"
      rev="${jetty-util.version}"
      conf="common->master"/>
    <dependency org="org.mortbay.jetty"
      name="jetty"
      rev="${jetty.version}"
      conf="common->default"/>
    <dependency org="org.mortbay.jetty"
      name="jsp-api-2.1"
      rev="${jsp-api-2.1.version}"
      conf="common->master"/>
    <dependency org="org.mortbay.jetty"
      name="jetty"
      rev="${jetty.version}"
      conf="common->default"/>
    <dependency org="org.codehaus.jackson"
      name="jackson-core-asl"
      rev="${jackson.version}"
      conf="common->default"/>
    <dependency org="org.codehaus.jackson"
      name="jackson-mapper-asl"
      rev="${jackson.version}"
      conf="common->default"/>
    <dependency org="commons-httpclient"
      name="commons-httpclient"
      rev="${commons-httpclient.version}"
      conf="common->master"/>
    <dependency org="commons-configuration"
      name="commons-configuration"
      rev="${commons-configuration.version}"
      conf="common->master"/>
    <dependency org="org.apache.commons"
      name="commons-math"
      rev="${commons-math.version}"
      conf="common->master"/>
    <dependency org="commons-lang"
      name="commons-lang"
      rev="${commons-lang.version}"
      conf="common->master"/>
  </dependencies>
</ivy-module>


text:
'use strict';

const Map = require('Map');
import type {
  RelayLazyContainer,
  RelayQueryConfigSpec,
} from 'RelayContainer';
import type {RelayQuerySet} from 'RelayInternalTypes';
const RelayMetaRoute = require('RelayMetaRoute');
const RelayProfiler = require('RelayProfiler');
const RelayQuery = require('RelayQuery');

const buildRQL = require('buildRQL');
const invariant = require('invariant');
const stableStringify = require('stableStringify');
const warning = require('warning');

var queryCache = new Map();

/**
 * @internal
 *
 * `getRelayQueries` retrieves all queries for a component given a route.
 */
function getRelayQueries(
  Component: RelayLazyContainer,
  route: RelayQueryConfigSpec
): RelayQuerySet {
  if (!queryCache.has(Component)) {
    queryCache.set(Component, {});
  }
  var cacheKey = route.name + ':' + stableStringify(route.params);
  /* $FlowFixMe(>=0.22.0): Error discovered while adding Flow types
   * to Map and Set. This is often because .get() can return null.
   */
  var cache = queryCache.get(Component);
  if (cache.hasOwnProperty(cacheKey)) {
    return cache[cacheKey];
  }
  var querySet = {};
  Component.getFragmentNames().forEach(fragmentName => {
    querySet[fragmentName] = null;
  });
  Object.keys(route.queries).forEach(queryName => {
    if (!Component.hasFragment(queryName)) {
      warning(
        false,
        'Relay.QL: query `%s.queries.%s` is invalid, expected fragment ' +
        '`%s.fragments.%s` to be defined.',
        route.name,
        queryName,
        Component.displayName,
        queryName
      );
      return;
    }
    var queryBuilder = route.queries[queryName];
    if (queryBuilder) {
      var concreteQuery = buildRQL.Query(
        queryBuilder,
        Component,
        queryName,
        route.params
      );
      invariant(
        concreteQuery !== undefined,
        'Relay.QL: query `%s.queries.%s` is invalid, a typical query is ' +
        'defined using: () => Relay.QL`query { ... }`.',
        route.name,
        queryName
      );
      if (concreteQuery) {
        var rootQuery = RelayQuery.Root.create(
          concreteQuery,
          RelayMetaRoute.get(route.name),
          route.params
        );
        const identifyingArg = rootQuery.getIdentifyingArg();
        if (!identifyingArg || identifyingArg.value !== undefined) {
          querySet[queryName] = rootQuery;
          return;
        }
      }
    }
    querySet[queryName] = null;
  });
  cache[cacheKey] = querySet;
  return querySet;
}

module.exports = RelayProfiler.instrument('Relay.getQueries', getRelayQueries);


text:
.PHONY: git vim zsh tmux docker pip virtualenv

#################################################################################
# GLOBALS                                                                       #
#################################################################################

PROJECT_DIR := $(shell dirname $(realpath $(lastword $(MAKEFILE_LIST))))
THE_SHELL = zsh

#################################################################################
# COMMANDS                                                                      #
#################################################################################

## Install git configuration
git:
	sudo apt-get install git
	cp "${PROJECT_DIR}/${THE_SHELL}/.git*" "${HOME}/"

## Install vimrc with plugins
vim:
	sudo apt-get install vim-gtk
	cp "${PROJECT_DIR}/${THE_SHELL}/.vimrc" "${HOME}/"
	git clone "https://github.com/gmarik/Vundle.vim.git" "${HOME}/.vim/bundle/Vundle.vim"
	vim +PluginInstall +qall

## Install zshrc with oh-my-zsh and powerlevel9k
zsh:
	sudo apt-get install zsh
	cp "${PROJECT_DIR}/${THE_SHELL}/.zshrc" "${HOME}/"
	cd "${HOME}"
	sh -c "$(wget https://raw.githubusercontent.com/robbyrussell/oh-my-zsh/master/tools/install.sh -O -)"
	git clone "https://github.com/bhilburn/powerlevel9k.git" "~/.oh-my-zsh/custom/themes/powerlevel9k"
	cd "${PROJECT_DIR}"

## Install tmux configuration with plugins and tmuxifier
tmux:
	sudo apt-get install tmux xsel
	git clone https://github.com/tmux-plugins/tpm ~/.tmux/plugins/tpm
	git clone https://github.com/jimeh/tmuxifier.git ~/.tmuxifier
	cp "${PROJECT_DIR}/${THE_SHELL}/.tmux.conf" "${HOME}/"

## Install docker and docker-compose
docker:
	sudo apt-get remove docker docker-engine docker.io
	sudo apt-get update
	# sudo apt-get install docker
	# https://github.com/docker/compose/releases

## Install pip configuration
pip:
	sudo apt-get install python-pip-whl
	mkdir "${HOME}/.pip"
	cp "${PROJECT_DIR}/${THE_SHELL}/pip.conf" "${HOME}/.pip/"

## Install Python virtualenv with virtualenvwrapper
virtualenv:
	sudo apt-get install python-virtualenv python3-virtualenv virtualenvwrapper
	mkdir "${WORKON_HOME}"
	cp ${PROJECT_DIR}/${THE_SHELL}/post* "${WORKON_HOME}/"

## Install node version manager
node:

## Install ruby version manager
ruby:

## Install rust version manager
rust:
	curl -L https://raw.github.com/sdepold/rsvm/master/install.sh | sh

## Install everything
install: git vim zsh tmux docker pip virtualenv

#################################################################################
# PROJECT RULES                                                                 #
#################################################################################

#################################################################################
# Self Documenting Commands                                                     #
#################################################################################

.DEFAULT_GOAL := show-help

# Inspired by <http://marmelab.com/blog/2016/02/29/auto-documented-makefile.html>
# sed script explained:
# /^##/:
# 	* save line in hold space
# 	* purge line
# 	* Loop:
# 		* append newline + line to hold space
# 		* go to next line
# 		* if line starts with doc comment, strip comment character off and loop
# 	* remove target prerequisites
# 	* append hold space (+ newline) to line
# 	* replace newline plus comments by `---`
# 	* print line
# Separate expressions are necessary because labels cannot be delimited by
# semicolon; see <http://stackoverflow.com/a/11799865/1968>
.PHONY: show-help
show-help:
	@echo "$$(tput bold)Available rules:$$(tput sgr0)"
	@echo
	@sed -n -e "/^## / { \
		h; \
		s/.*//; \
		:doc" \
		-e "H; \
		n; \
		s/^## //; \
		t doc" \
		-e "s/:.*//; \
		G; \
		s/\\n## /---/; \
		s/\\n/ /g; \
		p; \
	}" ${MAKEFILE_LIST} \
	| LC_ALL='C' sort --ignore-case \
	| awk -F '---' \
		-v ncol=$$(tput cols) \
		-v indent=19 \
		-v col_on="$$(tput setaf 6)" \
		-v col_off="$$(tput sgr0)" \
	'{ \
		printf "%s%*s%s ", col_on, -indent, $$1, col_off; \
		n = split($$2, words, " "); \
		line_length = ncol - indent; \
		for (i = 1; i <= n; i++) { \
			line_length -= length(words[i]) + 1; \
			if (line_length <= 0) { \
				line_length = ncol - indent - length(words[i]) - 1; \
				printf "\n%*s ", -indent, " "; \
			} \
			printf "%s ", words[i]; \
		} \
		printf "\n"; \
	}' \
	| more $(shell test $(shell uname) = Darwin && echo '--no-init --raw-control-chars')


text:
from django.contrib import admin
from django.contrib.auth.forms import UserCreationForm, UserChangeForm

from .models import User, Skill

class UserAdmin(admin.ModelAdmin):
    create_form_class = UserCreationForm
    update_form_class = UserChangeForm

admin.site.register(User, UserAdmin)
admin.site.register(Skill)


text:
import roslib
roslib.load_manifest('tagDetector')
import rospy
import tf
import math
from tagDetector.msg import Tag, TagArray
from tf.transformations import euler_from_quaternion
import re

PI = 3.141592
cameras = ['cam0']

if __name__ == '__main__':
    rospy.init_node('tag_tf_listener')

    listener = tf.TransformListener()

    location_pub = rospy.Publisher('quadLocation', TagArray)

    rate = rospy.Rate(10.0)

    tagArray = TagArray()

    while not rospy.is_shutdown():

        tagArray.tag = []
        idList = [0]

        ### for each camera ###
        for cam in cameras:

            ### Make a list of all tag transfromations contain the current camera ###
            tfList = [string for string in listener.getFrameStrings() if cam in string]

            ### For each transform in that list ##
            for string in tfList:
                tag = Tag()
                ### Look Up the transform for each tag ###
                try:
                    (trans,rot) = listener.lookupTransform('/' + cam + '/aprilTag.0', string, rospy.Time(0))
                except (tf.LookupException, tf.ConnectivityException, tf.ExtrapolationException):
                    continue

                ### Pull out ID ###
                tagID = int(re.sub('/' + cam + '/aprilTag.', '', string))

                ### See if tag has already been located ###
                if not tagID in idList:

                    idList.append(tagID)

                    angles = euler_from_quaternion(rot)
                    angle = angles[2] *180.0/PI

                    tag.id = tagID
                    tag.x = trans[0]
                    tag.y = trans[1]
                    tag.angle = angle
                    tagArray.tag.append(t)

        ### Publish Tag Stuff ###
        tagArray.size = len(tagArray.tag)
        tagArray.header.stamp = rospy.Time.now()
        location_pub.publish(tagArray)
        rate.sleep()


text:
package org.jboss.resteasy.test.providers.atom.jaxb.extended.resources;

import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;

@XmlRootElement(name = "disabled")
@XmlAccessorType(XmlAccessType.FIELD)
public class Disabled {

    @XmlElement
    private boolean value;

    public boolean getValue() {
        return value;
    }

    public void setValue(boolean disabled) {
        value = disabled;
    }

}


text:
using UnrealBuildTool;

public class D3D12RHI : ModuleRules
{
	public D3D12RHI(TargetInfo Target)
	{
		PrivateIncludePaths.Add("Runtime/Windows/D3D12RHI/Private");

		PrivateDependencyModuleNames.AddRange(
			new string[] {
				"Core",
				"Engine",
				"RHI",
				"RenderCore",
				"ShaderCore",
                "UtilityShaders",
			}
			);

        AddThirdPartyPrivateStaticDependencies(Target, "DX12");
		AddThirdPartyPrivateStaticDependencies(Target, "DX11");
        AddThirdPartyPrivateStaticDependencies(Target, "NVAPI");
        AddThirdPartyPrivateStaticDependencies(Target, "AMD");

		if (Target.Configuration != UnrealTargetConfiguration.Shipping)
		{
			PrivateIncludePathModuleNames.AddRange(new string[] { "TaskGraph" });
		}

        Definitions.Add("SUB_ALLOCATED_DEFAULT_ALLOCATIONS=1");

		// Not fully implemented yet.
        Definitions.Add("SUPPORTS_MEMORY_RESIDENCY=0");
	}
}


text:
var util = require('util')

var privateRegistry = {}
  , publicRegistry = {}
  , publicRegistry2 = {}

privateRegistry.port = 8022
privateRegistry.host = 'http://localhost'
privateRegistry.url = [privateRegistry.host, privateRegistry.port].join(':')

publicRegistry.port = 8023
publicRegistry.host = 'http://localhost'
publicRegistry.url = [publicRegistry.host, publicRegistry.port].join(':')

publicRegistry2.port = 8024
publicRegistry2.host = 'http://localhost'
publicRegistry2.url = [publicRegistry2.host, publicRegistry2.port].join(':')

exports.private = privateRegistry
exports.public = publicRegistry
exports.public2 = publicRegistry2
exports.port = 8021
exports.host = 'http://localhost:'+exports.port

exports.portSSL = 8020

exports.json = function(res, code, body) {
  res.writeHead(code, {
    'Content-Type': 'application/json'
  })
  res.end(JSON.stringify(body))
}

exports.wrongStatusCode = function(rec, exp, done) {
  var msg = util.format('Status Code: %d, but should have been %d',
    rec, exp)
  return done(new Error(msg))
}

exports.invalidRes = function(rec, done) {
  var msg = util.format('Invalid response received: %j', rec)
  return done(new Error(msg))
}

exports.url = function(url) {
  return url.replace(/\/\//g, '/')
}

exports.publicOk = function(done) {
  return function(err, res, body) {
    if (err) return done(err)
    if (res.statusCode !== 200) {
      return exports.wrongStatusCode(res.statusCode, 200, done)
    }
    if (!body.server) {
      return exports.invalidRes(res, done)
    }
    if (body.server !== 'public') {
      var msg = 'Request should have been proxied to the public registry'
      return done(new Error(msg))
    }
    done()
  }
}

exports.privateOk = function(done) {
  return function(err, res, body) {
    if (err) return done(err)
    if (res.statusCode !== 200) {
      return exports.wrongStatusCode(res.statusCode, 200, done)
    }
    if (!body.server) {
      return exports.invalidRes(res, done)
    }
    if (body.server !== 'private') {
      var msg = 'Request should have been proxied to the private registry'
      return done(new Error(msg))
    }
    done()
  }
}

exports.publicNotFound = function(done) {
  return function(err, res, body) {
    if (err) return done(err)
    if (res.statusCode !== 404) {
      return exports.wrongStatusCode(res.statusCode, 404, done)
    }
    if (!body.server) {
      return exports.invalidRes(res, done)
    }
    if (body.server !== 'public') {
      var msg = 'Request should have been proxied to the public registry'
      return done(new Error(msg))
    }
    done()
  }
}

exports.privateNotFound = function(done) {
  return function(err, res, body) {
    if (err) return done(err)
    if (res.statusCode !== 404) {
      return exports.wrongStatusCode(res.statusCode, 404, done)
    }
    if (!body.server) {
      return exports.invalidRes(res, done)
    }
    if (body.server !== 'private') {
      var msg = 'Request should have been proxied to the private registry'
      return done(new Error(msg))
    }
    done()
  }
}

exports.error = function(done) {
  return function(err, res, body) {
    if (err) return done(err)
    if (res.statusCode !== 400) {
      return exports.wrongStatusCode(res.statusCode, 400, done)
    }
    done()
  }
}

exports.list = {
  get: [
      '/-/jsonp/jsonp_blah'
    , '/-/all/since'
    , '/-/rss'
    , '/-/rss/package_blah'
    , '/-/all'
    , '/-/all/-/jsonp/jsonp_blah'
    , '/-/short'
    , '/-/scripts'
    , '/-/by-field'
    , '/-/fields'
    , '/-/needbuild'
    , '/-/prebuilt'
    , '/-/nonlocal'
    , '/-/_view/all'
    , '/-/_list/all'
    , '/-/_show/all'
  ],
  users: [
      '/-/by-user/user_blah'
    , '/-/starred-by-user/user_blah'
    , '/-/starred-by-package/user_blah'
    , '/-/users'
    , '/-/user/user_blah'
    , '/_users/user_blah'
    , '/-/user-by-email/user_blah'
  ],
  put: [
      '/-/user/user_blah'
    , '/_users/user_blah'
    , '/public_users/user_blah'
  ]
}


text:
import {Injector, THROW_IF_NOT_FOUND} from '../di/injector';
import {NgModuleRef} from '../linker/ng_module_factory';

import {DepDef, DepFlags, NgModuleData, NgModuleDefinition, NgModuleDefinitionFactory, NgModuleProviderDef, NodeFlags} from './types';
import {splitDepsDsl, tokenKey} from './util';

const NOT_CREATED = new Object();

const InjectorRefTokenKey = tokenKey(Injector);
const NgModuleRefTokenKey = tokenKey(NgModuleRef);

export function moduleProvideDef(
    flags: NodeFlags, token: any, value: any,
    deps: ([DepFlags, any] | any)[]): NgModuleProviderDef {
  const depDefs = splitDepsDsl(deps);
  return {
    // will bet set by the module definition
    index: -1,
    deps: depDefs, flags, token, value
  };
}

export function moduleDef(providers: NgModuleProviderDef[]): NgModuleDefinition {
  const providersByKey: {[key: string]: NgModuleProviderDef} = {};
  for (let i = 0; i < providers.length; i++) {
    const provider = providers[i];
    provider.index = i;
    providersByKey[tokenKey(provider.token)] = provider;
  }
  return {
    // Will be filled later...
    factory: null,
    providersByKey,
    providers
  };
}

export function initNgModule(data: NgModuleData) {
  const def = data._def;
  const providers = data._providers = new Array(def.providers.length);
  for (let i = 0; i < def.providers.length; i++) {
    const provDef = def.providers[i];
    providers[i] = provDef.flags & NodeFlags.LazyProvider ? NOT_CREATED :
                                                            _createProviderInstance(data, provDef);
  }
}

export function resolveNgModuleDep(
    data: NgModuleData, depDef: DepDef, notFoundValue: any = Injector.THROW_IF_NOT_FOUND): any {
  if (depDef.flags & DepFlags.Value) {
    return depDef.token;
  }
  if (depDef.flags & DepFlags.Optional) {
    notFoundValue = null;
  }
  if (depDef.flags & DepFlags.SkipSelf) {
    return data._parent.get(depDef.token, notFoundValue);
  }
  const tokenKey = depDef.tokenKey;
  switch (tokenKey) {
    case InjectorRefTokenKey:
    case NgModuleRefTokenKey:
      return data;
  }
  const providerDef = data._def.providersByKey[tokenKey];
  if (providerDef) {
    let providerInstance = data._providers[providerDef.index];
    if (providerInstance === NOT_CREATED) {
      providerInstance = data._providers[providerDef.index] =
          _createProviderInstance(data, providerDef);
    }
    return providerInstance;
  }
  return data._parent.get(depDef.token, notFoundValue);
}

function _createProviderInstance(ngModule: NgModuleData, providerDef: NgModuleProviderDef): any {
  let injectable: any;
  switch (providerDef.flags & NodeFlags.Types) {
    case NodeFlags.TypeClassProvider:
      injectable = _createClass(ngModule, providerDef.value, providerDef.deps);
      break;
    case NodeFlags.TypeFactoryProvider:
      injectable = _callFactory(ngModule, providerDef.value, providerDef.deps);
      break;
    case NodeFlags.TypeUseExistingProvider:
      injectable = resolveNgModuleDep(ngModule, providerDef.deps[0]);
      break;
    case NodeFlags.TypeValueProvider:
      injectable = providerDef.value;
      break;
  }
  return injectable;
}

function _createClass(ngModule: NgModuleData, ctor: any, deps: DepDef[]): any {
  const len = deps.length;
  let injectable: any;
  switch (len) {
    case 0:
      injectable = new ctor();
      break;
    case 1:
      injectable = new ctor(resolveNgModuleDep(ngModule, deps[0]));
      break;
    case 2:
      injectable =
          new ctor(resolveNgModuleDep(ngModule, deps[0]), resolveNgModuleDep(ngModule, deps[1]));
      break;
    case 3:
      injectable = new ctor(
          resolveNgModuleDep(ngModule, deps[0]), resolveNgModuleDep(ngModule, deps[1]),
          resolveNgModuleDep(ngModule, deps[2]));
      break;
    default:
      const depValues = new Array(len);
      for (let i = 0; i < len; i++) {
        depValues[i] = resolveNgModuleDep(ngModule, deps[i]);
      }
      injectable = new ctor(...depValues);
  }
  return injectable;
}

function _callFactory(ngModule: NgModuleData, factory: any, deps: DepDef[]): any {
  const len = deps.length;
  let injectable: any;
  switch (len) {
    case 0:
      injectable = factory();
      break;
    case 1:
      injectable = factory(resolveNgModuleDep(ngModule, deps[0]));
      break;
    case 2:
      injectable =
          factory(resolveNgModuleDep(ngModule, deps[0]), resolveNgModuleDep(ngModule, deps[1]));
      break;
    case 3:
      injectable = factory(
          resolveNgModuleDep(ngModule, deps[0]), resolveNgModuleDep(ngModule, deps[1]),
          resolveNgModuleDep(ngModule, deps[2]));
      break;
    default:
      const depValues = Array(len);
      for (let i = 0; i < len; i++) {
        depValues[i] = resolveNgModuleDep(ngModule, deps[i]);
      }
      injectable = factory(...depValues);
  }
  return injectable;
}

export function callNgModuleLifecycle(ngModule: NgModuleData, lifecycles: NodeFlags) {
  const def = ngModule._def;
  for (let i = 0; i < def.providers.length; i++) {
    const provDef = def.providers[i];
    if (provDef.flags & NodeFlags.OnDestroy) {
      const instance = ngModule._providers[i];
      if (instance && instance !== NOT_CREATED) {
        instance.ngOnDestroy();
      }
    }
  }
}


text:
class Component < ActiveRecord::Base
  belongs_to :category
  validates_presence_of :name, :description
  validates_presence_of :category_id, on: :create
end


text:
//
//  GRJSONHelper.h
//  GreedJSON
//
//  Created by Bell on 15/5/19.
//  Copyright (c) 2015年 GreedLab. All rights reserved.
//

@interface GRJSONHelper : NSObject

+ (BOOL)isPropertyReadOnly:(Class)aClass propertyName:(NSString*)propertyName;

/**
 *  all property classes ins class
 */
+ (NSMutableDictionary <NSString *, NSMutableDictionary *> *)allPropertyClassesInClass:(Class)aClass;

/**
 *  get the class of the property [propertyName] for the class [aClass]
 *
 *  @param propertyName property
 *  @param aClass        class
 *
 *  @return the class of the property
 */
+ (Class)propertyClassForPropertyName:(NSString *)propertyName ofClass:(Class)aClass;

/**
 *  all properties in aClass and super class
 *
 *  @param aClass Class
 *
 *  @return properties
 */
+ (NSMutableArray *)allPropertyNames:(Class)aClass;

/**
 *  the properties in aClass, no super class
 *
 *  @param aClass Class
 *
 *  @return properties
 */
+ (NSArray *)propertyNames:(Class)aClass;

+ (NSMutableArray*)allIgnoredPropertyNames:(Class)aClass;
+ (NSMutableDictionary*)allReplacedPropertyNames:(Class)aClass;
+ (NSMutableDictionary*)allClassInArray:(Class)aClass;

#pragma mark - Foundation

+ (NSSet *)foundationClasses;
+ (BOOL)isClassFromFoundation:(Class)aClass;

@end


text:
package main
import (
    "github.com/go-martini/martini"
    "github.com/martini-contrib/binding"
    "github.com/martini-contrib/render"
    "github.com/martini-contrib/sessions"
    "github.com/grandmore/mgosessions"
    "github.com/jerehmiah/lildata/database"
    "github.com/jerehmiah/lildata/controllers"
    "github.com/jerehmiah/lildata/models"
    "github.com/jerehmiah/lildata/auth"
)

func main() {
    m := martini.Classic()

    m.Map(database.Database())
    store := mgosessions.NewMongoStore(database.Database().DB("sessions").C("sessions"), []byte("secret123"))
    store.Options.MaxAge = 31536000
    m.Use(sessions.Sessions("lildata_session", store))
    m.Use(render.Renderer())

    pc := controllers.NewPermissionController(database.Database())
    sc := controllers.NewSubjectController(database.Database(), pc, nil)
    dc := controllers.NewDataController(database.Database(), pc, sc)
    prez := controllers.NewPresentationController(database.Database(), pc, dc, sc)

    m.Post("/establishSession", auth.CreateAuthSession())

    m.Get("/api/permissions", auth.Authentication(),pc.GetMyPermissions)
    m.Get("/api/permissions/:id", auth.Authentication(),pc.GetSubjectPermissions)
    m.Post("/api/permissions", auth.Authentication(), binding.Bind(models.Permission{}), pc.PostPermission)
    m.Delete("/api/permissions/:id", auth.Authentication(), pc.RevokePermission)

    m.Get("/api/subjects", auth.Authentication(), binding.Bind(models.Subject{}), sc.GetAllSubjects)
    m.Post("/api/subjects", auth.Authentication(), binding.Bind(models.Subject{}), sc.PostSubject)
    m.Delete("/api/subjects/:id", auth.Authentication(), sc.DeleteSubject)

    m.Get("/api/data/:id", auth.Authentication(), binding.Bind(models.Data{}), dc.GetAllData)
    m.Post("/api/data/:id", auth.Authentication(), binding.Bind(models.Data{}), dc.PostData)
    m.Delete("/api/data/:id", auth.Authentication(), dc.DeleteData)

    m.Get("/api/presentation/:id", auth.Authentication(), prez.GetPresentation)
    m.Post("/api/presentation/:id/preference/:os/:field/:display", auth.Authentication(), prez.SetDisplayPreference)
    m.Run()
}


text:
package com.amazonaws.services.logs.model;

import javax.annotation.Generated;

/**
 *

 * The query string is not valid. Details about this error are displayed in a QueryCompileError object. For
 * more information, see QueryCompileError.
 *

 *

 * For more information about valid query syntax, see CloudWatch Logs Insights Query
 * Syntax.
 *

 */
@Generated("com.amazonaws:aws-java-sdk-code-generator")
public class MalformedQueryException extends com.amazonaws.services.logs.model.AWSLogsException {
    private static final long serialVersionUID = 1L;

    private QueryCompileError queryCompileError;

    /**
     * Constructs a new MalformedQueryException with the specified error message.
     *
     * @param message
     *        Describes the error encountered.
     */
    public MalformedQueryException(String message) {
        super(message);
    }

    /**
     * @param queryCompileError
     */

    @com.fasterxml.jackson.annotation.JsonProperty("queryCompileError")
    public void setQueryCompileError(QueryCompileError queryCompileError) {
        this.queryCompileError = queryCompileError;
    }

    /**
     * @return
     */

    @com.fasterxml.jackson.annotation.JsonProperty("queryCompileError")
    public QueryCompileError getQueryCompileError() {
        return this.queryCompileError;
    }

    /**
     * @param queryCompileError
     * @return Returns a reference to this object so that method calls can be chained together.
     */

    public MalformedQueryException withQueryCompileError(QueryCompileError queryCompileError) {
        setQueryCompileError(queryCompileError);
        return this;
    }

}


text:
package com.volkhart.androidutil.reporting;

import com.crashlytics.android.Crashlytics;

import timber.log.Timber;

/**
 * All messages are logged to Crashlytics.
 */
public class CrashlyticsTree extends Timber.HollowTree {

    @Override
    public void v(String message, Object... args) {
        Crashlytics.log(String.format(message, args));
    }

    @Override
    public void v(Throwable throwable, String message, Object... args) {
        v(message, args);
        Crashlytics.logException(throwable);
    }

    @Override
    public void d(String message, Object... args) {
        Crashlytics.log(String.format(message, args));
    }

    @Override
    public void d(Throwable throwable, String message, Object... args) {
        d(message, args);
        Crashlytics.logException(throwable);
    }

    @Override
    public void i(String message, Object... args) {
        Crashlytics.log(String.format(message, args));
    }

    @Override
    public void i(Throwable throwable, String message, Object... args) {
        i(message, args);
        Crashlytics.logException(throwable);
    }

    @Override
    public void w(String message, Object... args) {
        Crashlytics.log(String.format(message, args));
    }

    @Override
    public void w(Throwable throwable, String message, Object... args) {
        w(message, args);
        Crashlytics.logException(throwable);
    }

    @Override
    public void e(String message, Object... args) {
        Crashlytics.log(String.format(message, args));
    }

    @Override
    public void e(Throwable throwable, String message, Object... args) {
        e(message, args);
        Crashlytics.logException(throwable);
    }
}


text:
require 'spec_helper'
require 'resume/file_system'

module Resume
  RSpec.describe FileSystem do
    describe '.open_document' do
      let(:filename) { 'resume.pdf' }

      context 'when run on Mac OS' do
        let(:mac_open_file_args) { ['open', filename] }

        before { stub_const('RUBY_PLATFORM', 'darwin') }

        it 'opens the file using the open command' do
          expect(described_class).to \
            receive(:system).with(*mac_open_file_args)
          described_class.open_document(filename)
        end
      end

      context 'when run on Linux' do
        let(:linux_open_file_args) { ['xdg-open', filename] }

        before { stub_const('RUBY_PLATFORM', 'linux') }

        it 'opens the file using the xdg-open command' do
          expect(described_class).to \
            receive(:system).with(*linux_open_file_args)
          described_class.open_document(filename)
        end
      end

      context 'when run on Windows' do
        let(:windows_open_file_args) do
          ['cmd', '/c', "\"start #{filename}\""]
        end

        before { stub_const('RUBY_PLATFORM', 'windows') }

        it 'opens the file using the cmd /c command' do
          expect(described_class).to \
            receive(:system).with(*windows_open_file_args)
          described_class.open_document(filename)
        end
      end

      context 'when run on an unknown operating system' do
        before { stub_const('RUBY_PLATFORM', 'unknown') }

        it 'requests the user to open the document themself' do
          expect(Output).to \
            receive(:warning).with(:dont_know_how_to_open_resume)
          described_class.open_document(filename)
        end
      end
    end

    describe '.tmpfile_path' do
      let(:filename) { 'file.txt' }
      let(:tmpdir) { '/tmp' }
      let(:pathname) { instance_double('Pathname') }

      before do
        allow(Dir).to receive(:tmpdir).and_return(tmpdir)
        allow(Pathname).to \
          receive(:new).with(tmpdir).and_return(pathname)
      end

      it 'returns the filepath for the file in the system temp directory' do
        expect(pathname).to receive(:join).with(filename)
        described_class.tmpfile_path(filename)
      end
    end
  end
end