text:
const MDCPaletteTint MDCPaletteTint50Name = MDC_PALETTE_TINT_50_INTERNAL_NAME;
const MDCPaletteTint MDCPaletteTint100Name = MDC_PALETTE_TINT_100_INTERNAL_NAME;
const MDCPaletteTint MDCPaletteTint200Name = MDC_PALETTE_TINT_200_INTERNAL_NAME;
const MDCPaletteTint MDCPaletteTint300Name = MDC_PALETTE_TINT_300_INTERNAL_NAME;
const MDCPaletteTint MDCPaletteTint400Name = MDC_PALETTE_TINT_400_INTERNAL_NAME;
const MDCPaletteTint MDCPaletteTint500Name = MDC_PALETTE_TINT_500_INTERNAL_NAME;
const MDCPaletteTint MDCPaletteTint600Name = MDC_PALETTE_TINT_600_INTERNAL_NAME;
const MDCPaletteTint MDCPaletteTint700Name = MDC_PALETTE_TINT_700_INTERNAL_NAME;
const MDCPaletteTint MDCPaletteTint800Name = MDC_PALETTE_TINT_800_INTERNAL_NAME;
const MDCPaletteTint MDCPaletteTint900Name = MDC_PALETTE_TINT_900_INTERNAL_NAME;

const MDCPaletteAccent MDCPaletteAccent100Name = MDC_PALETTE_ACCENT_100_INTERNAL_NAME;
const MDCPaletteAccent MDCPaletteAccent200Name = MDC_PALETTE_ACCENT_200_INTERNAL_NAME;
const MDCPaletteAccent MDCPaletteAccent400Name = MDC_PALETTE_ACCENT_400_INTERNAL_NAME;
const MDCPaletteAccent MDCPaletteAccent700Name = MDC_PALETTE_ACCENT_700_INTERNAL_NAME;

// Creates a UIColor from a 24-bit RGB color encoded as an integer.
static inline UIColor *ColorFromRGB(uint32_t rgbValue) {
  return [UIColor colorWithRed:((CGFloat)((rgbValue & 0xFF0000) >> 16)) / 255
                         green:((CGFloat)((rgbValue & 0x00FF00) >> 8)) / 255
                          blue:((CGFloat)((rgbValue & 0x0000FF) >> 0)) / 255
                         alpha:1];
}

@interface MDCPalette () {
  NSDictionary<MDCPaletteTint, UIColor *> *_tints;
  NSDictionary<MDCPaletteAccent, UIColor *> *_accents;
}

@end

@implementation MDCPalette

+ (MDCPalette *)redPalette {
  static MDCPalette *palette;
  static dispatch_once_t onceToken;
  dispatch_once(&onceToken, ^{
    palette = [[self alloc] initWithTints:@{
      MDCPaletteTint50Name : ColorFromRGB(0xFFEBEE),
      MDCPaletteTint100Name : ColorFromRGB(0xFFCDD2),
      MDCPaletteTint200Name : ColorFromRGB(0xEF9A9A),
      MDCPaletteTint300Name : ColorFromRGB(0xE57373),
      MDCPaletteTint400Name : ColorFromRGB(0xEF5350),
      MDCPaletteTint500Name : ColorFromRGB(0xF44336),
      MDCPaletteTint600Name : ColorFromRGB(0xE53935),
      MDCPaletteTint700Name : ColorFromRGB(0xD32F2F),
      MDCPaletteTint800Name : ColorFromRGB(0xC62828),
      MDCPaletteTint900Name : ColorFromRGB(0xB71C1C)
    }
                                  accents:@{
                                    MDCPaletteAccent100Name : ColorFromRGB(0xFF8A80),
                                    MDCPaletteAccent200Name : ColorFromRGB(0xFF5252),
                                    MDCPaletteAccent400Name : ColorFromRGB(0xFF1744),
                                    MDCPaletteAccent700Name : ColorFromRGB(0xD50000)
                                  }];
  });
  return palette;
}

+ (MDCPalette *)pinkPalette {
  static MDCPalette *palette;
  static dispatch_once_t onceToken;
  dispatch_once(&onceToken, ^{
    palette = [[self alloc] initWithTints:@{
      MDCPaletteTint50Name : ColorFromRGB(0xFCE4EC),
      MDCPaletteTint100Name : ColorFromRGB(0xF8BBD0),
      MDCPaletteTint200Name : ColorFromRGB(0xF48FB1),
      MDCPaletteTint300Name : ColorFromRGB(0xF06292),
      MDCPaletteTint400Name : ColorFromRGB(0xEC407A),
      MDCPaletteTint500Name : ColorFromRGB(0xE91E63),
      MDCPaletteTint600Name : ColorFromRGB(0xD81B60),
      MDCPaletteTint700Name : ColorFromRGB(0xC2185B),
      MDCPaletteTint800Name : ColorFromRGB(0xAD1457),
      MDCPaletteTint900Name : ColorFromRGB(0x880E4F)
    }
                                  accents:@{
                                    MDCPaletteAccent100Name : ColorFromRGB(0xFF80AB),
                                    MDCPaletteAccent200Name : ColorFromRGB(0xFF4081),
                                    MDCPaletteAccent400Name : ColorFromRGB(0xF50057),
                                    MDCPaletteAccent700Name : ColorFromRGB(0xC51162)
                                  }];
  });
  return palette;
}

+ (MDCPalette *)purplePalette {
  static MDCPalette *palette;
  static dispatch_once_t onceToken;
  dispatch_once(&onceToken, ^{
    palette = [[self alloc] initWithTints:@{
      MDCPaletteTint50Name : ColorFromRGB(0xF3E5F5),
      MDCPaletteTint100Name : ColorFromRGB(0xE1BEE7),
      MDCPaletteTint200Name : ColorFromRGB(0xCE93D8),
      MDCPaletteTint300Name : ColorFromRGB(0xBA68C8),
      MDCPaletteTint400Name : ColorFromRGB(0xAB47BC),
      MDCPaletteTint500Name : ColorFromRGB(0x9C27B0),
      MDCPaletteTint600Name : ColorFromRGB(0x8E24AA),
      MDCPaletteTint700Name : ColorFromRGB(0x7B1FA2),
      MDCPaletteTint800Name : ColorFromRGB(0x6A1B9A),
      MDCPaletteTint900Name : ColorFromRGB(0x4A148C)
    }
                                  accents:@{
                                    MDCPaletteAccent100Name : ColorFromRGB(0xEA80FC),
                                    MDCPaletteAccent200Name : ColorFromRGB(0xE040FB),
                                    MDCPaletteAccent400Name : ColorFromRGB(0xD500F9),
                                    MDCPaletteAccent700Name : ColorFromRGB(0xAA00FF)
                                  }];
  });
  return palette;
}

+ (MDCPalette *)deepPurplePalette {
  static MDCPalette *palette;
  static dispatch_once_t onceToken;
  dispatch_once(&onceToken, ^{
    palette = [[self alloc] initWithTints:@{
      MDCPaletteTint50Name : ColorFromRGB(0xEDE7F6),
      MDCPaletteTint100Name : ColorFromRGB(0xD1C4E9),
      MDCPaletteTint200Name : ColorFromRGB(0xB39DDB),
      MDCPaletteTint300Name : ColorFromRGB(0x9575CD),
      MDCPaletteTint400Name : ColorFromRGB(0x7E57C2),
      MDCPaletteTint500Name : ColorFromRGB(0x673AB7),
      MDCPaletteTint600Name : ColorFromRGB(0x5E35B1),
      MDCPaletteTint700Name : ColorFromRGB(0x512DA8),
      MDCPaletteTint800Name : ColorFromRGB(0x4527A0),
      MDCPaletteTint900Name : ColorFromRGB(0x311B92)
    }
                                  accents:@{
                                    MDCPaletteAccent100Name : ColorFromRGB(0xB388FF),
                                    MDCPaletteAccent200Name : ColorFromRGB(0x7C4DFF),
                                    MDCPaletteAccent400Name : ColorFromRGB(0x651FFF),
                                    MDCPaletteAccent700Name : ColorFromRGB(0x6200EA)
                                  }];
  });
  return palette;
}

+ (MDCPalette *)indigoPalette {
  static MDCPalette *palette;
  static dispatch_once_t onceToken;
  dispatch_once(&onceToken, ^{
    palette = [[self alloc] initWithTints:@{
      MDCPaletteTint50Name : ColorFromRGB(0xE8EAF6),
      MDCPaletteTint100Name : ColorFromRGB(0xC5CAE9),
      MDCPaletteTint200Name : ColorFromRGB(0x9FA8DA),
      MDCPaletteTint300Name : ColorFromRGB(0x7986CB),
      MDCPaletteTint400Name : ColorFromRGB(0x5C6BC0),
      MDCPaletteTint500Name : ColorFromRGB(0x3F51B5),
      MDCPaletteTint600Name : ColorFromRGB(0x3949AB),
      MDCPaletteTint700Name : ColorFromRGB(0x303F9F),
      MDCPaletteTint800Name : ColorFromRGB(0x283593),
      MDCPaletteTint900Name : ColorFromRGB(0x1A237E)
    }
                                  accents:@{
                                    MDCPaletteAccent100Name : ColorFromRGB(0x8C9EFF),
                                    MDCPaletteAccent200Name : ColorFromRGB(0x536DFE),
                                    MDCPaletteAccent400Name : ColorFromRGB(0x3D5AFE),
                                    MDCPaletteAccent700Name : ColorFromRGB(0x304FFE)
                                  }];
  });
  return palette;
}

+ (MDCPalette *)bluePalette {
  static MDCPalette *palette;
  static dispatch_once_t onceToken;
  dispatch_once(&onceToken, ^{
    palette = [[self alloc] initWithTints:@{
      MDCPaletteTint50Name : ColorFromRGB(0xE3F2FD),
      MDCPaletteTint100Name : ColorFromRGB(0xBBDEFB),
      MDCPaletteTint200Name : ColorFromRGB(0x90CAF9),
      MDCPaletteTint300Name : ColorFromRGB(0x64B5F6),
      MDCPaletteTint400Name : ColorFromRGB(0x42A5F5),
      MDCPaletteTint500Name : ColorFromRGB(0x2196F3),
      MDCPaletteTint600Name : ColorFromRGB(0x1E88E5),
      MDCPaletteTint700Name : ColorFromRGB(0x1976D2),
      MDCPaletteTint800Name : ColorFromRGB(0x1565C0),
      MDCPaletteTint900Name : ColorFromRGB(0x0D47A1)
    }
                                  accents:@{
                                    MDCPaletteAccent100Name : ColorFromRGB(0x82B1FF),
                                    MDCPaletteAccent200Name : ColorFromRGB(0x448AFF),
                                    MDCPaletteAccent400Name : ColorFromRGB(0x2979FF),
                                    MDCPaletteAccent700Name : ColorFromRGB(0x2962FF)
                                  }];
  });
  return palette;
}

+ (MDCPalette *)lightBluePalette {
  static MDCPalette *palette;
  static dispatch_once_t onceToken;
  dispatch_once(&onceToken, ^{
    palette = [[self alloc] initWithTints:@{
      MDCPaletteTint50Name : ColorFromRGB(0xE1F5FE),
      MDCPaletteTint100Name : ColorFromRGB(0xB3E5FC),
      MDCPaletteTint200Name : ColorFromRGB(0x81D4FA),
      MDCPaletteTint300Name : ColorFromRGB(0x4FC3F7),
      MDCPaletteTint400Name : ColorFromRGB(0x29B6F6),
      MDCPaletteTint500Name : ColorFromRGB(0x03A9F4),
      MDCPaletteTint600Name : ColorFromRGB(0x039BE5),
      MDCPaletteTint700Name : ColorFromRGB(0x0288D1),
      MDCPaletteTint800Name : ColorFromRGB(0x0277BD),
      MDCPaletteTint900Name : ColorFromRGB(0x01579B)
    }
                                  accents:@{
                                    MDCPaletteAccent100Name : ColorFromRGB(0x80D8FF),
                                    MDCPaletteAccent200Name : ColorFromRGB(0x40C4FF),
                                    MDCPaletteAccent400Name : ColorFromRGB(0x00B0FF),
                                    MDCPaletteAccent700Name : ColorFromRGB(0x0091EA)
                                  }];
  });
  return palette;
}

+ (MDCPalette *)cyanPalette {
  static MDCPalette *palette;
  static dispatch_once_t onceToken;
  dispatch_once(&onceToken, ^{
    palette = [[self alloc] initWithTints:@{
      MDCPaletteTint50Name : ColorFromRGB(0xE0F7FA),
      MDCPaletteTint100Name : ColorFromRGB(0xB2EBF2),
      MDCPaletteTint200Name : ColorFromRGB(0x80DEEA),
      MDCPaletteTint300Name : ColorFromRGB(0x4DD0E1),
      MDCPaletteTint400Name : ColorFromRGB(0x26C6DA),
      MDCPaletteTint500Name : ColorFromRGB(0x00BCD4),
      MDCPaletteTint600Name : ColorFromRGB(0x00ACC1),
      MDCPaletteTint700Name : ColorFromRGB(0x0097A7),
      MDCPaletteTint800Name : ColorFromRGB(0x00838F),
      MDCPaletteTint900Name : ColorFromRGB(0x006064)
    }
                                  accents:@{
                                    MDCPaletteAccent100Name : ColorFromRGB(0x84FFFF),
                                    MDCPaletteAccent200Name : ColorFromRGB(0x18FFFF),
                                    MDCPaletteAccent400Name : ColorFromRGB(0x00E5FF),
                                    MDCPaletteAccent700Name : ColorFromRGB(0x00B8D4)
                                  }];
  });
  return palette;
}

+ (MDCPalette *)tealPalette {
  static MDCPalette *palette;
  static dispatch_once_t onceToken;
  dispatch_once(&onceToken, ^{
    palette = [[self alloc] initWithTints:@{
      MDCPaletteTint50Name : ColorFromRGB(0xE0F2F1),
      MDCPaletteTint100Name : ColorFromRGB(0xB2DFDB),
      MDCPaletteTint200Name : ColorFromRGB(0x80CBC4),
      MDCPaletteTint300Name : ColorFromRGB(0x4DB6AC),
      MDCPaletteTint400Name : ColorFromRGB(0x26A69A),
      MDCPaletteTint500Name : ColorFromRGB(0x009688),
      MDCPaletteTint600Name : ColorFromRGB(0x00897B),
      MDCPaletteTint700Name : ColorFromRGB(0x00796B),
      MDCPaletteTint800Name : ColorFromRGB(0x00695C),
      MDCPaletteTint900Name : ColorFromRGB(0x004D40)
    }
                                  accents:@{
                                    MDCPaletteAccent100Name : ColorFromRGB(0xA7FFEB),
                                    MDCPaletteAccent200Name : ColorFromRGB(0x64FFDA),
                                    MDCPaletteAccent400Name : ColorFromRGB(0x1DE9B6),
                                    MDCPaletteAccent700Name : ColorFromRGB(0x00BFA5)
                                  }];
  });
  return palette;
}

+ (MDCPalette *)greenPalette {
  static MDCPalette *palette;
  static dispatch_once_t onceToken;
  dispatch_once(&onceToken, ^{
    palette = [[self alloc] initWithTints:@{
      MDCPaletteTint50Name : ColorFromRGB(0xE8F5E9),
      MDCPaletteTint100Name : ColorFromRGB(0xC8E6C9),
      MDCPaletteTint200Name : ColorFromRGB(0xA5D6A7),
      MDCPaletteTint300Name : ColorFromRGB(0x81C784),
      MDCPaletteTint400Name : ColorFromRGB(0x66BB6A),
      MDCPaletteTint500Name : ColorFromRGB(0x4CAF50),
      MDCPaletteTint600Name : ColorFromRGB(0x43A047),
      MDCPaletteTint700Name : ColorFromRGB(0x388E3C),
      MDCPaletteTint800Name : ColorFromRGB(0x2E7D32),
      MDCPaletteTint900Name : ColorFromRGB(0x1B5E20)
    }
                                  accents:@{
                                    MDCPaletteAccent100Name : ColorFromRGB(0xB9F6CA),
                                    MDCPaletteAccent200Name : ColorFromRGB(0x69F0AE),
                                    MDCPaletteAccent400Name : ColorFromRGB(0x00E676),
                                    MDCPaletteAccent700Name : ColorFromRGB(0x00C853)
                                  }];
  });
  return palette;
}

+ (MDCPalette *)lightGreenPalette {
  static MDCPalette *palette;
  static dispatch_once_t onceToken;
  dispatch_once(&onceToken, ^{
    palette = [[self alloc] initWithTints:@{
      MDCPaletteTint50Name : ColorFromRGB(0xF1F8E9),
      MDCPaletteTint100Name : ColorFromRGB(0xDCEDC8),
      MDCPaletteTint200Name : ColorFromRGB(0xC5E1A5),
      MDCPaletteTint300Name : ColorFromRGB(0xAED581),
      MDCPaletteTint400Name : ColorFromRGB(0x9CCC65),
      MDCPaletteTint500Name : ColorFromRGB(0x8BC34A),
      MDCPaletteTint600Name : ColorFromRGB(0x7CB342),
      MDCPaletteTint700Name : ColorFromRGB(0x689F38),
      MDCPaletteTint800Name : ColorFromRGB(0x558B2F),
      MDCPaletteTint900Name : ColorFromRGB(0x33691E)
    }
                                  accents:@{
                                    MDCPaletteAccent100Name : ColorFromRGB(0xCCFF90),
                                    MDCPaletteAccent200Name : ColorFromRGB(0xB2FF59),
                                    MDCPaletteAccent400Name : ColorFromRGB(0x76FF03),
                                    MDCPaletteAccent700Name : ColorFromRGB(0x64DD17)
                                  }];
  });
  return palette;
}

+ (MDCPalette *)limePalette {
  static MDCPalette *palette;
  static dispatch_once_t onceToken;
  dispatch_once(&onceToken, ^{
    palette = [[self alloc] initWithTints:@{
      MDCPaletteTint50Name : ColorFromRGB(0xF9FBE7),
      MDCPaletteTint100Name : ColorFromRGB(0xF0F4C3),
      MDCPaletteTint200Name : ColorFromRGB(0xE6EE9C),
      MDCPaletteTint300Name : ColorFromRGB(0xDCE775),
      MDCPaletteTint400Name : ColorFromRGB(0xD4E157),
      MDCPaletteTint500Name : ColorFromRGB(0xCDDC39),
      MDCPaletteTint600Name : ColorFromRGB(0xC0CA33),
      MDCPaletteTint700Name : ColorFromRGB(0xAFB42B),
      MDCPaletteTint800Name : ColorFromRGB(0x9E9D24),
      MDCPaletteTint900Name : ColorFromRGB(0x827717)
    }
                                  accents:@{
                                    MDCPaletteAccent100Name : ColorFromRGB(0xF4FF81),
                                    MDCPaletteAccent200Name : ColorFromRGB(0xEEFF41),
                                    MDCPaletteAccent400Name : ColorFromRGB(0xC6FF00),
                                    MDCPaletteAccent700Name : ColorFromRGB(0xAEEA00)
                                  }];
  });
  return palette;
}

+ (MDCPalette *)yellowPalette {
  static MDCPalette *palette;
  static dispatch_once_t onceToken;
  dispatch_once(&onceToken, ^{
    palette = [[self alloc] initWithTints:@{
      MDCPaletteTint50Name : ColorFromRGB(0xFFFDE7),
      MDCPaletteTint100Name : ColorFromRGB(0xFFF9C4),
      MDCPaletteTint200Name : ColorFromRGB(0xFFF59D),
      MDCPaletteTint300Name : ColorFromRGB(0xFFF176),
      MDCPaletteTint400Name : ColorFromRGB(0xFFEE58),
      MDCPaletteTint500Name : ColorFromRGB(0xFFEB3B),
      MDCPaletteTint600Name : ColorFromRGB(0xFDD835),
      MDCPaletteTint700Name : ColorFromRGB(0xFBC02D),
      MDCPaletteTint800Name : ColorFromRGB(0xF9A825),
      MDCPaletteTint900Name : ColorFromRGB(0xF57F17)
    }
                                  accents:@{
                                    MDCPaletteAccent100Name : ColorFromRGB(0xFFFF8D),
                                    MDCPaletteAccent200Name : ColorFromRGB(0xFFFF00),
                                    MDCPaletteAccent400Name : ColorFromRGB(0xFFEA00),
                                    MDCPaletteAccent700Name : ColorFromRGB(0xFFD600)
                                  }];
  });
  return palette;
}

+ (MDCPalette *)amberPalette {
  static MDCPalette *palette;
  static dispatch_once_t onceToken;
  dispatch_once(&onceToken, ^{
    palette = [[self alloc] initWithTints:@{
      MDCPaletteTint50Name : ColorFromRGB(0xFFF8E1),
      MDCPaletteTint100Name : ColorFromRGB(0xFFECB3),
      MDCPaletteTint200Name : ColorFromRGB(0xFFE082),
      MDCPaletteTint300Name : ColorFromRGB(0xFFD54F),
      MDCPaletteTint400Name : ColorFromRGB(0xFFCA28),
      MDCPaletteTint500Name : ColorFromRGB(0xFFC107),
      MDCPaletteTint600Name : ColorFromRGB(0xFFB300),
      MDCPaletteTint700Name : ColorFromRGB(0xFFA000),
      MDCPaletteTint800Name : ColorFromRGB(0xFF8F00),
      MDCPaletteTint900Name : ColorFromRGB(0xFF6F00)
    }
                                  accents:@{
                                    MDCPaletteAccent100Name : ColorFromRGB(0xFFE57F),
                                    MDCPaletteAccent200Name : ColorFromRGB(0xFFD740),
                                    MDCPaletteAccent400Name : ColorFromRGB(0xFFC400),
                                    MDCPaletteAccent700Name : ColorFromRGB(0xFFAB00)
                                  }];
  });
  return palette;
}

+ (MDCPalette *)orangePalette {
  static MDCPalette *palette;
  static dispatch_once_t onceToken;
  dispatch_once(&onceToken, ^{
    palette = [[self alloc] initWithTints:@{
      MDCPaletteTint50Name : ColorFromRGB(0xFFF3E0),
      MDCPaletteTint100Name : ColorFromRGB(0xFFE0B2),
      MDCPaletteTint200Name : ColorFromRGB(0xFFCC80),
      MDCPaletteTint300Name : ColorFromRGB(0xFFB74D),
      MDCPaletteTint400Name : ColorFromRGB(0xFFA726),
      MDCPaletteTint500Name : ColorFromRGB(0xFF9800),
      MDCPaletteTint600Name : ColorFromRGB(0xFB8C00),
      MDCPaletteTint700Name : ColorFromRGB(0xF57C00),
      MDCPaletteTint800Name : ColorFromRGB(0xEF6C00),
      MDCPaletteTint900Name : ColorFromRGB(0xE65100)
    }
                                  accents:@{
                                    MDCPaletteAccent100Name : ColorFromRGB(0xFFD180),
                                    MDCPaletteAccent200Name : ColorFromRGB(0xFFAB40),
                                    MDCPaletteAccent400Name : ColorFromRGB(0xFF9100),
                                    MDCPaletteAccent700Name : ColorFromRGB(0xFF6D00)
                                  }];
  });
  return palette;
}

+ (MDCPalette *)deepOrangePalette {
  static MDCPalette *palette;
  static dispatch_once_t onceToken;
  dispatch_once(&onceToken, ^{
    palette = [[self alloc] initWithTints:@{
      MDCPaletteTint50Name : ColorFromRGB(0xFBE9E7),
      MDCPaletteTint100Name : ColorFromRGB(0xFFCCBC),
      MDCPaletteTint200Name : ColorFromRGB(0xFFAB91),
      MDCPaletteTint300Name : ColorFromRGB(0xFF8A65),
      MDCPaletteTint400Name : ColorFromRGB(0xFF7043),
      MDCPaletteTint500Name : ColorFromRGB(0xFF5722),
      MDCPaletteTint600Name : ColorFromRGB(0xF4511E),
      MDCPaletteTint700Name : ColorFromRGB(0xE64A19),
      MDCPaletteTint800Name : ColorFromRGB(0xD84315),
      MDCPaletteTint900Name : ColorFromRGB(0xBF360C)
    }
                                  accents:@{
                                    MDCPaletteAccent100Name : ColorFromRGB(0xFF9E80),
                                    MDCPaletteAccent200Name : ColorFromRGB(0xFF6E40),
                                    MDCPaletteAccent400Name : ColorFromRGB(0xFF3D00),
                                    MDCPaletteAccent700Name : ColorFromRGB(0xDD2C00)
                                  }];
  });
  return palette;
}

+ (MDCPalette *)brownPalette {
  static MDCPalette *palette;
  static dispatch_once_t onceToken;
  dispatch_once(&onceToken, ^{
    palette = [[self alloc] initWithTints:@{
      MDCPaletteTint50Name : ColorFromRGB(0xEFEBE9),
      MDCPaletteTint100Name : ColorFromRGB(0xD7CCC8),
      MDCPaletteTint200Name : ColorFromRGB(0xBCAAA4),
      MDCPaletteTint300Name : ColorFromRGB(0xA1887F),
      MDCPaletteTint400Name : ColorFromRGB(0x8D6E63),
      MDCPaletteTint500Name : ColorFromRGB(0x795548),
      MDCPaletteTint600Name : ColorFromRGB(0x6D4C41),
      MDCPaletteTint700Name : ColorFromRGB(0x5D4037),
      MDCPaletteTint800Name : ColorFromRGB(0x4E342E),
      MDCPaletteTint900Name : ColorFromRGB(0x3E2723)
    }
                                  accents:nil];
  });
  return palette;
}

+ (MDCPalette *)greyPalette {
  static MDCPalette *palette;
  static dispatch_once_t onceToken;
  dispatch_once(&onceToken, ^{
    palette = [[self alloc] initWithTints:@{
      MDCPaletteTint50Name : ColorFromRGB(0xFAFAFA),
      MDCPaletteTint100Name : ColorFromRGB(0xF5F5F5),
      MDCPaletteTint200Name : ColorFromRGB(0xEEEEEE),
      MDCPaletteTint300Name : ColorFromRGB(0xE0E0E0),
      MDCPaletteTint400Name : ColorFromRGB(0xBDBDBD),
      MDCPaletteTint500Name : ColorFromRGB(0x9E9E9E),
      MDCPaletteTint600Name : ColorFromRGB(0x757575),
      MDCPaletteTint700Name : ColorFromRGB(0x616161),
      MDCPaletteTint800Name : ColorFromRGB(0x424242),
      MDCPaletteTint900Name : ColorFromRGB(0x212121)
    }
                                  accents:nil];
  });
  return palette;
}

+ (MDCPalette *)blueGreyPalette {
  static MDCPalette *palette;
  static dispatch_once_t onceToken;
  dispatch_once(&onceToken, ^{
    palette = [[self alloc] initWithTints:@{
      MDCPaletteTint50Name : ColorFromRGB(0xECEFF1),
      MDCPaletteTint100Name : ColorFromRGB(0xCFD8DC),
      MDCPaletteTint200Name : ColorFromRGB(0xB0BEC5),
      MDCPaletteTint300Name : ColorFromRGB(0x90A4AE),
      MDCPaletteTint400Name : ColorFromRGB(0x78909C),
      MDCPaletteTint500Name : ColorFromRGB(0x607D8B),
      MDCPaletteTint600Name : ColorFromRGB(0x546E7A),
      MDCPaletteTint700Name : ColorFromRGB(0x455A64),
      MDCPaletteTint800Name : ColorFromRGB(0x37474F),
      MDCPaletteTint900Name : ColorFromRGB(0x263238)
    }
                                  accents:nil];
  });
  return palette;
}

+ (instancetype)paletteGeneratedFromColor:(nonnull UIColor *)target500Color {
  NSArray *tintNames = @[
    MDCPaletteTint50Name, MDCPaletteTint100Name, MDCPaletteTint200Name, MDCPaletteTint300Name,
    MDCPaletteTint400Name, MDCPaletteTint500Name, MDCPaletteTint600Name, MDCPaletteTint700Name,
    MDCPaletteTint800Name, MDCPaletteTint900Name, MDCPaletteAccent100Name, MDCPaletteAccent200Name,
    MDCPaletteAccent400Name, MDCPaletteAccent700Name
  ];

  NSMutableDictionary *tints = [[NSMutableDictionary alloc] init];
  for (MDCPaletteTint name in tintNames) {
    [tints setObject:MDCPaletteTintFromTargetColor(target500Color, name) forKey:name];
  }

  NSArray *accentNames = @[
    MDCPaletteAccent100Name, MDCPaletteAccent200Name, MDCPaletteAccent400Name,
    MDCPaletteAccent700Name
  ];
  NSMutableDictionary *accents = [[NSMutableDictionary alloc] init];
  for (MDCPaletteAccent name in accentNames) {
    [accents setObject:MDCPaletteAccentFromTargetColor(target500Color, name) forKey:name];
  }

  return [self paletteWithTints:tints accents:accents];
}

+ (instancetype)paletteWithTints:(NSDictionary<MDCPaletteTint, UIColor *> *)tints
                         accents:(NSDictionary<MDCPaletteAccent, UIColor *> *)accents {
  return [[self alloc] initWithTints:tints accents:accents];
}

- (instancetype)initWithTints:(NSDictionary<MDCPaletteTint, UIColor *> *)tints
                      accents:(NSDictionary<MDCPaletteAccent, UIColor *> *)accents {
  self = [super init];
  if (self) {
    _accents = accents ? [accents copy] : @{};

    // Check if all the accent colors are present.
    NSDictionary<MDCPaletteTint, UIColor *> *allTints = tints;
    NSMutableSet<MDCPaletteAccent> *requiredTintKeys =
        [NSMutableSet setWithSet:[[self class] requiredTintKeys]];
    [requiredTintKeys minusSet:[NSSet setWithArray:[tints allKeys]]];
    if ([requiredTintKeys count] != 0) {
      NSAssert(NO, @"Missing accent colors for the following keys: %@.", requiredTintKeys);
      NSMutableDictionary<MDCPaletteTint, UIColor *> *replacementTints =
          [NSMutableDictionary dictionaryWithDictionary:_accents];
      for (MDCPaletteTint tintKey in requiredTintKeys) {
        [replacementTints setObject:[UIColor clearColor] forKey:tintKey];
      }
      allTints = replacementTints;
    }

    _tints = [allTints copy];
  }
  return self;
}

- (UIColor *)tint50 {
  return _tints[MDCPaletteTint50Name];
}

- (UIColor *)tint100 {
  return _tints[MDCPaletteTint100Name];
}

- (UIColor *)tint200 {
  return _tints[MDCPaletteTint200Name];
}

- (UIColor *)tint300 {
  return _tints[MDCPaletteTint300Name];
}

- (UIColor *)tint400 {
  return _tints[MDCPaletteTint400Name];
}

- (UIColor *)tint500 {
  return _tints[MDCPaletteTint500Name];
}

- (UIColor *)tint600 {
  return _tints[MDCPaletteTint600Name];
}

- (UIColor *)tint700 {
  return _tints[MDCPaletteTint700Name];
}

- (UIColor *)tint800 {
  return _tints[MDCPaletteTint800Name];
}

- (UIColor *)tint900 {
  return _tints[MDCPaletteTint900Name];
}

- (UIColor *)accent100 {
  return _accents[MDCPaletteAccent100Name];
}

- (UIColor *)accent200 {
  return _accents[MDCPaletteAccent200Name];
}

- (UIColor *)accent400 {
  return _accents[MDCPaletteAccent400Name];
}

- (UIColor *)accent700 {
  return _accents[MDCPaletteAccent700Name];
}

#pragma mark - Private methods

+ (nonnull NSSet<MDCPaletteTint> *)requiredTintKeys {
  return [NSSet setWithArray:@[
    MDCPaletteTint50Name, MDCPaletteTint100Name, MDCPaletteTint200Name, MDCPaletteTint300Name,
    MDCPaletteTint400Name, MDCPaletteTint500Name, MDCPaletteTint600Name, MDCPaletteTint700Name,
    MDCPaletteTint800Name, MDCPaletteTint900Name
  ]];
}

@end


text:
/**
 * @author Oleg V. Khaschansky
 * @version $Revision$
 */

package java.awt;

import java.awt.image.BufferedImage;
import java.util.Locale;

import org.apache.harmony.awt.ContextStorage;
import org.apache.harmony.awt.gl.CommonGraphics2DFactory;

public abstract class GraphicsEnvironment {
    protected GraphicsEnvironment() {}

    public static GraphicsEnvironment getLocalGraphicsEnvironment() {
        synchronized(ContextStorage.getContextLock()) {
            if (ContextStorage.getGraphicsEnvironment() == null) {
                if (isHeadless()) {
                    ContextStorage.setGraphicsEnvironment(new HeadlessGraphicsEnvironment());
                } else {
                    CommonGraphics2DFactory g2df =
                            (CommonGraphics2DFactory) Toolkit.getDefaultToolkit().getGraphicsFactory();

                    ContextStorage.setGraphicsEnvironment(
                            g2df.createGraphicsEnvironment(ContextStorage.getWindowFactory())
                    );
                }
            }

            return ContextStorage.getGraphicsEnvironment();
        }
    }

    public boolean isHeadlessInstance() {
        return false;
    }

    public static boolean isHeadless() {
        return "true".equals(System.getProperty("java.awt.headless"));
    }

    public Rectangle getMaximumWindowBounds() throws HeadlessException {
        return getDefaultScreenDevice().getDefaultConfiguration().getBounds();
    }

    public Point getCenterPoint() throws HeadlessException {
        Rectangle mwb = getMaximumWindowBounds();
        return new Point(mwb.width >> 1, mwb.height >> 1);
    }

    public void preferLocaleFonts() {
        // Note: API specification says following:
        // "The actual change in font rendering behavior resulting
        // from a call to this method is implementation dependent;
        // it may have no effect at all." So, doing nothing is an
        // acceptable behavior for this method.

        // For now FontManager uses 1.4 font.properties scheme for font mapping, so
        // this method doesn't make any sense. The implementation of this method
        // which will influence font mapping is postponed until
        // 1.5 mapping scheme not implemented.

        // todo - Implement non-default behavior with 1.5 font mapping scheme
    }

    public void preferProportionalFonts() {
        // Note: API specification says following:
        // "The actual change in font rendering behavior resulting
        // from a call to this method is implementation dependent;
        // it may have no effect at all." So, doing nothing is an
        // acceptable behavior for this method.

        // For now FontManager uses 1.4 font.properties scheme for font mapping, so
        // this method doesn't make any sense. The implementation of this method
        // which will influence font mapping is postponed until
        // 1.5 mapping scheme not implemented.

        // todo - Implement non-default behavior with 1.5 font mapping scheme
    }

    public abstract Graphics2D createGraphics(BufferedImage bufferedImage);

    public abstract Font[] getAllFonts();

    public abstract String[] getAvailableFontFamilyNames();

    public abstract String[] getAvailableFontFamilyNames(Locale locale);

    public abstract GraphicsDevice getDefaultScreenDevice() throws HeadlessException;

    public abstract GraphicsDevice[] getScreenDevices() throws HeadlessException;
}

redpajama_set_name: RedPajamaGithub


text: R CMD REMOVE --library=$PREFIX/lib/R/library/ UniProtKeywords


text:
<?xml version="1.0" encoding="UTF-8"?>
<SpimData version="0.2">
  <BasePath type="relative">.</BasePath>
  <SequenceDescription>
    <ImageLoader format="spimreconstruction.stack.ij">
      <imagedirectory type="relative">.</imagedirectory>
      <filePattern>stack{a}.tif</filePattern>
      <layoutTimepoints>0</layoutTimepoints>
      <layoutChannels>0</layoutChannels>
      <layoutIlluminations>0</layoutIlluminations>
      <layoutAngles>1</layoutAngles>
      <imglib2container>ArrayImgFactory</imglib2container>
    </ImageLoader>
    <ViewSetups>
      <ViewSetup>
        <id>0</id>
        <voxelSize>
          <unit>um</unit>
          <size>0.406 0.406 5.0</size>
        </voxelSize>
        <attributes>
          <illumination>0</illumination>
          <channel>0</channel>
          <angle>0</angle>
        </attributes>
      </ViewSetup>
      <ViewSetup>
        <id>1</id>
        <voxelSize>
          <unit>um</unit>
          <size>0.406 0.406 5.0</size>
        </voxelSize>
        <attributes>
          <illumination>0</illumination>
          <channel>0</channel>
          <angle>1</angle>
        </attributes>
      </ViewSetup>
      <Attributes name="illumination">
        <Illumination>
          <id>0</id>
          <name>0</name>
        </Illumination>
      </Attributes>
      <Attributes name="channel">
        <Channel>
          <id>0</id>
          <name>0</name>
        </Channel>
      </Attributes>
      <Attributes name="angle">
        <Angle>
          <id>0</id>
          <name>0</name>
        </Angle>
        <Angle>
          <id>1</id>
          <name>1</name>
        </Angle>
      </Attributes>
    </ViewSetups>
    <Timepoints type="pattern">
      <integerpattern />
    </Timepoints>
  </SequenceDescription>
  <ViewRegistrations>
    <ViewRegistration timepoint="0" setup="0">
      <ViewTransform type="affine">
        <Name>calibration</Name>
        <affine>1.0 0.0 0.0 0.0 0.0 1.0 0.0 0.0 0.0 0.0 12.31527093596059 0.0</affine>
      </ViewTransform>
    </ViewRegistration>
    <ViewRegistration timepoint="0" setup="1">
      <ViewTransform type="affine">
        <Name>calibration</Name>
        <affine>1.0 0.0 0.0 0.0 0.0 1.0 0.0 0.0 0.0 0.0 12.31527093596059 0.0</affine>
      </ViewTransform>
    </ViewRegistration>
  </ViewRegistrations>
  <ViewInterestPoints />
  <BoundingBoxes />
</SpimData>


text:
namespace views {
namespace test {

MenuRunnerTestAPI::MenuRunnerTestAPI(MenuRunner* menu_runner)
    : menu_runner_(menu_runner) {
}

MenuRunnerTestAPI::~MenuRunnerTestAPI() {
}

void MenuRunnerTestAPI::SetMenuRunnerHandler(
    std::unique_ptr<MenuRunnerHandler> menu_runner_handler) {
  menu_runner_->SetRunnerHandler(std::move(menu_runner_handler));
}

}  // test
}  // views


text:
const config = require('./config')
const Event = require('./event')
const Breadcrumb = require('./breadcrumb')
const Session = require('./session')
const map = require('./lib/es-utils/map')
const includes = require('./lib/es-utils/includes')
const filter = require('./lib/es-utils/filter')
const reduce = require('./lib/es-utils/reduce')
const keys = require('./lib/es-utils/keys')
const assign = require('./lib/es-utils/assign')
const runCallbacks = require('./lib/callback-runner')
const metadataDelegate = require('./lib/metadata-delegate')
const runSyncCallbacks = require('./lib/sync-callback-runner')
const BREADCRUMB_TYPES = require('./lib/breadcrumb-types')
const { add, clear, merge } = require('./lib/feature-flag-delegate')

const noop = () => {}

class Client {
  constructor (configuration, schema = config.schema, internalPlugins = [], notifier) {
    // notifier id
    this._notifier = notifier

    // intialise opts and config
    this._config = {}
    this._schema = schema

    // i/o
    this._delivery = { sendSession: noop, sendEvent: noop }
    this._logger = { debug: noop, info: noop, warn: noop, error: noop }

    // plugins
    this._plugins = {}

    // state
    this._breadcrumbs = []
    this._session = null
    this._metadata = {}
    this._featuresIndex = {}
    this._features = []
    this._context = undefined
    this._user = {}

    // callbacks:
    //  e: onError
    //  s: onSession
    //  sp: onSessionPayload
    //  b: onBreadcrumb
    // (note these names are minified by hand because object
    // properties are not safe to minify automatically)
    this._cbs = {
      e: [],
      s: [],
      sp: [],
      b: []
    }

    // expose internal constructors
    this.Client = Client
    this.Event = Event
    this.Breadcrumb = Breadcrumb
    this.Session = Session

    this._config = this._configure(configuration, internalPlugins)
    map(internalPlugins.concat(this._config.plugins), pl => {
      if (pl) this._loadPlugin(pl)
    })

    // when notify() is called we need to know how many frames are from our own source
    // this inital value is 1 not 0 because we wrap notify() to ensure it is always
    // bound to have the client as its `this` value – see below.
    this._depth = 1

    const self = this
    const notify = this.notify
    this.notify = function () {
      return notify.apply(self, arguments)
    }
  }

  addMetadata (section, keyOrObj, maybeVal) {
    return metadataDelegate.add(this._metadata, section, keyOrObj, maybeVal)
  }

  getMetadata (section, key) {
    return metadataDelegate.get(this._metadata, section, key)
  }

  clearMetadata (section, key) {
    return metadataDelegate.clear(this._metadata, section, key)
  }

  addFeatureFlag (name, variant = null) {
    add(this._features, this._featuresIndex, name, variant)
  }

  addFeatureFlags (featureFlags) {
    merge(this._features, featureFlags, this._featuresIndex)
  }

  clearFeatureFlag (name) {
    clear(this._features, this._featuresIndex, name)
  }

  clearFeatureFlags () {
    this._features = []
    this._featuresIndex = {}
  }

  getContext () {
    return this._context
  }

  setContext (c) {
    this._context = c
  }

  _configure (opts, internalPlugins) {
    const schema = reduce(internalPlugins, (schema, plugin) => {
      if (plugin && plugin.configSchema) return assign({}, schema, plugin.configSchema)
      return schema
    }, this._schema)

    // accumulate configuration and error messages
    const { errors, config } = reduce(keys(schema), (accum, key) => {
      const defaultValue = schema[key].defaultValue(opts[key])

      if (opts[key] !== undefined) {
        const valid = schema[key].validate(opts[key])
        if (!valid) {
          accum.errors[key] = schema[key].message
          accum.config[key] = defaultValue
        } else {
          if (schema[key].allowPartialObject) {
            accum.config[key] = assign(defaultValue, opts[key])
          } else {
            accum.config[key] = opts[key]
          }
        }
      } else {
        accum.config[key] = defaultValue
      }

      return accum
    }, { errors: {}, config: {} })

    if (schema.apiKey) {
      // missing api key is the only fatal error
      if (!config.apiKey) throw new Error('No Bugsnag API Key set')
      // warn about an apikey that is not of the expected format
      if (!/^[0-9a-f]{32}$/i.test(config.apiKey)) errors.apiKey = 'should be a string of 32 hexadecimal characters'
    }

    // update and elevate some options
    this._metadata = assign({}, config.metadata)
    merge(this._features, config.featureFlags, this._featuresIndex)
    this._user = assign({}, config.user)
    this._context = config.context
    if (config.logger) this._logger = config.logger

    // add callbacks
    if (config.onError) this._cbs.e = this._cbs.e.concat(config.onError)
    if (config.onBreadcrumb) this._cbs.b = this._cbs.b.concat(config.onBreadcrumb)
    if (config.onSession) this._cbs.s = this._cbs.s.concat(config.onSession)

    // finally warn about any invalid config where we fell back to the default
    if (keys(errors).length) {
      this._logger.warn(generateConfigErrorMessage(errors, opts))
    }

    return config
  }

  getUser () {
    return this._user
  }

  setUser (id, email, name) {
    this._user = { id, email, name }
  }

  _loadPlugin (plugin) {
    const result = plugin.load(this)
    // JS objects are not the safest way to store arbitrarily keyed values,
    // so bookend the key with some characters that prevent tampering with
    // stuff like __proto__ etc. (only store the result if the plugin had a
    // name)
    if (plugin.name) this._plugins[`~${plugin.name}~`] = result
    return this
  }

  getPlugin (name) {
    return this._plugins[`~${name}~`]
  }

  _setDelivery (d) {
    this._delivery = d(this)
  }

  startSession () {
    const session = new Session()

    session.app.releaseStage = this._config.releaseStage
    session.app.version = this._config.appVersion
    session.app.type = this._config.appType

    session._user = assign({}, this._user)

    // run onSession callbacks
    const ignore = runSyncCallbacks(this._cbs.s, session, 'onSession', this._logger)

    if (ignore) {
      this._logger.debug('Session not started due to onSession callback')
      return this
    }
    return this._sessionDelegate.startSession(this, session)
  }

  addOnError (fn, front = false) {
    this._cbs.e[front ? 'unshift' : 'push'](fn)
  }

  removeOnError (fn) {
    this._cbs.e = filter(this._cbs.e, f => f !== fn)
  }

  _addOnSessionPayload (fn) {
    this._cbs.sp.push(fn)
  }

  addOnSession (fn) {
    this._cbs.s.push(fn)
  }

  removeOnSession (fn) {
    this._cbs.s = filter(this._cbs.s, f => f !== fn)
  }

  addOnBreadcrumb (fn, front = false) {
    this._cbs.b[front ? 'unshift' : 'push'](fn)
  }

  removeOnBreadcrumb (fn) {
    this._cbs.b = filter(this._cbs.b, f => f !== fn)
  }

  pauseSession () {
    return this._sessionDelegate.pauseSession(this)
  }

  resumeSession () {
    return this._sessionDelegate.resumeSession(this)
  }

  leaveBreadcrumb (message, metadata, type) {
    // coerce bad values so that the defaults get set
    message = typeof message === 'string' ? message : ''
    type = (typeof type === 'string' && includes(BREADCRUMB_TYPES, type)) ? type : 'manual'
    metadata = typeof metadata === 'object' && metadata !== null ? metadata : {}

    // if no message, discard
    if (!message) return

    const crumb = new Breadcrumb(message, metadata, type)

    // run onBreadcrumb callbacks
    const ignore = runSyncCallbacks(this._cbs.b, crumb, 'onBreadcrumb', this._logger)

    if (ignore) {
      this._logger.debug('Breadcrumb not attached due to onBreadcrumb callback')
      return
    }

    // push the valid crumb onto the queue and maintain the length
    this._breadcrumbs.push(crumb)
    if (this._breadcrumbs.length > this._config.maxBreadcrumbs) {
      this._breadcrumbs = this._breadcrumbs.slice(this._breadcrumbs.length - this._config.maxBreadcrumbs)
    }
  }

  _isBreadcrumbTypeEnabled (type) {
    const types = this._config.enabledBreadcrumbTypes

    return types === null || includes(types, type)
  }

  notify (maybeError, onError, postReportCallback = noop) {
    const event = Event.create(maybeError, true, undefined, 'notify()', this._depth + 1, this._logger)
    this._notify(event, onError, postReportCallback)
  }

  _notify (event, onError, postReportCallback = noop) {
    event.app = assign({}, event.app, {
      releaseStage: this._config.releaseStage,
      version: this._config.appVersion,
      type: this._config.appType
    })
    event.context = event.context || this._context
    event._metadata = assign({}, event._metadata, this._metadata)
    event._user = assign({}, event._user, this._user)
    event.breadcrumbs = this._breadcrumbs.slice()
    merge(event._features, this._features, event._featuresIndex)

    // exit early if events should not be sent on the current releaseStage
    if (this._config.enabledReleaseStages !== null && !includes(this._config.enabledReleaseStages, this._config.releaseStage)) {
      this._logger.warn('Event not sent due to releaseStage/enabledReleaseStages configuration')
      return postReportCallback(null, event)
    }

    const originalSeverity = event.severity

    const onCallbackError = err => {
      // errors in callbacks are tolerated but we want to log them out
      this._logger.error('Error occurred in onError callback, continuing anyway…')
      this._logger.error(err)
    }

    const callbacks = [].concat(this._cbs.e).concat(onError)
    runCallbacks(callbacks, event, onCallbackError, (err, shouldSend) => {
      if (err) onCallbackError(err)

      if (!shouldSend) {
        this._logger.debug('Event not sent due to onError callback')
        return postReportCallback(null, event)
      }

      if (this._isBreadcrumbTypeEnabled('error')) {
        // only leave a crumb for the error if actually got sent
        Client.prototype.leaveBreadcrumb.call(this, event.errors[0].errorClass, {
          errorClass: event.errors[0].errorClass,
          errorMessage: event.errors[0].errorMessage,
          severity: event.severity
        }, 'error')
      }

      if (originalSeverity !== event.severity) {
        event._handledState.severityReason = { type: 'userCallbackSetSeverity' }
      }

      if (event.unhandled !== event._handledState.unhandled) {
        event._handledState.severityReason.unhandledOverridden = true
        event._handledState.unhandled = event.unhandled
      }

      if (this._session) {
        this._session._track(event)
        event._session = this._session
      }

      this._delivery.sendEvent({
        apiKey: event.apiKey || this._config.apiKey,
        notifier: this._notifier,
        events: [event]
      }, (err) => postReportCallback(err, event))
    })
  }
}

const generateConfigErrorMessage = (errors, rawInput) => {
  const er = new Error(
  `Invalid configuration\n${map(keys(errors), key => `  - ${key} ${errors[key]}, got ${stringify(rawInput[key])}`).join('\n\n')}`)
  return er
}

const stringify = val => {
  switch (typeof val) {
    case 'string':
    case 'number':
    case 'object':
      return JSON.stringify(val)
    default: return String(val)
  }
}

module.exports = Client


text:
import _plotly_utils.basevalidators

class LocationmodeValidator(_plotly_utils.basevalidators.EnumeratedValidator):
    def __init__(self, plotly_name="locationmode", parent_name="scattergeo", **kwargs):
        super(LocationmodeValidator, self).__init__(
            plotly_name=plotly_name,
            parent_name=parent_name,
            edit_type=kwargs.pop("edit_type", "calc"),
            values=kwargs.pop(
                "values", ["ISO-3", "USA-states", "country names", "geojson-id"]
            ),
            **kwargs,
        )


text:
"""
The :mod:`solartime` module provides the means to calculate dawn, sunrise, solar noon, sunset,
and dusk, at a specific latitude/longitude.

The module provides one main class, :class:`SolarTime`.

:class:`SolarTime`
    * Calculates events in the UTC timezone.

Example usage ::

    >>> from datetime import date
    >>> from pytz import timezone
    >>> from solartime import SolarTime
    >>> today = date(2014, 1, 19)
    >>> localtz = timezone('US/Eastern')
    >>> lat, lon = 38.0, -79.0
    >>> sun = SolarTime()
    >>> schedule = sun.sun_utc(today, lat, lon)
    >>> sunset = schedule['sunset'].astimezone(localtz)
    >>> print(sunset)
    2014-01-19 17:24:43-05:00

"""

import datetime
from math import cos, sin, tan, acos, asin, floor, radians, degrees

try:
    import pytz
except ImportError:
    raise ImportError('The solartime module requires the pytz module to be available.')

try:
    basestring  # Python 2/3 compatibility
except NameError:
    basestring = str

__all__ = ['SolarTime', 'SolarError']

__version__ = '0.1b1'
__license__ = 'Apache 2.0'
__author__  = 'Simon Kennedy <code@sffjunkie.co.uk>, David Riggs <driggs@myotisoft.com>'

class SolarError(Exception):
    pass

class SolarTime(object):

    def __init__(self, solar_depression=6):
        """Create a SolarTime calculator.

        :param solar_depression:  Number of degrees the sun must be below the horizon for dawn/dusk calculation
        :type number or str:  Either number of degrees, or one of 'civil', 'nautical', 'astronomical'
        """

        self._depression = 6
        self.solar_depression = solar_depression  # Set default depression in degrees

    @property
    def solar_depression(self):
        """The number of degrees the sun must be below the horizon for the
        dawn/dusk calc.

        Can either be set as a number of degrees below the horizon or as
        one of the following strings

        ============= =======
        String        Degrees
        ============= =======
        civil            6.0
        nautical        12.0
        astronomical    18.0
        ============= =======
        """
        return self._depression

    @solar_depression.setter
    def solar_depression(self, depression):
        if isinstance(depression, basestring):
            try:
                self._depression = {
                    'civil': 6,
                    'nautical': 12,
                    'astronomical': 18}[depression]
            except:
                raise KeyError("solar_depression must be either a number or one of 'civil', 'nautical' or 'astronomical'")
        else:
            self._depression = float(depression)

    def sun_utc(self, date, latitude, longitude):
        """Calculate all the info for the sun at once.

        :param date:       Date to calculate for.
        :type date:        :class:`datetime.date`
        :param latitude:   Latitude - Northern latitudes should be positive
        :type latitude:    float
        :param longitude:  Longitude - Eastern longitudes should be positive
        :type longitude:   float

        :rtype:
            Dictionary with keys ``dawn``, ``sunrise``, ``noon``, ``sunset`` and ``dusk``
        """

        return {
            'dawn':    self.dawn_utc(date, latitude, longitude),
            'sunrise': self.sunrise_utc(date, latitude, longitude),
            'noon':    self.solar_noon_utc(date, longitude),
            'sunset':  self.sunset_utc(date, latitude, longitude),
            'dusk':    self.dusk_utc(date, latitude, longitude)
        }

    def dawn_utc(self, date, latitude, longitude):
        """Calculate dawn time in the UTC timezone.

        :param date:       Date to calculate for.
        :type date:        datetime.date
        :param latitude:   Latitude - Northern latitudes should be positive
        :type latitude:    float
        :param longitude:  Longitude - Eastern longitudes should be positive
        :type longitude:   float

        :rtype: date/time in UTC timezone
        """

        try:
            return self._calc_time(date, latitude, longitude, self._depression)
        except:
            raise SolarError('Sun remains below the horizon on this day, at this location.')

    def sunrise_utc(self, date, latitude, longitude):
        """Calculate sunrise time in the UTC timezone.

        :param date:       Date to calculate for.
        :type date:        datetime.date
        :param latitude:   Latitude - Northern latitudes should be positive
        :type latitude:    float
        :param longitude:  Longitude - Eastern longitudes should be positive
        :type longitude:   float

        :rtype: date/time in UTC timezone
        """

        try:
            return self._calc_time(date, latitude, longitude, 0.833)
        except:
            raise SolarError('Sun remains below the horizon on this day, at this location.')

    def solar_noon_utc(self, date, longitude):
        """Calculate solar noon time in the UTC timezone.

        :param date:       Date to calculate for.
        :type date:        datetime.date
        :param latitude:   Latitude - Northern latitudes should be positive
        :type latitude:    float
        :param longitude:  Longitude - Eastern longitudes should be positive
        :type longitude:   float

        :rtype: date/time in UTC timezone
        """

        julianday = self._julianday(date)

        newt = self._jday_to_jcentury(julianday + 0.5 + -longitude / 360.0)

        eqtime = self._eq_of_time(newt)
        timeUTC = 720.0 + (-longitude * 4.0) - eqtime

        timeUTC /= 60.0
        hour = int(timeUTC)
        minute = int((timeUTC - hour) * 60)
        second = int((((timeUTC - hour) * 60) - minute) * 60)

        if second > 59:
            second -= 60
            minute += 1
        elif second < 0:
            second += 60
            minute -= 1

        if minute > 59:
            minute -= 60
            hour += 1
        elif minute < 0:
            minute += 60
            hour -= 1

        if hour > 23:
            hour -= 24
            date += datetime.timedelta(days=1)
        elif hour < 0:
            hour += 24
            date -= datetime.timedelta(days=1)

        return datetime.datetime(date.year, date.month, date.day, hour, minute, second, tzinfo=pytz.utc)

    def sunset_utc(self, date, latitude, longitude):
        """Calculate sunset time in the UTC timezone.

        :param date:       Date to calculate for.
        :type date:        datetime.date
        :param latitude:   Latitude - Northern latitudes should be positive
        :type latitude:    float
        :param longitude:  Longitude - Eastern longitudes should be positive
        :type longitude:   float

        :rtype: date/time in UTC timezone
        """

        try:
            return self._calc_time(date, latitude, longitude, -0.833)
        except:
            raise SolarError('Sun remains below the horizon on this day, at this location.')

    def dusk_utc(self, date, latitude, longitude):
        """Calculate dusk time in the UTC timezone.

        :param date:       Date to calculate for.
        :type date:        datetime.date
        :param latitude:   Latitude - Northern latitudes should be positive
        :type latitude:    float
        :param longitude:  Longitude - Eastern longitudes should be positive
        :type longitude:   float

        :rtype: date/time in UTC timezone
        """

        try:
            return self._calc_time(date, latitude, longitude, - self._depression)
        except:
            raise SolarError('Sun remains below the horizon on this day, at this location.')

    def _julianday(self, date, timezone=None):
        day = date.day
        month = date.month
        year = date.year

        if timezone is not None:
            offset = timezone.localize(datetime.datetime(year, month, day)).utcoffset()
            offset = offset.total_seconds() / 1440.0
            day += offset + 0.5

        if month <= 2:
            year -= 1
            month += 12

        A = floor(year / 100.0)
        B = 2 - A + floor(A / 4.0)

        jd = floor(365.25 * (year + 4716)) + floor(30.6001 * (month + 1)) + day - 1524.5
        if jd > 2299160.4999999:
            jd += B

        return jd

    def _jday_to_jcentury(self, julianday):
        return (julianday - 2451545.0) / 36525.0

    def _jcentury_to_jday(self, juliancentury):
        return (juliancentury * 36525.0) + 2451545.0

    def _mean_obliquity_of_ecliptic(self, juliancentury):
        seconds = 21.448 - juliancentury * (46.815 + juliancentury * (0.00059 - juliancentury * 0.001813))
        return 23.0 + (26.0 + (seconds / 60.0)) / 60.0

    def _obliquity_correction(self, juliancentury):
        e0 = self._mean_obliquity_of_ecliptic(juliancentury)
        omega = 125.04 - 1934.136 * juliancentury
        return e0 + 0.00256 * cos(radians(omega))

    def _geom_mean_long_sun(self, juliancentury):
        l0 = 280.46646 + juliancentury * (36000.76983 + 0.0003032 * juliancentury)
        return l0 % 360.0

    def _eccentrilocation_earth_orbit(self, juliancentury):
        return 0.016708634 - juliancentury * (0.000042037 + 0.0000001267 * juliancentury)

    def _geom_mean_anomaly_sun(self, juliancentury):
        return 357.52911 + juliancentury * (35999.05029 - 0.0001537 * juliancentury)

    def _eq_of_time(self, juliancentury):
        epsilon = self._obliquity_correction(juliancentury)
        l0 = self._geom_mean_long_sun(juliancentury)
        e = self._eccentrilocation_earth_orbit(juliancentury)
        m = self._geom_mean_anomaly_sun(juliancentury)

        y = tan(radians(epsilon) / 2.0)
        y = y * y

        sin2l0 = sin(2.0 * radians(l0))
        sinm = sin(radians(m))
        cos2l0 = cos(2.0 * radians(l0))
        sin4l0 = sin(4.0 * radians(l0))
        sin2m = sin(2.0 * radians(m))

        Etime = y * sin2l0 - 2.0 * e * sinm + 4.0 * e * y * sinm * cos2l0 - 0.5 * y * y * sin4l0 - 1.25 * e * e * sin2m
        return degrees(Etime) * 4.0

    def _sun_eq_of_center(self, juliancentury):
        m = self._geom_mean_anomaly_sun(juliancentury)

        mrad = radians(m)
        sinm = sin(mrad)
        sin2m = sin(mrad + mrad)
        sin3m = sin(mrad + mrad + mrad)

        c = sinm * (1.914602 - juliancentury * (0.004817 + 0.000014 * juliancentury)) + sin2m * (0.019993 - 0.000101 * juliancentury) + sin3m * 0.000289
        return c

    def _sun_true_long(self, juliancentury):
        l0 = self._geom_mean_long_sun(juliancentury)
        c = self._sun_eq_of_center(juliancentury)
        return l0 + c

    def _sun_apparent_long(self, juliancentury):
        O = self._sun_true_long(juliancentury)

        omega = 125.04 - 1934.136 * juliancentury
        return O - 0.00569 - 0.00478 * sin(radians(omega))

    def _sun_declination(self, juliancentury):
        e = self._obliquity_correction(juliancentury)
        lambd = self._sun_apparent_long(juliancentury)

        sint = sin(radians(e)) * sin(radians(lambd))
        return degrees(asin(sint))

    def _hour_angle(self, latitude, solar_dec, solar_depression):
        latRad = radians(latitude)
        sdRad = radians(solar_dec)

        HA = (acos(cos(radians(90 + solar_depression)) / (cos(latRad) * cos(sdRad)) - tan(latRad) * tan(sdRad)))
        return HA

    def _calc_time(self, date, latitude, longitude, depression):
        julianday = self._julianday(date)

        if latitude > 89.8:
            latitude = 89.8

        if latitude < -89.8:
            latitude = -89.8

        t = self._jday_to_jcentury(julianday)
        eqtime = self._eq_of_time(t)
        solarDec = self._sun_declination(t)

        hourangle = -self._hour_angle(latitude, solarDec, 0.833)

        delta = -longitude - degrees(hourangle)
        timeDiff = 4.0 * delta
        timeUTC = 720.0 + timeDiff - eqtime

        newt = self._jday_to_jcentury(self._jcentury_to_jday(t) + timeUTC / 1440.0)
        eqtime = self._eq_of_time(newt)
        solarDec = self._sun_declination(newt)

        if depression < 0:
            depression = abs(depression)
            hourangle = -self._hour_angle(latitude, solarDec, depression)
        else:
            hourangle = self._hour_angle(latitude, solarDec, depression)

        delta = -longitude - degrees(hourangle)
        timeDiff = 4 * delta
        timeUTC = 720 + timeDiff - eqtime

        timeUTC /= 60.0
        hour = int(timeUTC)
        minute = int((timeUTC - hour) * 60)
        second = int((((timeUTC - hour) * 60) - minute) * 60)

        if second > 59:
            second -= 60
            minute += 1
        elif second < 0:
            second += 60
            minute -= 1

        if minute > 59:
            minute -= 60
            hour += 1
        elif minute < 0:
            minute += 60
            hour -= 1

        if hour > 23:
            hour -= 24
            date += datetime.timedelta(days=1)
        elif hour < 0:
            hour += 24
            date -= datetime.timedelta(days=1)

        return datetime.datetime(date.year, date.month, date.day, hour, minute, second, tzinfo=pytz.utc)


text:
namespace Microsoft.AspNetCore.Mvc.Formatters.Xml;

/// <summary>
/// Defines an interface for wrapping objects for serialization or deserialization into xml.
/// </summary>
public interface IWrapperProvider
{
    /// <summary>
    /// Gets the wrapping type.
    /// </summary>
    Type WrappingType { get; }

    /// <summary>
    /// Wraps the given object to the wrapping type provided by <see cref="WrappingType"/>.
    /// </summary>
    /// <param name="original">The original non-wrapped object.</param>
    /// <returns>Returns a wrapped object.</returns>
    object? Wrap(object? original);
}


text:
package net.floodlightcontroller.core.module;

import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.Enumeration;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.LinkedList;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Properties;
import java.util.Queue;
import java.util.ServiceConfigurationError;
import java.util.ServiceLoader;
import java.util.Set;

import net.floodlightcontroller.core.annotations.LogMessageDoc;
import net.floodlightcontroller.core.annotations.LogMessageDocs;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

/**
 * Finds all Floodlight modules in the class path and loads/starts them.
 * @author alexreimers
 *
 */
public class FloodlightModuleLoader {
    protected static Logger logger =
            LoggerFactory.getLogger(FloodlightModuleLoader.class);

    protected static Map<Class<? extends IFloodlightService>,
                  Collection<IFloodlightModule>> serviceMap;
    protected static Map<IFloodlightModule,
                  Collection<Class<? extends
                                   IFloodlightService>>> moduleServiceMap;
    protected static Map<String, IFloodlightModule> moduleNameMap;
    protected static Object lock = new Object();

    protected FloodlightModuleContext floodlightModuleContext;

    public static final String COMPILED_CONF_FILE =
            "floodlightdefault.properties";
    public static final String FLOODLIGHT_MODULES_KEY =
            "floodlight.modules";

	public FloodlightModuleLoader() {
	    floodlightModuleContext = new FloodlightModuleContext();
	}

	/**
	 * Finds all IFloodlightModule(s) in the classpath. It creates 3 Maps.
	 * serviceMap -> Maps a service to a module
	 * moduleServiceMap -> Maps a module to all the services it provides
	 * moduleNameMap -> Maps the string name to the module
	 * @throws FloodlightModuleException If two modules are specified in the configuration
	 * that provide the same service.
	 */
	protected static void findAllModules(Collection<String> mList) throws FloodlightModuleException {
	    synchronized (lock) {
	        if (serviceMap != null) return;
	        serviceMap =
	                new HashMap<Class<? extends IFloodlightService>,
	                            Collection<IFloodlightModule>>();
	        moduleServiceMap =
	                new HashMap<IFloodlightModule,
	                            Collection<Class<? extends
	                                       IFloodlightService>>>();
	        moduleNameMap = new HashMap<String, IFloodlightModule>();

	        // Get all the current modules in the classpath
	        ClassLoader cl = Thread.currentThread().getContextClassLoader();
	        ServiceLoader<IFloodlightModule> moduleLoader
	            = ServiceLoader.load(IFloodlightModule.class, cl);
	        // Iterate for each module, iterate through and add it's services
	        Iterator<IFloodlightModule> moduleIter = moduleLoader.iterator();
	        while (moduleIter.hasNext()) {
	        	IFloodlightModule m = null;
	        	try {
	        		m = moduleIter.next();
	        	} catch (ServiceConfigurationError sce) {
	        		logger.debug("Could not find module");
	        		//moduleIter.remove();
	        		continue;
	        	}
	        //}
	        //for (IFloodlightModule m : moduleLoader) {
	            if (logger.isDebugEnabled()) {
	                logger.debug("Found module " + m.getClass().getName());
	            }

	            // Set up moduleNameMap
	            moduleNameMap.put(m.getClass().getCanonicalName(), m);

	            // Set up serviceMap
	            Collection<Class<? extends IFloodlightService>> servs =
	                    m.getModuleServices();
	            if (servs != null) {
	                moduleServiceMap.put(m, servs);
	                for (Class<? extends IFloodlightService> s : servs) {
	                    Collection<IFloodlightModule> mods =
	                            serviceMap.get(s);
	                    if (mods == null) {
	                        mods = new ArrayList<IFloodlightModule>();
	                        serviceMap.put(s, mods);
	                    }
	                    mods.add(m);
	                    // Make sure they haven't specified duplicate modules in the config
	                    int dupInConf = 0;
	                    for (IFloodlightModule cMod : mods) {
	                        if (mList.contains(cMod.getClass().getCanonicalName()))
	                            dupInConf += 1;
	                    }

	                    if (dupInConf > 1) {
	                        String duplicateMods = "";
                            for (IFloodlightModule mod : mods) {
                                duplicateMods += mod.getClass().getCanonicalName() + ", ";
                            }
	                        throw new FloodlightModuleException("ERROR! The configuraiton" +
	                                " file specifies more than one module that provides the service " +
	                                s.getCanonicalName() +". Please specify only ONE of the " +
	                                "following modules in the config file: " + duplicateMods);
	                    }
	                }
	            }
	        }
	    }
	}

	/**
	 * Loads the modules from a specified configuration file.
	 * @param fName The configuration file path
	 * @return An IFloodlightModuleContext with all the modules to be started
	 * @throws FloodlightModuleException
	 */
	@LogMessageDocs({
	    @LogMessageDoc(level="INFO",
	            message="Loading modules from file {file name}",
	            explanation="The controller is initializing its module " +
	                    "configuration from the specified properties file"),
	    @LogMessageDoc(level="INFO",
	            message="Loading default modules",
	            explanation="The controller is initializing its module " +
	                    "configuration to the default configuration"),
	    @LogMessageDoc(level="ERROR",
	            message="Could not load module configuration file",
	            explanation="The controller failed to read the " +
	            		"module configuration file",
	            recommendation="Verify that the module configuration is " +
	            		"present. " + LogMessageDoc.CHECK_CONTROLLER),
	    @LogMessageDoc(level="ERROR",
                message="Could not load default modules",
                explanation="The controller failed to read the default " +
                        "module configuration",
                recommendation=LogMessageDoc.CHECK_CONTROLLER),
	})
	public IFloodlightModuleContext loadModulesFromConfig(String fName)
	        throws FloodlightModuleException {
	    Properties prop = new Properties();

	    File f = new File(fName);
	    if (f.isFile()) {
            logger.info("Loading modules from file {}", fName);
            try {
                prop.load(new FileInputStream(fName));
            } catch (Exception e) {
                logger.error("Could not load module configuration file", e);
                System.exit(1);
            }
        } else {
            logger.info("Loading default modules");
            InputStream is = this.getClass().getClassLoader().
                                    getResourceAsStream(COMPILED_CONF_FILE);
            try {
                prop.load(is);
            } catch (IOException e) {
                logger.error("Could not load default modules", e);
                System.exit(1);
            }
        }

        String moduleList = prop.getProperty(FLOODLIGHT_MODULES_KEY)
                                .replaceAll("\\s", "");
        Collection<String> configMods = new ArrayList<String>();
        configMods.addAll(Arrays.asList(moduleList.split(",")));
        return loadModulesFromList(configMods, prop);
	}

	/**
	 * Loads modules (and their dependencies) specified in the list
	 * @param mList The array of fully qualified module names
	 * @param ignoreList The list of Floodlight services NOT to
	 * load modules for. Used for unit testing.
	 * @return The ModuleContext containing all the loaded modules
	 * @throws FloodlightModuleException
	 */
	protected IFloodlightModuleContext loadModulesFromList(Collection<String> configMods, Properties prop,
			Collection<IFloodlightService> ignoreList) throws FloodlightModuleException {
		logger.debug("Starting module loader");
		if (logger.isDebugEnabled() && ignoreList != null)
			logger.debug("Not loading module services " + ignoreList.toString());

        findAllModules(configMods);

        Collection<IFloodlightModule> moduleSet = new ArrayList<IFloodlightModule>();
        Map<Class<? extends IFloodlightService>, IFloodlightModule> moduleMap =
                new HashMap<Class<? extends IFloodlightService>,
                            IFloodlightModule>();

        Queue<String> moduleQ = new LinkedList<String>();
        // Add the explicitly configured modules to the q
        moduleQ.addAll(configMods);
        Set<String> modsVisited = new HashSet<String>();

        while (!moduleQ.isEmpty()) {
            String moduleName = moduleQ.remove();
            if (modsVisited.contains(moduleName))
                continue;
            modsVisited.add(moduleName);
            IFloodlightModule module = moduleNameMap.get(moduleName);
            if (module == null) {
                throw new FloodlightModuleException("Module " +
                        moduleName + " not found");
            }
            // If the module provies a service that is in the
            // services ignorelist don't load it.
            if ((ignoreList != null) && (module.getModuleServices() != null)) {
            	for (IFloodlightService ifs : ignoreList) {
            		for (Class<?> intsIgnore : ifs.getClass().getInterfaces()) {
            			//System.out.println(intsIgnore.getName());
        				// Check that the interface extends IFloodlightService
        				//if (intsIgnore.isAssignableFrom(IFloodlightService.class)) {
            			//System.out.println(module.getClass().getName());
    					if (intsIgnore.isAssignableFrom(module.getClass())) {
    						// We now ignore loading this module.
    						logger.debug("Not loading module " +
    									 module.getClass().getCanonicalName() +
    									 " because interface " +
    									 intsIgnore.getCanonicalName() +
    									 " is in the ignore list.");

    						continue;
    					}
        				//}
            		}
            	}
            }

            // Add the module to be loaded
            addModule(moduleMap, moduleSet, module);
            // Add it's dep's to the queue
            Collection<Class<? extends IFloodlightService>> deps =
                    module.getModuleDependencies();
            if (deps != null) {
                for (Class<? extends IFloodlightService> c : deps) {
                    IFloodlightModule m = moduleMap.get(c);
                    if (m == null) {
                        Collection<IFloodlightModule> mods = serviceMap.get(c);
                        // Make sure only one module is loaded
                        if ((mods == null) || (mods.size() == 0)) {
                            throw new FloodlightModuleException("ERROR! Could not " +
                                    "find an IFloodlightModule that provides service " +
                                    c.toString());
                        } else if (mods.size() == 1) {
                            IFloodlightModule mod = mods.iterator().next();
                            if (!modsVisited.contains(mod.getClass().getCanonicalName()))
                                moduleQ.add(mod.getClass().getCanonicalName());
                        } else {
                            boolean found = false;
                            for (IFloodlightModule moduleDep : mods) {
                                if (configMods.contains(moduleDep.getClass().getCanonicalName())) {
                                    // Module will be loaded, we can continue
                                    found = true;
                                    break;
                                }
                            }
                            if (!found) {
                                String duplicateMods = "";
                                for (IFloodlightModule mod : mods) {
                                    duplicateMods += mod.getClass().getCanonicalName() + ", ";
                                }
                                throw new FloodlightModuleException("ERROR! Found more " +
                                    "than one (" + mods.size() + ") IFloodlightModules that provides " +
                                    "service " + c.toString() +
                                    ". Please specify one of the following modules in the config: " +
                                    duplicateMods);
                            }
                        }
                    }
                }
            }
        }

        floodlightModuleContext.setModuleSet(moduleSet);
        parseConfigParameters(prop);
        initModules(moduleSet);
        startupModules(moduleSet);

        return floodlightModuleContext;
	}

	/**
	 * Loads modules (and their dependencies) specified in the list.
	 * @param configMods The collection of fully qualified module names to load.
	 * @param prop The list of properties that are configuration options.
	 * @return The ModuleContext containing all the loaded modules.
	 * @throws FloodlightModuleException
	 */
	public IFloodlightModuleContext loadModulesFromList(Collection<String> configMods, Properties prop)
            throws FloodlightModuleException {
		return loadModulesFromList(configMods, prop, null);
    }

	/**
	 * Add a module to the set of modules to load and register its services
	 * @param moduleMap the module map
	 * @param moduleSet the module set
	 * @param module the module to add
	 */
	protected void addModule(Map<Class<? extends IFloodlightService>,
                                           IFloodlightModule> moduleMap,
                            Collection<IFloodlightModule> moduleSet,
                            IFloodlightModule module) {
        if (!moduleSet.contains(module)) {
            Collection<Class<? extends IFloodlightService>> servs =
                    moduleServiceMap.get(module);
            if (servs != null) {
                for (Class<? extends IFloodlightService> c : servs)
                    moduleMap.put(c, module);
            }
            moduleSet.add(module);
        }
	}

    /**
     * Allocate  service implementations and then init all the modules
     * @param moduleSet The set of modules to call their init function on
     * @throws FloodlightModuleException If a module can not properly be loaded
     */
    protected void initModules(Collection<IFloodlightModule> moduleSet)
                                           throws FloodlightModuleException {
        for (IFloodlightModule module : moduleSet) {
            // Get the module's service instance(s)
            Map<Class<? extends IFloodlightService>,
                IFloodlightService> simpls = module.getServiceImpls();

            // add its services to the context
            if (simpls != null) {
                for (Entry<Class<? extends IFloodlightService>,
                        IFloodlightService> s : simpls.entrySet()) {
                    if (logger.isDebugEnabled()) {
                        logger.debug("Setting " + s.getValue() +
                                     "  as provider for " +
                                     s.getKey().getCanonicalName());
                    }
                    if (floodlightModuleContext.getServiceImpl(s.getKey()) == null) {
                        floodlightModuleContext.addService(s.getKey(),
                                                           s.getValue());
                    } else {
                        throw new FloodlightModuleException("Cannot set "
                                                            + s.getValue()
                                                            + " as the provider for "
                                                            + s.getKey().getCanonicalName()
                                                            + " because "
                                                            + floodlightModuleContext.getServiceImpl(s.getKey())
                                                            + " already provides it");
                    }
                }
            }
        }

        for (IFloodlightModule module : moduleSet) {
            // init the module
            if (logger.isDebugEnabled()) {
                logger.debug("Initializing " +
                             module.getClass().getCanonicalName());
            }
            module.init(floodlightModuleContext);
        }
    }

    /**
     * Call each loaded module's startup method
     * @param moduleSet the module set to start up
     */
    protected void startupModules(Collection<IFloodlightModule> moduleSet) {
        for (IFloodlightModule m : moduleSet) {
            if (logger.isDebugEnabled()) {
                logger.debug("Starting " + m.getClass().getCanonicalName());
            }
            m.startUp(floodlightModuleContext);
        }
    }

    /**
     * Parses configuration parameters for each module
     * @param prop The properties file to use
     */
    @LogMessageDoc(level="WARN",
                   message="Module {module} not found or loaded. " +
                           "Not adding configuration option {key} = {value}",
                   explanation="Ignoring a configuration parameter for a " +
                   		"module that is not loaded.")
    protected void parseConfigParameters(Properties prop) {
    	if (prop == null) return;

        Enumeration<?> e = prop.propertyNames();
        while (e.hasMoreElements()) {
            String key = (String) e.nextElement();
            // Ignore module list key
            if (key.equals(FLOODLIGHT_MODULES_KEY)) {
                continue;
            }

            String configValue = null;
            int lastPeriod = key.lastIndexOf(".");
            String moduleName = key.substring(0, lastPeriod);
            String configKey = key.substring(lastPeriod + 1);
            // Check to see if it's overridden on the command line
            String systemKey = System.getProperty(key);
            if (systemKey != null) {
                configValue = systemKey;
            } else {
                configValue = prop.getProperty(key);
            }

            IFloodlightModule mod = moduleNameMap.get(moduleName);
            if (mod == null) {
                logger.warn("Module {} not found or loaded. " +
                		    "Not adding configuration option {} = {}",
                            new Object[]{moduleName, configKey, configValue});
            } else {
                floodlightModuleContext.addConfigParam(mod, configKey, configValue);
            }
        }
    }
}


text:
/*
 * @name Pie Chart
 * @arialabel Pie chart on a grey background with the different slices of the pie chart in various shades of grey
 * @description Uses the arc() function to generate a pie chart from the data
 * stored in an array.
 */
let angles = [30, 10, 45, 35, 60, 38, 75, 67];

function setup() {
  createCanvas(720, 400);
  noStroke();
  noLoop(); // Run once and stop
}

function draw() {
  background(100);
  pieChart(300, angles);
}

function pieChart(diameter, data) {
  let lastAngle = 0;
  for (let i = 0; i < data.length; i++) {
    let gray = map(i, 0, data.length, 0, 255);
    fill(gray);
    arc(
      width / 2,
      height / 2,
      diameter,
      diameter,
      lastAngle,
      lastAngle + radians(angles[i])
    );
    lastAngle += radians(angles[i]);
  }
}


text:
package com.brein.api;

import com.brein.domain.BreinConfig;
import com.brein.domain.BreinUser;
import com.brein.domain.results.BreinTemporalDataResult;
import com.brein.util.BreinMapUtil;
import com.brein.util.BreinUtil;

import java.time.ZonedDateTime;
import java.time.format.DateTimeFormatter;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.TimeZone;

/**
 * Provides the lookup functionality
 */
public class BreinTemporalData extends BreinBase<BreinTemporalData> implements IExecutable<BreinTemporalDataResult> {
    public static final DateTimeFormatter JAVA_SCRIPT_FORMAT =
            DateTimeFormatter.ofPattern("E MMM dd yyyy HH:mm:ss \'GMT\'Z (z)");

    /**
     * The following fields are used within the additional
     */
    public static final String LOCATION_FIELD = "location";
    public static final String LOCAL_DATE_TIME_FIELD = "localDateTime";
    public static final String TIMEZONE_FIELD = "timezone";
    public static final String IP_ADDRESS_FIELD = "ipAddress";

    /**
     * The following fields are used within the location
     */
    public static final String LONGITUDE_FIELD = "longitude";
    public static final String LATITUDE_FIELD = "latitude";
    public static final String SHAPE_TYPES_FIELD = "shapeTypes";
    public static final String TEXT_FIELD = "text";

    public static final String CITY_TEXT_FIELD = "city";
    public static final String STATE_TEXT_FIELD = "state";
    public static final String COUNTRY_TEXT_FIELD = "country";

    @Override
    public String getEndPoint(final BreinConfig config) {
        return config.getTemporalDataEndpoint();
    }

    @Override
    public void prepareRequestData(final BreinConfig config, final Map<String, Object> requestData) {
        // nothing additionally to be added
    }

    /**
     * Sets the timezone within the request, i.e.:
     *

     *

     *     {
     *         user: {
     *              additional: {
     *                  'timezone': timezone
     *              }
     *         }
     *     }
     *

     *
     * @param timezone the value to be set
     *
     * @return {@code this}
     */
    public BreinTemporalData setTimezone(final TimeZone timezone) {
        return setTimezone(timezone == null ? null : timezone.getID());
    }

    /**
     * Sets the timezone within the request, i.e.:
     *

     *

     *     {
     *         user: {
     *              additional: {
     *                  'timezone': timezone
     *              }
     *         }
     *     }
     *

     *
     * @param timezone the value to be set
     *
     * @return {@code this}
     */
    public BreinTemporalData setTimezone(final String timezone) {
        setAdditional(TIMEZONE_FIELD, timezone);
        return this;
    }

    /**
     * Sets the ipAddress used to look-up the temporal information, i.e.:
     *

     *

     *     {
     *         user: {
     *              additional: {
     *                  'ipAddress': ipAddress
     *              }
     *         }
     *     }
     *

     *
     * @param ipAddress the value to be set
     *
     * @return {@code this}
     */
    public BreinTemporalData setLookUpIpAddress(final String ipAddress) {
        setAdditional(IP_ADDRESS_FIELD, ipAddress);
        return this;
    }

    /**
     * Sets the longitude used to look-up the temporal information, i.e.:
     *

     *

     *     {
     *         user: {
     *              additional: {
     *                  location: {
     *                      'longitude': longitude
     *                  }
     *              }
     *         }
     *     }
     *

     *
     * @param longitude the longitude to be used
     *
     * @return {@code this}
     */
    public BreinTemporalData setLongitude(final double longitude) {
        setLocation(LONGITUDE_FIELD, longitude);
        return this;
    }

    /**
     * Sets the latitude used to look-up the temporal information, i.e.:
     *

     *

     *     {
     *         user: {
     *              additional: {
     *                  location: {
     *                      'latitude': latitude
     *                  }
     *              }
     *         }
     *     }
     *

     *
     * @param latitude the latitude to be used
     *
     * @return {@code this}
     */
    public BreinTemporalData setLatitude(final double latitude) {
        setLocation(LATITUDE_FIELD, latitude);
        return this;
    }

    /**
     * Sets the shape-types to be returned with the response of the request, i.e.:
     *

     *

     *     {
     *         user: {
     *              additional: {
     *                  location: {
     *                      'shapeTypes': [...]
     *                  }
     *              }
     *         }
     *     }
     *

     *
     * @param shapeTypes the shapeTypes to be set, if empty the shapeTypes will be removed
     *
     * @return {@code this}
     */
    public BreinTemporalData setShapeTypes(final String... shapeTypes) {
        if (shapeTypes == null || shapeTypes.length == 0) {
            setLocation(SHAPE_TYPES_FIELD, null);
        } else {
            setLocation(SHAPE_TYPES_FIELD, new ArrayList<>(Arrays.asList(shapeTypes)));
        }
        return this;
    }

    /**
     * Sets the location data using free text, i.e.:
     *

     *

     *     {
     *         user: {
     *              additional: {
     *                  location: {
     *                      'text': freeText
     *                  }
     *              }
     *         }
     *     }
     *

     *
     * @param freeText the text describing the location
     *
     * @return {@code this}
     */
    public BreinTemporalData setLocation(final String freeText) {
        setLocation(TEXT_FIELD, freeText);
        return this;
    }

    /**
     * Sets the localDateTime based on the system's time, i.e.:
     *

     *

     *     {
     *         user: {
     *              additional: {
     *                  'localDateTime': now
     *              }
     *         }
     *     }
     *

     *
     * @return {@code this}
     *
     * @see ZonedDateTime#now()
     */
    public BreinTemporalData setLocalDateTime() {
        return setLocalDateTime(ZonedDateTime.now());
    }

    /**
     * Sets the localDateTime, i.e.:
     *

     *

     *     {
     *         user: {
     *              additional: {
     *                  'localDateTime': zonedDateTime
     *              }
     *         }
     *     }
     *

     *
     * @return {@code this}
     */
    public BreinTemporalData setLocalDateTime(final ZonedDateTime zonedDateTime) {
        setAdditional(LOCAL_DATE_TIME_FIELD, zonedDateTime.format(JAVA_SCRIPT_FORMAT));
        return this;
    }

    /**
     * Sets the localDateTime for a Stringified date, which will be parsed server side, i.e.:
     *

     *

     *     {
     *         user: {
     *              additional: {
     *                  'localDateTime': zonedDateTime
     *              }
     *         }
     *     }
     *

     *
     * @return {@code this}
     */
    public BreinTemporalData setLocalDateTime(final String timeString) {
        setAdditional(LOCAL_DATE_TIME_FIELD, timeString);
        return this;
    }

    /**
     * Sets the location data using structured data (city, state, country), i.e.:
     *

     *

     *     {
     *         user: {
     *              additional: {
     *                  location: {
     *                      'city': city,
     *                      'state': state,
     *                      'country': country
     *                  }
     *              }
     *         }
     *     }
     *

     *
     * @param city    the city to look up
     * @param state   the state to look up (can be {@code null})
     * @param country the country to look up (can be {@code null})
     *
     * @return {@code this}
     */
    public BreinTemporalData setLocation(final String city, final String state, final String country) {
        setLocation(CITY_TEXT_FIELD, city);
        setLocation(STATE_TEXT_FIELD, state);
        setLocation(COUNTRY_TEXT_FIELD, country);
        return this;
    }

    /**
     * Adds the specified {@code shapeTypes} to the currently defined shape-types to be returned with the response of
     * the request, i.e.:
     *

     *

     *     {
     *         user: {
     *              additional: {
     *                  location: {
     *                      'shapeTypes': [...]
     *                  }
     *              }
     *         }
     *     }
     *

     *
     * @param shapeTypes the shapeTypes to be added
     *
     * @return {@code this}
     */
    public BreinTemporalData addShapeTypes(final String... shapeTypes) {
        if (shapeTypes == null || shapeTypes.length == 0) {
            return this;
        }

        List<String> list = getLocation(SHAPE_TYPES_FIELD);
        if (list == null) {
            list = new ArrayList<>();
            setLocation(SHAPE_TYPES_FIELD, list);
        }
        list.addAll(Arrays.asList(shapeTypes));

        return this;
    }

    /**
     * Gets the current value specified within the location of the request.
     *
     * @param key the value to retrieve (e.g., {@code "shapeTypes"}, {@code "city"}, or {@code "latitude"})
     * @param <T> the expected type of the returned value
     *
     * @return the associated value to the specified key
     */
    @SuppressWarnings("unchecked")
    public <T> T getLocation(final String key) {
        final Map<String, Object> location = getUser().getAdditional(LOCATION_FIELD);
        return location == null ? null : (T) location.get(key);
    }

    public BreinTemporalData setLocation(final String key, final Object value) {
        Map<String, Object> location = getUser().getAdditional(LOCATION_FIELD);
        if (location == null) {
            location = new HashMap<>();
            getUser().setAdditional(LOCATION_FIELD, location);
        }

        location.put(key, value);

        return this;
    }

    /**
     * Creates the signature for temporaldata
     *
     * @return signature
     */
    @Override
    public String createSignature(final BreinConfig config, final Map<String, Object> requestData) {
        final String localDateTime = BreinMapUtil.getNestedValue(requestData,
                BreinUser.USER_FIELD, BreinUser.ADDITIONAL_FIELD, LOCAL_DATE_TIME_FIELD);
        final String paraLocalDateTime = localDateTime == null ? "" : localDateTime;

        final String timeZone = BreinMapUtil.getNestedValue(requestData,
                BreinUser.USER_FIELD, BreinUser.ADDITIONAL_FIELD, TIMEZONE_FIELD);
        final String paraTimezone = timeZone == null ? "" : timeZone;

        final long unixTimestamp = BreinMapUtil.getNestedValue(requestData, UNIX_TIMESTAMP_FIELD);

        final String message = String.format("%d-%s-%s", unixTimestamp, paraLocalDateTime, paraTimezone);

        return BreinUtil.generateSignature(message, config.getSecret());
    }

    @Override
    public BreinTemporalDataResult execute() {
        return Breinify.temporalData(this);
    }
}


text:
<!DOCTYPE html>
<html>
<head>
<script src="/js-test-resources/js-test.js"></script>
</head>
<body>
<script>
startWorker("../script-tests/eventsource-cors-non-http.js");
</script>
</body>
</html>


text:
package com.flextrade.jfixture.utility;

public class KeyValuePair {
    private final Object key;
    private final Object value;

    public KeyValuePair(Object key, Object value) {
        this.key = key;
        this.value = value;
    }

    public Object getKey() {
        return this.key;
    }

    public Object getValue() {
        return this.value;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;

        KeyValuePair that = (KeyValuePair) o;

        return key.equals(that.key) && value.equals(that.value);
    }

    @Override
    public int hashCode() {
        int result = key.hashCode();
        result = 31 * result + value.hashCode();
        return result;
    }
}


text:
import { Injectable } from "@angular/core";
import { CanActivate, ActivatedRouteSnapshot, RouterStateSnapshot, Router } from "@angular/router";
import { Observable } from "rxjs/Rx";
import { AuthService } from "./auth.service";
import 'rxjs/add/operator/map';
import 'rxjs/add/operator/first';

@Injectable()
export class AuthGuardService implements CanActivate {

    constructor(
        private _authService: AuthService,
        private _router: Router) {
    }

    canActivate(route: ActivatedRouteSnapshot, state: RouterStateSnapshot): Observable<boolean> | Promise<boolean> | boolean {
        return this._authService.getUser().map(user => {
            if (user) {
                return true
            } else {
                this._router.navigate(['/login'])
            }
        }).first()
    }
}