content_type stringclasses 8
values | main_lang stringclasses 7
values | message stringlengths 1 50 | sha stringlengths 40 40 | patch stringlengths 52 962k | file_count int64 1 300 |
|---|---|---|---|---|---|
Python | Python | add a configuration test like ac_check_funcs_once | eb91adf1193e471ae784c015e6a46329d02d3b45 | <ide><path>numpy/distutils/command/config.py
<ide> def check_func(self, func,
<ide> return self.try_link(body, headers, include_dirs,
<ide> libraries, library_dirs)
<ide>
<add> def check_funcs_once(self, funcs,
<add> headers=None, include_dirs=None,
<add> libraries=None, library_dirs=None,
<add> decl=False, call=False, call_args=None):
<add> """Like check_func, except that it is given a list of function in
<add> funcs, and the test is done only once. Can be useful for faster
<add> configure to test a serie of functions."""
<add> # clean up distutils's config a bit: add void to main(), and
<add> # return a value.
<add> self._check_compiler()
<add> body = []
<add> if decl:
<add> for func in funcs:
<add> body.append("int %s ();" % func)
<add> body.append("int main (void) {")
<add> if call:
<add> for func in funcs:
<add> if not call_args.has_key(func):
<add> call_args = ''
<add> body.append(" %s(%s);" % (func, call_args[func]))
<add> else:
<add> for func in funcs:
<add> body.append(" %s;" % func)
<add> body.append(" return 0;")
<add> body.append("}")
<add> body = '\n'.join(body) + "\n"
<add>
<add> return self.try_link(body, headers, include_dirs,
<add> libraries, library_dirs)
<add>
<ide> def get_output(self, body, headers=None, include_dirs=None,
<ide> libraries=None, library_dirs=None,
<ide> lang="c"): | 1 |
Text | Text | fix default of duplex.allowhalfopen | 029215d754844c6f845ada0d3e6f42f51b33731a | <ide><path>doc/api/stream.md
<ide> added: v0.9.4
<ide>
<ide> If `false` then the stream will automatically end the writable side when the
<ide> readable side ends. Set initially by the `allowHalfOpen` constructor option,
<del>which defaults to `false`.
<add>which defaults to `true`.
<ide>
<ide> This can be changed manually to change the half-open behavior of an existing
<ide> `Duplex` stream instance, but must be changed before the `'end'` event is | 1 |
Javascript | Javascript | fix config path (#537) | 815f17989befcb1875131fb91d4e2b82e2356561 | <ide><path>server/index.js
<ide> export default class Server {
<ide> this.router = new Router()
<ide> this.hotReloader = dev ? new HotReloader(this.dir, { quiet }) : null
<ide> this.http = null
<del> this.config = getConfig(dir)
<add> this.config = getConfig(this.dir)
<ide>
<ide> this.defineRoutes()
<ide> } | 1 |
Python | Python | resolve line-too-long in preprocessing | 7b5629dcf8d770e9e9fdc77ced3f87c8df0990a1 | <ide><path>keras/preprocessing/image.py
<ide> def set_processing_attrs(
<ide> (if `save_to_dir` is set).
<ide> subset: Subset of data (`"training"` or `"validation"`) if
<ide> validation_split is set in ImageDataGenerator.
<del> interpolation: Interpolation method used to resample the image if the
<del> target size is different from that of the loaded image.
<del> Supported methods are "nearest", "bilinear", and "bicubic".
<del> If PIL version 1.1.3 or newer is installed, "lanczos" is also
<add> interpolation: Interpolation method used to resample the image if
<add> the target size is different from that of the loaded image.
<add> Supported methods are "nearest", "bilinear", and "bicubic". If
<add> PIL version 1.1.3 or newer is installed, "lanczos" is also
<ide> supported. If PIL version 3.4.0 or newer is installed, "box" and
<ide> "hamming" are also supported. By default, "nearest" is used.
<del> keep_aspect_ratio: Boolean, whether to resize images to a target size
<del> without aspect ratio distortion. The image is cropped in the center
<del> with target aspect ratio before resizing.
<add> keep_aspect_ratio: Boolean, whether to resize images to a target
<add> size without aspect ratio distortion. The image is cropped in
<add> the center with target aspect ratio before resizing.
<ide> """
<ide> self.image_data_generator = image_data_generator
<ide> self.target_size = tuple(target_size)
<ide> def _get_batches_of_transformed_samples(self, index_array):
<ide> def filepaths(self):
<ide> """List of absolute paths to image files."""
<ide> raise NotImplementedError(
<del> "`filepaths` property method has not been implemented in {}.".format(
<del> type(self).__name__
<del> )
<add> "`filepaths` property method has not "
<add> "been implemented in {}.".format(type(self).__name__)
<ide> )
<ide>
<ide> @property
<ide> def labels(self):
<ide> @property
<ide> def sample_weight(self):
<ide> raise NotImplementedError(
<del> "`sample_weight` property method has not been implemented in {}.".format(
<del> type(self).__name__
<del> )
<add> "`sample_weight` property method has not "
<add> "been implemented in {}.".format(type(self).__name__)
<ide> )
<ide>
<ide>
<ide> class DirectoryIterator(BatchFromFilesMixin, Iterator):
<ide> https://www.tensorflow.org/guide/keras/preprocessing_layers).
<ide>
<ide> Args:
<del> directory: Path to the directory to read images from. Each subdirectory in
<del> this directory will be considered to contain images from one class, or
<del> alternatively you could specify class subdirectories via the `classes`
<del> argument.
<add> directory: Path to the directory to read images from. Each subdirectory
<add> in this directory will be considered to contain images from one class,
<add> or alternatively you could specify class subdirectories via the
<add> `classes` argument.
<ide> image_data_generator: Instance of `ImageDataGenerator` to use for random
<ide> transformations and normalization.
<ide> target_size: tuple of integers, dimensions to resize input images to.
<ide> class DirectoryIterator(BatchFromFilesMixin, Iterator):
<ide> - `"binary"`: binary targets (if there are only two classes),
<ide> - `"categorical"`: categorical targets,
<ide> - `"sparse"`: integer targets,
<del> - `"input"`: targets are images identical to input images (mainly used
<del> to work with autoencoders),
<add> - `"input"`: targets are images identical to input images (mainly
<add> used to work with autoencoders),
<ide> - `None`: no targets get yielded (only input images are yielded).
<ide> batch_size: Integer, size of a batch.
<ide> shuffle: Boolean, whether to shuffle the data between epochs.
<ide> seed: Random seed for data shuffling.
<ide> data_format: String, one of `channels_first`, `channels_last`.
<del> save_to_dir: Optional directory where to save the pictures being yielded,
<del> in a viewable format. This is useful for visualizing the random
<del> transformations being applied, for debugging purposes.
<add> save_to_dir: Optional directory where to save the pictures being
<add> yielded, in a viewable format. This is useful for visualizing the
<add> random transformations being applied, for debugging purposes.
<ide> save_prefix: String prefix to use for saving sample images (if
<ide> `save_to_dir` is set).
<ide> save_format: Format to use for saving sample images (if `save_to_dir` is
<ide> class DirectoryIterator(BatchFromFilesMixin, Iterator):
<ide> interpolation: Interpolation method used to resample the image if the
<ide> target size is different from that of the loaded image. Supported
<ide> methods are "nearest", "bilinear", and "bicubic". If PIL version 1.1.3
<del> or newer is installed, "lanczos" is also supported. If PIL version 3.4.0
<del> or newer is installed, "box" and "hamming" are also supported. By
<del> default, "nearest" is used.
<add> or newer is installed, "lanczos" is also supported. If PIL version
<add> 3.4.0 or newer is installed, "box" and "hamming" are also supported.
<add> By default, "nearest" is used.
<ide> keep_aspect_ratio: Boolean, whether to resize images to a target size
<ide> without aspect ratio distortion. The image is cropped in the center
<ide> with target aspect ratio before resizing.
<ide> class NumpyArrayIterator(Iterator):
<ide>
<ide> Args:
<ide> x: Numpy array of input data or tuple. If tuple, the second elements is
<del> either another numpy array or a list of numpy arrays, each of which gets
<del> passed through as an output without any modifications.
<add> either another numpy array or a list of numpy arrays, each of which
<add> gets passed through as an output without any modifications.
<ide> y: Numpy array of targets data.
<ide> image_data_generator: Instance of `ImageDataGenerator` to use for random
<ide> transformations and normalization.
<ide> class NumpyArrayIterator(Iterator):
<ide> sample_weight: Numpy array of sample weights.
<ide> seed: Random seed for data shuffling.
<ide> data_format: String, one of `channels_first`, `channels_last`.
<del> save_to_dir: Optional directory where to save the pictures being yielded,
<del> in a viewable format. This is useful for visualizing the random
<del> transformations being applied, for debugging purposes.
<add> save_to_dir: Optional directory where to save the pictures being
<add> yielded, in a viewable format. This is useful for visualizing the
<add> random transformations being applied, for debugging purposes.
<ide> save_prefix: String prefix to use for saving sample images (if
<ide> `save_to_dir` is set).
<ide> save_format: Format to use for saving sample images (if `save_to_dir` is
<ide> class DataFrameIterator(BatchFromFilesMixin, Iterator):
<ide>
<ide> Args:
<ide> dataframe: Pandas dataframe containing the filepaths relative to
<del> `directory` (or absolute paths if `directory` is None) of the images in
<del> a string column. It should include other column/s depending on the
<add> `directory` (or absolute paths if `directory` is None) of the images
<add> in a string column. It should include other column/s depending on the
<ide> `class_mode`: - if `class_mode` is `"categorical"` (default value) it
<del> must include the `y_col` column with the class/es of each image.
<del> Values in column can be string/list/tuple if a single class or
<del> list/tuple if multiple classes. - if `class_mode` is `"binary"` or
<del> `"sparse"` it must include the given `y_col` column with class values
<del> as strings. - if `class_mode` is `"raw"` or `"multi_output"` it should
<del> contain the columns specified in `y_col`. - if `class_mode` is
<del> `"input"` or `None` no extra column is needed.
<add> must include the `y_col` column with the class/es of each image.
<add> Values in column can be string/list/tuple if a single class or
<add> list/tuple if multiple classes.
<add> - if `class_mode` is `"binary"` or `"sparse"` it must include the
<add> given `y_col` column with class values as strings.
<add> - if `class_mode` is `"raw"` or `"multi_output"` it should contain
<add> the columns specified in `y_col`.
<add> - if `class_mode` is `"input"` or `None` no extra column is needed.
<ide> directory: string, path to the directory to read images from. If `None`,
<ide> data in `x_col` column should be absolute paths.
<ide> image_data_generator: Instance of `ImageDataGenerator` to use for random
<ide> class DataFrameIterator(BatchFromFilesMixin, Iterator):
<ide> "raw", "sparse" or None. Default: "categorical".
<ide> Mode for yielding the targets:
<ide> - `"binary"`: 1D numpy array of binary labels,
<del> - `"categorical"`: 2D numpy array of one-hot encoded labels. Supports
<del> multi-label output.
<add> - `"categorical"`: 2D numpy array of one-hot encoded labels.
<add> Supports multi-label output.
<ide> - `"input"`: images identical to input images (mainly used to work
<ide> with autoencoders),
<ide> - `"multi_output"`: list with the values of the different columns,
<ide> class DataFrameIterator(BatchFromFilesMixin, Iterator):
<ide> shuffle: Boolean, whether to shuffle the data between epochs.
<ide> seed: Random seed for data shuffling.
<ide> data_format: String, one of `channels_first`, `channels_last`.
<del> save_to_dir: Optional directory where to save the pictures being yielded,
<del> in a viewable format. This is useful for visualizing the random
<del> transformations being applied, for debugging purposes.
<add> save_to_dir: Optional directory where to save the pictures being
<add> yielded, in a viewable format. This is useful for visualizing the
<add> random transformations being applied, for debugging purposes.
<ide> save_prefix: String prefix to use for saving sample images (if
<ide> `save_to_dir` is set).
<ide> save_format: Format to use for saving sample images (if `save_to_dir` is
<ide> class DataFrameIterator(BatchFromFilesMixin, Iterator):
<ide> interpolation: Interpolation method used to resample the image if the
<ide> target size is different from that of the loaded image. Supported
<ide> methods are "nearest", "bilinear", and "bicubic". If PIL version 1.1.3
<del> or newer is installed, "lanczos" is also supported. If PIL version 3.4.0
<del> or newer is installed, "box" and "hamming" are also supported. By
<del> default, "nearest" is used.
<add> or newer is installed, "lanczos" is also supported. If PIL version
<add> 3.4.0 or newer is installed, "box" and "hamming" are also supported.
<add> By default, "nearest" is used.
<ide> keep_aspect_ratio: Boolean, whether to resize images to a target size
<ide> without aspect ratio distortion. The image is cropped in the center
<ide> with target aspect ratio before resizing.
<ide> dtype: Dtype to use for the generated arrays.
<ide> validate_filenames: Boolean, whether to validate image filenames in
<ide> `x_col`. If `True`, invalid images will be ignored. Disabling this
<del> option can lead to speed-up in the instantiation of this class. Default:
<del> `True`.
<add> option can lead to speed-up in the instantiation of this class.
<add> Default: `True`.
<ide> """
<ide>
<ide> allowed_class_modes = {
<ide> def _check_params(self, df, x_col, y_col, weight_col, classes):
<ide> self.class_mode, self.allowed_class_modes
<ide> )
<ide> )
<del> # check that y_col has several column names if class_mode is multi_output
<add> # check that y_col has several column names if class_mode is
<add> # multi_output
<ide> if (self.class_mode == "multi_output") and not isinstance(y_col, list):
<ide> raise TypeError(
<ide> 'If class_mode="{}", y_col must be a list. Received {}.'.format(
<ide> def remove_classes(labels, classes):
<ide> return labels if labels in classes else None
<ide> else:
<ide> raise TypeError(
<del> "Expect string, list or tuple but found {} in {} column ".format(
<del> type(labels), y_col
<del> )
<add> "Expect string, list or tuple "
<add> "but found {} in {} column ".format(type(labels), y_col)
<ide> )
<ide>
<ide> if classes:
<ide> def _filter_valid_filepaths(self, df, x_col):
<ide>
<ide> Args:
<ide> df: Pandas dataframe containing filenames in a column
<del> x_col: string, column in `df` that contains the filenames or filepaths
<add> x_col: string, column in `df` that contains the filenames or
<add> filepaths
<ide> Returns:
<ide> absolute paths to image files
<ide> """
<ide> class ImageDataGenerator:
<ide> - 1-D array-like: random elements from the array.
<ide> - int: integer number of pixels from interval `(-width_shift_range,
<ide> +width_shift_range)` - With `width_shift_range=2` possible values
<del> are integers `[-1, 0, +1]`, same as with `width_shift_range=[-1, 0,
<del> +1]`, while with `width_shift_range=1.0` possible values are floats
<del> in the interval [-1.0, +1.0).
<add> are integers `[-1, 0, +1]`, same as with `width_shift_range=[-1,
<add> 0, +1]`, while with `width_shift_range=1.0` possible values are
<add> floats in the interval [-1.0, +1.0).
<ide> height_shift_range: Float, 1-D array-like or int
<ide> - float: fraction of total height, if < 1, or pixels if >= 1.
<ide> - 1-D array-like: random elements from the array.
<ide> - int: integer number of pixels from interval `(-height_shift_range,
<del> +height_shift_range)` - With `height_shift_range=2` possible values
<del> are integers `[-1, 0, +1]`, same as with `height_shift_range=[-1, 0,
<del> +1]`, while with `height_shift_range=1.0` possible values are floats
<del> in the interval [-1.0, +1.0).
<add> +height_shift_range)` - With `height_shift_range=2` possible
<add> values are integers `[-1, 0, +1]`, same as with
<add> `height_shift_range=[-1, 0, +1]`, while with
<add> `height_shift_range=1.0` possible values are floats in the
<add> interval [-1.0, +1.0).
<ide> brightness_range: Tuple or list of two floats. Range for picking a
<ide> brightness shift value from.
<ide> shear_range: Float. Shear Intensity (Shear angle in counter-clockwise
<ide> direction in degrees)
<ide> zoom_range: Float or [lower, upper]. Range for random zoom. If a float,
<ide> `[lower, upper] = [1-zoom_range, 1+zoom_range]`.
<ide> channel_shift_range: Float. Range for random channel shifts.
<del> fill_mode: One of {"constant", "nearest", "reflect" or "wrap"}. Default is
<del> 'nearest'. Points outside the boundaries of the input are filled
<del> according to the given mode:
<add> fill_mode: One of {"constant", "nearest", "reflect" or "wrap"}. Default
<add> is 'nearest'. Points outside the boundaries of the input are filled
<add> according to the given mode:
<ide> - 'constant': kkkkkkkk|abcd|kkkkkkkk (cval=k)
<ide> - 'nearest': aaaaaaaa|abcd|dddddddd
<ide> - 'reflect': abcddcba|abcd|dcbaabcd
<ide> class ImageDataGenerator:
<ide> `fill_mode = "constant"`.
<ide> horizontal_flip: Boolean. Randomly flip inputs horizontally.
<ide> vertical_flip: Boolean. Randomly flip inputs vertically.
<del> rescale: rescaling factor. Defaults to None. If None or 0, no rescaling is
<del> applied, otherwise we multiply the data by the value provided (after
<del> applying all other transformations).
<add> rescale: rescaling factor. Defaults to None. If None or 0, no rescaling
<add> is applied, otherwise we multiply the data by the value provided
<add> (after applying all other transformations).
<ide> preprocessing_function: function that will be applied on each input. The
<ide> function will run after the image is resized and augmented.
<ide> The function should take one argument: one image (Numpy tensor with
<ide> rank 3), and should output a Numpy tensor with the same shape.
<ide> data_format: Image data format, either "channels_first" or
<del> "channels_last". "channels_last" mode means that the images should have
<del> shape `(samples, height, width, channels)`, "channels_first" mode means
<del> that the images should have shape `(samples, channels, height, width)`.
<del> It defaults to the `image_data_format` value found in your Keras config
<del> file at `~/.keras/keras.json`. If you never set it, then it will be
<del> "channels_last".
<add> "channels_last". "channels_last" mode means that the images should
<add> have shape `(samples, height, width, channels)`, "channels_first" mode
<add> means that the images should have shape `(samples, channels, height,
<add> width)`. It defaults to the `image_data_format` value found in your
<add> Keras config file at `~/.keras/keras.json`. If you never set it, then
<add> it will be "channels_last".
<ide> validation_split: Float. Fraction of images reserved for validation
<ide> (strictly between 0 and 1).
<ide> dtype: Dtype to use for the generated arrays.
<ide> def flow(
<ide>
<ide> Args:
<ide> x: Input data. Numpy array of rank 4 or a tuple. If tuple, the first
<del> element should contain the images and the second element another numpy
<del> array or a list of numpy arrays that gets passed to the output without
<del> any modifications. Can be used to feed the model miscellaneous data
<del> along with the images. In case of grayscale data, the channels axis of
<del> the image array should have value 1, in case of RGB data, it should
<del> have value 3, and in case of RGBA data, it should have value 4.
<add> element should contain the images and the second element another
<add> numpy array or a list of numpy arrays that gets passed to the
<add> output without any modifications. Can be used to feed the model
<add> miscellaneous data along with the images. In case of grayscale
<add> data, the channels axis of the image array should have value 1, in
<add> case of RGB data, it should have value 3, and in case of RGBA
<add> data, it should have value 4.
<ide> y: Labels.
<ide> batch_size: Int (default: 32).
<ide> shuffle: Boolean (default: True).
<ide> sample_weight: Sample weights.
<ide> seed: Int (default: None).
<del> save_to_dir: None or str (default: None). This allows you to optionally
<del> specify a directory to which to save the augmented pictures being
<del> generated (useful for visualizing what you are doing).
<del> save_prefix: Str (default: `''`). Prefix to use for filenames of saved
<del> pictures (only relevant if `save_to_dir` is set).
<del> save_format: one of "png", "jpeg", "bmp", "pdf", "ppm", "gif", "tif",
<del> "jpg" (only relevant if `save_to_dir` is set). Default: "png".
<add> save_to_dir: None or str (default: None). This allows you to
<add> optionally specify a directory to which to save the augmented
<add> pictures being generated (useful for visualizing what you are
<add> doing).
<add> save_prefix: Str (default: `''`). Prefix to use for filenames of
<add> saved pictures (only relevant if `save_to_dir` is set).
<add> save_format: one of "png", "jpeg", "bmp", "pdf", "ppm", "gif",
<add> "tif", "jpg" (only relevant if `save_to_dir` is set). Default:
<add> "png".
<ide> ignore_class_split: Boolean (default: False), ignore difference
<ide> in number of classes in labels across train and validation
<ide> split (useful for non-classification tasks)
<ide> def flow_from_directory(
<ide> """Takes the path to a directory & generates batches of augmented data.
<ide>
<ide> Args:
<del> directory: string, path to the target directory. It should contain one
<del> subdirectory per class. Any PNG, JPG, BMP, PPM or TIF images inside
<del> each of the subdirectories directory tree will be included in the
<del> generator. See [this script](
<del> https://gist.github.com/fchollet/0830affa1f7f19fd47b06d4cf89ed44d)
<del> for more details.
<add> directory: string, path to the target directory. It should contain
<add> one subdirectory per class. Any PNG, JPG, BMP, PPM or TIF images
<add> inside each of the subdirectories directory tree will be included
<add> in the generator. See [this script](
<add> https://gist.github.com/fchollet/0830affa1f7f19fd47b06d4cf89ed44d)
<add> for more details.
<ide> target_size: Tuple of integers `(height, width)`, defaults to `(256,
<ide> 256)`. The dimensions to which all images found will be resized.
<del> color_mode: One of "grayscale", "rgb", "rgba". Default: "rgb". Whether
<del> the images will be converted to have 1, 3, or 4 channels.
<del> classes: Optional list of class subdirectories
<del> (e.g. `['dogs', 'cats']`). Default: None. If not provided, the list
<del> of classes will be automatically inferred from the subdirectory
<del> names/structure under `directory`, where each subdirectory will be
<del> treated as a different class (and the order of the classes, which
<del> will map to the label indices, will be alphanumeric). The
<del> dictionary containing the mapping from class names to class
<del> indices can be obtained via the attribute `class_indices`.
<add> color_mode: One of "grayscale", "rgb", "rgba". Default: "rgb".
<add> Whether the images will be converted to have 1, 3, or 4 channels.
<add> classes: Optional list of class subdirectories (e.g. `['dogs',
<add> 'cats']`). Default: None. If not provided, the list of classes
<add> will be automatically inferred from the subdirectory
<add> names/structure under `directory`, where each subdirectory will be
<add> treated as a different class (and the order of the classes, which
<add> will map to the label indices, will be alphanumeric). The
<add> dictionary containing the mapping from class names to class
<add> indices can be obtained via the attribute `class_indices`.
<ide> class_mode: One of "categorical", "binary", "sparse",
<ide> "input", or None. Default: "categorical".
<ide> Determines the type of label arrays that are returned:
<ide> def flow_from_directory(
<ide> the data still needs to reside in a subdirectory
<ide> of `directory` for it to work correctly.
<ide> batch_size: Size of the batches of data (default: 32).
<del> shuffle: Whether to shuffle the data (default: True) If set to False,
<del> sorts the data in alphanumeric order.
<add> shuffle: Whether to shuffle the data (default: True) If set to
<add> False, sorts the data in alphanumeric order.
<ide> seed: Optional random seed for shuffling and transformations.
<del> save_to_dir: None or str (default: None). This allows you to optionally
<del> specify a directory to which to save the augmented pictures being
<del> generated (useful for visualizing what you are doing).
<del> save_prefix: Str. Prefix to use for filenames of saved pictures (only
<del> relevant if `save_to_dir` is set).
<del> save_format: one of "png", "jpeg", "bmp", "pdf", "ppm", "gif", "tif",
<del> "jpg"
<del> (only relevant if `save_to_dir` is set). Default: "png".
<add> save_to_dir: None or str (default: None). This allows you to
<add> optionally specify a directory to which to save the augmented
<add> pictures being generated (useful for visualizing what you are
<add> doing).
<add> save_prefix: Str. Prefix to use for filenames of saved pictures
<add> (only relevant if `save_to_dir` is set).
<add> save_format: one of "png", "jpeg", "bmp", "pdf", "ppm", "gif",
<add> "tif", "jpg" (only relevant if `save_to_dir` is set). Default:
<add> "png".
<ide> follow_links: Whether to follow symlinks inside
<ide> class subdirectories (default: False).
<ide> subset: Subset of data (`"training"` or `"validation"`) if
<ide> `validation_split` is set in `ImageDataGenerator`.
<del> interpolation: Interpolation method used to resample the image if the
<del> target size is different from that of the loaded image. Supported
<del> methods are `"nearest"`, `"bilinear"`, and `"bicubic"`. If PIL version
<del> 1.1.3 or newer is installed, `"lanczos"` is also supported. If PIL
<del> version 3.4.0 or newer is installed, `"box"` and `"hamming"` are also
<del> supported. By default, `"nearest"` is used.
<add> interpolation: Interpolation method used to resample the image if
<add> the target size is different from that of the loaded image.
<add> Supported methods are `"nearest"`, `"bilinear"`, and `"bicubic"`.
<add> If PIL version 1.1.3 or newer is installed, `"lanczos"` is also
<add> supported. If PIL version 3.4.0 or newer is installed, `"box"` and
<add> `"hamming"` are also supported. By default, `"nearest"` is used.
<ide> keep_aspect_ratio: Boolean, whether to resize images to a target
<ide> size without aspect ratio distortion. The image is cropped in
<ide> the center with target aspect ratio before resizing.
<ide> def flow_from_dataframe(
<ide> or list/tuple if multiple classes.
<ide> - if `class_mode` is `"binary"` or `"sparse"` it must include
<ide> the given `y_col` column with class values as strings.
<del> - if `class_mode` is `"raw"` or `"multi_output"` it should contain
<del> the columns specified in `y_col`.
<del> - if `class_mode` is `"input"` or `None` no extra column is needed.
<del> directory: string, path to the directory to read images from. If `None`,
<del> data in `x_col` column should be absolute paths.
<add> - if `class_mode` is `"raw"` or `"multi_output"` it should
<add> contain the columns specified in `y_col`.
<add> - if `class_mode` is `"input"` or `None` no extra column is
<add> needed.
<add> directory: string, path to the directory to read images from. If
<add> `None`, data in `x_col` column should be absolute paths.
<ide> x_col: string, column in `dataframe` that contains the filenames (or
<ide> absolute paths if `directory` is `None`).
<del> y_col: string or list, column/s in `dataframe` that has the target data.
<add> y_col: string or list, column/s in `dataframe` that has the target
<add> data.
<ide> weight_col: string, column in `dataframe` that contains the sample
<ide> weights. Default: `None`.
<del> target_size: tuple of integers `(height, width)`, default: `(256, 256)`.
<del> The dimensions to which all images found will be resized.
<del> color_mode: one of "grayscale", "rgb", "rgba". Default: "rgb". Whether
<del> the images will be converted to have 1 or 3 color channels.
<del> classes: optional list of classes (e.g. `['dogs', 'cats']`). Default is
<del> None. If not provided, the list of classes will be automatically
<del> inferred from the `y_col`, which will map to the label indices, will
<del> be alphanumeric). The dictionary containing the mapping from class
<del> names to class indices can be obtained via the attribute
<del> `class_indices`.
<add> target_size: tuple of integers `(height, width)`, default: `(256,
<add> 256)`. The dimensions to which all images found will be resized.
<add> color_mode: one of "grayscale", "rgb", "rgba". Default: "rgb".
<add> Whether the images will be converted to have 1 or 3 color
<add> channels.
<add> classes: optional list of classes (e.g. `['dogs', 'cats']`). Default
<add> is None. If not provided, the list of classes will be
<add> automatically inferred from the `y_col`, which will map to the
<add> label indices, will be alphanumeric). The dictionary containing
<add> the mapping from class names to class indices can be obtained via
<add> the attribute `class_indices`.
<ide> class_mode: one of "binary", "categorical", "input", "multi_output",
<ide> "raw", sparse" or None. Default: "categorical".
<ide> Mode for yielding the targets:
<ide> - `"binary"`: 1D numpy array of binary labels,
<ide> - `"categorical"`: 2D numpy array of one-hot encoded labels.
<ide> Supports multi-label output.
<del> - `"input"`: images identical to input images (mainly used to work
<del> with autoencoders),
<del> - `"multi_output"`: list with the values of the different columns,
<add> - `"input"`: images identical to input images (mainly used to
<add> work with autoencoders),
<add> - `"multi_output"`: list with the values of the different
<add> columns,
<ide> - `"raw"`: numpy array of values in `y_col` column(s),
<del> - `"sparse"`: 1D numpy array of integer labels, - `None`, no targets
<del> are returned (the generator will only yield batches of image data,
<del> which is useful to use in `model.predict()`).
<add> - `"sparse"`: 1D numpy array of integer labels,
<add> - `None`, no targets are returned (the generator will only yield
<add> batches of image data, which is useful to use in
<add> `model.predict()`).
<ide> batch_size: size of the batches of data (default: 32).
<ide> shuffle: whether to shuffle the data (default: True)
<ide> seed: optional random seed for shuffling and transformations.
<del> save_to_dir: None or str (default: None). This allows you to optionally
<del> specify a directory to which to save the augmented pictures being
<del> generated (useful for visualizing what you are doing).
<del> save_prefix: str. Prefix to use for filenames of saved pictures (only
<del> relevant if `save_to_dir` is set).
<del> save_format: one of "png", "jpeg", "bmp", "pdf", "ppm", "gif", "tif",
<del> "jpg" (only relevant if `save_to_dir` is set). Default: "png".
<add> save_to_dir: None or str (default: None). This allows you to
<add> optionally specify a directory to which to save the augmented
<add> pictures being generated (useful for visualizing what you are
<add> doing).
<add> save_prefix: str. Prefix to use for filenames of saved pictures
<add> (only relevant if `save_to_dir` is set).
<add> save_format: one of "png", "jpeg", "bmp", "pdf", "ppm", "gif",
<add> "tif", "jpg" (only relevant if `save_to_dir` is set). Default:
<add> "png".
<ide> subset: Subset of data (`"training"` or `"validation"`) if
<ide> `validation_split` is set in `ImageDataGenerator`.
<del> interpolation: Interpolation method used to resample the image if the
<del> target size is different from that of the loaded image. Supported
<del> methods are `"nearest"`, `"bilinear"`, and `"bicubic"`. If PIL version
<del> 1.1.3 or newer is installed, `"lanczos"` is also supported. If PIL
<del> version 3.4.0 or newer is installed, `"box"` and `"hamming"` are also
<del> supported. By default, `"nearest"` is used.
<add> interpolation: Interpolation method used to resample the image if
<add> the target size is different from that of the loaded image.
<add> Supported methods are `"nearest"`, `"bilinear"`, and `"bicubic"`.
<add> If PIL version 1.1.3 or newer is installed, `"lanczos"` is also
<add> supported. If PIL version 3.4.0 or newer is installed, `"box"` and
<add> `"hamming"` are also supported. By default, `"nearest"` is used.
<ide> validate_filenames: Boolean, whether to validate image filenames in
<ide> `x_col`. If `True`, invalid images will be ignored. Disabling this
<ide> option can lead to speed-up in the execution of this function.
<ide> def flow_from_dataframe(
<ide> )
<ide>
<ide> def standardize(self, x):
<del> """Applies the normalization configuration in-place to a batch of inputs.
<add> """Applies the normalization configuration in-place to a batch of
<add> inputs.
<ide>
<ide> `x` is changed in-place since the function is mainly used internally
<ide> to standardize images and feed them to your network. If a copy of `x`
<ide> def random_rotation(
<ide> ):
<ide> """Performs a random rotation of a Numpy image tensor.
<ide>
<del> Deprecated: `tf.keras.preprocessing.image.random_rotation` does not operate on
<del> tensors and is not recommended for new code. Prefer
<del> `tf.keras.layers.RandomRotation` which provides equivalent functionality as a
<del> preprocessing layer. For more information, see the tutorial for
<add> Deprecated: `tf.keras.preprocessing.image.random_rotation` does not operate
<add> on tensors and is not recommended for new code. Prefer
<add> `tf.keras.layers.RandomRotation` which provides equivalent functionality as
<add> a preprocessing layer. For more information, see the tutorial for
<ide> [augmenting images](
<ide> https://www.tensorflow.org/tutorials/images/data_augmentation), as well as
<ide> the [preprocessing layer guide](
<ide> def random_shift(
<ide>
<ide> Deprecated: `tf.keras.preprocessing.image.random_shift` does not operate on
<ide> tensors and is not recommended for new code. Prefer
<del> `tf.keras.layers.RandomTranslation` which provides equivalent functionality as
<del> a preprocessing layer. For more information, see the tutorial for
<add> `tf.keras.layers.RandomTranslation` which provides equivalent functionality
<add> as a preprocessing layer. For more information, see the tutorial for
<ide> [augmenting images](
<ide> https://www.tensorflow.org/tutorials/images/data_augmentation), as well as
<ide> the [preprocessing layer guide](
<ide> def apply_brightness_shift(x, brightness, scale=True):
<ide> def random_brightness(x, brightness_range, scale=True):
<ide> """Performs a random brightness shift.
<ide>
<del> Deprecated: `tf.keras.preprocessing.image.random_brightness` does not operate
<del> on tensors and is not recommended for new code. Prefer
<del> `tf.keras.layers.RandomBrightness` which provides equivalent functionality as
<del> a preprocessing layer. For more information, see the tutorial for
<add> Deprecated: `tf.keras.preprocessing.image.random_brightness` does not
<add> operate on tensors and is not recommended for new code. Prefer
<add> `tf.keras.layers.RandomBrightness` which provides equivalent functionality
<add> as a preprocessing layer. For more information, see the tutorial for
<ide> [augmenting images](
<ide> https://www.tensorflow.org/tutorials/images/data_augmentation), as well as
<ide> the [preprocessing layer guide](
<ide> def apply_affine_transform(
<ide> final_offset = transform_matrix[:2, 2]
<ide>
<ide> channel_images = [
<del> ndimage.interpolation.affine_transform( # pylint: disable=g-complex-comprehension
<add> ndimage.interpolation.affine_transform(
<ide> x_channel,
<ide> final_affine_matrix,
<ide> final_offset,
<ide><path>keras/preprocessing/image_test.py
<ide> def test_image_data_generator_with_validation_split(self):
<ide> # number of classes, because labels are sorted
<ide> with self.assertRaisesRegex(
<ide> ValueError,
<del> "Training and validation subsets have different number of classes",
<add> "Training and validation subsets have "
<add> "different number of classes",
<ide> ):
<ide> generator.flow(
<ide> images,
<ide><path>keras/preprocessing/sequence_test.py
<ide> def test_TimeSeriesGenerator_doesnt_miss_any_sample(self):
<ide> self.assertEqual(expected, actual)
<ide>
<ide> if len(g) > 0: # pylint: disable=g-explicit-length-test
<del> # All elements in range(length, 10) should be used as current step
<add> # All elements in range(length, 10) should be used as current
<add> # step
<ide> expected = np.arange(length, 10).reshape(-1, 1)
<ide>
<ide> y = np.concatenate([g[ix][1] for ix in range(len(g))], axis=0)
<ide><path>keras/preprocessing/text.py
<ide> def one_hot(
<ide> ):
<ide> r"""One-hot encodes a text into a list of word indexes of size `n`.
<ide>
<del> Deprecated: `tf.keras.text.preprocessing.one_hot` does not operate on tensors
<del> and is not recommended for new code. Prefer `tf.keras.layers.Hashing` with
<del> `output_mode='one_hot'` which provides equivalent functionality through a
<del> layer which accepts `tf.Tensor` input. See the [preprocessing layer guide]
<del> (https://www.tensorflow.org/guide/keras/preprocessing_layers)
<del> for an overview of preprocessing layers.
<add> Deprecated: `tf.keras.text.preprocessing.one_hot` does not operate on
<add> tensors and is not recommended for new code. Prefer
<add> `tf.keras.layers.Hashing` with `output_mode='one_hot'` which provides
<add> equivalent functionality through a layer which accepts `tf.Tensor` input.
<add> See the [preprocessing layer guide]
<add> (https://www.tensorflow.org/guide/keras/preprocessing_layers) for an
<add> overview of preprocessing layers.
<ide>
<ide> This function receives as input a string of text and returns a
<ide> list of encoded integers each corresponding to a word (or token)
<ide> def hashing_trick(
<ide> r"""Converts a text to a sequence of indexes in a fixed-size hashing space.
<ide>
<ide> Deprecated: `tf.keras.text.preprocessing.hashing_trick` does not operate on
<del> tensors and is not recommended for new code. Prefer `tf.keras.layers.Hashing`
<del> which provides equivalent functionality through a layer which accepts
<del> `tf.Tensor` input. See the [preprocessing layer guide]
<del> (https://www.tensorflow.org/guide/keras/preprocessing_layers)
<del> for an overview of preprocessing layers.
<add> tensors and is not recommended for new code. Prefer
<add> `tf.keras.layers.Hashing` which provides equivalent functionality through a
<add> layer which accepts `tf.Tensor` input. See the [preprocessing layer guide](
<add> https://www.tensorflow.org/guide/keras/preprocessing_layers) for an
<add> overview of preprocessing layers.
<ide>
<ide> Args:
<ide> text: Input text (string).
<ide><path>keras/preprocessing/text_test.py
<ide> def test_tokenizer_serde_no_fitting(self):
<ide>
<ide> def test_tokenizer_serde_fitting(self):
<ide> sample_texts = [
<del> "There was a time that the pieces fit, but I watched them fall away",
<add> "There was a time that the pieces fit, but I watched "
<add> "them fall away",
<ide> "Mildewed and smoldering, strangled by our coveting",
<del> "I've done the math enough to know the dangers of our second guessing",
<add> "I've done the math enough to know the dangers of our second "
<add> "guessing",
<ide> ]
<ide> tokenizer = text.Tokenizer(num_words=100)
<ide> tokenizer.fit_on_texts(sample_texts) | 5 |
Ruby | Ruby | avoid encrypt + decrypt on attribute assignment | 9ba037471d6abf0ce52a250db43cfcd2e9a72390 | <ide><path>activerecord/lib/active_record/encryption/encrypted_attribute_type.rb
<ide> def initialize(scheme:, cast_type: ActiveModel::Type::String.new, previous_type:
<ide> @default = default
<ide> end
<ide>
<add> def cast(value)
<add> cast_type.cast(value)
<add> end
<add>
<ide> def deserialize(value)
<ide> cast_type.deserialize decrypt(value)
<ide> end | 1 |
Python | Python | add none testcases to date, datetime, time | 681ad6f5370c88c15ccde3ecd61e735cde514e1a | <ide><path>rest_framework/tests/fields.py
<ide> def test_from_native_empty(self):
<ide>
<ide> self.assertEqual(result, None)
<ide>
<add> def test_from_native_none(self):
<add> """
<add> Make sure from_native() returns None on None param.
<add> """
<add> f = serializers.DateField()
<add> result = f.from_native(None)
<add>
<add> self.assertEqual(result, None)
<add>
<ide> def test_from_native_invalid_date(self):
<ide> """
<ide> Make sure from_native() raises a ValidationError on passing an invalid date.
<ide> def test_from_native_empty(self):
<ide>
<ide> self.assertEqual(result, None)
<ide>
<add> def test_from_native_none(self):
<add> """
<add> Make sure from_native() returns None on None param.
<add> """
<add> f = serializers.DateTimeField()
<add> result = f.from_native(None)
<add>
<add> self.assertEqual(result, None)
<add>
<ide> def test_from_native_invalid_datetime(self):
<ide> """
<ide> Make sure from_native() raises a ValidationError on passing an invalid datetime.
<ide> def test_from_native_empty(self):
<ide>
<ide> self.assertEqual(result, None)
<ide>
<add> def test_from_native_none(self):
<add> """
<add> Make sure from_native() returns None on None param.
<add> """
<add> f = serializers.TimeField()
<add> result = f.from_native(None)
<add>
<add> self.assertEqual(result, None)
<add>
<ide> def test_from_native_invalid_time(self):
<ide> """
<ide> Make sure from_native() raises a ValidationError on passing an invalid time. | 1 |
Ruby | Ruby | use #model_name on instances instead of classes | 6b0e834a194d112585f41deba0a40780d68e38c6 | <ide><path>actionpack/lib/action_controller/model_naming.rb
<ide> def convert_to_model(object)
<ide> end
<ide>
<ide> def model_name_from_record_or_class(record_or_class)
<del> (record_or_class.is_a?(Class) ? record_or_class : convert_to_model(record_or_class).class).model_name
<add> convert_to_model(record_or_class).model_name
<ide> end
<ide> end
<ide> end
<ide><path>actionpack/lib/action_dispatch/routing/polymorphic_routes.rb
<ide> def handle_model(record)
<ide> model = record.to_model
<ide> name = if record.persisted?
<ide> args << model
<del> model.class.model_name.singular_route_key
<add> model.model_name.singular_route_key
<ide> else
<del> @key_strategy.call model.class.model_name
<add> @key_strategy.call model.model_name
<ide> end
<ide>
<ide> named_route = prefix + "#{name}_#{suffix}"
<ide> def handle_list(list)
<ide> parent.model_name.singular_route_key
<ide> else
<ide> args << parent.to_model
<del> parent.to_model.class.model_name.singular_route_key
<add> parent.to_model.model_name.singular_route_key
<ide> end
<ide> }
<ide>
<ide> def handle_list(list)
<ide> else
<ide> if record.persisted?
<ide> args << record.to_model
<del> record.to_model.class.model_name.singular_route_key
<add> record.to_model.model_name.singular_route_key
<ide> else
<del> @key_strategy.call record.to_model.class.model_name
<add> @key_strategy.call record.to_model.model_name
<ide> end
<ide> end
<ide>
<ide><path>actionview/lib/action_view/helpers/form_helper.rb
<ide> def submit_default_value
<ide> object = convert_to_model(@object)
<ide> key = object ? (object.persisted? ? :update : :create) : :submit
<ide>
<del> model = if object.class.respond_to?(:model_name)
<del> object.class.model_name.human
<add> model = if object.respond_to?(:model_name)
<add> object.model_name.human
<ide> else
<ide> @object_name.to_s.humanize
<ide> end
<ide><path>actionview/lib/action_view/helpers/tags/label.rb
<ide> def render(&block)
<ide> @object_name.gsub!(/\[(.*)_attributes\]\[\d+\]/, '.\1')
<ide>
<ide> if object.respond_to?(:to_model)
<del> key = object.class.model_name.i18n_key
<add> key = object.model_name.i18n_key
<ide> i18n_default = ["#{key}.#{method_and_value}".to_sym, ""]
<ide> end
<ide>
<ide><path>actionview/lib/action_view/model_naming.rb
<ide> def convert_to_model(object)
<ide> end
<ide>
<ide> def model_name_from_record_or_class(record_or_class)
<del> (record_or_class.is_a?(Class) ? record_or_class : convert_to_model(record_or_class).class).model_name
<add> convert_to_model(record_or_class).model_name
<ide> end
<ide> end
<ide> end
<ide><path>actionview/test/activerecord/polymorphic_routes_test.rb
<ide> def to_model
<ide> end
<ide>
<ide> class ModelDelegate
<del> def self.model_name
<del> ActiveModel::Name.new(self)
<add> def model_name
<add> ActiveModel::Name.new(self.class)
<ide> end
<ide>
<ide> def to_param
<ide><path>activemodel/lib/active_model/errors.rb
<ide> def generate_message(attribute, type = :invalid, options = {})
<ide>
<ide> options = {
<ide> default: defaults,
<del> model: @base.class.model_name.human,
<add> model: @base.model_name.human,
<ide> attribute: @base.class.human_attribute_name(attribute),
<ide> value: value
<ide> }.merge!(options)
<ide><path>activemodel/lib/active_model/lint.rb
<ide> def test_persisted?
<ide>
<ide> # == \Naming
<ide> #
<del> # Model.model_name must return a string with some convenience methods:
<del> # <tt>:human</tt>, <tt>:singular</tt> and <tt>:plural</tt>. Check
<del> # ActiveModel::Naming for more information.
<add> # Model.model_name and Model#model_name must return a string with some
<add> # convenience methods: # <tt>:human</tt>, <tt>:singular</tt> and
<add> # <tt>:plural</tt>. Check ActiveModel::Naming for more information.
<ide> def test_model_naming
<del> assert model.class.respond_to?(:model_name), "The model should respond to model_name"
<add> assert model.class.respond_to?(:model_name), "The model class should respond to model_name"
<ide> model_name = model.class.model_name
<ide> assert model_name.respond_to?(:to_str)
<ide> assert model_name.human.respond_to?(:to_str)
<ide> assert model_name.singular.respond_to?(:to_str)
<ide> assert model_name.plural.respond_to?(:to_str)
<add>
<add> assert model.respond_to?(:model_name), "The model instance should respond to model_name"
<add> assert_equal model.model_name, model.class.model_name
<ide> end
<ide>
<ide> # == \Errors Testing
<ide><path>activemodel/lib/active_model/naming.rb
<ide> def self.model_name_from_record_or_class(record_or_class) #:nodoc:
<ide> if record_or_class.respond_to?(:model_name)
<ide> record_or_class.model_name
<ide> elsif record_or_class.respond_to?(:to_model)
<del> record_or_class.to_model.class.model_name
<add> record_or_class.to_model.model_name
<ide> else
<ide> record_or_class.class.model_name
<ide> end
<ide><path>activemodel/lib/active_model/serializers/json.rb
<ide> def as_json(options = nil)
<ide> end
<ide>
<ide> if root
<del> root = self.class.model_name.element if root == true
<add> root = model_name.element if root == true
<ide> { root => serializable_hash(options) }
<ide> else
<ide> serializable_hash(options)
<ide><path>activemodel/lib/active_model/serializers/xml.rb
<ide> def serialize
<ide> @builder = options[:builder]
<ide> @builder.instruct! unless options[:skip_instruct]
<ide>
<del> root = (options[:root] || @serializable.class.model_name.element).to_s
<add> root = (options[:root] || @serializable.model_name.element).to_s
<ide> root = ActiveSupport::XmlMini.rename_key(root, options)
<ide>
<ide> args = [root]
<ide><path>activemodel/lib/active_model/validations.rb
<ide> module Validations
<ide> extend ActiveSupport::Concern
<ide>
<ide> included do
<add> extend ActiveModel::Naming
<ide> extend ActiveModel::Callbacks
<ide> extend ActiveModel::Translation
<ide>
<ide><path>activerecord/lib/active_record/integration.rb
<ide> def to_param
<ide> def cache_key(*timestamp_names)
<ide> case
<ide> when new_record?
<del> "#{self.class.model_name.cache_key}/new"
<add> "#{model_name.cache_key}/new"
<ide> when timestamp_names.any?
<ide> timestamp = max_updated_column_timestamp(timestamp_names)
<ide> timestamp = timestamp.utc.to_s(cache_timestamp_format)
<del> "#{self.class.model_name.cache_key}/#{id}-#{timestamp}"
<add> "#{model_name.cache_key}/#{id}-#{timestamp}"
<ide> when timestamp = max_updated_column_timestamp
<ide> timestamp = timestamp.utc.to_s(cache_timestamp_format)
<del> "#{self.class.model_name.cache_key}/#{id}-#{timestamp}"
<add> "#{model_name.cache_key}/#{id}-#{timestamp}"
<ide> else
<del> "#{self.class.model_name.cache_key}/#{id}"
<add> "#{model_name.cache_key}/#{id}"
<ide> end
<ide> end
<ide> | 13 |
Javascript | Javascript | fix soft tabs | 9d382d6f664720486beca0b937f70c1ba545cacc | <ide><path>test/unit/src/animation/AnimationAction.tests.js
<ide> import { LoopOnce, LoopRepeat, LoopPingPong } from '../../../../src/constants';
<ide>
<ide> function createAnimation(){
<ide>
<del> var root = new Object3D();
<add> var root = new Object3D();
<ide> var mixer = new AnimationMixer(root);
<ide> var track = new NumberKeyframeTrack( ".rotation[x]", [ 0, 1000 ], [ 0, 360 ] );
<ide> var clip = new AnimationClip( "clip1", 1000, [track] );
<ide>
<del> var animationAction = mixer.clipAction( clip );
<del> return {
<del> root: root,
<del> mixer: mixer,
<del> track: track,
<del> clip: clip,
<del> animationAction: animationAction
<del> };
<add> var animationAction = mixer.clipAction( clip );
<add> return {
<add> root: root,
<add> mixer: mixer,
<add> track: track,
<add> clip: clip,
<add> animationAction: animationAction
<add> };
<ide>
<ide> }
<ide>
<ide> export default QUnit.module( 'Animation', () => {
<ide>
<ide> QUnit.test( "getMixer", ( assert ) => {
<ide>
<del> var { mixer, animationAction } = createAnimation();
<del> var mixer2 = animationAction.getMixer();
<del> assert.equal( mixer, mixer2, "mixer should be returned by getMixer." );
<add> var { mixer, animationAction } = createAnimation();
<add> var mixer2 = animationAction.getMixer();
<add> assert.equal( mixer, mixer2, "mixer should be returned by getMixer." );
<ide>
<ide> } );
<ide>
<del> QUnit.test("getClip", (assert) => {
<add> QUnit.test("getClip", (assert) => {
<ide>
<del> var { clip, animationAction } = createAnimation();
<del> var clip2 = animationAction.getClip();
<del> assert.equal( clip, clip2, "clip should be returned by getClip." );
<add> var { clip, animationAction } = createAnimation();
<add> var clip2 = animationAction.getClip();
<add> assert.equal( clip, clip2, "clip should be returned by getClip." );
<ide>
<ide> } );
<ide>
<ide> QUnit.test( "getRoot", ( assert ) => {
<ide>
<del> var { root, animationAction } = createAnimation();
<del> var root2 = animationAction.getRoot();
<del> assert.equal(root, root2, "root should be returned by getRoot." );
<add> var { root, animationAction } = createAnimation();
<add> var root2 = animationAction.getRoot();
<add> assert.equal(root, root2, "root should be returned by getRoot." );
<ide>
<ide> } );
<ide> | 1 |
PHP | PHP | add newlines for readability | 203bb49f733299d779212e86ba64ef92acb60b9a | <ide><path>tests/TestCase/Core/AppTest.php
<ide> public function testClassPathWithPlugins()
<ide> {
<ide> $basepath = TEST_APP . 'Plugin' . DS;
<ide> $this->loadPlugins(['TestPlugin', 'Company/TestPluginThree']);
<add>
<ide> $result = App::classPath('Controller', 'TestPlugin');
<ide> $this->assertPathEquals($basepath . 'TestPlugin' . DS . 'src' . DS . 'Controller' . DS, $result[0]);
<add>
<ide> $result = App::classPath('Controller', 'Company/TestPluginThree');
<ide> $expected = $basepath . 'Company' . DS . 'TestPluginThree' . DS . 'src' . DS . 'Controller' . DS;
<ide> $this->assertPathEquals($expected, $result[0]);
<ide> public function testPathWithPlugins()
<ide> $this->deprecated(function () {
<ide> $basepath = TEST_APP . 'Plugin' . DS;
<ide> $this->loadPlugins(['TestPlugin', 'Company/TestPluginThree']);
<add>
<ide> $result = App::path('Controller', 'TestPlugin');
<ide> $this->assertPathEquals($basepath . 'TestPlugin' . DS . 'src' . DS . 'Controller' . DS, $result[0]);
<add>
<ide> $result = App::path('Controller', 'Company/TestPluginThree');
<ide> $expected = $basepath . 'Company' . DS . 'TestPluginThree' . DS . 'src' . DS . 'Controller' . DS;
<ide> $this->assertPathEquals($expected, $result[0]); | 1 |
Python | Python | create a preprocess function that gets bigrams | 6e641f46d49fcdc88e3d0cbcefa5c4860e2cd0ea | <ide><path>spacy/_ml.py
<ide> def _zero_init_impl(self, X, y):
<ide>
<ide> @layerize
<ide> def _preprocess_doc(docs, drop=0.):
<del> keys = [doc.to_array([LOWER]) for doc in docs]
<add> keys = [doc.to_array(LOWER) for doc in docs]
<ide> ops = Model.ops
<ide> # The dtype here matches what thinc is expecting -- which differs per
<ide> # platform (by int definition). This should be fixed once the problem
<ide> # is fixed on Thinc's side.
<ide> lengths = ops.asarray([arr.shape[0] for arr in keys], dtype=numpy.int_)
<ide> keys = ops.xp.concatenate(keys)
<del> vals = ops.allocate(keys.shape[0]) + 1
<add> vals = ops.allocate(keys.shape) + 1.
<add> return (keys, vals, lengths), None
<add>
<add>@layerize
<add>def _preprocess_doc_bigrams(docs, drop=0.):
<add> unigrams = [doc.to_array(LOWER) for doc in docs]
<add> ops = Model.ops
<add> bigrams = [ops.ngrams(2, doc_unis) for doc_unis in unigrams]
<add> keys = [ops.xp.concatenate(feats) for feats in zip(unigrams, bigrams)]
<add> keys, vals = zip(*[ops.xp.unique(k, return_counts=True) for k in keys])
<add> # The dtype here matches what thinc is expecting -- which differs per
<add> # platform (by int definition). This should be fixed once the problem
<add> # is fixed on Thinc's side.
<add> lengths = ops.asarray([arr.shape[0] for arr in keys], dtype=numpy.int_)
<add> keys = ops.xp.concatenate(keys)
<add> vals = ops.asarray(ops.xp.concatenate(vals), dtype='f')
<ide> return (keys, vals, lengths), None
<ide>
<ide>
<ide> def build_text_classifier(nr_class, width=64, **cfg):
<ide>
<ide> linear_model = (
<ide> _preprocess_doc
<del> >> LinearModel(nr_class, drop_factor=0.)
<add> >> LinearModel(nr_class)
<ide> )
<add> #model = linear_model >> logistic
<ide>
<ide> model = (
<ide> (linear_model | cnn_model) | 1 |
Javascript | Javascript | fix alpn tests for openssl1.0.2h | be480b14996153e93326cdf17ea86f85c0b43fa6 | <ide><path>test/parallel/test-tls-alpn-server-client.js
<ide> function Test1() {
<ide> client: {ALPN: 'b', NPN: undefined}});
<ide> // nothing is selected by ALPN
<ide> checkResults(results[2],
<del> {server: {ALPN: false, NPN: false},
<del> client: {ALPN: false, NPN: undefined}});
<add> {server: {ALPN: false, NPN: 'first-priority-unsupported'},
<add> client: {ALPN: false, NPN: false}});
<ide> // execute next test
<ide> Test2();
<ide> });
<ide> function Test2() {
<ide> client: {ALPN: 'b', NPN: undefined}});
<ide> // nothing is selected by ALPN
<ide> checkResults(results[2],
<del> {server: {ALPN: false, NPN: false},
<del> client: {ALPN: false, NPN: undefined}});
<add> {server: {ALPN: false, NPN: 'http/1.1'},
<add> client: {ALPN: false, NPN: false}});
<ide> // execute next test
<ide> Test3();
<ide> });
<ide> function Test5() {
<ide> checkResults(results[1], {server: {ALPN: 'b', NPN: false},
<ide> client: {ALPN: 'b', NPN: undefined}});
<ide> // nothing is selected by ALPN
<del> checkResults(results[2], {server: {ALPN: false, NPN: false},
<del> client: {ALPN: false, NPN: undefined}});
<add> checkResults(results[2], {server: {ALPN: false,
<add> NPN: 'first-priority-unsupported'},
<add> client: {ALPN: false, NPN: false}});
<ide> // execute next test
<ide> Test6();
<ide> });
<ide> function Test6() {
<ide> checkResults(results[1], {server: {ALPN: 'b', NPN: false},
<ide> client: {ALPN: 'b', NPN: undefined}});
<ide> // nothing is selected by ALPN
<del> checkResults(results[2], {server: {ALPN: false, NPN: false},
<del> client: {ALPN: false, NPN: undefined}});
<add> checkResults(results[2], {server: {ALPN: false, NPN: 'http/1.1'},
<add> client: {ALPN: false, NPN: false}});
<ide> // execute next test
<ide> Test7();
<ide> }); | 1 |
Text | Text | add french translation | 7ee89b908ee93833e6bd93de0db416f8f44135bb | <ide><path>threejs/lessons/fr/threejs-fog.md
<ide> On peut l'ajouter comme ceci.
<ide> }
<ide> ```
<ide>
<del>The `near` and `far` parameters set the minimum and maximum values
<del>for adjusting the fog. They are set when we setup the camera.
<add>Les paramètres `near` et `far` définissent les valeurs minimales et maximales pour ajuster le brouillard. Ils sont définis lors de la configuration de la caméra.
<ide>
<del>The `.listen()` at the end of the last 2 lines tells dat.GUI to *listen*
<del>for changes. That way when we change `near` because of an edit to `far`
<del>or we change `far` in response to an edit to `near` dat.GUI will update
<del>the other property's UI for us.
<add>Le `.listen()` à la fin des 2 lignes, dit à dat.GUI *d'écouter*
<add>les changements. Ainsi, que nous changions `near` ou `far`, dat.GUI mettra automatiquement à jour les deux propriétés pour nous.
<ide>
<del>It might also be nice to be able to change the fog color but like was
<del>mentioned above we need to keep both the fog color and the background
<del>color in sync. So, let's add another *virtual* property to our helper
<del>that will set both colors when dat.GUI manipulates it.
<add>Il peut également être agréable de pouvoir changer la couleur du brouillard, mais comme mentionné ci-dessus, nous devons synchroniser la couleur du brouillard et la couleur de l'arrière-plan. Ajoutons donc une autre propriété *virtuelle* à notre helper qui définira les deux couleurs lorsque dat.GUI la manipule.
<ide>
<del>dat.GUI can manipulate colors in 4 ways, as a CSS 6 digit hex string (eg: `#112233`). As an hue, saturation, value, object (eg: `{h: 60, s: 1, v: }`).
<del>As an RGB array (eg: `[255, 128, 64]`). Or, as an RGBA array (eg: `[127, 200, 75, 0.3]`).
<add>dat.GUI peut manipuler les couleurs de 4 façons différentes. Sous la forme d'une chaîne hexadécimale à 6 chiffres (ex : `#112233`). Sous la forme HSL (ex : `{h: 60, s: 1, v: }`).
<add>En tant que tableau RGB (ex : `[255, 128, 64]`). Ou, comme un tableau RGBA (ex : `[127, 200, 75, 0.3]`).
<ide>
<del>It's easiest for our purpose to use the hex string version since that way
<del>dat.GUI is only manipulating a single value. Fortunately `THREE.Color`
<del>as a [`getHexString`](Color.getHexString) method
<del>we get use to easily get such a string, we just have to prepend a '#' to the front.
<add>Il est plus simple d'utiliser la première solution, la version chaîne hexadécimale, ainsi
<add>dat.GUI nemanipule qu'une seule valeur. Heureusement, `THREE.Color`
<add>a une méthode pour cela : [`getHexString`](Color.getHexString) qui permet d'obtenir une telle chaîne, il suffit juste d'ajouter un '#' au début.
<ide>
<ide> ```js
<del>// We use this class to pass to dat.gui
<del>// so when it manipulates near or far
<del>// near is never > far and far is never < near
<del>+// Also when dat.gui manipulates color we'll
<del>+// update both the fog and background colors.
<add>/// On utilise cette classe pour passer à dat.gui
<add>// donc quand il manipule near ou far
<add>// near n'est jamais > far et far n'est jamais < near
<add>+// Aussi, lorsque dat.gui manipule la couleur, nous allons
<add>+// mettre à jour les couleurs du brouillard et de l'arrière-plan.
<ide> class FogGUIHelper {
<ide> * constructor(fog, backgroundColor) {
<ide> this.fog = fog;
<ide> class FogGUIHelper {
<ide> }
<ide> ```
<ide>
<del>We then call `gui.addColor` to add a color UI for our helper's virtual property.
<add>Ensuite, nous appelons `gui.addColor` pour ajouter une couleur à notre propriété virtuelle.
<ide>
<ide> ```js
<ide> {
<ide> We then call `gui.addColor` to add a color UI for our helper's virtual property.
<ide>
<ide> {{{example url="../threejs-fog-gui.html" }}}
<ide>
<del>You can see setting `near` to like 1.9 and `far` to 2.0 gives
<del>a very sharp transition between un-fogged and completely fogged.
<del>where as `near` = 1.1 and `far` = 2.9 should just about be
<del>the smoothest given our cubes are spinning 2 units away from the camera.
<del>
<del>One last thing, there is a boolean [`fog`](Material.fog)
<del>property on a material for whether or not objects rendered
<del>with that material are affected by fog. It defaults to `true`
<del>for most materials. As an example of why you might want
<del>to turn the fog off, imagine you're making a 3D vehicle
<del>simulator with a view from the driver's seat or cockpit.
<del>You probably want the fog off for everything inside the vehicle when
<del>viewing from inside the vehicle.
<del>
<del>A better example might be a house
<del>and thick fog outside house. Let's say the fog is set to start
<del>2 meters away (near = 2) and completely fogged out at 4 meters (far = 4).
<del>Rooms are longer than 2 meters and the house is probably longer
<del>than 4 meters so you need to set the materials for the inside
<del>of the house to not apply fog otherwise when standing inside the
<del>house looking outside the wall at the far end of the room will look
<del>like it's in the fog.
<add>Vous pouvez voir qu'un réglage `near` à 1.9 et `far` à 2,0 donne une transition très nette entre non embué et complètement dans le brouillard. `near` = 1,1 et `far` = 2,9 devrait être la meilleure configuration étant donné que nos cubes tournent à 2 unités de la caméra.
<add>
<add>Une dernière chose, il existe une propriété [les matériaux](Material.fog) pour savoir si les objets rendus avec ce matériau sont affectés ou non par le brouillard. La valeur par défaut est `true` pour la plupart des matériaux. Pour illustrer pourquoi vous pourriez vouloir désactiver le brouillard, imaginez que vous créez un simulateur de véhicule 3D avec une vue depuis le siège du conducteur ou le cockpit. Vous voulez probablement que le brouillard se dissipe pour tout ce qui se trouve à l'intérieur du véhicule lorsque vous regardez de l'intérieur du véhicule.
<add>
<add>Prenons un autre exemple. Une maison avec un épais brouillard à l'extérieur. Disons que pour commencer, le brouillard est réglé pour commencer à 2 mètres (near = 2) et être complet à 4 mètres (far = 4). Les pièces et la maison faisant probablement plus de 4 mètres, il faudra donc définir les matériaux utilisés à l'intérieur de la maison pour qu'il n'y est pas de brouillard. Sinon, ça donnerait ceci.
<ide>
<ide> <div class="spread">
<ide> <div>
<ide> like it's in the fog.
<ide> </div>
<ide> </div>
<ide>
<del>Notice the walls and ceiling at the far end of the room are getting fog applied.
<del>By turning fog off on the materials for the house we can fix that issue.
<add>Remarquez que les murs et le plafond au fond de la pièce sont dans le brouillard. En désactivant le brouillard sur les matériaux de la maison, on résoud le problème.
<ide>
<ide> <div class="spread">
<ide> <div> | 1 |
Javascript | Javascript | fix minor typo | 9fea1dedc5079f6ca093839a1754d94677a08918 | <ide><path>examples/todos/test/actions/todos.spec.js
<ide> describe('todo actions', () => {
<ide> })
<ide> })
<ide>
<del> it('toogleTodo should create TOGGLE_TODO action', () => {
<add> it('toggleTodo should create TOGGLE_TODO action', () => {
<ide> expect(actions.toggleTodo(1)).toEqual({
<ide> type: 'TOGGLE_TODO',
<ide> id: 1 | 1 |
Javascript | Javascript | simplify asserterror creation | 4716dc662d8d24d4d454dd4459ff724588e98eb1 | <ide><path>lib/assert.js
<ide> var assert = module.exports = ok;
<ide> // expected: expected })
<ide>
<ide> assert.AssertionError = function AssertionError(options) {
<del> this.name = 'AssertionError';
<ide> this.message = options.message;
<ide> this.actual = options.actual;
<ide> this.expected = options.expected;
<ide> this.operator = options.operator;
<ide> var stackStartFunction = options.stackStartFunction || fail;
<ide>
<del> if (Error.captureStackTrace) {
<del> Error.captureStackTrace(this, stackStartFunction);
<del> }
<add> this.name = getName(this, options.message);
<add> Error.captureStackTrace(this, stackStartFunction);
<ide> };
<ide>
<ide> // assert.AssertionError instanceof Error
<ide> function truncate(s, n) {
<ide> }
<ide> }
<ide>
<del>assert.AssertionError.prototype.toString = function() {
<del> if (this.message) {
<del> return [this.name + ':', this.message].join(' ');
<add>function getName(self, message) {
<add> if (message) {
<add> return 'AssertionError: ' + message;
<ide> } else {
<del> return [
<del> this.name + ':',
<del> truncate(JSON.stringify(this.actual, replacer), 128),
<del> this.operator,
<del> truncate(JSON.stringify(this.expected, replacer), 128)
<del> ].join(' ');
<add> return 'AssertionError: ' +
<add> truncate(JSON.stringify(self.actual, replacer), 128) + ' ' +
<add> self.operator + ' ' +
<add> truncate(JSON.stringify(self.expected, replacer), 128);
<ide> }
<del>};
<add>}
<ide>
<ide> // At present only the three keys mentioned above are used and
<ide> // understood by the spec. Implementations or sub modules can pass | 1 |
Java | Java | add support for generating classes | d5374550e5da13f8855321b337295b6a38ef38c8 | <ide><path>spring-core/src/main/java/org/springframework/aot/generate/ClassGenerator.java
<add>/*
<add> * Copyright 2002-2022 the original author or authors.
<add> *
<add> * Licensed under the Apache License, Version 2.0 (the "License");
<add> * you may not use this file except in compliance with the License.
<add> * You may obtain a copy of the License at
<add> *
<add> * https://www.apache.org/licenses/LICENSE-2.0
<add> *
<add> * Unless required by applicable law or agreed to in writing, software
<add> * distributed under the License is distributed on an "AS IS" BASIS,
<add> * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
<add> * See the License for the specific language governing permissions and
<add> * limitations under the License.
<add> */
<add>
<add>package org.springframework.aot.generate;
<add>
<add>import java.util.Collection;
<add>import java.util.Collections;
<add>
<add>import org.springframework.javapoet.ClassName;
<add>import org.springframework.javapoet.JavaFile;
<add>
<add>/**
<add> * Generates new {@link GeneratedClass} instances.
<add> *
<add> * @author Phillip Webb
<add> * @since 6.0
<add> * @see GeneratedMethods
<add> */
<add>public interface ClassGenerator {
<add>
<add> /**
<add> * Get or generate a new {@link GeneratedClass} for a given java file
<add> * generator, target and feature name.
<add> * @param javaFileGenerator the java file generator
<add> * @param target the target of the newly generated class
<add> * @param featureName the name of the feature that the generated class
<add> * supports
<add> * @return a {@link GeneratedClass} instance
<add> */
<add> GeneratedClass getOrGenerateClass(JavaFileGenerator javaFileGenerator,
<add> Class<?> target, String featureName);
<add>
<add> /**
<add> * Get or generate a new {@link GeneratedClass} for a given java file
<add> * generator, target and feature name.
<add> * @param javaFileGenerator the java file generator
<add> * @param target the target of the newly generated class
<add> * @param featureName the name of the feature that the generated class
<add> * supports
<add> * @return a {@link GeneratedClass} instance
<add> */
<add> GeneratedClass getOrGenerateClass(JavaFileGenerator javaFileGenerator, String target,
<add> String featureName);
<add>
<add>
<add> /**
<add> * Strategy used to generate the java file for the generated class.
<add> * Implementations of this interface are included as part of the key used to
<add> * identify classes that have already been created and as such should be
<add> * static final instances or implement a valid
<add> * {@code equals}/{@code hashCode}.
<add> */
<add> @FunctionalInterface
<add> interface JavaFileGenerator {
<add>
<add> /**
<add> * Generate the file {@link JavaFile} to be written.
<add> * @param className the class name of the file
<add> * @param methods the generated methods that must be included
<add> * @return the generated files
<add> */
<add> JavaFile generateJavaFile(ClassName className, GeneratedMethods methods);
<add>
<add> /**
<add> * Return method names that must not be generated.
<add> * @return the reserved method names
<add> */
<add> default Collection<String> getReservedMethodNames() {
<add> return Collections.emptySet();
<add> }
<add>
<add> }
<add>
<add>}
<ide><path>spring-core/src/main/java/org/springframework/aot/generate/GeneratedClass.java
<add>/*
<add> * Copyright 2002-2022 the original author or authors.
<add> *
<add> * Licensed under the Apache License, Version 2.0 (the "License");
<add> * you may not use this file except in compliance with the License.
<add> * You may obtain a copy of the License at
<add> *
<add> * https://www.apache.org/licenses/LICENSE-2.0
<add> *
<add> * Unless required by applicable law or agreed to in writing, software
<add> * distributed under the License is distributed on an "AS IS" BASIS,
<add> * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
<add> * See the License for the specific language governing permissions and
<add> * limitations under the License.
<add> */
<add>
<add>package org.springframework.aot.generate;
<add>
<add>import org.springframework.aot.generate.ClassGenerator.JavaFileGenerator;
<add>import org.springframework.javapoet.ClassName;
<add>import org.springframework.javapoet.JavaFile;
<add>import org.springframework.util.Assert;
<add>
<add>/**
<add> * A generated class.
<add> *
<add> * @author Phillip Webb
<add> * @since 6.0
<add> * @see GeneratedClasses
<add> * @see ClassGenerator
<add> */
<add>public final class GeneratedClass {
<add>
<add> private final JavaFileGenerator JavaFileGenerator;
<add>
<add> private final ClassName name;
<add>
<add> private final GeneratedMethods methods;
<add>
<add>
<add> /**
<add> * Create a new {@link GeneratedClass} instance with the given name. This
<add> * constructor is package-private since names should only be generated via a
<add> * {@link GeneratedClasses}.
<add> * @param name the generated name
<add> */
<add> GeneratedClass(JavaFileGenerator javaFileGenerator, ClassName name) {
<add> MethodNameGenerator methodNameGenerator = new MethodNameGenerator(
<add> javaFileGenerator.getReservedMethodNames());
<add> this.JavaFileGenerator = javaFileGenerator;
<add> this.name = name;
<add> this.methods = new GeneratedMethods(methodNameGenerator);
<add> }
<add>
<add>
<add> /**
<add> * Return the name of the generated class.
<add> * @return the name of the generated class
<add> */
<add> public ClassName getName() {
<add> return this.name;
<add> }
<add>
<add> /**
<add> * Return the method generator that can be used for this generated class.
<add> * @return the method generator
<add> */
<add> public MethodGenerator getMethodGenerator() {
<add> return this.methods;
<add> }
<add>
<add> JavaFile generateJavaFile() {
<add> JavaFile javaFile = this.JavaFileGenerator.generateJavaFile(this.name,
<add> this.methods);
<add> Assert.state(this.name.packageName().equals(javaFile.packageName),
<add> () -> "Generated JavaFile should be in package '"
<add> + this.name.packageName() + "'");
<add> Assert.state(this.name.simpleName().equals(javaFile.typeSpec.name),
<add> () -> "Generated JavaFile should be named '" + this.name.simpleName()
<add> + "'");
<add> return javaFile;
<add> }
<add>
<add>}
<ide><path>spring-core/src/main/java/org/springframework/aot/generate/GeneratedClasses.java
<add>/*
<add> * Copyright 2002-2022 the original author or authors.
<add> *
<add> * Licensed under the Apache License, Version 2.0 (the "License");
<add> * you may not use this file except in compliance with the License.
<add> * You may obtain a copy of the License at
<add> *
<add> * https://www.apache.org/licenses/LICENSE-2.0
<add> *
<add> * Unless required by applicable law or agreed to in writing, software
<add> * distributed under the License is distributed on an "AS IS" BASIS,
<add> * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
<add> * See the License for the specific language governing permissions and
<add> * limitations under the License.
<add> */
<add>
<add>package org.springframework.aot.generate;
<add>
<add>import java.io.IOException;
<add>import java.util.ArrayList;
<add>import java.util.Comparator;
<add>import java.util.List;
<add>import java.util.Map;
<add>import java.util.concurrent.ConcurrentHashMap;
<add>
<add>import org.springframework.util.Assert;
<add>
<add>/**
<add> * A managed collection of generated classes.
<add> *
<add> * @author Phillip Webb
<add> * @since 6.0
<add> * @see GeneratedClass
<add> */
<add>public class GeneratedClasses implements ClassGenerator {
<add>
<add> private final ClassNameGenerator classNameGenerator;
<add>
<add> private final Map<Owner, GeneratedClass> classes = new ConcurrentHashMap<>();
<add>
<add>
<add> public GeneratedClasses(ClassNameGenerator classNameGenerator) {
<add> Assert.notNull(classNameGenerator, "'classNameGenerator' must not be null");
<add> this.classNameGenerator = classNameGenerator;
<add> }
<add>
<add>
<add> @Override
<add> public GeneratedClass getOrGenerateClass(JavaFileGenerator javaFileGenerator,
<add> Class<?> target, String featureName) {
<add>
<add> Assert.notNull(javaFileGenerator, "'javaFileGenerator' must not be null");
<add> Assert.notNull(target, "'target' must not be null");
<add> Assert.hasLength(featureName, "'featureName' must not be empty");
<add> Owner owner = new Owner(javaFileGenerator, target.getName(), featureName);
<add> return this.classes.computeIfAbsent(owner,
<add> key -> new GeneratedClass(javaFileGenerator,
<add> this.classNameGenerator.generateClassName(target, featureName)));
<add> }
<add>
<add> @Override
<add> public GeneratedClass getOrGenerateClass(JavaFileGenerator javaFileGenerator,
<add> String target, String featureName) {
<add>
<add> Assert.notNull(javaFileGenerator, "'javaFileGenerator' must not be null");
<add> Assert.hasLength(target, "'target' must not be empty");
<add> Assert.hasLength(featureName, "'featureName' must not be empty");
<add> Owner owner = new Owner(javaFileGenerator, target, featureName);
<add> return this.classes.computeIfAbsent(owner,
<add> key -> new GeneratedClass(javaFileGenerator,
<add> this.classNameGenerator.generateClassName(target, featureName)));
<add> }
<add>
<add> /**
<add> * Write generated Spring {@code .factories} files to the given
<add> * {@link GeneratedFiles} instance.
<add> * @param generatedFiles where to write the generated files
<add> * @throws IOException on IO error
<add> */
<add> public void writeTo(GeneratedFiles generatedFiles) throws IOException {
<add> Assert.notNull(generatedFiles, "'generatedFiles' must not be null");
<add> List<GeneratedClass> generatedClasses = new ArrayList<>(this.classes.values());
<add> generatedClasses.sort(Comparator.comparing(GeneratedClass::getName));
<add> for (GeneratedClass generatedClass : generatedClasses) {
<add> generatedFiles.addSourceFile(generatedClass.generateJavaFile());
<add> }
<add> }
<add>
<add> private record Owner(JavaFileGenerator javaFileGenerator, String target,
<add> String featureName) {
<add>
<add> }
<add>
<add>}
<ide><path>spring-core/src/test/java/org/springframework/aot/generate/GeneratedClassTests.java
<add>/*
<add> * Copyright 2002-2022 the original author or authors.
<add> *
<add> * Licensed under the Apache License, Version 2.0 (the "License");
<add> * you may not use this file except in compliance with the License.
<add> * You may obtain a copy of the License at
<add> *
<add> * https://www.apache.org/licenses/LICENSE-2.0
<add> *
<add> * Unless required by applicable law or agreed to in writing, software
<add> * distributed under the License is distributed on an "AS IS" BASIS,
<add> * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
<add> * See the License for the specific language governing permissions and
<add> * limitations under the License.
<add> */
<add>
<add>package org.springframework.aot.generate;
<add>
<add>import org.junit.jupiter.api.Test;
<add>
<add>import org.springframework.javapoet.ClassName;
<add>import org.springframework.javapoet.JavaFile;
<add>import org.springframework.javapoet.TypeSpec;
<add>
<add>import static org.assertj.core.api.Assertions.assertThat;
<add>import static org.assertj.core.api.Assertions.assertThatIllegalStateException;
<add>
<add>/**
<add> * Tests for {@link GeneratedClass}.
<add> *
<add> * @author Phillip Webb
<add> */
<add>class GeneratedClassTests {
<add>
<add> @Test
<add> void getNameReturnsName() {
<add> ClassName name = ClassName.bestGuess("com.example.Test");
<add> GeneratedClass generatedClass = new GeneratedClass(this::generateJavaFile, name);
<add> assertThat(generatedClass.getName()).isSameAs(name);
<add> }
<add>
<add> @Test
<add> void generateJavaFileSuppliesGeneratedMethods() {
<add> ClassName name = ClassName.bestGuess("com.example.Test");
<add> GeneratedClass generatedClass = new GeneratedClass(this::generateJavaFile, name);
<add> MethodGenerator methodGenerator = generatedClass.getMethodGenerator();
<add> methodGenerator.generateMethod("test")
<add> .using(builder -> builder.addJavadoc("Test Method"));
<add> assertThat(generatedClass.generateJavaFile().toString()).contains("Test Method");
<add> }
<add>
<add> @Test
<add> void generateJavaFileWhenHasBadPackageThrowsException() {
<add> ClassName name = ClassName.bestGuess("com.example.Test");
<add> GeneratedClass generatedClass = new GeneratedClass(
<add> this::generateBadPackageJavaFile, name);
<add> assertThatIllegalStateException()
<add> .isThrownBy(
<add> () -> assertThat(generatedClass.generateJavaFile().toString()))
<add> .withMessageContaining("should be in package");
<add> }
<add>
<add> @Test
<add> void generateJavaFileWhenHasBadNameThrowsException() {
<add> ClassName name = ClassName.bestGuess("com.example.Test");
<add> GeneratedClass generatedClass = new GeneratedClass(this::generateBadNameJavaFile,
<add> name);
<add> assertThatIllegalStateException()
<add> .isThrownBy(
<add> () -> assertThat(generatedClass.generateJavaFile().toString()))
<add> .withMessageContaining("should be named");
<add> }
<add>
<add> private JavaFile generateJavaFile(ClassName className, GeneratedMethods methods) {
<add> TypeSpec.Builder classBuilder = TypeSpec.classBuilder(className);
<add> methods.doWithMethodSpecs(classBuilder::addMethod);
<add> return JavaFile.builder(className.packageName(), classBuilder.build()).build();
<add> }
<add>
<add> private JavaFile generateBadPackageJavaFile(ClassName className,
<add> GeneratedMethods methods) {
<add> TypeSpec.Builder classBuilder = TypeSpec.classBuilder(className);
<add> return JavaFile.builder("naughty", classBuilder.build()).build();
<add> }
<add>
<add> private JavaFile generateBadNameJavaFile(ClassName className,
<add> GeneratedMethods methods) {
<add> TypeSpec.Builder classBuilder = TypeSpec.classBuilder("Naughty");
<add> return JavaFile.builder(className.packageName(), classBuilder.build()).build();
<add> }
<add>
<add>}
<ide><path>spring-core/src/test/java/org/springframework/aot/generate/GeneratedClassesTests.java
<add>/*
<add> * Copyright 2002-2022 the original author or authors.
<add> *
<add> * Licensed under the Apache License, Version 2.0 (the "License");
<add> * you may not use this file except in compliance with the License.
<add> * You may obtain a copy of the License at
<add> *
<add> * https://www.apache.org/licenses/LICENSE-2.0
<add> *
<add> * Unless required by applicable law or agreed to in writing, software
<add> * distributed under the License is distributed on an "AS IS" BASIS,
<add> * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
<add> * See the License for the specific language governing permissions and
<add> * limitations under the License.
<add> */
<add>
<add>package org.springframework.aot.generate;
<add>
<add>import org.junit.jupiter.api.Test;
<add>
<add>import org.springframework.aot.generate.ClassGenerator.JavaFileGenerator;
<add>import org.springframework.javapoet.ClassName;
<add>import org.springframework.javapoet.JavaFile;
<add>import org.springframework.javapoet.TypeSpec;
<add>
<add>import static org.assertj.core.api.Assertions.assertThat;
<add>import static org.assertj.core.api.Assertions.assertThatIllegalArgumentException;
<add>
<add>/**
<add> * Tests for {@link GeneratedClasses}.
<add> *
<add> * @author Phillip Webb
<add> */
<add>class GeneratedClassesTests {
<add>
<add> private GeneratedClasses generatedClasses = new GeneratedClasses(
<add> new ClassNameGenerator());
<add>
<add> private static final JavaFileGenerator JAVA_FILE_GENERATOR = GeneratedClassesTests::generateJavaFile;
<add>
<add> @Test
<add> void createWhenClassNameGeneratorIsNullThrowsException() {
<add> assertThatIllegalArgumentException().isThrownBy(() -> new GeneratedClasses(null))
<add> .withMessage("'classNameGenerator' must not be null");
<add> }
<add>
<add> @Test
<add> void getOrGenerateWithClassTargetWhenJavaFileGeneratorIsNullThrowsException() {
<add> assertThatIllegalArgumentException()
<add> .isThrownBy(() -> this.generatedClasses.getOrGenerateClass(null,
<add> TestTarget.class, "test"))
<add> .withMessage("'javaFileGenerator' must not be null");
<add> }
<add>
<add> @Test
<add> void getOrGenerateWithClassTargetWhenTargetIsNullThrowsException() {
<add> assertThatIllegalArgumentException()
<add> .isThrownBy(() -> this.generatedClasses
<add> .getOrGenerateClass(JAVA_FILE_GENERATOR, (Class<?>) null, "test"))
<add> .withMessage("'target' must not be null");
<add> }
<add>
<add> @Test
<add> void getOrGenerateWithClassTargetWhenFeatureIsNullThrowsException() {
<add> assertThatIllegalArgumentException()
<add> .isThrownBy(() -> this.generatedClasses
<add> .getOrGenerateClass(JAVA_FILE_GENERATOR, TestTarget.class, null))
<add> .withMessage("'featureName' must not be empty");
<add> }
<add>
<add> @Test
<add> void getOrGenerateWithStringTargetWhenJavaFileGeneratorIsNullThrowsException() {
<add> assertThatIllegalArgumentException()
<add> .isThrownBy(() -> this.generatedClasses.getOrGenerateClass(null,
<add> TestTarget.class.getName(), "test"))
<add> .withMessage("'javaFileGenerator' must not be null");
<add> }
<add>
<add> @Test
<add> void getOrGenerateWithStringTargetWhenTargetIsNullThrowsException() {
<add> assertThatIllegalArgumentException()
<add> .isThrownBy(() -> this.generatedClasses
<add> .getOrGenerateClass(JAVA_FILE_GENERATOR, (String) null, "test"))
<add> .withMessage("'target' must not be empty");
<add> }
<add>
<add> @Test
<add> void getOrGenerateWithStringTargetWhenFeatureIsNullThrowsException() {
<add> assertThatIllegalArgumentException()
<add> .isThrownBy(() -> this.generatedClasses.getOrGenerateClass(
<add> JAVA_FILE_GENERATOR, TestTarget.class.getName(), null))
<add> .withMessage("'featureName' must not be empty");
<add> }
<add>
<add> @Test
<add> void getOrGenerateWhenNewReturnsGeneratedMethod() {
<add> GeneratedClass generatedClass1 = this.generatedClasses
<add> .getOrGenerateClass(JAVA_FILE_GENERATOR, TestTarget.class, "one");
<add> GeneratedClass generatedClass2 = this.generatedClasses.getOrGenerateClass(
<add> JAVA_FILE_GENERATOR, TestTarget.class.getName(), "two");
<add> assertThat(generatedClass1).isNotNull().isNotEqualTo(generatedClass2);
<add> assertThat(generatedClass2).isNotNull();
<add> }
<add>
<add> @Test
<add> void getOrGenerateWhenRepeatReturnsSameGeneratedMethod() {
<add> GeneratedClasses generated = this.generatedClasses;
<add> GeneratedClass generatedClass1 = generated.getOrGenerateClass(JAVA_FILE_GENERATOR,
<add> TestTarget.class, "one");
<add> GeneratedClass generatedClass2 = generated.getOrGenerateClass(JAVA_FILE_GENERATOR,
<add> TestTarget.class, "one");
<add> GeneratedClass generatedClass3 = generated.getOrGenerateClass(JAVA_FILE_GENERATOR,
<add> TestTarget.class.getName(), "one");
<add> GeneratedClass generatedClass4 = generated.getOrGenerateClass(JAVA_FILE_GENERATOR,
<add> TestTarget.class, "two");
<add> assertThat(generatedClass1).isNotNull().isSameAs(generatedClass2)
<add> .isSameAs(generatedClass3).isNotSameAs(generatedClass4);
<add> }
<add>
<add> static JavaFile generateJavaFile(ClassName className,
<add> GeneratedMethods generatedMethods) {
<add> TypeSpec typeSpec = TypeSpec.classBuilder(className).addJavadoc("Test").build();
<add> return JavaFile.builder(className.packageName(), typeSpec).build();
<add> }
<add>
<add> private static class TestTarget {
<add>
<add> }
<add>
<add>} | 5 |
Go | Go | return nil explicitly | cda9d5f7f0c4a155d1ae9e06c203fcb89600ff2a | <ide><path>pkg/system/rm.go
<ide> func EnsureRemoveAll(dir string) error {
<ide> for {
<ide> err := os.RemoveAll(dir)
<ide> if err == nil {
<del> return err
<add> return nil
<ide> }
<ide>
<ide> pe, ok := err.(*os.PathError) | 1 |
Javascript | Javascript | fix parsing of binary upgrade response body | de4600ea2bf2eb5a1367825dc84ea7561b0c3529 | <ide><path>lib/_http_client.js
<ide> function parserOnIncomingClient(res, shouldKeepAlive) {
<ide> var socket = this.socket;
<ide> var req = socket._httpMessage;
<ide>
<del>
<ide> // propagate "domain" setting...
<ide> if (req.domain && !res.domain) {
<ide> debug('setting "res.domain"');
<ide> function parserOnIncomingClient(res, shouldKeepAlive) {
<ide> // We already have a response object, this means the server
<ide> // sent a double response.
<ide> socket.destroy();
<del> return;
<add> return 0; // No special treatment.
<ide> }
<ide> req.res = res;
<ide>
<ide> // Responses to CONNECT request is handled as Upgrade.
<del> if (req.method === 'CONNECT') {
<add> const method = req.method;
<add> if (method === 'CONNECT') {
<ide> res.upgrade = true;
<del> return 2; // skip body, and the rest
<add> return 2; // Skip body and treat as Upgrade.
<ide> }
<ide>
<del> // Responses to HEAD requests are crazy.
<del> // HEAD responses aren't allowed to have an entity-body
<del> // but *can* have a content-length which actually corresponds
<del> // to the content-length of the entity-body had the request
<del> // been a GET.
<del> var isHeadResponse = req.method === 'HEAD';
<del> debug('AGENT isHeadResponse', isHeadResponse);
<del>
<ide> if (res.statusCode === 100) {
<ide> // restart the parser, as this is a continue message.
<ide> req.res = null; // Clear res so that we don't hit double-responses.
<ide> req.emit('continue');
<del> return true;
<add> return 1; // Skip body but don't treat as Upgrade.
<ide> }
<ide>
<ide> if (req.shouldKeepAlive && !shouldKeepAlive && !req.upgradeOrConnect) {
<ide> function parserOnIncomingClient(res, shouldKeepAlive) {
<ide> req.shouldKeepAlive = false;
<ide> }
<ide>
<del>
<ide> DTRACE_HTTP_CLIENT_RESPONSE(socket, req);
<ide> LTTNG_HTTP_CLIENT_RESPONSE(socket, req);
<ide> COUNTER_HTTP_CLIENT_RESPONSE();
<ide> function parserOnIncomingClient(res, shouldKeepAlive) {
<ide> if (!handled)
<ide> res._dump();
<ide>
<del> return isHeadResponse;
<add> if (method === 'HEAD')
<add> return 1; // Skip body but don't treat as Upgrade.
<add>
<add> return 0; // No special treatment.
<ide> }
<ide>
<ide> // client
<ide><path>lib/_http_common.js
<ide> function parserOnHeadersComplete(versionMajor, versionMinor, headers, method,
<ide>
<ide> parser.incoming.upgrade = upgrade;
<ide>
<del> var skipBody = 0; // response to HEAD or CONNECT
<add> if (upgrade)
<add> return 2; // Skip body and treat as Upgrade.
<ide>
<del> if (!upgrade) {
<del> // For upgraded connections and CONNECT method request, we'll emit this
<del> // after parser.execute so that we can capture the first part of the new
<del> // protocol.
<del> skipBody = parser.onIncoming(parser.incoming, shouldKeepAlive);
<del> }
<del>
<del> if (typeof skipBody !== 'number')
<del> return skipBody ? 1 : 0;
<del> else
<del> return skipBody;
<add> return parser.onIncoming(parser.incoming, shouldKeepAlive);
<ide> }
<ide>
<ide> // XXX This is a mess.
<ide><path>lib/_http_server.js
<ide> function parserOnIncoming(server, socket, state, req, keepAlive) {
<ide> } else {
<ide> server.emit('request', req, res);
<ide> }
<del> return false; // Not a HEAD response. (Not even a response!)
<add> return 0; // No special treatment.
<ide> }
<ide>
<ide> function resetSocketTimeout(server, socket, state) {
<ide><path>test/parallel/test-http-upgrade-binary.js
<add>'use strict';
<add>const { mustCall } = require('../common');
<add>const assert = require('assert');
<add>const http = require('http');
<add>const net = require('net');
<add>
<add>// https://github.com/nodejs/node/issues/17789 - a connection upgrade response
<add>// that has a Transfer-Encoding header and a body whose first byte is > 127
<add>// triggers a bug where said byte is skipped over.
<add>net.createServer(mustCall(function(conn) {
<add> conn.write('HTTP/1.1 101 Switching Protocols\r\n' +
<add> 'Connection: upgrade\r\n' +
<add> 'Transfer-Encoding: chunked\r\n' +
<add> 'Upgrade: websocket\r\n' +
<add> '\r\n' +
<add> '\u0080', 'latin1');
<add> this.close();
<add>})).listen(0, mustCall(function() {
<add> http.get({
<add> host: this.address().host,
<add> port: this.address().port,
<add> headers: { 'Connection': 'upgrade', 'Upgrade': 'websocket' },
<add> }).on('upgrade', mustCall((res, conn, head) => {
<add> assert.strictEqual(head.length, 1);
<add> assert.strictEqual(head[0], 128);
<add> conn.destroy();
<add> }));
<add>})); | 4 |
Ruby | Ruby | fix flatten_deeper to preserve nils | 92253829dee9a1fb545f71f71894dee1df604f74 | <ide><path>activerecord/lib/active_record/associations/association_proxy.rb
<ide> def flatten_deeper(array)
<ide> if elem.respond_to?(:each)
<ide> flatten_deeper(elem)
<ide> else
<del> Array.wrap(elem)
<add> [elem]
<ide> end
<ide> end
<ide> end | 1 |
Python | Python | add support for batch_input_shape kwarg | 2553f07c3c366704dff429aeb939dff5e323d422 | <ide><path>keras/layers/containers.py
<ide> def get_output(self, train=False):
<ide> else:
<ide> return dict([(k, v.get_output(train)) for k, v in self.outputs.items()])
<ide>
<del> def add_input(self, name, input_shape, dtype='float'):
<add> def add_input(self, name, input_shape=None, batch_input_shape=None, dtype='float'):
<ide> if name in self.namespace:
<ide> raise Exception('Duplicate node identifier: ' + name)
<ide> self.namespace.add(name)
<ide> self.input_order.append(name)
<ide> layer = Layer() # empty layer
<del> layer.set_input_shape(input_shape)
<add> if input_shape:
<add> layer.set_input_shape((None,) + tuple(input_shape))
<add> elif batch_input_shape:
<add> layer.set_input_shape(batch_input_shape)
<ide> if dtype == 'float':
<ide> layer.input = K.placeholder(shape=layer.input_shape, name=name)
<ide> else:
<ide><path>keras/layers/core.py
<ide>
<ide> class Layer(object):
<ide> def __init__(self, **kwargs):
<add> allowed_kwargs = {'input_shape',
<add> 'trainable',
<add> 'batch_input_shape'}
<ide> for kwarg in kwargs:
<del> assert kwarg in {'input_shape', 'trainable'}, "Keyword argument not understood: " + kwarg
<add> assert kwarg in allowed_kwargs, "Keyword argument not understood: " + kwarg
<ide> if 'input_shape' in kwargs:
<del> self.set_input_shape(kwargs['input_shape'])
<add> self.set_input_shape((None,) + tuple(kwargs['input_shape']))
<add> if 'batch_input_shape' in kwargs:
<add> self.set_input_shape(tuple(kwargs['batch_input_shape']))
<ide> if 'trainable' in kwargs:
<ide> self._trainable = kwargs['trainable']
<ide> if not hasattr(self, 'params'):
<ide> def input_shape(self):
<ide> def set_input_shape(self, input_shape):
<ide> if type(input_shape) not in [tuple, list]:
<ide> raise Exception('Invalid input shape - input_shape should be a tuple of int.')
<del> input_shape = (None,) + tuple(input_shape)
<add> input_shape = tuple(input_shape)
<ide> if hasattr(self, 'input_ndim') and self.input_ndim:
<ide> if self.input_ndim != len(input_shape):
<ide> raise Exception('Invalid input shape - Layer expects input ndim=' +
<ide><path>keras/layers/embeddings.py
<ide> def __init__(self, input_dim, output_dim,
<ide> super(Embedding, self).__init__(**kwargs)
<ide>
<ide> def build(self):
<del> self.input = K.placeholder(shape=(None, self.input_length),
<add> self.input = K.placeholder(shape=(self.input_shape[0], self.input_length),
<ide> dtype='int32')
<ide> self.W = self.init((self.input_dim, self.output_dim))
<ide> self.params = [self.W]
<ide><path>tests/keras/backend/test_backends.py
<ide> def check_single_tensor_operation(function_name, input_shape, **kwargs):
<ide> ztf = KTF.eval(getattr(KTF, function_name)(xtf, **kwargs))
<ide>
<ide> assert zth.shape == ztf.shape
<del> assert_allclose(zth, ztf, atol=1e-06)
<add> assert_allclose(zth, ztf, atol=1e-05)
<ide>
<ide>
<ide> def check_two_tensor_operation(function_name, x_input_shape,
<ide> def check_two_tensor_operation(function_name, x_input_shape,
<ide> ztf = KTF.eval(getattr(KTF, function_name)(xtf, ytf, **kwargs))
<ide>
<ide> assert zth.shape == ztf.shape
<del> assert_allclose(zth, ztf, atol=1e-06)
<add> assert_allclose(zth, ztf, atol=1e-05)
<ide>
<ide>
<ide> @pytest.mark.skipif(sys.version_info.major != 2, reason="Requires Python 2.7")
<ide> def test_shape_operations(self):
<ide> zth = KTH.eval(KTH.concatenate([xth, yth], axis=-1))
<ide> ztf = KTF.eval(KTF.concatenate([xtf, ytf], axis=-1))
<ide> assert zth.shape == ztf.shape
<del> assert_allclose(zth, ztf, atol=1e-06)
<add> assert_allclose(zth, ztf, atol=1e-05)
<ide>
<ide> check_single_tensor_operation('reshape', (4, 2), shape=(8, 1))
<ide> check_single_tensor_operation('permute_dimensions', (4, 2, 3),
<ide> def test_value_manipulation(self):
<ide> valth = KTH.get_value(xth)
<ide> valtf = KTF.get_value(xtf)
<ide> assert valtf.shape == valth.shape
<del> assert_allclose(valth, valtf, atol=1e-06)
<add> assert_allclose(valth, valtf, atol=1e-05)
<ide>
<ide> # set_value
<ide> val = np.random.random((4, 2))
<ide> def test_value_manipulation(self):
<ide> valth = KTH.get_value(xth)
<ide> valtf = KTF.get_value(xtf)
<ide> assert valtf.shape == valth.shape
<del> assert_allclose(valth, valtf, atol=1e-06)
<add> assert_allclose(valth, valtf, atol=1e-05)
<ide>
<ide> # count_params
<ide> assert KTH.count_params(xth) == KTF.count_params(xtf)
<ide> def test_gradient(self):
<ide> zth = KTH.eval(gradth[0])
<ide> ztf = KTF.eval(gradtf[0])
<ide> assert zth.shape == ztf.shape
<del> assert_allclose(zth, ztf, atol=1e-06)
<add> assert_allclose(zth, ztf, atol=1e-05)
<ide>
<ide> def test_function(self):
<ide> val = np.random.random((4, 2))
<ide> def test_function(self):
<ide> function_outputs_th = fth([input_val])[0]
<ide> function_outputs_tf = ftf([input_val])[0]
<ide> assert function_outputs_th.shape == function_outputs_tf.shape
<del> assert_allclose(function_outputs_th, function_outputs_tf, atol=1e-06)
<add> assert_allclose(function_outputs_th, function_outputs_tf, atol=1e-05)
<ide>
<ide> new_val_th = KTH.get_value(xth)
<ide> new_val_tf = KTF.get_value(xtf)
<ide> assert new_val_th.shape == new_val_tf.shape
<del> assert_allclose(new_val_th, new_val_tf, atol=1e-06)
<add> assert_allclose(new_val_th, new_val_tf, atol=1e-05)
<ide>
<ide> def test_rnn(self):
<ide> # implement a simple RNN
<ide> def step_function(x, states):
<ide> assert len(new_states) == 1
<ide> tf_state = KTF.eval(new_states[0])
<ide>
<del> assert_allclose(tf_last_output, th_last_output, atol=1e-06)
<del> assert_allclose(tf_outputs, th_outputs, atol=1e-06)
<del> assert_allclose(tf_state, th_state, atol=1e-06)
<add> assert_allclose(tf_last_output, th_last_output, atol=1e-05)
<add> assert_allclose(tf_outputs, th_outputs, atol=1e-05)
<add> assert_allclose(tf_state, th_state, atol=1e-05)
<ide>
<ide> def test_switch(self):
<ide> val = np.random.random()
<ide> def test_switch(self):
<ide> ztf = KTF.eval(xtf)
<ide>
<ide> assert zth.shape == ztf.shape
<del> assert_allclose(zth, ztf, atol=1e-06)
<add> assert_allclose(zth, ztf, atol=1e-05)
<ide>
<ide> def test_nn_operations(self):
<ide> check_single_tensor_operation('relu', (4, 2), alpha=0.1, max_value=0.5)
<ide><path>tests/keras/layers/test_recurrent.py
<ide> def _runner(layer_class):
<ide>
<ide> mask = layer.get_output_mask(train)
<ide>
<add> # check statefulness
<add> layer = layer_class(output_dim, return_sequences=False,
<add> weights=None, batch_input_shape=(nb_samples, timesteps, input_dim))
<add> layer.input = K.variable(np.ones((nb_samples, timesteps, input_dim)))
<add> out = K.eval(layer.get_output(train))
<add> assert(out.shape == (nb_samples, output_dim))
<add>
<ide>
<ide> class TestRNNS(unittest.TestCase):
<ide> """
<ide><path>tests/test_shape_inference.py
<ide> def check_layer_output_shape(layer, input_data):
<ide> ndim = len(input_data.shape)
<ide> layer.input = K.placeholder(ndim=ndim)
<del> layer.set_input_shape(input_data.shape[1:])
<add> layer.set_input_shape(input_data.shape)
<ide> expected_output_shape = layer.output_shape[1:]
<ide>
<ide> function = K.function([layer.input], [layer.get_output()]) | 6 |
Go | Go | replace s.d.start() with s.d.startwithbusybox() | aef344dcf801b1af67bc7ce6219e636e48c28a1f | <ide><path>integration-cli/docker_cli_network_unix_test.go
<ide> func (s *DockerNetworkSuite) TestDockerNetworkMultipleNetworksGracefulDaemonRest
<ide> cName := "bb"
<ide> nwList := []string{"nw1", "nw2", "nw3"}
<ide>
<del> s.d.Start()
<add> s.d.StartWithBusybox()
<ide>
<ide> connectContainerToNetworks(c, s.d, cName, nwList)
<ide> verifyContainerIsConnectedToNetworks(c, s.d, cName, nwList)
<ide> func (s *DockerNetworkSuite) TestDockerNetworkMultipleNetworksUngracefulDaemonRe
<ide> cName := "cc"
<ide> nwList := []string{"nw1", "nw2", "nw3"}
<ide>
<del> s.d.Start()
<add> s.d.StartWithBusybox()
<ide>
<ide> connectContainerToNetworks(c, s.d, cName, nwList)
<ide> verifyContainerIsConnectedToNetworks(c, s.d, cName, nwList)
<ide> func (s *DockerNetworkSuite) TestDockerNetworkRunNetByID(c *check.C) {
<ide>
<ide> func (s *DockerNetworkSuite) TestDockerNetworkHostModeUngracefulDaemonRestart(c *check.C) {
<ide> testRequires(c, DaemonIsLinux, NotUserNamespace)
<del> s.d.Start()
<add> s.d.StartWithBusybox()
<ide>
<ide> // Run a few containers on host network
<ide> for i := 0; i < 10; i++ { | 1 |
Ruby | Ruby | remove unnecessary require statements | c59d5db6313f1478f51e0c8dd71b376566c67c75 | <ide><path>Library/Homebrew/livecheck/strategy/extract_plist.rb
<ide>
<ide> require "bundle_version"
<ide> require "unversioned_cask_checker"
<del>require_relative "page_match"
<ide>
<ide> module Homebrew
<ide> module Livecheck
<ide><path>Library/Homebrew/livecheck/strategy/header_match.rb
<ide> # typed: true
<ide> # frozen_string_literal: true
<ide>
<del>require_relative "page_match"
<del>
<ide> module Homebrew
<ide> module Livecheck
<ide> module Strategy | 2 |
Python | Python | update error messages in preprocessing/image.py | 961acd563851cf1cf90d20f08c30b3e392d068ff | <ide><path>keras/preprocessing/image.py
<ide> def smart_resize(x, size, interpolation='bilinear'):
<ide> """
<ide> if len(size) != 2:
<ide> raise ValueError('Expected `size` to be a tuple of 2 integers, '
<del> 'but got: %s' % (size,))
<add> f'but got: {size}.')
<ide> img = tf.convert_to_tensor(x)
<ide> if img.shape.rank is not None:
<ide> if img.shape.rank < 3 or img.shape.rank > 4:
<ide> raise ValueError(
<ide> 'Expected an image array with shape `(height, width, channels)`, '
<del> 'or `(batch_size, height, width, channels)` but '
<del> 'got input with incorrect rank, of shape %s' % (img.shape,))
<add> 'or `(batch_size, height, width, channels)`, but '
<add> f'got input with incorrect rank, of shape {img.shape}.')
<ide> shape = tf.shape(img)
<ide> height, width = shape[-3], shape[-2]
<ide> target_height, target_width = size | 1 |
Javascript | Javascript | update shared mmdphysics | 0c5e84eac5d07aec1de6ae5f0f4286a7dd7f68ee | <ide><path>examples/js/animation/MMDPhysics.js
<ide> THREE.MMDPhysics.prototype = {
<ide>
<ide> update: function ( delta ) {
<ide>
<add> this.updateRigidBodies();
<add> this.stepSimulation( delta );
<add> this.updateBones();
<add>
<add> },
<add>
<add> stepSimulation: function ( delta ) {
<add>
<ide> var unitStep = this.unitStep;
<ide> var stepTime = delta;
<ide> var maxStepNum = ( ( delta / unitStep ) | 0 ) + 1;
<ide> THREE.MMDPhysics.prototype = {
<ide>
<ide> }
<ide>
<del> this.updateRigidBodies();
<ide> this.world.stepSimulation( stepTime, maxStepNum, unitStep );
<del> this.updateBones();
<ide>
<ide> },
<ide>
<ide><path>examples/js/loaders/MMDLoader.js
<ide> THREE.MMDHelper = function ( renderer ) {
<ide> this.doOutlineDrawing = true;
<ide> this.doCameraAnimation = true;
<ide>
<add> this.sharedPhysics = false;
<add> this.masterPhysics = null;
<add>
<ide> this.audioManager = null;
<ide> this.camera = null;
<ide>
<ide> THREE.MMDHelper.prototype = {
<ide>
<ide> setPhysicses: function ( params ) {
<ide>
<del> params = ( params === undefined ) ? {} : Object.assign( {}, params );
<del>
<ide> for ( var i = 0; i < this.meshes.length; i++ ) {
<ide>
<ide> this.setPhysics( this.meshes[ i ], params );
<ide>
<del> if ( i === 0 && params.sharePhysicsWorld === true ) {
<del>
<del> params.world = this.meshes[ 0 ].physics.world;
<del>
<del> }
<del>
<ide> }
<ide>
<ide> },
<ide>
<ide> setPhysics: function ( mesh, params ) {
<ide>
<del> if ( params === undefined ) params = {};
<add> params = ( params === undefined ) ? {} : Object.assign( {}, params );
<add>
<add> if ( params.world === undefined && this.sharedPhysics ) {
<add>
<add> var masterPhysics = this.getMasterPhysics();
<add>
<add> if ( masterPhysics !== null ) params.world = masterPhysics.world;
<add>
<add> }
<ide>
<ide> var warmup = params.warmup !== undefined ? params.warmup : 60;
<ide>
<ide> var physics = new THREE.MMDPhysics( mesh, params );
<ide>
<del> if ( mesh.mixer !== null && mesh.mixer !== undefined && this.doAnimation === true && params.preventAnimationWarmup !== false ) {
<add> if ( mesh.mixer !== null && mesh.mixer !== undefined && params.preventAnimationWarmup !== false ) {
<ide>
<ide> this.animateOneMesh( 0, mesh );
<ide> physics.reset();
<ide> THREE.MMDHelper.prototype = {
<ide>
<ide> },
<ide>
<add> getMasterPhysics: function () {
<add>
<add> if ( this.masterPhysics !== null ) return this.masterPhysics;
<add>
<add> for ( var i = 0, il = this.meshes.length; i < il; i ++ ) {
<add>
<add> var physics = this.meshes[ i ].physics;
<add>
<add> if ( physics !== undefined && physics !== null ) {
<add>
<add> this.masterPhysics = physics;
<add> return this.masterPhysics;
<add>
<add> }
<add> }
<add>
<add> return null;
<add>
<add> },
<add>
<ide> enablePhysics: function ( enabled ) {
<ide>
<ide> if ( enabled === true ) {
<ide> THREE.MMDHelper.prototype = {
<ide>
<ide> }
<ide>
<add> if ( this.sharedPhysics ) this.updateSharedPhysics( delta );
<add>
<ide> this.animateCamera( delta );
<ide>
<ide> },
<ide> THREE.MMDHelper.prototype = {
<ide>
<ide> }
<ide>
<del> if ( physics !== null && this.doPhysics === true ) {
<add> if ( physics !== null && this.doPhysics && ! this.sharedPhysics) {
<ide>
<ide> physics.update( delta );
<ide>
<ide> }
<ide>
<ide> },
<ide>
<add> updateSharedPhysics: function ( delta ) {
<add>
<add> if ( this.meshes.length === 0 || ! this.doPhysics || ! this.sharedPhysics ) return;
<add>
<add> var physics = this.getMasterPhysics();
<add>
<add> if ( physics === null ) return;
<add>
<add> for ( var i = 0, il = this.meshes.length; i < il; i ++ ) {
<add>
<add> var p = this.meshes[ i ].physics;
<add>
<add> if ( p !== null && p !== undefined ) {
<add>
<add> p.updateRigidBodies();
<add>
<add> }
<add>
<add> }
<add>
<add> physics.stepSimulation( delta );
<add>
<add> for ( var i = 0, il = this.meshes.length; i < il; i ++ ) {
<add>
<add> var p = this.meshes[ i ].physics;
<add>
<add> if ( p !== null && p !== undefined ) {
<add>
<add> p.updateBones();
<add>
<add> }
<add>
<add> }
<add>
<add> },
<add>
<ide> animateCamera: function ( delta ) {
<ide>
<ide> if ( this.camera === null ) { | 2 |
PHP | PHP | improve assoc array docs | 51e38e03598d8c53d00616965cce92aafac33655 | <ide><path>src/View/Helper/HtmlHelper.php
<ide> public function tableCells(
<ide> $count++;
<ide> $cellsOut = $this->_renderCells($line, $useCount);
<ide> $opts = $count % 2 ? $oddTrOptions : $evenTrOptions;
<del> /** @var array<string> $options */
<add> /** @var array<string, mixed> $options */
<ide> $options = (array)$opts;
<ide> $out[] = $this->tableRow(implode(' ', $cellsOut), $options);
<ide> } | 1 |
Javascript | Javascript | add german keyboard "+"-zoom | d05031d3b0812b4844d0e778ffa6cf0062016c7e | <ide><path>web/viewer.js
<ide> window.addEventListener('keydown', function keydown(evt) {
<ide> case 61: // FF/Mac '='
<ide> case 107: // FF '+' and '='
<ide> case 187: // Chrome '+'
<add> case 171: // FF with German keyboard
<ide> PDFView.zoomIn();
<ide> handled = true;
<ide> break; | 1 |
Python | Python | update 3n+1.py (#996) | 1e0b33d3dd7eda32a97fe73df09df20e2004eb98 | <ide><path>maths/3n+1.py
<del>def main():
<del> def n31(a):# a = initial number
<del> c = 0
<del> l = [a]
<del> while a != 1:
<del> if a % 2 == 0:#if even divide it by 2
<del> a = a // 2
<del> elif a % 2 == 1:#if odd 3n+1
<del> a = 3*a +1
<del> c += 1#counter
<del> l += [a]
<add>from typing import Tuple, List
<add>
<add>def n31(a: int) -> Tuple[List[int], int]:
<add> """
<add> Returns the Collatz sequence and its length of any postiver integer.
<add> >>> n31(4)
<add> ([4, 2, 1], 3)
<add> """
<ide>
<del> return l , c
<del> print(n31(43))
<del> print(n31(98)[0][-1])# = a
<del> print("It took {0} steps.".format(n31(13)[1]))#optional finish
<add> if not isinstance(a, int):
<add> raise TypeError('Must be int, not {0}'.format(type(a).__name__))
<add> if a < 1:
<add> raise ValueError('Given integer must be greater than 1, not {0}'.format(a))
<add>
<add> path = [a]
<add> while a != 1:
<add> if a % 2 == 0:
<add> a = a // 2
<add> else:
<add> a = 3*a +1
<add> path += [a]
<add> return path, len(path)
<add>
<add>def main():
<add> num = 4
<add> path , length = n31(num)
<add> print("The Collatz sequence of {0} took {1} steps. \nPath: {2}".format(num,length, path))
<ide>
<ide> if __name__ == '__main__':
<ide> main() | 1 |
Javascript | Javascript | improve readline test coverage for tty | 7a953929fef5a7892d4697ed73e6fd314055beee | <ide><path>test/parallel/test-readline-interface.js
<ide> function isWarned(emitter) {
<ide> assert.strictEqual(cursorPos.cols, expectedLines.slice(-1)[0].length);
<ide> rli.close();
<ide> }
<add>
<add> {
<add> // Beginning and end of line
<add> const fi = new FakeInput();
<add> const rli = new readline.Interface({
<add> input: fi,
<add> output: fi,
<add> prompt: '',
<add> terminal: terminal
<add> });
<add> fi.emit('data', 'the quick brown fox');
<add> fi.emit('keypress', '.', { ctrl: true, name: 'a' });
<add> let cursorPos = rli._getCursorPos();
<add> assert.strictEqual(cursorPos.rows, 0);
<add> assert.strictEqual(cursorPos.cols, 0);
<add> fi.emit('keypress', '.', { ctrl: true, name: 'e' });
<add> cursorPos = rli._getCursorPos();
<add> assert.strictEqual(cursorPos.rows, 0);
<add> assert.strictEqual(cursorPos.cols, 19);
<add> rli.close();
<add> }
<add>
<add> {
<add> // `wordLeft` and `wordRight`
<add> const fi = new FakeInput();
<add> const rli = new readline.Interface({
<add> input: fi,
<add> output: fi,
<add> prompt: '',
<add> terminal: terminal
<add> });
<add> fi.emit('data', 'the quick brown fox');
<add> fi.emit('keypress', '.', { ctrl: true, name: 'left' });
<add> let cursorPos = rli._getCursorPos();
<add> assert.strictEqual(cursorPos.rows, 0);
<add> assert.strictEqual(cursorPos.cols, 16);
<add> fi.emit('keypress', '.', { meta: true, name: 'b' });
<add> cursorPos = rli._getCursorPos();
<add> assert.strictEqual(cursorPos.rows, 0);
<add> assert.strictEqual(cursorPos.cols, 10);
<add> fi.emit('keypress', '.', { ctrl: true, name: 'right' });
<add> cursorPos = rli._getCursorPos();
<add> assert.strictEqual(cursorPos.rows, 0);
<add> assert.strictEqual(cursorPos.cols, 16);
<add> fi.emit('keypress', '.', { meta: true, name: 'f' });
<add> cursorPos = rli._getCursorPos();
<add> assert.strictEqual(cursorPos.rows, 0);
<add> assert.strictEqual(cursorPos.cols, 19);
<add> rli.close();
<add> }
<add>
<add> {
<add> // `deleteWordLeft`
<add> [
<add> { ctrl: true, name: 'w' },
<add> { ctrl: true, name: 'backspace' },
<add> { meta: true, name: 'backspace' }
<add> ]
<add> .forEach((deleteWordLeftKey) => {
<add> let fi = new FakeInput();
<add> let rli = new readline.Interface({
<add> input: fi,
<add> output: fi,
<add> prompt: '',
<add> terminal: terminal
<add> });
<add> fi.emit('data', 'the quick brown fox');
<add> fi.emit('keypress', '.', { ctrl: true, name: 'left' });
<add> rli.on('line', common.mustCall((line) => {
<add> assert.strictEqual(line, 'the quick fox');
<add> }));
<add> fi.emit('keypress', '.', deleteWordLeftKey);
<add> fi.emit('data', '\n');
<add> rli.close();
<add>
<add> // No effect if pressed at beginning of line
<add> fi = new FakeInput();
<add> rli = new readline.Interface({
<add> input: fi,
<add> output: fi,
<add> prompt: '',
<add> terminal: terminal
<add> });
<add> fi.emit('data', 'the quick brown fox');
<add> fi.emit('keypress', '.', { ctrl: true, name: 'a' });
<add> rli.on('line', common.mustCall((line) => {
<add> assert.strictEqual(line, 'the quick brown fox');
<add> }));
<add> fi.emit('keypress', '.', deleteWordLeftKey);
<add> fi.emit('data', '\n');
<add> rli.close();
<add> });
<add> }
<add>
<add> {
<add> // `deleteWordRight`
<add> [
<add> { ctrl: true, name: 'delete' },
<add> { meta: true, name: 'delete' },
<add> { meta: true, name: 'd' }
<add> ]
<add> .forEach((deleteWordRightKey) => {
<add> let fi = new FakeInput();
<add> let rli = new readline.Interface({
<add> input: fi,
<add> output: fi,
<add> prompt: '',
<add> terminal: terminal
<add> });
<add> fi.emit('data', 'the quick brown fox');
<add> fi.emit('keypress', '.', { ctrl: true, name: 'left' });
<add> fi.emit('keypress', '.', { ctrl: true, name: 'left' });
<add> rli.on('line', common.mustCall((line) => {
<add> assert.strictEqual(line, 'the quick fox');
<add> }));
<add> fi.emit('keypress', '.', deleteWordRightKey);
<add> fi.emit('data', '\n');
<add> rli.close();
<add>
<add> // No effect if pressed at end of line
<add> fi = new FakeInput();
<add> rli = new readline.Interface({
<add> input: fi,
<add> output: fi,
<add> prompt: '',
<add> terminal: terminal
<add> });
<add> fi.emit('data', 'the quick brown fox');
<add> rli.on('line', common.mustCall((line) => {
<add> assert.strictEqual(line, 'the quick brown fox');
<add> }));
<add> fi.emit('keypress', '.', deleteWordRightKey);
<add> fi.emit('data', '\n');
<add> rli.close();
<add> });
<add> }
<ide> }
<ide>
<ide> // isFullWidthCodePoint() should return false for non-numeric values | 1 |
Go | Go | attach streams before create | 02d1934279294f28af6e509a29f909654677ed8b | <ide><path>integration-cli/docker_cli_run_test.go
<ide> func (s *DockerDaemonSuite) TestRunWithUlimitAndDaemonDefault(c *check.C) {
<ide> c.Assert(err, checker.IsNil)
<ide> c.Assert(out, checker.Contains, "[nofile=42:42]")
<ide> }
<add>
<add>func (s *DockerSuite) TestRunStoppedLoggingDriverNoLeak(c *check.C) {
<add> nroutines, err := getGoroutineNumber()
<add> c.Assert(err, checker.IsNil)
<add>
<add> out, _, err := dockerCmdWithError("run", "--name=fail", "--log-driver=splunk", "busybox", "true")
<add> c.Assert(err, checker.NotNil)
<add> c.Assert(out, checker.Contains, "Failed to initialize logging driver", check.Commentf("error should be about logging driver, got output %s", out))
<add>
<add> // NGoroutines is not updated right away, so we need to wait before failing
<add> c.Assert(waitForGoroutines(nroutines), checker.IsNil)
<add>}
<ide><path>libcontainerd/container_linux.go
<ide> import (
<ide>
<ide> "github.com/Sirupsen/logrus"
<ide> containerd "github.com/docker/containerd/api/grpc/types"
<add> "github.com/docker/docker/pkg/ioutils"
<ide> "github.com/docker/docker/restartmanager"
<ide> "github.com/opencontainers/runtime-spec/specs-go"
<ide> "golang.org/x/net/context"
<ide> func (ctr *container) start(checkpoint string, checkpointDir string) error {
<ide> if err != nil {
<ide> return nil
<ide> }
<add> createChan := make(chan struct{})
<ide> iopipe, err := ctr.openFifos(spec.Process.Terminal)
<ide> if err != nil {
<ide> return err
<ide> }
<ide>
<add> // we need to delay stdin closure after container start or else "stdin close"
<add> // event will be rejected by containerd.
<add> // stdin closure happens in AttachStreams
<add> stdin := iopipe.Stdin
<add> iopipe.Stdin = ioutils.NewWriteCloserWrapper(stdin, func() error {
<add> go func() {
<add> <-createChan
<add> stdin.Close()
<add> }()
<add> return nil
<add> })
<add>
<ide> r := &containerd.CreateContainerRequest{
<ide> Id: ctr.containerID,
<ide> BundlePath: ctr.dir,
<ide> func (ctr *container) start(checkpoint string, checkpointDir string) error {
<ide> }
<ide> ctr.client.appendContainer(ctr)
<ide>
<del> resp, err := ctr.client.remote.apiClient.CreateContainer(context.Background(), r)
<del> if err != nil {
<add> if err := ctr.client.backend.AttachStreams(ctr.containerID, *iopipe); err != nil {
<add> close(createChan)
<ide> ctr.closeFifos(iopipe)
<ide> return err
<ide> }
<del> ctr.startedAt = time.Now()
<ide>
<del> if err := ctr.client.backend.AttachStreams(ctr.containerID, *iopipe); err != nil {
<add> resp, err := ctr.client.remote.apiClient.CreateContainer(context.Background(), r)
<add> if err != nil {
<add> close(createChan)
<add> ctr.closeFifos(iopipe)
<ide> return err
<ide> }
<add> ctr.startedAt = time.Now()
<ide> ctr.systemPid = systemPid(resp.Container)
<add> close(createChan)
<ide>
<ide> return ctr.client.backend.StateChanged(ctr.containerID, StateInfo{
<ide> CommonStateInfo: CommonStateInfo{ | 2 |
Ruby | Ruby | use connection_class to check in connected_to | 3e936131ac44afe92b7933971e9ea94a8dcfb17d | <ide><path>activerecord/lib/active_record/connection_handling.rb
<ide> def connected_to(role: nil, shard: nil, prevent_writes: false, &blk)
<ide> raise NotImplementedError, "calling `connected_to` is only allowed on ActiveRecord::Base or abstract classes."
<ide> end
<ide>
<del> if name != connection_specification_name && !primary_class?
<add> if !connection_class? && !primary_class?
<ide> raise NotImplementedError, "calling `connected_to` is only allowed on the abstract class that established the connection."
<ide> end
<ide> | 1 |
Javascript | Javascript | remove unneeded comma in numberkeyframetrack | bbf8aa17f24de6016bdbb60735e3027a84c1e774 | <ide><path>src/animation/tracks/NumberKeyframeTrack.js
<ide> NumberKeyframeTrack.prototype =
<ide>
<ide> constructor: NumberKeyframeTrack,
<ide>
<del> ValueTypeName: 'number',
<add> ValueTypeName: 'number'
<ide>
<ide> // ValueBufferType is inherited
<ide> | 1 |
PHP | PHP | apply fixes from styleci | 639ddda89dd3d9466b6e9e68a7ebdb06f1fe6700 | <ide><path>src/Illuminate/Routing/Redirector.php
<ide> class Redirector
<ide> {
<ide> use Macroable;
<del>
<add>
<ide> /**
<ide> * The URL generator instance.
<ide> * | 1 |
Text | Text | add missing period in shouldcomponentupdate doc | fa4f79f9fc94a26c9ce18478e24a8bfd8cb39267 | <ide><path>docs/docs/reference-react-component.md
<ide> shouldComponentUpdate(nextProps, nextState)
<ide>
<ide> Use `shouldComponentUpdate()` to let React know if a component's output is not affected by the current change in state or props. The default behavior is to re-render on every state change, and in the vast majority of cases you should rely on the default behavior.
<ide>
<del>`shouldComponentUpdate()` is invoked before rendering when new props or state are being received. Defaults to `true` This method is not called for the initial render or when `forceUpdate()` is used.
<add>`shouldComponentUpdate()` is invoked before rendering when new props or state are being received. Defaults to `true`. This method is not called for the initial render or when `forceUpdate()` is used.
<ide>
<ide> Returning `false` does not prevent child components from re-rendering when *their* state changes.
<ide> | 1 |
PHP | PHP | make mailable@with more flexible | b7f7a3f5e21733f48c58d2fbcb6512a3a83a453f | <ide><path>src/Illuminate/Mail/Mailable.php
<ide> public function text($textView, array $data = [])
<ide> /**
<ide> * Set the view data for the message.
<ide> *
<del> * @param array $data
<add> * @param string|array $key
<add> * @param mixed $value
<ide> * @return $this
<ide> */
<del> public function with(array $data)
<add> public function with($key, $value = null)
<ide> {
<del> $this->viewData = $data;
<add> if (is_array($key)) {
<add> $this->viewData = array_merge($this->viewData, $key);
<add> } else {
<add> $this->viewData[$key] = $value;
<add> }
<ide>
<ide> return $this;
<ide> } | 1 |
PHP | PHP | update layout.blade.php | 4880ca605b47608cc10906cd3ab9690c38006932 | <ide><path>src/Illuminate/Mail/resources/views/html/layout.blade.php
<ide> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<ide> <meta name="color-scheme" content="light">
<ide> <meta name="supported-color-schemes" content="light">
<del></head>
<del><body>
<ide> <style>
<ide> @media only screen and (max-width: 600px) {
<ide> .inner-body {
<ide> }
<ide> }
<ide> </style>
<add></head>
<add><body>
<ide>
<ide> <table class="wrapper" width="100%" cellpadding="0" cellspacing="0" role="presentation">
<ide> <tr> | 1 |
Text | Text | add javascript links | 746925eb4bc8c465ba67dc9096d649f7df917529 | <ide><path>guide/english/javascript/additional-javascript-resources/index.md
<ide> title: JavaScript Tutorials and Other Resources
<ide> * [Introduction to JavaScript: First Steps](https://www.educative.io/collection/5679346740101120/5720605454237696)
<ide> * [JavaScript for Cats](http://jsforcats.com/)
<ide> * [Javascript.com by Pluralsight](https://www.javascript.com/learn)
<add>* [SoloLearn JavaScript Tutorial](https://www.sololearn.com/Course/JavaScript/)
<ide>
<ide>
<ide> ## Video Tutorials
<ide> title: JavaScript Tutorials and Other Resources
<ide> * [Functional programming in JavaScript](https://www.youtube.com/playlist?list=PL0zVEGEvSaeEd9hlmCXrk5yUyqUag-n84)
<ide> * [Douglas Crockford's Videos](https://www.youtube.com/watch?v=v2ifWcnQs6M&index=1&list=PL62E185BB8577B63D)
<ide> * [Gordon Zhu - Practical JavaScript](https://watchandcode.com/p/practical-javascript)
<add>* [The Net Ninja - JavaScript Tutorial for Beginners](https://www.youtube.com/watch?v=qoSksQ4s_hg&list=PL4cUxeGkcC9i9Ae2D9Ee1RvylH38dKuET)
<ide>
<ide>
<ide> ## Desktop Editors
<ide> title: JavaScript Tutorials and Other Resources
<ide> * [Object Playground](http://www.objectplayground.com) - Excellent resource to get to grips with Object Orientated JS.
<ide> * [Plunker](https://plnkr.co)
<ide> * [AWS Cloud 9](https://aws.amazon.com/cloud9) - Cloud Based IDE by Amazon
<add>* [Glitch](https://glitch.com/)
<ide>
<ide>
<ide> ## Coding Challenges and Exercises | 1 |
Javascript | Javascript | add a name to some anonyous functions | 083256634c8b6286d7847fcf204f5f16f9abc8b6 | <ide><path>fonts.js
<ide> var Fonts = {
<ide> * type1Font.bind();
<ide> */
<ide> var Font = (function () {
<del> var constructor = function(aName, aFile, aProperties) {
<add> var constructor = function font_constructor(aName, aFile, aProperties) {
<ide> this.name = aName;
<ide> this.encoding = aProperties.encoding;
<ide>
<ide> var TrueType = function(aName, aFile, aProperties) {
<ide> });
<ide>
<ide> // Tables needs to be written by ascendant alphabetic order
<del> tables.sort(function(a, b) {
<add> tables.sort(function tables_sort(a, b) {
<ide> return a.tag > b.tag;
<ide> });
<ide>
<ide> CFF.prototype = {
<ide> }
<ide> };
<ide>
<del> charstrings.sort(function(a, b) {
<add> charstrings.sort(function charstrings_sort(a, b) {
<ide> return a.unicode > b.unicode;
<ide> });
<ide> return charstrings;
<ide> CFF.prototype = {
<ide> "hvcurveto": 31,
<ide> },
<ide>
<del> flattenCharstring: function(aGlyph, aCharstring, aSubrs) {
<add> flattenCharstring: function flattenCharstring(aGlyph, aCharstring, aSubrs) {
<ide> var i = 0;
<ide> while (true) {
<ide> var obj = aCharstring[i];
<ide> CFF.prototype = {
<ide> error("failing with i = " + i + " in charstring:" + aCharstring + "(" + aCharstring.length + ")");
<ide> },
<ide>
<del> wrap: function(aName, aProperties) {
<add> wrap: function wrap(aName, aProperties) {
<ide> var charstrings = this.getOrderedCharStrings(aProperties.glyphs);
<ide>
<ide> // Starts the conversion of the Type1 charstrings to Type2 | 1 |
Ruby | Ruby | run `tap --repair` as part of `prune` | 291977d823f7080c33339f3c91c102f1d5ea4b24 | <ide><path>Library/Homebrew/cmd/prune.rb
<ide> require 'keg'
<add>require 'cmd/tap'
<ide>
<ide> module Homebrew extend self
<ide> # $n and $d are used by the ObserverPathnameExtension to keep track of
<ide> def prune
<ide>
<ide> dirs.sort.reverse_each{ |d| d.rmdir_if_possible }
<ide>
<add> repair_taps
<add>
<ide> if $n == 0 and $d == 0
<ide> puts "Nothing pruned" if ARGV.verbose?
<ide> else | 1 |
Javascript | Javascript | add german translation | 6679a0131d89cfeec38f5ed7593e970ac35f16f4 | <ide><path>lang/de.js
<add>(function () {
<add> var lang = {
<add> months : "Januar_Februar_März_April_Mai_Juni_Juli_August_September_Oktober_November_Dezember".split("_"),
<add> monthsShort : "Jan._Febr._Mrz._Apr._Mai_Jun._Jul._Aug._Sept._Okt._Nov._Dez.".split("_"),
<add> weekdays : "Sonntag_Montag_Dienstag_Mittwoch_Donnerstag_Freitag_Samstag".split("_"),
<add> weekdaysShort : "So._Mo._Di._Mi._Do._Fr._Sa.".split("_"),
<add> longDateFormat : {
<add> L : "DD.MM.YYYY",
<add> LL : "D. MMMM YYYY",
<add> LLL : "D. MMMM YYYY HH:mm U\\hr",
<add> LLLL : "dddd, D. MMMM YYYY HH:mm U\\hr"
<add> },
<add> relativeTime : {
<add> future : "in %s",
<add> past : "vor %s",
<add> s : "ein paar Sekunden",
<add> m : "einer Minute",
<add> mm : "%d Minuten",
<add> h : "einer Stunde",
<add> hh : "%d Stunden",
<add> d : "einem Tag",
<add> dd : "%d Tagen",
<add> M : "einem Monat",
<add> MM : "%d Monaten",
<add> y : "einem Jahr",
<add> yy : "%d Jahren"
<add> },
<add> ordinal : function (number) {
<add> return '.';
<add> }
<add> };
<add>
<add> // Node
<add> if (typeof module !== 'undefined') {
<add> module.exports = lang;
<add> }
<add> // Browser
<add> if (typeof window !== 'undefined' && this.moment && this.moment.lang) {
<add> this.moment.lang('de', lang);
<add> }
<add>}());
<ide><path>lang/de.min.js
<add>(function(){var a={months:"Januar_Februar_März_April_Mai_Juni_Juli_August_September_Oktober_November_Dezember".split("_"),monthsShort:"Jan._Febr._Mrz._Apr._Mai_Jun._Jul._Aug._Sept._Okt._Nov._Dez.".split("_"),weekdays:"Sonntag_Montag_Dienstag_Mittwoch_Donnerstag_Freitag_Samstag".split("_"),weekdaysShort:"So._Mo._Di._Mi._Do._Fr._Sa.".split("_"),longDateFormat:{L:"DD.MM.YYYY",LL:"D. MMMM YYYY",LLL:"D. MMMM YYYY HH:mm U\\hr",LLLL:"dddd, D. MMMM YYYY HH:mm U\\hr"},relativeTime:{future:"in %s",past:"vor %s",s:"ein paar Sekunden",m:"einer Minute",mm:"%d Minuten",h:"einer Stunde",hh:"%d Stunden",d:"einem Tag",dd:"%d Tagen",M:"einem Monat",MM:"%d Monaten",y:"einem Jahr",yy:"%d Jahren"},ordinal:function(a){return"."}};typeof module!="undefined"&&(module.exports=a),typeof window!="undefined"&&this.moment&&this.moment.lang&&this.moment.lang("de",a)})()
<ide>\ No newline at end of file
<ide><path>lang/test/de.js
<add>
<add>/**************************************************
<add> German
<add> *************************************************/
<add>
<add>module("lang:de");
<add>
<add>test("format", 18, function() {
<add> moment.lang('de');
<add> var a = [
<add> ['dddd, Do MMMM YYYY, h:mm:ss a', 'Sonntag, 14. Februar 2010, 3:25:50 pm'],
<add> ['ddd, hA', 'So., 3PM'],
<add> ['M Mo MM MMMM MMM', '2 2. 02 Februar Febr.'],
<add> ['YYYY YY', '2010 10'],
<add> ['D Do DD', '14 14. 14'],
<add> ['d do dddd ddd', '0 0. Sonntag So.'],
<add> ['DDD DDDo DDDD', '45 45. 045'],
<add> ['w wo ww', '8 8. 08'],
<add> ['h hh', '3 03'],
<add> ['H HH', '15 15'],
<add> ['m mm', '25 25'],
<add> ['s ss', '50 50'],
<add> ['a A', 'pm PM'],
<add> ['t\\he DDDo \\d\\ay of t\\he ye\\ar', 'the 45. day of the year'],
<add> ['L', '14.02.2010'],
<add> ['LL', '14. Februar 2010'],
<add> ['LLL', '14. Februar 2010 15:25 Uhr'],
<add> ['LLLL', 'Sonntag, 14. Februar 2010 15:25 Uhr']
<add> ],
<add> b = moment(new Date(2010, 1, 14, 15, 25, 50, 125)),
<add> i;
<add> for (i = 0; i < a.length; i++) {
<add> equal(b.format(a[i][0]), a[i][1], a[i][0] + ' ---> ' + a[i][1]);
<add> }
<add>});
<add>
<add>test("format YY", 1, function() {
<add> var b = moment(new Date(2009, 1, 14, 15, 25, 50, 125));
<add> equal(b.format('YY'), '09', 'YY ---> 09');
<add>});
<add>
<add>test("format timezone", 2, function() {
<add> var b = moment(new Date(2010, 1, 14, 15, 25, 50, 125));
<add> ok(b.format('z').match(/^[A-Z]{3,4}$/), 'z ---> Something like "PST"');
<add> ok(b.format('zz').match(/^[A-Z]{3,4}$/), 'zz ---> Something like "PST"');
<add>});
<add>
<add>test("format ordinal", 31, function() {
<add> moment.lang('de');
<add> equal(moment([2011, 0, 1]).format('DDDo'), '1.', '1.');
<add> equal(moment([2011, 0, 2]).format('DDDo'), '2.', '2.');
<add> equal(moment([2011, 0, 3]).format('DDDo'), '3.', '3.');
<add> equal(moment([2011, 0, 4]).format('DDDo'), '4.', '4.');
<add> equal(moment([2011, 0, 5]).format('DDDo'), '5.', '5.');
<add> equal(moment([2011, 0, 6]).format('DDDo'), '6.', '6.');
<add> equal(moment([2011, 0, 7]).format('DDDo'), '7.', '7.');
<add> equal(moment([2011, 0, 8]).format('DDDo'), '8.', '8.');
<add> equal(moment([2011, 0, 9]).format('DDDo'), '9.', '9.');
<add> equal(moment([2011, 0, 10]).format('DDDo'), '10.', '10.');
<add>
<add> equal(moment([2011, 0, 11]).format('DDDo'), '11.', '11.');
<add> equal(moment([2011, 0, 12]).format('DDDo'), '12.', '12.');
<add> equal(moment([2011, 0, 13]).format('DDDo'), '13.', '13.');
<add> equal(moment([2011, 0, 14]).format('DDDo'), '14.', '14.');
<add> equal(moment([2011, 0, 15]).format('DDDo'), '15.', '15.');
<add> equal(moment([2011, 0, 16]).format('DDDo'), '16.', '16.');
<add> equal(moment([2011, 0, 17]).format('DDDo'), '17.', '17.');
<add> equal(moment([2011, 0, 18]).format('DDDo'), '18.', '18.');
<add> equal(moment([2011, 0, 19]).format('DDDo'), '19.', '19.');
<add> equal(moment([2011, 0, 20]).format('DDDo'), '20.', '20.');
<add>
<add> equal(moment([2011, 0, 21]).format('DDDo'), '21.', '21.');
<add> equal(moment([2011, 0, 22]).format('DDDo'), '22.', '22.');
<add> equal(moment([2011, 0, 23]).format('DDDo'), '23.', '23.');
<add> equal(moment([2011, 0, 24]).format('DDDo'), '24.', '24.');
<add> equal(moment([2011, 0, 25]).format('DDDo'), '25.', '25.');
<add> equal(moment([2011, 0, 26]).format('DDDo'), '26.', '26.');
<add> equal(moment([2011, 0, 27]).format('DDDo'), '27.', '27.');
<add> equal(moment([2011, 0, 28]).format('DDDo'), '28.', '28.');
<add> equal(moment([2011, 0, 29]).format('DDDo'), '29.', '29.');
<add> equal(moment([2011, 0, 30]).format('DDDo'), '30.', '30.');
<add>
<add> equal(moment([2011, 0, 31]).format('DDDo'), '31.', '31.');
<add>});
<add>
<add>test("format month", 12, function() {
<add> moment.lang('de');
<add> var expected = 'Januar Jan._Februar Febr._März Mrz._April Apr._Mai Mai_Juni Jun._Juli Jul._August Aug._September Sept._Oktober Okt._November Nov._Dezember Dez.'.split("_");
<add> var i;
<add> for (i = 0; i < expected.length; i++) {
<add> equal(moment([2011, i, 0]).format('MMMM MMM'), expected[i], expected[i]);
<add> }
<add>});
<add>
<add>test("format week", 7, function() {
<add> moment.lang('de');
<add> var expected = 'Sonntag So._Montag Mo._Dienstag Di._Mittwoch Mi._Donnerstag Do._Freitag Fr._Samstag Sa.'.split("_");
<add> var i;
<add> for (i = 0; i < expected.length; i++) {
<add> equal(moment([2011, 0, 2 + i]).format('dddd ddd'), expected[i], expected[i]);
<add> }
<add>});
<add>
<add>test("from", 30, function() {
<add> moment.lang('de');
<add> var start = moment([2007, 1, 28]);
<add> equal(start.from(moment([2007, 1, 28]).add({s:44}), true), "ein paar Sekunden", "44 seconds = a few seconds");
<add> equal(start.from(moment([2007, 1, 28]).add({s:45}), true), "einer Minute", "45 seconds = a minute");
<add> equal(start.from(moment([2007, 1, 28]).add({s:89}), true), "einer Minute", "89 seconds = a minute");
<add> equal(start.from(moment([2007, 1, 28]).add({s:90}), true), "2 Minuten", "90 seconds = 2 minutes");
<add> equal(start.from(moment([2007, 1, 28]).add({m:44}), true), "44 Minuten", "44 minutes = 44 minutes");
<add> equal(start.from(moment([2007, 1, 28]).add({m:45}), true), "einer Stunde", "45 minutes = an hour");
<add> equal(start.from(moment([2007, 1, 28]).add({m:89}), true), "einer Stunde", "89 minutes = an hour");
<add> equal(start.from(moment([2007, 1, 28]).add({m:90}), true), "2 Stunden", "90 minutes = 2 hours");
<add> equal(start.from(moment([2007, 1, 28]).add({h:5}), true), "5 Stunden", "5 hours = 5 hours");
<add> equal(start.from(moment([2007, 1, 28]).add({h:21}), true), "21 Stunden", "21 hours = 21 hours");
<add> equal(start.from(moment([2007, 1, 28]).add({h:22}), true), "einem Tag", "22 hours = a day");
<add> equal(start.from(moment([2007, 1, 28]).add({h:35}), true), "einem Tag", "35 hours = a day");
<add> equal(start.from(moment([2007, 1, 28]).add({h:36}), true), "2 Tagen", "36 hours = 2 days");
<add> equal(start.from(moment([2007, 1, 28]).add({d:1}), true), "einem Tag", "1 day = a day");
<add> equal(start.from(moment([2007, 1, 28]).add({d:5}), true), "5 Tagen", "5 days = 5 days");
<add> equal(start.from(moment([2007, 1, 28]).add({d:25}), true), "25 Tagen", "25 days = 25 days");
<add> equal(start.from(moment([2007, 1, 28]).add({d:26}), true), "einem Monat", "26 days = a month");
<add> equal(start.from(moment([2007, 1, 28]).add({d:30}), true), "einem Monat", "30 days = a month");
<add> equal(start.from(moment([2007, 1, 28]).add({d:45}), true), "einem Monat", "45 days = a month");
<add> equal(start.from(moment([2007, 1, 28]).add({d:46}), true), "2 Monaten", "46 days = 2 months");
<add> equal(start.from(moment([2007, 1, 28]).add({d:74}), true), "2 Monaten", "75 days = 2 months");
<add> equal(start.from(moment([2007, 1, 28]).add({d:76}), true), "3 Monaten", "76 days = 3 months");
<add> equal(start.from(moment([2007, 1, 28]).add({M:1}), true), "einem Monat", "1 month = a month");
<add> equal(start.from(moment([2007, 1, 28]).add({M:5}), true), "5 Monaten", "5 months = 5 months");
<add> equal(start.from(moment([2007, 1, 28]).add({d:344}), true), "11 Monaten", "344 days = 11 months");
<add> equal(start.from(moment([2007, 1, 28]).add({d:345}), true), "einem Jahr", "345 days = a year");
<add> equal(start.from(moment([2007, 1, 28]).add({d:547}), true), "einem Jahr", "547 days = a year");
<add> equal(start.from(moment([2007, 1, 28]).add({d:548}), true), "2 Jahren", "548 days = 2 years");
<add> equal(start.from(moment([2007, 1, 28]).add({y:1}), true), "einem Jahr", "1 year = a year");
<add> equal(start.from(moment([2007, 1, 28]).add({y:5}), true), "5 Jahren", "5 years = 5 years");
<add>});
<add>
<add>test("suffix", 2, function() {
<add> moment.lang('de');
<add> equal(moment(30000).from(0), "in ein paar Sekunden", "prefix");
<add> equal(moment(0).from(30000), "vor ein paar Sekunden", "suffix");
<add>});
<add>
<add>test("fromNow", 2, function() {
<add> moment.lang('de');
<add> equal(moment().add({s:30}).fromNow(), "in ein paar Sekunden", "in a few seconds");
<add> equal(moment().add({d:5}).fromNow(), "in 5 Tagen", "in 5 days");
<add>}); | 3 |
Ruby | Ruby | add exception handling with built-in retry options | ef4aff07a41f1249baade695e68c75a8db3ded58 | <ide><path>lib/active_job/enqueuing.rb
<ide> def enqueue_at(timestamp, *args)
<ide> def initialize(arguments = nil)
<ide> @arguments = arguments
<ide> end
<add>
<add> def retry_now
<add> self.class.enqueue *arguments
<add> end
<add>
<add> def retry_in(interval)
<add> self.class.enqueue_in interval, *arguments
<add> end
<add>
<add> def retry_at(timestamp)
<add> self.class.enqueue_at timestamp, *arguments
<add> end
<ide> end
<ide> end
<ide><path>lib/active_job/performing.rb
<add>require 'active_support/rescuable'
<ide> require 'active_job/arguments'
<ide>
<ide> module ActiveJob
<ide> module Performing
<add> extend ActiveSupport::Concern
<add>
<add> included do
<add> include ActiveSupport::Rescuable
<add> end
<add>
<ide> def perform_with_hooks(*serialized_args)
<ide> self.arguments = Arguments.deserialize(serialized_args)
<ide>
<ide> run_callbacks :perform do
<ide> perform *arguments
<ide> end
<add> rescue => exception
<add> rescue_with_handler(exception)
<ide> end
<ide>
<ide> def perform(*)
<ide><path>test/cases/callbacks_test.rb
<ide> require 'helper'
<del>require 'active_job/arguments'
<ide> require 'jobs/callback_job'
<ide>
<ide> require 'active_support/core_ext/object/inclusion'
<ide><path>test/cases/rescue_test.rb
<add>require 'helper'
<add>require 'jobs/rescue_job'
<add>
<add>require 'active_support/core_ext/object/inclusion'
<add>
<add>class RescueTest < ActiveSupport::TestCase
<add> setup do
<add> $BUFFER = []
<add> end
<add>
<add> test 'rescue perform exception with retry' do
<add> job = RescueJob.new
<add> job.perform_with_hooks("david")
<add> assert_equal [ "rescued from StandardError", "performed beautifully" ], $BUFFER
<add> end
<add>end
<ide><path>test/jobs/rescue_job.rb
<add>class RescueJob < ActiveJob::Base
<add> rescue_from(StandardError) do
<add> $BUFFER << "rescued from StandardError"
<add> arguments[0] = "DIFFERENT!"
<add> retry_now
<add> end
<add>
<add> def perform(person = "david")
<add> if person == "david"
<add> raise "Hair too good"
<add> else
<add> $BUFFER << "performed beautifully"
<add> end
<add> end
<add>end | 5 |
Ruby | Ruby | cask changes /usr/local ownership recursively | d00f35b8c4dcdcbf86074015f0471f27e3dc2aaa | <ide><path>Library/Homebrew/cask/lib/hbc/caskroom.rb
<ide> def migrate_caskroom_from_repo_to_prefix
<ide> FileUtils.mv repo_caskroom, Hbc.caskroom
<ide> else
<ide> opoo "#{Hbc.caskroom.parent} is not writable, sudo is needed to move the Caskroom."
<del> system "/usr/bin/sudo", "--", "/bin/mv", "--", repo_caskroom.to_s, Hbc.caskroom.parent.to_s
<add> sudo "/bin/mv", repo_caskroom.to_s, Hbc.caskroom.parent.to_s
<ide> end
<ide> end
<ide>
<ide> def ensure_caskroom_exists
<ide> return if Hbc.caskroom.exist?
<ide>
<ide> ohai "Creating Caskroom at #{Hbc.caskroom}"
<del> if Hbc.caskroom.parent.writable?
<del> Hbc.caskroom.mkpath
<del> else
<del> ohai "We'll set permissions properly so we won't need sudo in the future"
<del> toplevel_dir = Hbc.caskroom
<del> toplevel_dir = toplevel_dir.parent until toplevel_dir.parent.root?
<del> unless toplevel_dir.directory?
<del> # If a toplevel dir such as '/opt' must be created, enforce standard permissions.
<del> # sudo in system is rude.
<del> system "/usr/bin/sudo", "--", "/bin/mkdir", "--", toplevel_dir
<del> system "/usr/bin/sudo", "--", "/bin/chmod", "--", "0775", toplevel_dir
<del> end
<del> # sudo in system is rude.
<del> system "/usr/bin/sudo", "--", "/bin/mkdir", "-p", "--", Hbc.caskroom
<del> unless Hbc.caskroom.parent == toplevel_dir
<del> system "/usr/bin/sudo", "--", "/usr/sbin/chown", "-R", "--", "#{Utils.current_user}:staff", Hbc.caskroom.parent.to_s
<del> end
<del> end
<add> ohai "We'll set permissions properly so we won't need sudo in the future"
<add>
<add> sudo "/bin/mkdir", "-p", Hbc.caskroom
<add> sudo "/bin/chmod", "g+rwx", Hbc.caskroom
<add> sudo "/usr/sbin/chown", Utils.current_user, Hbc.caskroom
<add> sudo "/usr/bin/chgrp", "admin", Hbc.caskroom
<add> end
<add>
<add> def sudo(*args)
<add> ohai "/usr/bin/sudo #{args.join(" ")}"
<add> system "/usr/bin/sudo", *args
<ide> end
<ide> end
<ide> end | 1 |
Ruby | Ruby | switch === to case / when | b9a622f817b28b7796c5d5c78ec294b35ae7dfe2 | <ide><path>actionpack/lib/action_dispatch/routing/mapper.rb
<ide> def split_constraints(path_params, constraints)
<ide> end
<ide>
<ide> def normalize_format!(formatted)
<del> if formatted == true
<add> case formatted
<add> when true
<ide> @requirements[:format] ||= /.+/
<del> elsif Regexp === formatted
<add> when Regexp
<ide> @requirements[:format] ||= formatted
<ide> @defaults[:format] ||= nil
<del> elsif String === formatted
<add> when String
<ide> @requirements[:format] ||= Regexp.compile(formatted)
<ide> @defaults[:format] ||= formatted
<ide> end | 1 |
PHP | PHP | move ability check into the backtrace method | 7154df4686249e83da85c3239fcea7a604518f91 | <ide><path>src/Illuminate/Foundation/Auth/Access/AuthorizesRequests.php
<ide> trait AuthorizesRequests
<ide> /**
<ide> * Authorize a given action against a set of arguments.
<ide> *
<del> * @param string $ability
<add> * @param mixed $ability
<ide> * @param mixed|array $arguments
<ide> * @return void
<ide> *
<ide> * @throws \Symfony\Component\HttpKernel\Exception\HttpException
<ide> */
<ide> public function authorize($ability, $arguments = [])
<ide> {
<del> if (! is_string($ability)) {
<del> list($arguments, $ability) = [$ability, $this->guessAbilityName()];
<del> }
<add> list($ability, $arguments) = $this->parseAbilityAndArguments($ability, $arguments);
<ide>
<ide> if (! app(Gate::class)->check($ability, $arguments)) {
<ide> throw $this->createGateUnauthorizedException($ability, $arguments);
<ide> public function authorize($ability, $arguments = [])
<ide> * Authorize a given action for a user.
<ide> *
<ide> * @param \Illuminate\Contracts\Auth\Authenticatable|mixed $user
<del> * @param string $ability
<del> * @param array $arguments
<add> * @param mixed $ability
<add> * @param mixed|array $arguments
<ide> * @return void
<ide> *
<ide> * @throws \Symfony\Component\HttpKernel\Exception\HttpException
<ide> */
<ide> public function authorizeForUser($user, $ability, $arguments = [])
<ide> {
<del> if (! is_string($ability)) {
<del> list($arguments, $ability) = [$ability, $this->guessAbilityName()];
<del> }
<add> list($ability, $arguments) = $this->parseAbilityAndArguments($ability, $arguments);
<ide>
<ide> $result = app(Gate::class)->forUser($user)->check($ability, $arguments);
<ide>
<ide> public function authorizeForUser($user, $ability, $arguments = [])
<ide> }
<ide>
<ide> /**
<del> * Guesses the ability's name from the original method name.
<add> * Guesses the ability's name if it wasn't provided.
<ide> *
<del> * @return string
<add> * @param mixed $ability
<add> * @param mixed|array $arguments
<add> * @return array
<ide> */
<del> protected function guessAbilityName()
<add> protected function parseAbilityAndArguments($ability, $arguments)
<ide> {
<del> return debug_backtrace(false, 3)[2]['function'];
<add> if (is_string($ability)) {
<add> return [$ability, $arguments];
<add> }
<add>
<add> return [debug_backtrace(false, 3)[2]['function'], $ability];
<ide> }
<ide>
<ide> /** | 1 |
Mixed | Python | add apply cli | c223cd7a86f460f3dabb9e7369eef136a653218e | <ide><path>spacy/cli/__init__.py
<ide> from .debug_model import debug_model # noqa: F401
<ide> from .debug_diff import debug_diff # noqa: F401
<ide> from .evaluate import evaluate # noqa: F401
<add>from .apply import apply # noqa: F401
<ide> from .convert import convert # noqa: F401
<ide> from .init_pipeline import init_pipeline_cli # noqa: F401
<ide> from .init_config import init_config, fill_config # noqa: F401
<ide><path>spacy/cli/_util.py
<ide> def setup_gpu(use_gpu: int, silent=None) -> None:
<ide> local_msg.info("To switch to GPU 0, use the option: --gpu-id 0")
<ide>
<ide>
<add>def walk_directory(path: Path, suffix: Optional[str] = None) -> List[Path]:
<add> if not path.is_dir():
<add> return [path]
<add> paths = [path]
<add> locs = []
<add> seen = set()
<add> for path in paths:
<add> if str(path) in seen:
<add> continue
<add> seen.add(str(path))
<add> if path.parts[-1].startswith("."):
<add> continue
<add> elif path.is_dir():
<add> paths.extend(path.iterdir())
<add> elif suffix is not None and not path.parts[-1].endswith(suffix):
<add> continue
<add> else:
<add> locs.append(path)
<add> # It's good to sort these, in case the ordering messes up cache.
<add> locs.sort()
<add> return locs
<add>
<add>
<ide> def _format_number(number: Union[int, float], ndigits: int = 2) -> str:
<ide> """Formats a number (float or int) rounding to `ndigits`, without truncating trailing 0s,
<ide> as happens with `round(number, ndigits)`"""
<ide><path>spacy/cli/apply.py
<add>import tqdm
<add>import srsly
<add>
<add>from itertools import chain
<add>from pathlib import Path
<add>from typing import Optional, List, Iterable, cast, Union
<add>
<add>from wasabi import msg
<add>
<add>from ._util import app, Arg, Opt, setup_gpu, import_code, walk_directory
<add>
<add>from ..tokens import Doc, DocBin
<add>from ..vocab import Vocab
<add>from ..util import ensure_path, load_model
<add>
<add>
<add>path_help = """Location of the documents to predict on.
<add>Can be a single file in .spacy format or a .jsonl file.
<add>Files with other extensions are treated as single plain text documents.
<add>If a directory is provided it is traversed recursively to grab
<add>all files to be processed.
<add>The files can be a mixture of .spacy, .jsonl and text files.
<add>If .jsonl is provided the specified field is going
<add>to be grabbed ("text" by default)."""
<add>
<add>out_help = "Path to save the resulting .spacy file"
<add>code_help = (
<add> "Path to Python file with additional " "code (registered functions) to be imported"
<add>)
<add>gold_help = "Use gold preprocessing provided in the .spacy files"
<add>force_msg = (
<add> "The provided output file already exists. "
<add> "To force overwriting the output file, set the --force or -F flag."
<add>)
<add>
<add>
<add>DocOrStrStream = Union[Iterable[str], Iterable[Doc]]
<add>
<add>
<add>def _stream_docbin(path: Path, vocab: Vocab) -> Iterable[Doc]:
<add> """
<add> Stream Doc objects from DocBin.
<add> """
<add> docbin = DocBin().from_disk(path)
<add> for doc in docbin.get_docs(vocab):
<add> yield doc
<add>
<add>
<add>def _stream_jsonl(path: Path, field: str) -> Iterable[str]:
<add> """
<add> Stream "text" field from JSONL. If the field "text" is
<add> not found it raises error.
<add> """
<add> for entry in srsly.read_jsonl(path):
<add> if field not in entry:
<add> msg.fail(
<add> f"{path} does not contain the required '{field}' field.", exits=1
<add> )
<add> else:
<add> yield entry[field]
<add>
<add>
<add>def _stream_texts(paths: Iterable[Path]) -> Iterable[str]:
<add> """
<add> Yields strings from text files in paths.
<add> """
<add> for path in paths:
<add> with open(path, "r") as fin:
<add> text = fin.read()
<add> yield text
<add>
<add>
<add>@app.command("apply")
<add>def apply_cli(
<add> # fmt: off
<add> model: str = Arg(..., help="Model name or path"),
<add> data_path: Path = Arg(..., help=path_help, exists=True),
<add> output_file: Path = Arg(..., help=out_help, dir_okay=False),
<add> code_path: Optional[Path] = Opt(None, "--code", "-c", help=code_help),
<add> text_key: str = Opt("text", "--text-key", "-tk", help="Key containing text string for JSONL"),
<add> force_overwrite: bool = Opt(False, "--force", "-F", help="Force overwriting the output file"),
<add> use_gpu: int = Opt(-1, "--gpu-id", "-g", help="GPU ID or -1 for CPU."),
<add> batch_size: int = Opt(1, "--batch-size", "-b", help="Batch size."),
<add> n_process: int = Opt(1, "--n-process", "-n", help="number of processors to use.")
<add>):
<add> """
<add> Apply a trained pipeline to documents to get predictions.
<add> Expects a loadable spaCy pipeline and path to the data, which
<add> can be a directory or a file.
<add> The data files can be provided in multiple formats:
<add> 1. .spacy files
<add> 2. .jsonl files with a specified "field" to read the text from.
<add> 3. Files with any other extension are assumed to be containing
<add> a single document.
<add> DOCS: https://spacy.io/api/cli#apply
<add> """
<add> data_path = ensure_path(data_path)
<add> output_file = ensure_path(output_file)
<add> code_path = ensure_path(code_path)
<add> if output_file.exists() and not force_overwrite:
<add> msg.fail(force_msg, exits=1)
<add> if not data_path.exists():
<add> msg.fail(f"Couldn't find data path: {data_path}", exits=1)
<add> import_code(code_path)
<add> setup_gpu(use_gpu)
<add> apply(data_path, output_file, model, text_key, batch_size, n_process)
<add>
<add>
<add>def apply(
<add> data_path: Path,
<add> output_file: Path,
<add> model: str,
<add> json_field: str,
<add> batch_size: int,
<add> n_process: int,
<add>):
<add> docbin = DocBin(store_user_data=True)
<add> paths = walk_directory(data_path)
<add> if len(paths) == 0:
<add> docbin.to_disk(output_file)
<add> msg.warn("Did not find data to process,"
<add> f" {data_path} seems to be an empty directory.")
<add> return
<add> nlp = load_model(model)
<add> msg.good(f"Loaded model {model}")
<add> vocab = nlp.vocab
<add> streams: List[DocOrStrStream] = []
<add> text_files = []
<add> for path in paths:
<add> if path.suffix == ".spacy":
<add> streams.append(_stream_docbin(path, vocab))
<add> elif path.suffix == ".jsonl":
<add> streams.append(_stream_jsonl(path, json_field))
<add> else:
<add> text_files.append(path)
<add> if len(text_files) > 0:
<add> streams.append(_stream_texts(text_files))
<add> datagen = cast(DocOrStrStream, chain(*streams))
<add> for doc in tqdm.tqdm(nlp.pipe(datagen, batch_size=batch_size, n_process=n_process)):
<add> docbin.add(doc)
<add> if output_file.suffix == "":
<add> output_file = output_file.with_suffix(".spacy")
<add> docbin.to_disk(output_file)
<ide><path>spacy/cli/convert.py
<del>from typing import Callable, Iterable, Mapping, Optional, Any, List, Union
<add>from typing import Callable, Iterable, Mapping, Optional, Any, Union
<ide> from enum import Enum
<ide> from pathlib import Path
<ide> from wasabi import Printer
<ide> import sys
<ide> import itertools
<ide>
<del>from ._util import app, Arg, Opt
<add>from ._util import app, Arg, Opt, walk_directory
<ide> from ..training import docs_to_json
<ide> from ..tokens import Doc, DocBin
<ide> from ..training.converters import iob_to_docs, conll_ner_to_docs, json_to_docs
<ide> def autodetect_ner_format(input_data: str) -> Optional[str]:
<ide> return None
<ide>
<ide>
<del>def walk_directory(path: Path, converter: str) -> List[Path]:
<del> if not path.is_dir():
<del> return [path]
<del> paths = [path]
<del> locs = []
<del> seen = set()
<del> for path in paths:
<del> if str(path) in seen:
<del> continue
<del> seen.add(str(path))
<del> if path.parts[-1].startswith("."):
<del> continue
<del> elif path.is_dir():
<del> paths.extend(path.iterdir())
<del> elif converter == "json" and not path.parts[-1].endswith("json"):
<del> continue
<del> elif converter == "conll" and not path.parts[-1].endswith("conll"):
<del> continue
<del> elif converter == "iob" and not path.parts[-1].endswith("iob"):
<del> continue
<del> else:
<del> locs.append(path)
<del> # It's good to sort these, in case the ordering messes up cache.
<del> locs.sort()
<del> return locs
<del>
<del>
<ide> def verify_cli_args(
<ide> msg: Printer,
<ide> input_path: Path,
<ide><path>spacy/tests/test_cli.py
<ide> import pkg_resources
<ide> import time
<ide>
<add>import spacy
<ide> import numpy
<ide> import pytest
<ide> import srsly
<ide> from spacy.cli.project.remote_storage import RemoteStorage
<ide> from spacy.cli.project.run import _check_requirements
<ide> from spacy.cli.validate import get_model_pkgs
<add>from spacy.cli.apply import apply
<ide> from spacy.cli.find_threshold import find_threshold
<ide> from spacy.lang.en import English
<ide> from spacy.lang.nl import Dutch
<ide> def test_span_length_freq_dist_output_must_be_correct():
<ide> assert list(span_freqs.keys()) == [3, 1, 4, 5, 2]
<ide>
<ide>
<add>def test_applycli_empty_dir():
<add> with make_tempdir() as data_path:
<add> output = data_path / "test.spacy"
<add> apply(data_path, output, "blank:en", "text", 1, 1)
<add>
<add>
<add>def test_applycli_docbin():
<add> with make_tempdir() as data_path:
<add> output = data_path / "testout.spacy"
<add> nlp = spacy.blank("en")
<add> doc = nlp("testing apply cli.")
<add> # test empty DocBin case
<add> docbin = DocBin()
<add> docbin.to_disk(data_path / "testin.spacy")
<add> apply(data_path, output, "blank:en", "text", 1, 1)
<add> docbin.add(doc)
<add> docbin.to_disk(data_path / "testin.spacy")
<add> apply(data_path, output, "blank:en", "text", 1, 1)
<add>
<add>
<add>def test_applycli_jsonl():
<add> with make_tempdir() as data_path:
<add> output = data_path / "testout.spacy"
<add> data = [{"field": "Testing apply cli.", "key": 234}]
<add> data2 = [{"field": "234"}]
<add> srsly.write_jsonl(data_path / "test.jsonl", data)
<add> apply(data_path, output, "blank:en", "field", 1, 1)
<add> srsly.write_jsonl(data_path / "test2.jsonl", data2)
<add> apply(data_path, output, "blank:en", "field", 1, 1)
<add>
<add>
<add>def test_applycli_txt():
<add> with make_tempdir() as data_path:
<add> output = data_path / "testout.spacy"
<add> with open(data_path / "test.foo", "w") as ftest:
<add> ftest.write("Testing apply cli.")
<add> apply(data_path, output, "blank:en", "text", 1, 1)
<add>
<add>
<add>def test_applycli_mixed():
<add> with make_tempdir() as data_path:
<add> output = data_path / "testout.spacy"
<add> text = "Testing apply cli"
<add> nlp = spacy.blank("en")
<add> doc = nlp(text)
<add> jsonl_data = [{"text": text}]
<add> srsly.write_jsonl(data_path / "test.jsonl", jsonl_data)
<add> docbin = DocBin()
<add> docbin.add(doc)
<add> docbin.to_disk(data_path / "testin.spacy")
<add> with open(data_path / "test.txt", "w") as ftest:
<add> ftest.write(text)
<add> apply(data_path, output, "blank:en", "text", 1, 1)
<add> # Check whether it worked
<add> result = list(DocBin().from_disk(output).get_docs(nlp.vocab))
<add> assert len(result) == 3
<add> for doc in result:
<add> assert doc.text == text
<add>
<add>
<add>def test_applycli_user_data():
<add> Doc.set_extension("ext", default=0)
<add> val = ("ext", 0)
<add> with make_tempdir() as data_path:
<add> output = data_path / "testout.spacy"
<add> nlp = spacy.blank("en")
<add> doc = nlp("testing apply cli.")
<add> doc._.ext = val
<add> docbin = DocBin(store_user_data=True)
<add> docbin.add(doc)
<add> docbin.to_disk(data_path / "testin.spacy")
<add> apply(data_path, output, "blank:en", "", 1, 1)
<add> result = list(DocBin().from_disk(output).get_docs(nlp.vocab))
<add> assert result[0]._.ext == val
<add>
<add>
<ide> def test_local_remote_storage():
<ide> with make_tempdir() as d:
<ide> filename = "a.txt"
<ide><path>website/docs/api/cli.md
<ide> menu:
<ide> - ['train', 'train']
<ide> - ['pretrain', 'pretrain']
<ide> - ['evaluate', 'evaluate']
<add> - ['apply', 'apply']
<ide> - ['find-threshold', 'find-threshold']
<ide> - ['assemble', 'assemble']
<ide> - ['package', 'package']
<ide> report span characteristics such as the average span length and the span (or
<ide> span boundary) distinctiveness. The distinctiveness measure shows how different
<ide> the tokens are with respect to the rest of the corpus using the KL-divergence of
<ide> the token distributions. To learn more, you can check out Papay et al.'s work on
<del>[*Dissecting Span Identification Tasks with Performance Prediction* (EMNLP 2020)](https://aclanthology.org/2020.emnlp-main.396/).
<add>[_Dissecting Span Identification Tasks with Performance Prediction_ (EMNLP 2020)](https://aclanthology.org/2020.emnlp-main.396/).
<ide>
<ide> </Infobox>
<ide>
<ide> $ python -m spacy evaluate [model] [data_path] [--output] [--code] [--gold-prepr
<ide> | `--help`, `-h` | Show help message and available arguments. ~~bool (flag)~~ |
<ide> | **CREATES** | Training results and optional metrics and visualizations. |
<ide>
<add>## apply {#apply new="3.5" tag="command"}
<add>
<add>Applies a trained pipeline to data and stores the resulting annotated documents
<add>in a `DocBin`. The input can be a single file or a directory. The recognized
<add>input formats are:
<add>
<add>1. `.spacy`
<add>2. `.jsonl` containing a user specified `text_key`
<add>3. Files with any other extension are assumed to be plain text files containing
<add> a single document.
<add>
<add>When a directory is provided it is traversed recursively to collect all files.
<add>
<add>```cli
<add>$ python -m spacy apply [model] [data-path] [output-file] [--code] [--text-key] [--force-overwrite] [--gpu-id] [--batch-size] [--n-process]
<add>```
<add>
<add>| Name | Description |
<add>| ----------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
<add>| `model` | Pipeline to apply to the data. Can be a package or a path to a data directory. ~~str (positional)~~ |
<add>| `data_path` | Location of data to be evaluated in spaCy's [binary format](/api/data-formats#training), jsonl, or plain text. ~~Path (positional)~~ |
<add>| `output-file`, `-o` | Output `DocBin` path. ~~str (positional)~~ |
<add>| `--code`, `-c` <Tag variant="new">3</Tag> | Path to Python file with additional code to be imported. Allows [registering custom functions](/usage/training#custom-functions) for new architectures. ~~Optional[Path] \(option)~~ |
<add>| `--text-key`, `-tk` | The key for `.jsonl` files to use to grab the texts from. Defaults to `text`. ~~Optional[str] \(option)~~ |
<add>| `--force-overwrite`, `-F` | If the provided `output-file` already exists, then force `apply` to overwrite it. If this is `False` (default) then quits with a warning instead. ~~bool (flag)~~ |
<add>| `--gpu-id`, `-g` | GPU to use, if any. Defaults to `-1` for CPU. ~~int (option)~~ |
<add>| `--batch-size`, `-b` | Batch size to use for prediction. Defaults to `1`. ~~int (option)~~ |
<add>| `--n-process`, `-n` | Number of processes to use for prediction. Defaults to `1`. ~~int (option)~~ |
<add>| `--help`, `-h` | Show help message and available arguments. ~~bool (flag)~~ |
<add>| **CREATES** | A `DocBin` with the annotations from the `model` for all the files found in `data-path`. |
<add>
<ide> ## find-threshold {#find-threshold new="3.5" tag="command"}
<ide>
<ide> Runs prediction trials for a trained model with varying tresholds to maximize
<ide> be provided.
<ide> > $ python -m spacy find-threshold my_nlp data.spacy spancat threshold spans_sc_f
<ide> > ```
<ide>
<del>
<ide> | Name | Description |
<ide> | ----------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
<ide> | `model` | Pipeline to evaluate. Can be a package or a path to a data directory. ~~str (positional)~~ | | 6 |
Ruby | Ruby | remove unused method | dbc30d7e261c5cfa324722f219f3acf53e819e4a | <ide><path>railties/lib/rails/generators/rails/plugin/plugin_generator.rb
<ide> def namespaced_name
<ide>
<ide> protected
<ide>
<del> def app_templates_dir
<del> "../../app/templates"
<del> end
<del>
<ide> def create_dummy_app(path = nil)
<ide> dummy_path(path) if path
<ide> | 1 |
Javascript | Javascript | restore ios, android links on showcase | 016f47c7f5c1009a0340360ec0af92a14cae462f | <ide><path>website/src/react-native/index.js
<ide> var Prism = require('Prism');
<ide> var React = require('React');
<ide> var Site = require('Site');
<ide>
<del>var apps = require('./showcaseData').pinned;
<add>var apps = [
<add> {
<add> name: 'Facebook',
<add> icon: 'https://lh3.googleusercontent.com/ZZPdzvlpK9r_Df9C3M7j1rNRi7hhHRvPhlklJ3lfi5jk86Jd1s0Y5wcQ1QgbVaAP5Q=w300',
<add> infoLink: 'https://itunes.apple.com/app/facebook/id284882215',
<add> },
<add> {
<add> name: 'Facebook Ads Manager',
<add> icon: 'http://is5.mzstatic.com/image/pf/us/r30/Purple5/v4/9e/16/86/9e1686ef-cc55-805a-c977-538ddb5e6832/mzl.gqbhwitj.png',
<add> infoLink: 'https://itunes.apple.com/us/app/facebook-ads-manager/id964397083?mt=8',
<add> },
<add> {
<add> name: 'Facebook Groups',
<add> icon: 'http://is4.mzstatic.com/image/pf/us/r30/Purple69/v4/57/f8/4c/57f84c0c-793d-5f9a-95ee-c212d0369e37/mzl.ugjwfhzx.png',
<add> infoLink: 'https://itunes.apple.com/us/app/facebook-groups/id931735837?mt=8',
<add> },
<add> {
<add> name: 'Instagram',
<add> icon: 'http://a4.mzstatic.com/us/r30/Purple62/v4/1f/8d/f9/1f8df910-8ec7-3b8e-0104-d44e869f4d65/icon175x175.jpeg',
<add> infoLink: 'https://www.instagram.com/',
<add> },
<add> {
<add> name: 'Airbnb',
<add> icon: 'https://a2.muscache.com/airbnb/static/icons/apple-touch-icon-180x180-bcbe0e3960cd084eb8eaf1353cf3c730.png',
<add> infoLink: 'https://www.airbnb.com/mobile',
<add> },
<add> {
<add> name: 'Baidu(手机百度)',
<add> icon: 'http://a3.mzstatic.com/us/r30/Purple62/v4/90/7c/9b/907c9b4e-556d-1a45-45d4-0ea801719abd/icon175x175.png',
<add> infoLink: 'http://baike.baidu.com/link?url=TW8YhcVN4tO_Jz5VqMclCjGhf12EEqMD_TeVC6efe2REZlx80r6T0dX96hdmNl36XogLyExXzrvFU9rFeqxg_K',
<add> },
<add> {
<add> name: 'Discord',
<add> icon: 'http://a5.mzstatic.com/us/r30/Purple5/v4/c1/2f/4c/c12f4cba-1d9a-f6bf-2240-04085d3470ec/icon175x175.jpeg',
<add> infoLink: 'https://itunes.apple.com/us/app/discord-chat-for-gamers/id985746746?mt=8',
<add> },
<add> {
<add> name: 'Gyroscope',
<add> icon: 'https://media.gyrosco.pe/images/magneto/180x180.png',
<add> infoLink: 'https://itunes.apple.com/app/apple-store/id1104085053?pt=117927205&ct=website&mt=8',
<add> },
<add> {
<add> name: 'li.st',
<add> icon: 'https://lh3.googleusercontent.com/tXt0HgJ7dCgOnuQ-lQr1P7E57mnOYfwXhRsV9lGcPwHPVvrDAN6YmpLVFgy88qKrkFI=w300',
<add> infoLink: 'https://play.google.com/store/apps/details?id=st.li.listapp',
<add> },
<add> {
<add> name: 'QQ',
<add> icon: 'http://pp.myapp.com/ma_icon/0/icon_6633_1461768893/96',
<add> infoLink: 'http://android.myapp.com/myapp/detail.htm?apkName=com.tencent.mobileqq',
<add> },
<add> {
<add> name: 'Townske',
<add> icon: 'http://a3.mzstatic.com/us/r30/Purple69/v4/8b/42/20/8b4220af-5165-91fd-0f05-014332df73ef/icon175x175.png',
<add> infoLink: 'https://itunes.apple.com/us/app/townske-stunning-city-guides/id1018136179?ls=1&mt=8',
<add> },
<add> {
<add> name: 'Vogue',
<add> icon: 'http://a2.mzstatic.com/us/r30/Purple30/v4/06/24/92/0624927f-a389-746c-27f9-e2466d59e55b/icon175x175.jpeg',
<add> infoLink: 'https://itunes.apple.com/app/apple-store/id1087973225?pt=45076&ct=site-promo&mt=8',
<add> }
<add>];
<ide>
<ide> var AppList = React.createClass({
<ide> render: function() {
<ide> var AppList = React.createClass({
<ide> },
<ide>
<ide> _renderApp: function(app, i) {
<del> var inner = (
<del> <div>
<del> {this._renderIcon(app)}
<del> </div>
<del> );
<del>
<ide> return (
<ide> <div className="showcase" key={i}>
<del> {inner}
<add> {this._renderIcon(app)}
<ide> </div>
<ide> );
<ide> },
<ide>
<ide> _renderIcon: function(app) {
<del> var icon = (
<del> <img src={app.icon} alt={app.name} />
<del> );
<del>
<ide> return (
<del> <a href={app.defaultLink}>
<del> {icon}
<add> <a href={app.infoLink}>
<add> <img src={app.icon} alt={app.name} />
<ide> </a>
<ide> );
<ide> },
<ide>
<ide> _renderTitle: function(app) {
<del> var title = (
<del> <h3>{app.name}</h3>
<del> );
<del>
<ide> return (
<del> <a href={app.defaultLink}>
<del> {title}
<add> <a href={app.infoLink}>
<add> <h3>{app.name}</h3>
<ide> </a>
<ide> );
<ide> },
<ide><path>website/src/react-native/showcase.js
<ide> var React = require('React');
<ide> var Site = require('Site');
<ide>
<del>var featured = require('./showcaseData').featured;
<del>var pinned = require('./showcaseData').pinned;
<add>
<add>/*
<add>Thousands of applications use React Native, so we can't list all of them
<add>in our showcase. To be useful to someone looking through the showcase,
<add>either the app must be something that most readers would recognize, or the
<add>makers of the application must have posted useful technical content about the
<add>making of the app. It also must be useful considering that the majority of
<add>readers only speak English. So, each app in the showcase should link to either:
<add>
<add>1/ An English-language news article discussing the app, built either by a funded startup or for a public company
<add>2/ An English-language technical post on a funded startup or public company blog discussing React Native
<add>
<add>For each app in the showcase, use infoLink and infoTitle to reference this
<add>content.
<add>*/
<add>var featured = [
<add> {
<add> name: 'QQ空间',
<add> icon: 'http://pp.myapp.com/ma_icon/0/icon_9959_1460036593/96',
<add> linkPlayStore: 'http://android.myapp.com/myapp/detail.htm?apkName=com.qzone',
<add> infoLink: 'https://en.wikipedia.org/wiki/Qzone',
<add> infoTitle: 'Qzone is a Chinese social network with over 600 million users',
<add> },
<add> {
<add> name: 'QQ音乐',
<add> icon: 'http://pp.myapp.com/ma_icon/0/icon_6259_1462429453/96',
<add> linkPlayStore: 'http://android.myapp.com/myapp/detail.htm?apkName=com.tencent.qqmusic',
<add> infoLink: 'http://www.wsj.com/articles/tencent-customers-come-for-the-music-stay-for-the-perks-1433869369',
<add> infoTitle: 'Internet giant tries to get people to pay for digital music',
<add> },
<add> {
<add> name: 'FanVision Bolt',
<add> icon: 'http://a4.mzstatic.com/us/r30/Purple18/v4/94/b4/6e/94b46ee5-80e3-ff6e-513d-16da926b03a3/icon175x175.jpeg',
<add> linkAppStore: 'https://itunes.apple.com/us/app/fanvision-bolt/id1081891275',
<add> infoLink: 'https://www.youtube.com/watch?v=oWOcAXyDf0w',
<add> infoTitle: 'FanVision Bolt accessory + app provide live audio/video and stats at NASCAR events',
<add> },
<add> {
<add> name: 'F8',
<add> icon: 'https://raw.githubusercontent.com/fbsamples/f8app/master/ios/F8v2/Images.xcassets/AppIcon.appiconset/AppIcon%402x.png',
<add> linkAppStore: 'https://itunes.apple.com/us/app/f8/id853467066?mt=8',
<add> linkPlayStore: 'https://play.google.com/store/apps/details?id=com.facebook.f8',
<add> infoLink: 'http://makeitopen.com/tutorials/building-the-f8-app/planning/',
<add> infoTitle: 'Building the F8 App',
<add> },
<add> {
<add> name: 'Discovery VR',
<add> icon: 'http://a2.mzstatic.com/us/r30/Purple6/v4/d1/d5/f4/d1d5f437-9f6b-b5aa-5fe7-47bd19f934bf/icon175x175.png',
<add> linkAppStore: 'https://itunes.apple.com/us/app/discovery-vr/id1030815031?mt=8',
<add> linkPlayStore: 'https://play.google.com/store/apps/details?id=com.discovery.DiscoveryVR',
<add> infoLink: 'https://medium.com/ios-os-x-development/an-ios-developer-on-react-native-1f24786c29f0',
<add> infoTitle: '"I may never write an iOS app in Objective-C or Swift again."',
<add> },
<add> {
<add> name: 'Movie Trailers by MovieLaLa',
<add> icon: 'https://lh3.googleusercontent.com/16aug4m_6tvJB7QZden9w1SOMqpZgNp7rHqDhltZNvofw1a4V_ojGGXUMPGiK0dDCqzL=w300',
<add> linkAppStore: 'https://itunes.apple.com/us/app/movie-trailers-by-movielala/id1001416601?mt=8',
<add> linkPlayStore: 'https://play.google.com/store/apps/details?id=com.movielala.trailers',
<add> infoLink: 'http://variety.com/2016/digital/news/movielala-1-4-million-seed-round-hollywood-angel-investors-1201678139/',
<add> infoTitle: 'MovieLaLa Closes $1.4 Million Seed Round',
<add> },
<add> {
<add> name: 'Myntra',
<add> icon: 'http://a5.mzstatic.com/us/r30/Purple6/v4/9c/78/df/9c78dfa6-0061-1af2-5026-3e1d5a073c94/icon350x350.png',
<add> linkAppStore: 'https://itunes.apple.com/in/app/myntra-fashion-shopping-app/id907394059',
<add> infoLink: 'https://techcrunch.com/2014/05/22/flipkart-myntra-acqusition/',
<add> infoTitle: 'Flipkart Buys Fashion E-tailer Myntra To Fight Amazon',
<add> },
<add> {
<add> name: 'SoundCloud Pulse',
<add> icon: 'https://i1.sndcdn.com/artworks-000149203716-k5je96-original.jpg',
<add> linkAppStore: 'https://itunes.apple.com/us/app/soundcloud-pulse-for-creators/id1074278256?mt=8',
<add> infoLink: 'https://blog.soundcloud.com/2016/02/23/soundcloud-pulse-now-on-iphone/',
<add> infoTitle: 'SoundCloud Pulse: now on iPhone',
<add> },
<add> {
<add> name: 'Start - medication manager for depression',
<add> icon: 'http://a1.mzstatic.com/us/r30/Purple49/v4/de/9b/6f/de9b6fe8-84ea-7a12-ba2c-0a6d6c7b10b0/icon175x175.png',
<add> linkAppStore: 'https://itunes.apple.com/us/app/start-medication-manager-for/id1012099928?mt=8',
<add> infoLink: 'http://www.nytimes.com/2014/09/24/technology/to-gather-drug-information-a-health-start-up-turns-to-consumers.html?_r=0',
<add> infoTitle: 'NYT: A Health Startup Turns to Consumers',
<add> },
<add> {
<add> name: 'Taxfyle - taxes filed on-demand via licensed CPA',
<add> icon: 'https://s3.amazonaws.com/taxfyle-public/images/taxfyle-icon-1024px.png',
<add> linkAppStore: 'https://itunes.apple.com/us/app/taxfyle/id1058033104?mt=8',
<add> infoLink: 'http://www.techinsider.io/taxfyle-wants-to-be-the-uber-for-taxes-2016-4',
<add> infoTitle: 'Taxfyle: the Uber for filing taxes',
<add> },
<add> {
<add> name: 'This AM',
<add> icon: 'http://s3.r29static.com//bin/public/efe/x/1542038/image.png',
<add> linkAppStore: 'https://itunes.apple.com/us/app/refinery29-this-am-top-breaking/id988472315?mt=8',
<add> infoLink: 'https://techcrunch.com/2016/02/01/refinery29-debuts-its-first-app-a-morning-news-round-up-called-refinery29-am/',
<add> infoTitle: 'Refinery29 debuts its first app',
<add> },
<add> {
<add> name: 'TRED - Sell your car for more',
<add> icon: 'http://a1.mzstatic.com/us/r30/Purple20/v4/b0/0c/07/b00c07d2-a057-06bc-6044-9fdab97f370f/icon175x175.jpeg',
<add> linkAppStore: 'https://itunes.apple.com/us/app/tred-sell-my-car-for-more!/id1070071394?mt=8',
<add> linkPlayStore: 'https://play.google.com/store/apps/details?id=com.tredmobile&hl=en',
<add> infoLink: 'http://www.geekwire.com/2015/mobile-dealership-tred-raises-another-1m-to-help-used-car-owners-make-more-money/',
<add> infoTitle: 'Sell your car for thousands more than Craigslist or the dealer with TRED',
<add> },
<add> {
<add> name: 'Bitt Wallet',
<add> icon: 'http://a4.mzstatic.com/us/r30/Purple69/v4/5b/00/34/5b003497-cc85-a0d0-0d3e-4fb3bc6f95cd/icon175x175.jpeg',
<add> linkAppStore: 'https://itunes.apple.com/us/app/bitt-wallet/id1081954916?mt=8',
<add> infoLink: 'https://bitcoinmagazine.com/articles/overstock-invests-in-bitt-to-launch-official-digital-currencies-in-the-caribbean-islands-1459961581',
<add> infoTitle: 'Overstock invests in Bitt to launch digital currencies',
<add> },
<add> {
<add> name: 'Calor - Field Pro',
<add> icon: 'http://rnfdigital.com/wp-content/uploads/2016/04/FieldProIcon.png',
<add> infoLink: 'http://rnfdigital.com/react-native-a-game-changer-for-enterprise-mobile-development/',
<add> infoTitle: 'React Native: a game changer for Enterprise Mobile Development',
<add> },
<add> {
<add> name: 'CBS Sports Franchise Football',
<add> icon: 'http://a2.mzstatic.com/us/r30/Purple69/v4/7b/0c/a0/7b0ca007-885a-7cfc-9fa2-2ec4394c2ecc/icon175x175.png',
<add> linkPlayStore: 'https://play.google.com/store/apps/details?id=com.cbssports.fantasy.franchisefootball2015',
<add> infoLink: 'http://www.cbssports.com/fantasy/football/games/franchise/2015',
<add> infoTitle: 'The award winning Fantasy Football league manager.',
<add> },
<add> {
<add> name: 'Coiney(窓口)',
<add> icon: 'http://a4.mzstatic.com/us/r30/Purple69/v4/c9/bc/3a/c9bc3a29-9c11-868f-b960-ca46d5fcd509/icon175x175.jpeg',
<add> linkAppStore: 'https://itunes.apple.com/jp/app/coiney-chuang-kou/id1069271336?mt=8',
<add> infoLink: 'https://www.techinasia.com/japan-startup-coiney-aims-for-ipo',
<add> infoTitle: 'Japanese startup Coiney aims for IPO',
<add> },
<add> {
<add> name: 'Convoy Driver',
<add> icon: 'http://a1.mzstatic.com/us/r30/Purple30/v4/5a/74/56/5a74567d-4491-a298-65cd-722c8a7211ac/icon175x175.png',
<add> linkAppStore: 'https://itunes.apple.com/us/app/convoy-driver/id1045368390?mt=8',
<add> infoLink: 'http://www.theverge.com/2015/10/27/9620352/convoy-uber-for-trucking',
<add> infoTitle: 'Convoy, a Seattle-based "Uber for trucking"',
<add> },
<add> {
<add> name: 'Fixt',
<add> icon: 'http://a5.mzstatic.com/us/r30/Purple62/v4/7f/b3/66/7fb366c4-79fd-34e1-3037-ffc02d8a93f7/icon350x350.png',
<add> linkAppStore: 'https://itunes.apple.com/us/app/dropbot-phone-replacement/id1000855694?mt=8',
<add> linkPlayStore: 'https://play.google.com/store/apps/details?id=co.fixt',
<add> infoLink: 'http://www.phonearena.com/news/Fixt-is-an-app-that-promises-a-hassle-free-smartphone-repairy-service_id81069',
<add> infoTitle: 'A hassle-free smartphone repair service',
<add> },
<add> {
<add> name: 'Leanpub',
<add> icon: 'http://a2.mzstatic.com/us/r30/Purple6/v4/9f/4a/6f/9f4a6f8c-8951-ed89-4083-74ace23df9ef/icon350x350.jpeg',
<add> linkAppStore: 'https://itunes.apple.com/us/app/leanpub/id913517110?ls=1&mt=8',
<add> infoLink: 'http://techland.time.com/2011/06/23/how-to-turn-your-blog-into-an-instant-e-book/',
<add> infoTitle: 'Leanpub: How to Turn Your Blog into an Instant E-Book',
<add> },
<add> {
<add> name: 'Lugg – Your On-Demand Mover',
<add> icon: 'https://lh3.googleusercontent.com/EV9z7kRRME2KPMBRNHnje7bBNEl_Why2CFq-MfKzBC88uSFJTYr1HO3-nPt-JuVJwKFb=w300',
<add> linkPlayStore: 'https://play.google.com/store/apps/details?id=com.lugg',
<add> infoLink: 'https://techcrunch.com/2015/08/26/lugg-an-app-for-on-demand-short-distance-moves-raises-3-8-million/',
<add> infoTitle: 'Lugg, An App for Short-Distance Moves, Raises $3.8 Million',
<add> },
<add> {
<add> name: 'Pimmr',
<add> icon: 'http://a2.mzstatic.com/eu/r30/Purple69/v4/99/da/0e/99da0ee6-bc87-e1a6-1d95-7027c78f50e1/icon175x175.jpeg',
<add> linkAppStore: 'https://itunes.apple.com/nl/app/pimmr/id1023343303?mt=8',
<add> infoLink: 'https://www.crunchbase.com/organization/pimmr#/entity',
<add> infoTitle: 'Pimmr helps you find the needle in the haystack',
<add> },
<add> {
<add> name: 'Project September',
<add> icon: 'http://a4.mzstatic.com/us/r30/Purple30/v4/95/51/b7/9551b72a-d80a-5b1c-5c6d-7fc77d745d31/icon175x175.png',
<add> linkAppStore: 'https://itunes.apple.com/us/app/project-september/id1074075331?ls=1&mt=8&_branch_match_id=273849075056044546',
<add> infoLink: 'http://fortune.com/2016/04/14/project-september-alexis-maybank/',
<add> infoTitle: 'Former Gilt CEO Launches New Mobile App',
<add> },
<add> {
<add> name: 'Samanage',
<add> icon: 'http://a3.mzstatic.com/us/r30/Purple69/v4/ed/e9/ff/ede9ff34-a9f6-5eb6-2a23-fcb014b326f2/icon175x175.jpeg',
<add> linkAppStore: 'https://itunes.apple.com/us/app/samanage/id1033018362',
<add> infoLink: 'https://techcrunch.com/2015/05/20/samanage-raises-16m-as-asset-management-business-grows/',
<add> infoTitle: 'Samanage raises $16M as Asset Management Expands',
<add> },
<add> {
<add> name: 'ShareWis',
<add> icon: 'https://s3-ap-northeast-1.amazonaws.com/sw-misc/sharewis3_app.png',
<add> linkAppStore: 'https://itunes.apple.com/jp/app/id585517208',
<add> infoLink: 'https://www.crunchbase.com/organization/sharewis#/entity',
<add> infoTitle: 'The concept is to turn learning into an adventure',
<add> },
<add> {
<add> name: 'sneat',
<add> icon: 'http://a3.mzstatic.com/eu/r30/Purple49/v4/71/71/df/7171df47-6e03-8619-19a8-07f52186b0ed/icon175x175.jpeg',
<add> linkAppStore: 'https://itunes.apple.com/fr/app/sneat-reservez-les-meilleurs/id1062510079?l=en&mt=8',
<add> infoLink: 'http://www.internetsansfrontieres.com/sneat-application-mobile-reserver-restaurant/',
<add> infoTitle: 'Application mobile pour réserver un restaurant',
<add> },
<add> {
<add> name: 'Ticketea',
<add> icon: 'http://f.cl.ly/items/0n3g3x2t0W0a0d0b1F0C/tkt-icon.png',
<add> linkAppStore: 'https://itunes.apple.com/es/app/entradas-teatro-y-conciertos/id1060067658?mt=8',
<add> linkPlayStore: 'https://play.google.com/store/apps/details?id=com.ticketea.geminis',
<add> infoLink: 'https://techcrunch.com/2013/05/27/ticket-to-ride/',
<add> infoTitle: 'Ticketea raises $4 Million to Beat Ticketmaster',
<add> },
<add> {
<add> name: 'uSwitch',
<add> icon: 'https://lh3.googleusercontent.com/NpkGlwFWdj7VsK2ueVwlgdrrBrNJ-yN-4TkEHjjSjDUu7NpMcfyAp10p97f0zci0CSFQ=w300',
<add> linkAppStore: 'https://itunes.apple.com/gb/app/uswitch-compare-switch-save/id935325621?mt=8&ct=react',
<add> linkPlayStore: 'https://play.google.com/store/apps/details?id=com.uswitchmobileapp',
<add> infoLink: 'https://en.wikipedia.org/wiki/USwitch',
<add> infoTitle: 'uSwitch: a UK-based price comparison service',
<add> },
<add> {
<add> name: 'WEARVR',
<add> icon: 'http://a2.mzstatic.com/eu/r30/Purple69/v4/4f/5a/28/4f5a2876-9530-ef83-e399-c5ef5b2dab80/icon175x175.png',
<add> linkAppStore: 'https://itunes.apple.com/gb/app/wearvr/id1066288171?mt=8',
<add> linkPlayStore: 'https://play.google.com/store/apps/details?id=com.wearvr.app',
<add> infoLink: 'http://venturebeat.com/2015/04/07/virtual-reality-app-store-wear-vr-secures-1-5m-in-funding/',
<add> infoTitle: 'Wear VR secures $1.5M in funding',
<add> },
<add> {
<add> name: 'Wego Concerts',
<add> icon: 'http://a5.mzstatic.com/us/r30/Purple69/v4/03/91/2d/03912daa-fae7-6a25-5f11-e6b19290b3f4/icon175x175.png',
<add> linkAppStore: 'https://itunes.apple.com/us/app/wego-concerts-follow-friends/id869478093?mt=8',
<add> infoLink: 'http://www.nydailynews.com/life-style/wego-concerts-app-links-music-fans-article-1.2066776',
<add> infoTitle: 'Wego Concerts: Like the love child of Tinder and StubHub',
<add> },
<add> {
<add> name: 'Bdsdiet',
<add> icon: 'http://s3.ap-northeast-2.amazonaws.com/bdsdiet-bucket/media/store-icon.png',
<add> linkPlayStore: 'https://play.google.com/store/apps/details?id=com.bdsdiet_app',
<add> infoLink: 'https://www.crunchbase.com/organization/bds-diet#/entity',
<add> infoTitle: 'Bdsdiet provides real estate brokerage services through web and live agents in Korea.',
<add> },
<add> {
<add> name: 'Fengniao Crowdsource(蜂鸟众包)',
<add> icon: 'http://img.wdjimg.com/mms/icon/v1/e/6e/687b129606504cd52632a8cc4ca816ee_256_256.png',
<add> linkPlayStore: 'http://www.wandoujia.com/apps/me.ele.crowdsource',
<add> linkAppStore: 'https://itunes.apple.com/cn/app/feng-niao-zhong-bao-jian-zhi/id1061034377?mt=8',
<add> infoLink: 'https://elelogistics.github.io/about/Crowdsource-App-Write-In-React-Native.html',
<add> infoTitle: 'Fengniao Crowdsource is the largest crowdsourced logistics platform in China.',
<add> },
<add> {
<add> name: '昨日热推',
<add> icon: 'https://frontbin.com/images/apple-touch-icon.png',
<add> linkAppStore: 'https://itunes.apple.com/cn/app/zuo-ri-re-tui/id1137163693?l=en&mt=8',
<add> infoLink: 'https://www.zfanw.com/blog/developing-react-native-image-viewer-library.html',
<add> infoTitle: 'Developing the react-native-image-viewer library',
<add> },
<add> {
<add> name: 'Artsy',
<add> icon: 'https://raw.githubusercontent.com/artsy/eigen/master/Artsy/Resources/Images.xcassets/AppIcon.appiconset/AppIcon167.png',
<add> linkAppStore: 'https://itunes.apple.com/us/app/artsy-collect-bid-on-fine/id703796080?mt=8',
<add> infoLink: 'https://artsy.github.io/series/react-native-at-artsy/',
<add> infoTitle: 'React Native at Artsy',
<add> },
<add> {
<add> name: 'Huiseoul(惠首尔)',
<add> icon: 'https://cdn.huiseoul.com/icon.png',
<add> linkAppStore: 'https://itunes.apple.com/us/app/hui-shou-er-ni-si-ren-mei/id1127150360?ls=1&mt=8',
<add> infoLink: 'https://engineering.huiseoul.com/building-a-conversational-e-commerce-app-in-6-weeks-with-react-native-c35d46637e07',
<add> infoTitle: 'Building a conversational E-commerce app in 6 weeks with React Native',
<add> },
<add> {
<add> name: 'PlaceAVote',
<add> icon: 'https://s12.postimg.org/nr79mplq5/pav_Icon.png',
<add> linkAppStore: 'https://itunes.apple.com/us/app/placeavote/id1120628991?ls=1&mt=8',
<add> linkPlayStore: 'https://play.google.com/store/apps/details?id=com.placeavote.androidapp&hl=en',
<add> infoLink: 'https://techcrunch.com/2016/05/10/placeavote-wants-to-give-voters-a-say-in-congress/',
<add> infoTitle: 'PlaceAVote wants to give voters a say in Congress',
<add> },
<add> {
<add> name: 'Robin Rooms',
<add> icon: 'http://robinpowered.s3.amazonaws.com/rooms/appicon.png',
<add> linkAppStore: 'https://itunes.apple.com/us/app/robin-rooms/id947566115',
<add> linkPlayStore: 'https://play.google.com/store/apps/details?id=com.robinpowered.rooms',
<add> infoLink: 'https://techcrunch.com/2016/05/31/robin-makes-the-office-smarter-with-7-million-in-new-funding/',
<add> infoTitle: 'Robin Rooms manages and mounts outside your conference rooms'
<add> },
<add> {
<add> name: 'Sleeperbot',
<add> icon: 'https://blitzchat.net/uploads/c8425332190a4f4b852d7770ad32e602/original.png',
<add> linkAppStore: 'https://itunes.apple.com/us/app/sleeperbot-fantasy-football/id987367543?mt=8',
<add> linkPlayStore: 'https://play.google.com/store/apps/details?id=com.sleeperbot&hl=en',
<add> infoLink: 'https://medium.com/sleeperbot-hq/switching-to-react-native-in-production-on-ios-and-android-e6b675402712#.cug6h6qhn',
<add> infoTitle: 'Switching to React Native in Production on iOS and Android',
<add> }
<add>];
<add>
<add>/*
<add>If you want your app to be featured in the showcase, add them to the featured
<add>hash above this line. The pinned list is reserved for a small list of hand-picked apps.
<add>*/
<add>var pinned = [
<add> {
<add> name: 'Facebook',
<add> icon: 'https://lh3.googleusercontent.com/ZZPdzvlpK9r_Df9C3M7j1rNRi7hhHRvPhlklJ3lfi5jk86Jd1s0Y5wcQ1QgbVaAP5Q=w300',
<add> linkAppStore: 'https://itunes.apple.com/app/facebook/id284882215',
<add> linkPlayStore: 'https://play.google.com/store/apps/details?id=com.facebook.katana&hl=en',
<add> infoLink: 'https://code.facebook.com/posts/895897210527114/dive-into-react-native-performance/',
<add> infoTitle: 'Using React Native in the Facebook App',
<add> defaultLink: 'https://itunes.apple.com/app/facebook/id284882215',
<add> },
<add> {
<add> name: 'Facebook Ads Manager',
<add> icon: 'http://is5.mzstatic.com/image/pf/us/r30/Purple5/v4/9e/16/86/9e1686ef-cc55-805a-c977-538ddb5e6832/mzl.gqbhwitj.png',
<add> linkAppStore: 'https://itunes.apple.com/us/app/facebook-ads-manager/id964397083?mt=8',
<add> linkPlayStore: 'https://play.google.com/store/apps/details?id=com.facebook.adsmanager',
<add> infoLink: 'https://code.facebook.com/posts/1189117404435352/react-native-for-android-how-we-built-the-first-cross-platform-react-native-app/',
<add> infoTitle: 'How We Built the First Cross-Platform React Native App',
<add> defaultLink: 'https://itunes.apple.com/us/app/facebook-ads-manager/id964397083?mt=8',
<add> },
<add> {
<add> name: 'Facebook Groups',
<add> icon: 'http://is4.mzstatic.com/image/pf/us/r30/Purple69/v4/57/f8/4c/57f84c0c-793d-5f9a-95ee-c212d0369e37/mzl.ugjwfhzx.png',
<add> linkAppStore: 'https://itunes.apple.com/us/app/facebook-groups/id931735837?mt=8',
<add> infoLink: 'https://code.facebook.com/posts/1014532261909640/react-native-bringing-modern-web-techniques-to-mobile/',
<add> infoTitle: 'React Native: Bringing Modern Web Techniques to Mobile',
<add> defaultLink: 'https://itunes.apple.com/us/app/facebook-groups/id931735837?mt=8',
<add> },
<add> {
<add> name: 'Instagram',
<add> icon: 'http://a4.mzstatic.com/us/r30/Purple62/v4/1f/8d/f9/1f8df910-8ec7-3b8e-0104-d44e869f4d65/icon175x175.jpeg',
<add> linkAppStore: 'https://itunes.apple.com/app/instagram/id389801252?pt=428156&ct=igweb.unifiedHome.badge&mt=8',
<add> linkPlayStore: 'https://play.google.com/store/apps/details?id=com.instagram.android&referrer=utm_source%3Dinstagramweb%26utm_campaign%3DunifiedHome%26utm_medium%3Dbadge',
<add> infoLink: '',
<add> infoTitle: '',
<add> defaultLink: 'https://www.instagram.com/',
<add> },
<add> {
<add> name: 'Airbnb',
<add> icon: 'https://a2.muscache.com/airbnb/static/icons/apple-touch-icon-180x180-bcbe0e3960cd084eb8eaf1353cf3c730.png',
<add> linkAppStore: 'https://itunes.apple.com/us/app/airbnb/id401626263?mt=8&bev=1472279725_4ITWKWGX6KrmU6pT&utm_medium=web&utm_source=airbnb&_branch_match_id=307510898795870823',
<add> linkPlayStore: 'https://play.google.com/store/apps/details?id=com.airbnb.android&hl=en&referrer=bev%3D1472279725_4ITWKWGX6KrmU6pT%26utm_medium%3Dweb%26utm_source%3Dairbnb',
<add> infoLink: 'https://www.youtube.com/watch?v=tUfgQtmG3R0',
<add> infoTitle: 'Hybrid React Native Apps at Airbnb',
<add> infoTitle: 'Tech Talk: Hybrid React Native Apps at Airbnb',
<add> defaultLink: 'https://www.airbnb.com/mobile',
<add> },
<add> {
<add> name: 'Baidu(手机百度)',
<add> icon: 'http://a3.mzstatic.com/us/r30/Purple62/v4/90/7c/9b/907c9b4e-556d-1a45-45d4-0ea801719abd/icon175x175.png',
<add> linkPlayStore: 'http://shouji.baidu.com/software/9896302.html',
<add> linkAppStore: 'https://itunes.apple.com/en/app/shou-ji-bai-du-hai-liang-xin/id382201985?l=en&mt=8',
<add> infoLink: 'http://baike.baidu.com/link?url=TW8YhcVN4tO_Jz5VqMclCjGhf12EEqMD_TeVC6efe2REZlx80r6T0dX96hdmNl36XogLyExXzrvFU9rFeqxg_K',
<add> infoTitle: 'Baidu is a search engine that has 600 million users.',
<add> defaultLink: 'http://baike.baidu.com/link?url=TW8YhcVN4tO_Jz5VqMclCjGhf12EEqMD_TeVC6efe2REZlx80r6T0dX96hdmNl36XogLyExXzrvFU9rFeqxg_K',
<add> },
<add> {
<add> name: 'Discord',
<add> icon: 'http://a5.mzstatic.com/us/r30/Purple5/v4/c1/2f/4c/c12f4cba-1d9a-f6bf-2240-04085d3470ec/icon175x175.jpeg',
<add> linkAppStore: 'https://itunes.apple.com/us/app/discord-chat-for-gamers/id985746746?mt=8',
<add> infoLink: 'https://discord.engineering/react-native-deep-dive-91fd5e949933#.5jnqftgof',
<add> infoTitle: 'Using React Native: One Year Later',
<add> defaultLink: 'https://itunes.apple.com/us/app/discord-chat-for-gamers/id985746746?mt=8',
<add> },
<add> {
<add> name: 'Gyroscope',
<add> icon: 'https://media.gyrosco.pe/images/magneto/180x180.png',
<add> linkAppStore: 'https://itunes.apple.com/app/apple-store/id1104085053?pt=117927205&ct=website&mt=8',
<add> infoLink: 'https://blog.gyrosco.pe/building-the-app-1dac1a97d253',
<add> infoTitle: 'Building a visualization experience with React Native',
<add> defaultLink: 'https://itunes.apple.com/app/apple-store/id1104085053?pt=117927205&ct=website&mt=8',
<add> },
<add> {
<add> name: 'li.st',
<add> icon: 'https://lh3.googleusercontent.com/tXt0HgJ7dCgOnuQ-lQr1P7E57mnOYfwXhRsV9lGcPwHPVvrDAN6YmpLVFgy88qKrkFI=w300',
<add> linkPlayStore: 'https://play.google.com/store/apps/details?id=st.li.listapp',
<add> infoLink: 'https://www.youtube.com/watch?v=cI9bDvDEsYE',
<add> infoTitle: 'Building li.st for Android with React Native',
<add> defaultLink: 'https://play.google.com/store/apps/details?id=st.li.listapp',
<add> },
<add> {
<add> name: 'QQ',
<add> icon: 'http://pp.myapp.com/ma_icon/0/icon_6633_1461768893/96',
<add> linkPlayStore: 'http://android.myapp.com/myapp/detail.htm?apkName=com.tencent.mobileqq',
<add> infoLink: 'https://en.wikipedia.org/wiki/Tencent_QQ',
<add> infoTitle: 'QQ is a Chinese messaging service with 829 million active accounts',
<add> defaultLink: 'http://android.myapp.com/myapp/detail.htm?apkName=com.tencent.mobileqq',
<add> },
<add> {
<add> name: 'Townske',
<add> icon: 'http://a3.mzstatic.com/us/r30/Purple69/v4/8b/42/20/8b4220af-5165-91fd-0f05-014332df73ef/icon175x175.png',
<add> linkAppStore: 'https://itunes.apple.com/us/app/townske-stunning-city-guides/id1018136179?ls=1&mt=8',
<add> infoLink: 'https://hackernoon.com/townske-app-in-react-native-6ad557de7a7c',
<add> infoTitle: '"I would recommend React Native in a heartbeat."',
<add> defaultLink: 'https://itunes.apple.com/us/app/townske-stunning-city-guides/id1018136179?ls=1&mt=8',
<add> },
<add> {
<add> name: 'Vogue',
<add> icon: 'http://a2.mzstatic.com/us/r30/Purple30/v4/06/24/92/0624927f-a389-746c-27f9-e2466d59e55b/icon175x175.jpeg',
<add> linkAppStore: 'https://itunes.apple.com/app/apple-store/id1087973225?pt=45076&ct=site-promo&mt=8',
<add> infoLink: 'http://www.vogue.com/app',
<add> infoTitle: '',
<add> defaultLink: 'https://itunes.apple.com/app/apple-store/id1087973225?pt=45076&ct=site-promo&mt=8',
<add> }
<add>];
<ide>
<ide> featured.sort(function(a, b) {
<ide> return a.name.localeCompare(b.name);
<ide> var AppList = React.createClass({
<ide> return (<div className="showcase" key={i}>{inner}</div>);
<ide> }
<ide>
<del> var className = "showcase";
<del> if (app.pinned) {
<del> // className = "showcase pinned";
<del> }
<del>
<ide> return (
<del> <div className={className} key={i}>
<add> <div className="showcase" key={i}>
<ide> {inner}
<ide> </div>
<ide> );
<ide> var AppList = React.createClass({
<ide> },
<ide>
<ide> _renderTitle: function(app) {
<del> // if (app.pinned) {
<del> // return;
<del> // }
<del>
<ide> var title = (
<ide> <h3>{app.name}</h3>
<ide> );
<ide> var AppList = React.createClass({
<ide> },
<ide>
<ide> _renderInfo: function(app) {
<del> // if (app.pinned) {
<del> // return;
<del> // }
<del>
<ide> if (!app.infoLink) {
<ide> return;
<ide> }
<ide> var AppList = React.createClass({
<ide> },
<ide>
<ide> _renderLinks: function(app) {
<del> if (app.pinned) {
<del> return;
<del> }
<del>
<ide> if (!app.linkAppStore && !app.linkPlayStore) {
<ide> return;
<ide> }
<ide><path>website/src/react-native/showcaseData.js
<del>/**
<del> * Copyright (c) 2015-present, Facebook, Inc.
<del> * All rights reserved.
<del> *
<del> * This source code is licensed under the BSD-style license found in the
<del> * LICENSE file in the root directory of this source tree. An additional grant
<del> * of patent rights can be found in the PATENTS file in the same directory.
<del>*/
<del>
<del>/*
<del>Thousands of applications use React Native, so we can't list all of them
<del>in our showcase. To be useful to someone looking through the showcase,
<del>either the app must be something that most readers would recognize, or the
<del>makers of the application must have posted useful technical content about the
<del>making of the app. It also must be useful considering that the majority of
<del>readers only speak English. So, each app in the showcase should link to either:
<del>
<del>1/ An English-language news article discussing the app, built either by a funded startup or for a public company
<del>2/ An English-language technical post on a funded startup or public company blog discussing React Native
<del>
<del>For each app in the showcase, use infoLink and infoTitle to reference this
<del>content.
<del>*/
<del>
<del>var featured = [
<del> {
<del> name: 'QQ空间',
<del> icon: 'http://pp.myapp.com/ma_icon/0/icon_9959_1460036593/96',
<del> linkPlayStore: 'http://android.myapp.com/myapp/detail.htm?apkName=com.qzone',
<del> infoLink: 'https://en.wikipedia.org/wiki/Qzone',
<del> infoTitle: 'Qzone is a Chinese social network with over 600 million users',
<del> pinned: false,
<del> },
<del> {
<del> name: 'QQ音乐',
<del> icon: 'http://pp.myapp.com/ma_icon/0/icon_6259_1462429453/96',
<del> linkPlayStore: 'http://android.myapp.com/myapp/detail.htm?apkName=com.tencent.qqmusic',
<del> infoLink: 'http://www.wsj.com/articles/tencent-customers-come-for-the-music-stay-for-the-perks-1433869369',
<del> infoTitle: 'Internet giant tries to get people to pay for digital music',
<del> pinned: false,
<del> },
<del> {
<del> name: 'FanVision Bolt',
<del> icon: 'http://a4.mzstatic.com/us/r30/Purple18/v4/94/b4/6e/94b46ee5-80e3-ff6e-513d-16da926b03a3/icon175x175.jpeg',
<del> linkAppStore: 'https://itunes.apple.com/us/app/fanvision-bolt/id1081891275',
<del> infoLink: 'https://www.youtube.com/watch?v=oWOcAXyDf0w',
<del> infoTitle: 'FanVision Bolt accessory + app provide live audio/video and stats at NASCAR events',
<del> pinned: false,
<del> },
<del> {
<del> name: 'F8',
<del> icon: 'https://raw.githubusercontent.com/fbsamples/f8app/master/ios/F8v2/Images.xcassets/AppIcon.appiconset/AppIcon%402x.png',
<del> linkAppStore: 'https://itunes.apple.com/us/app/f8/id853467066?mt=8',
<del> linkPlayStore: 'https://play.google.com/store/apps/details?id=com.facebook.f8',
<del> infoLink: 'http://makeitopen.com/tutorials/building-the-f8-app/planning/',
<del> infoTitle: 'Building the F8 App',
<del> pinned: false,
<del> },
<del> {
<del> name: 'Discovery VR',
<del> icon: 'http://a2.mzstatic.com/us/r30/Purple6/v4/d1/d5/f4/d1d5f437-9f6b-b5aa-5fe7-47bd19f934bf/icon175x175.png',
<del> linkAppStore: 'https://itunes.apple.com/us/app/discovery-vr/id1030815031?mt=8',
<del> linkPlayStore: 'https://play.google.com/store/apps/details?id=com.discovery.DiscoveryVR',
<del> infoLink: 'https://medium.com/ios-os-x-development/an-ios-developer-on-react-native-1f24786c29f0',
<del> infoTitle: '"I may never write an iOS app in Objective-C or Swift again."',
<del> pinned: false,
<del> },
<del> {
<del> name: 'Movie Trailers by MovieLaLa',
<del> icon: 'https://lh3.googleusercontent.com/16aug4m_6tvJB7QZden9w1SOMqpZgNp7rHqDhltZNvofw1a4V_ojGGXUMPGiK0dDCqzL=w300',
<del> linkAppStore: 'https://itunes.apple.com/us/app/movie-trailers-by-movielala/id1001416601?mt=8',
<del> linkPlayStore: 'https://play.google.com/store/apps/details?id=com.movielala.trailers',
<del> infoLink: 'http://variety.com/2016/digital/news/movielala-1-4-million-seed-round-hollywood-angel-investors-1201678139/',
<del> infoTitle: 'MovieLaLa Closes $1.4 Million Seed Round',
<del> pinned: false,
<del> },
<del> {
<del> name: 'Myntra',
<del> icon: 'http://a5.mzstatic.com/us/r30/Purple6/v4/9c/78/df/9c78dfa6-0061-1af2-5026-3e1d5a073c94/icon350x350.png',
<del> linkAppStore: 'https://itunes.apple.com/in/app/myntra-fashion-shopping-app/id907394059',
<del> infoLink: 'https://techcrunch.com/2014/05/22/flipkart-myntra-acqusition/',
<del> infoTitle: 'Flipkart Buys Fashion E-tailer Myntra To Fight Amazon',
<del> pinned: false,
<del> },
<del> {
<del> name: 'SoundCloud Pulse',
<del> icon: 'https://i1.sndcdn.com/artworks-000149203716-k5je96-original.jpg',
<del> linkAppStore: 'https://itunes.apple.com/us/app/soundcloud-pulse-for-creators/id1074278256?mt=8',
<del> infoLink: 'https://blog.soundcloud.com/2016/02/23/soundcloud-pulse-now-on-iphone/',
<del> infoTitle: 'SoundCloud Pulse: now on iPhone',
<del> pinned: false,
<del> },
<del> {
<del> name: 'Start - medication manager for depression',
<del> icon: 'http://a1.mzstatic.com/us/r30/Purple49/v4/de/9b/6f/de9b6fe8-84ea-7a12-ba2c-0a6d6c7b10b0/icon175x175.png',
<del> linkAppStore: 'https://itunes.apple.com/us/app/start-medication-manager-for/id1012099928?mt=8',
<del> infoLink: 'http://www.nytimes.com/2014/09/24/technology/to-gather-drug-information-a-health-start-up-turns-to-consumers.html?_r=0',
<del> infoTitle: 'NYT: A Health Startup Turns to Consumers',
<del> pinned: false,
<del> },
<del> {
<del> name: 'Taxfyle - taxes filed on-demand via licensed CPA',
<del> icon: 'https://s3.amazonaws.com/taxfyle-public/images/taxfyle-icon-1024px.png',
<del> linkAppStore: 'https://itunes.apple.com/us/app/taxfyle/id1058033104?mt=8',
<del> infoLink: 'http://www.techinsider.io/taxfyle-wants-to-be-the-uber-for-taxes-2016-4',
<del> infoTitle: 'Taxfyle: the Uber for filing taxes',
<del> pinned: false,
<del> },
<del> {
<del> name: 'This AM',
<del> icon: 'http://s3.r29static.com//bin/public/efe/x/1542038/image.png',
<del> linkAppStore: 'https://itunes.apple.com/us/app/refinery29-this-am-top-breaking/id988472315?mt=8',
<del> infoLink: 'https://techcrunch.com/2016/02/01/refinery29-debuts-its-first-app-a-morning-news-round-up-called-refinery29-am/',
<del> infoTitle: 'Refinery29 debuts its first app',
<del> pinned: false,
<del> },
<del> {
<del> name: 'TRED - Sell your car for more',
<del> icon: 'http://a1.mzstatic.com/us/r30/Purple20/v4/b0/0c/07/b00c07d2-a057-06bc-6044-9fdab97f370f/icon175x175.jpeg',
<del> linkAppStore: 'https://itunes.apple.com/us/app/tred-sell-my-car-for-more!/id1070071394?mt=8',
<del> linkPlayStore: 'https://play.google.com/store/apps/details?id=com.tredmobile&hl=en',
<del> infoLink: 'http://www.geekwire.com/2015/mobile-dealership-tred-raises-another-1m-to-help-used-car-owners-make-more-money/',
<del> infoTitle: 'Sell your car for thousands more than Craigslist or the dealer with TRED',
<del> pinned: false,
<del> },
<del> {
<del> name: 'Bitt Wallet',
<del> icon: 'http://a4.mzstatic.com/us/r30/Purple69/v4/5b/00/34/5b003497-cc85-a0d0-0d3e-4fb3bc6f95cd/icon175x175.jpeg',
<del> linkAppStore: 'https://itunes.apple.com/us/app/bitt-wallet/id1081954916?mt=8',
<del> infoLink: 'https://bitcoinmagazine.com/articles/overstock-invests-in-bitt-to-launch-official-digital-currencies-in-the-caribbean-islands-1459961581',
<del> infoTitle: 'Overstock invests in Bitt to launch digital currencies',
<del> pinned: false,
<del> },
<del> {
<del> name: 'Calor - Field Pro',
<del> icon: 'http://rnfdigital.com/wp-content/uploads/2016/04/FieldProIcon.png',
<del> infoLink: 'http://rnfdigital.com/react-native-a-game-changer-for-enterprise-mobile-development/',
<del> infoTitle: 'React Native: a game changer for Enterprise Mobile Development',
<del> pinned: false,
<del> },
<del> {
<del> name: 'CBS Sports Franchise Football',
<del> icon: 'http://a2.mzstatic.com/us/r30/Purple69/v4/7b/0c/a0/7b0ca007-885a-7cfc-9fa2-2ec4394c2ecc/icon175x175.png',
<del> linkPlayStore: 'https://play.google.com/store/apps/details?id=com.cbssports.fantasy.franchisefootball2015',
<del> infoLink: 'http://www.cbssports.com/fantasy/football/games/franchise/2015',
<del> infoTitle: 'The award winning Fantasy Football league manager.',
<del> pinned: false,
<del> },
<del> {
<del> name: 'Coiney窓口',
<del> icon: 'http://a4.mzstatic.com/us/r30/Purple69/v4/c9/bc/3a/c9bc3a29-9c11-868f-b960-ca46d5fcd509/icon175x175.jpeg',
<del> linkAppStore: 'https://itunes.apple.com/jp/app/coiney-chuang-kou/id1069271336?mt=8',
<del> infoLink: 'https://www.techinasia.com/japan-startup-coiney-aims-for-ipo',
<del> infoTitle: 'Japanese startup Coiney aims for IPO',
<del> pinned: false,
<del> },
<del> {
<del> name: 'Convoy Driver',
<del> icon: 'http://a1.mzstatic.com/us/r30/Purple30/v4/5a/74/56/5a74567d-4491-a298-65cd-722c8a7211ac/icon175x175.png',
<del> linkAppStore: 'https://itunes.apple.com/us/app/convoy-driver/id1045368390?mt=8',
<del> infoLink: 'http://www.theverge.com/2015/10/27/9620352/convoy-uber-for-trucking',
<del> infoTitle: 'Convoy, a Seattle-based "Uber for trucking"',
<del> pinned: false,
<del> },
<del> {
<del> name: 'Fixt',
<del> icon: 'http://a5.mzstatic.com/us/r30/Purple62/v4/7f/b3/66/7fb366c4-79fd-34e1-3037-ffc02d8a93f7/icon350x350.png',
<del> linkAppStore: 'https://itunes.apple.com/us/app/dropbot-phone-replacement/id1000855694?mt=8',
<del> linkPlayStore: 'https://play.google.com/store/apps/details?id=co.fixt',
<del> infoLink: 'http://www.phonearena.com/news/Fixt-is-an-app-that-promises-a-hassle-free-smartphone-repairy-service_id81069',
<del> infoTitle: 'A hassle-free smartphone repair service',
<del> pinned: false,
<del> },
<del> {
<del> name: 'Leanpub',
<del> icon: 'http://a2.mzstatic.com/us/r30/Purple6/v4/9f/4a/6f/9f4a6f8c-8951-ed89-4083-74ace23df9ef/icon350x350.jpeg',
<del> linkAppStore: 'https://itunes.apple.com/us/app/leanpub/id913517110?ls=1&mt=8',
<del> infoLink: 'http://techland.time.com/2011/06/23/how-to-turn-your-blog-into-an-instant-e-book/',
<del> infoTitle: 'Leanpub: How to Turn Your Blog into an Instant E-Book',
<del> pinned: false,
<del> },
<del> {
<del> name: 'Lugg – Your On-Demand Mover',
<del> icon: 'https://lh3.googleusercontent.com/EV9z7kRRME2KPMBRNHnje7bBNEl_Why2CFq-MfKzBC88uSFJTYr1HO3-nPt-JuVJwKFb=w300',
<del> linkPlayStore: 'https://play.google.com/store/apps/details?id=com.lugg',
<del> infoLink: 'https://techcrunch.com/2015/08/26/lugg-an-app-for-on-demand-short-distance-moves-raises-3-8-million/',
<del> infoTitle: 'Lugg, An App for Short-Distance Moves, Raises $3.8 Million',
<del> pinned: false,
<del> },
<del> {
<del> name: 'Pimmr',
<del> icon: 'http://a2.mzstatic.com/eu/r30/Purple69/v4/99/da/0e/99da0ee6-bc87-e1a6-1d95-7027c78f50e1/icon175x175.jpeg',
<del> linkAppStore: 'https://itunes.apple.com/nl/app/pimmr/id1023343303?mt=8',
<del> infoLink: 'https://www.crunchbase.com/organization/pimmr#/entity',
<del> infoTitle: 'Pimmr helps you find the needle in the haystack',
<del> pinned: false,
<del> },
<del> {
<del> name: 'Project September',
<del> icon: 'http://a4.mzstatic.com/us/r30/Purple30/v4/95/51/b7/9551b72a-d80a-5b1c-5c6d-7fc77d745d31/icon175x175.png',
<del> linkAppStore: 'https://itunes.apple.com/us/app/project-september/id1074075331?ls=1&mt=8&_branch_match_id=273849075056044546',
<del> infoLink: 'http://fortune.com/2016/04/14/project-september-alexis-maybank/',
<del> infoTitle: 'Former Gilt CEO Launches New Mobile App',
<del> pinned: false,
<del> },
<del> {
<del> name: 'Samanage',
<del> icon: 'http://a3.mzstatic.com/us/r30/Purple69/v4/ed/e9/ff/ede9ff34-a9f6-5eb6-2a23-fcb014b326f2/icon175x175.jpeg',
<del> linkAppStore: 'https://itunes.apple.com/us/app/samanage/id1033018362',
<del> infoLink: 'https://techcrunch.com/2015/05/20/samanage-raises-16m-as-asset-management-business-grows/',
<del> infoTitle: 'Samanage raises $16M as Asset Management Expands',
<del> pinned: false,
<del> },
<del> {
<del> name: 'ShareWis',
<del> icon: 'https://s3-ap-northeast-1.amazonaws.com/sw-misc/sharewis3_app.png',
<del> linkAppStore: 'https://itunes.apple.com/jp/app/id585517208',
<del> infoLink: 'https://www.crunchbase.com/organization/sharewis#/entity',
<del> infoTitle: 'The concept is to turn learning into an adventure',
<del> pinned: false,
<del> },
<del> {
<del> name: 'sneat',
<del> icon: 'http://a3.mzstatic.com/eu/r30/Purple49/v4/71/71/df/7171df47-6e03-8619-19a8-07f52186b0ed/icon175x175.jpeg',
<del> linkAppStore: 'https://itunes.apple.com/fr/app/sneat-reservez-les-meilleurs/id1062510079?l=en&mt=8',
<del> infoLink: 'http://www.internetsansfrontieres.com/sneat-application-mobile-reserver-restaurant/',
<del> infoTitle: 'Application mobile pour réserver un restaurant',
<del> pinned: false,
<del> },
<del> {
<del> name: 'Ticketea',
<del> icon: 'http://f.cl.ly/items/0n3g3x2t0W0a0d0b1F0C/tkt-icon.png',
<del> linkAppStore: 'https://itunes.apple.com/es/app/entradas-teatro-y-conciertos/id1060067658?mt=8',
<del> linkPlayStore: 'https://play.google.com/store/apps/details?id=com.ticketea.geminis',
<del> infoLink: 'https://techcrunch.com/2013/05/27/ticket-to-ride/',
<del> infoTitle: 'Ticketea raises $4 Million to Beat Ticketmaster',
<del> pinned: false,
<del> },
<del> {
<del> name: 'uSwitch - Energy switching app',
<del> icon: 'https://lh3.googleusercontent.com/NpkGlwFWdj7VsK2ueVwlgdrrBrNJ-yN-4TkEHjjSjDUu7NpMcfyAp10p97f0zci0CSFQ=w300',
<del> linkAppStore: 'https://itunes.apple.com/gb/app/uswitch-compare-switch-save/id935325621?mt=8&ct=react',
<del> linkPlayStore: 'https://play.google.com/store/apps/details?id=com.uswitchmobileapp',
<del> infoLink: 'https://en.wikipedia.org/wiki/USwitch',
<del> infoTitle: 'uSwitch: a UK-based price comparison service',
<del> pinned: false,
<del> },
<del> {
<del> name: 'WEARVR',
<del> icon: 'http://a2.mzstatic.com/eu/r30/Purple69/v4/4f/5a/28/4f5a2876-9530-ef83-e399-c5ef5b2dab80/icon175x175.png',
<del> linkAppStore: 'https://itunes.apple.com/gb/app/wearvr/id1066288171?mt=8',
<del> linkPlayStore: 'https://play.google.com/store/apps/details?id=com.wearvr.app',
<del> infoLink: 'http://venturebeat.com/2015/04/07/virtual-reality-app-store-wear-vr-secures-1-5m-in-funding/',
<del> infoTitle: 'Wear VR secures $1.5M in funding',
<del> pinned: false,
<del> },
<del> {
<del> name: 'wego concerts',
<del> icon: 'http://a5.mzstatic.com/us/r30/Purple69/v4/03/91/2d/03912daa-fae7-6a25-5f11-e6b19290b3f4/icon175x175.png',
<del> linkAppStore: 'https://itunes.apple.com/us/app/wego-concerts-follow-friends/id869478093?mt=8',
<del> infoLink: 'http://www.nydailynews.com/life-style/wego-concerts-app-links-music-fans-article-1.2066776',
<del> infoTitle: 'Wego Concerts: Like the love child of Tinder and StubHub',
<del> pinned: false,
<del> },
<del> {
<del> name: 'Bdsdiet',
<del> icon: 'http://s3.ap-northeast-2.amazonaws.com/bdsdiet-bucket/media/store-icon.png',
<del> linkPlayStore: 'https://play.google.com/store/apps/details?id=com.bdsdiet_app',
<del> infoLink: 'https://www.crunchbase.com/organization/bds-diet#/entity',
<del> infoTitle: 'Bdsdiet provides real estate brokerage services through web and live agents in Korea.',
<del> pinned: false,
<del> },
<del> {
<del> name: '蜂鸟众包',
<del> icon: 'http://img.wdjimg.com/mms/icon/v1/e/6e/687b129606504cd52632a8cc4ca816ee_256_256.png',
<del> linkPlayStore: 'http://www.wandoujia.com/apps/me.ele.crowdsource',
<del> linkAppStore: 'https://itunes.apple.com/cn/app/feng-niao-zhong-bao-jian-zhi/id1061034377?mt=8',
<del> infoLink: 'https://elelogistics.github.io/about/Crowdsource-App-Write-In-React-Native.html',
<del> infoTitle: '"Fengniao Crowdsource app" is a mobile app, developed by Eleme, Inc, for Fengniao Crowdsource, the largest crowdsourced logistics platform in China.',
<del> pinned: false,
<del> },
<del> {
<del> name: '昨日热推',
<del> icon: 'https://frontbin.com/images/apple-touch-icon.png',
<del> linkAppStore: 'https://itunes.apple.com/cn/app/zuo-ri-re-tui/id1137163693?l=en&mt=8',
<del> infoLink: 'https://www.zfanw.com/blog/developing-react-native-image-viewer-library.html',
<del> infoTitle: 'Developing the react-native-image-viewer library',
<del> pinned: false,
<del> },
<del> {
<del> name: 'Artsy – Collect and Bid on Fine Art & Design',
<del> icon: 'https://raw.githubusercontent.com/artsy/eigen/master/Artsy/Resources/Images.xcassets/AppIcon.appiconset/AppIcon167.png',
<del> linkAppStore: 'https://itunes.apple.com/us/app/artsy-collect-bid-on-fine/id703796080?mt=8',
<del> infoLink: 'https://artsy.github.io/series/react-native-at-artsy/',
<del> infoTitle: 'React Native at Artsy',
<del> pinned: false,
<del> },
<del> {
<del> name: 'Huiseoul(惠首尔)',
<del> icon: 'https://cdn.huiseoul.com/icon.png',
<del> linkAppStore: 'https://itunes.apple.com/us/app/hui-shou-er-ni-si-ren-mei/id1127150360?ls=1&mt=8',
<del> infoLink: 'https://engineering.huiseoul.com/building-a-conversational-e-commerce-app-in-6-weeks-with-react-native-c35d46637e07',
<del> infoTitle: 'Building a conversational E-commerce app in 6 weeks with React Native',
<del> pinned: false,
<del> },
<del> {
<del> name: 'PlaceAVote',
<del> icon: 'https://s12.postimg.org/nr79mplq5/pav_Icon.png',
<del> linkAppStore: 'https://itunes.apple.com/us/app/placeavote/id1120628991?ls=1&mt=8',
<del> linkPlayStore: 'https://play.google.com/store/apps/details?id=com.placeavote.androidapp&hl=en',
<del> infoLink: 'https://techcrunch.com/2016/05/10/placeavote-wants-to-give-voters-a-say-in-congress/',
<del> infoTitle: 'PlaceAVote wants to give voters a say in Congress',
<del> pinned: false,
<del> },
<del> {
<del> name: 'Robin Rooms',
<del> icon: 'http://robinpowered.s3.amazonaws.com/rooms/appicon.png',
<del> linkAppStore: 'https://itunes.apple.com/us/app/robin-rooms/id947566115',
<del> linkPlayStore: 'https://play.google.com/store/apps/details?id=com.robinpowered.rooms',
<del> infoLink: 'https://techcrunch.com/2016/05/31/robin-makes-the-office-smarter-with-7-million-in-new-funding/',
<del> infoTitle: 'Robin Rooms manages and mounts outside your conference rooms'
<del> },
<del> {
<del> name: 'Sleeperbot',
<del> icon: 'https://blitzchat.net/uploads/c8425332190a4f4b852d7770ad32e602/original.png',
<del> linkAppStore: 'https://itunes.apple.com/us/app/sleeperbot-fantasy-football/id987367543?mt=8',
<del> linkPlayStore: 'https://play.google.com/store/apps/details?id=com.sleeperbot&hl=en',
<del> infoLink: 'https://medium.com/sleeperbot-hq/switching-to-react-native-in-production-on-ios-and-android-e6b675402712#.cug6h6qhn',
<del> infoTitle: 'Switching to React Native in Production on iOS and Android',
<del> }
<del>];
<del>
<del>/*
<del>If you want your app to be featured in the showcase, add them to the featured
<del>hash above this line. The pinned list is reserved for a small list of hand-picked apps.
<del>*/
<del>var pinned = [
<del> {
<del> name: 'Facebook',
<del> icon: 'https://lh3.googleusercontent.com/ZZPdzvlpK9r_Df9C3M7j1rNRi7hhHRvPhlklJ3lfi5jk86Jd1s0Y5wcQ1QgbVaAP5Q=w300',
<del> linkAppStore: 'https://itunes.apple.com/app/facebook/id284882215',
<del> linkPlayStore: 'https://play.google.com/store/apps/details?id=com.facebook.katana&hl=en',
<del> infoLink: 'https://code.facebook.com/posts/895897210527114/dive-into-react-native-performance/',
<del> infoTitle: 'Using React Native in the Facebook App',
<del> defaultLink: 'https://itunes.apple.com/app/facebook/id284882215',
<del> pinned: true,
<del> },
<del> {
<del> name: 'Facebook Ads Manager',
<del> icon: 'http://is5.mzstatic.com/image/pf/us/r30/Purple5/v4/9e/16/86/9e1686ef-cc55-805a-c977-538ddb5e6832/mzl.gqbhwitj.png',
<del> linkAppStore: 'https://itunes.apple.com/us/app/facebook-ads-manager/id964397083?mt=8',
<del> linkPlayStore: 'https://play.google.com/store/apps/details?id=com.facebook.adsmanager',
<del> infoLink: 'https://code.facebook.com/posts/1189117404435352/react-native-for-android-how-we-built-the-first-cross-platform-react-native-app/',
<del> infoTitle: 'How We Built the First Cross-Platform React Native App',
<del> defaultLink: 'https://itunes.apple.com/us/app/facebook-ads-manager/id964397083?mt=8',
<del> pinned: true,
<del> },
<del> {
<del> name: 'Facebook Groups',
<del> icon: 'http://is4.mzstatic.com/image/pf/us/r30/Purple69/v4/57/f8/4c/57f84c0c-793d-5f9a-95ee-c212d0369e37/mzl.ugjwfhzx.png',
<del> linkAppStore: 'https://itunes.apple.com/us/app/facebook-groups/id931735837?mt=8',
<del> infoLink: 'https://code.facebook.com/posts/1014532261909640/react-native-bringing-modern-web-techniques-to-mobile/',
<del> infoTitle: 'React Native: Bringing Modern Web Techniques to Mobile',
<del> defaultLink: 'https://itunes.apple.com/us/app/facebook-groups/id931735837?mt=8',
<del> pinned: true,
<del> },
<del> {
<del> name: 'Instagram',
<del> icon: 'http://a4.mzstatic.com/us/r30/Purple62/v4/1f/8d/f9/1f8df910-8ec7-3b8e-0104-d44e869f4d65/icon175x175.jpeg',
<del> linkAppStore: 'https://itunes.apple.com/app/instagram/id389801252?pt=428156&ct=igweb.unifiedHome.badge&mt=8',
<del> linkPlayStore: 'https://play.google.com/store/apps/details?id=com.instagram.android&referrer=utm_source%3Dinstagramweb%26utm_campaign%3DunifiedHome%26utm_medium%3Dbadge',
<del> infoLink: '',
<del> infoTitle: '',
<del> defaultLink: 'https://www.instagram.com/',
<del> pinned: true,
<del> },
<del> {
<del> name: 'Airbnb',
<del> icon: 'https://a2.muscache.com/airbnb/static/icons/apple-touch-icon-180x180-bcbe0e3960cd084eb8eaf1353cf3c730.png',
<del> linkAppStore: 'https://itunes.apple.com/us/app/airbnb/id401626263?mt=8&bev=1472279725_4ITWKWGX6KrmU6pT&utm_medium=web&utm_source=airbnb&_branch_match_id=307510898795870823',
<del> linkPlayStore: 'https://play.google.com/store/apps/details?id=com.airbnb.android&hl=en&referrer=bev%3D1472279725_4ITWKWGX6KrmU6pT%26utm_medium%3Dweb%26utm_source%3Dairbnb',
<del> infoLink: 'https://www.youtube.com/watch?v=tUfgQtmG3R0',
<del> infoTitle: 'Tech Talk: Hybrid React Native Apps at Airbnb',
<del> defaultLink: 'https://www.airbnb.com/mobile',
<del> pinned: true,
<del> },
<del> {
<del> name: 'Airbnb',
<del> icon: 'https://a2.muscache.com/airbnb/static/icons/apple-touch-icon-180x180-bcbe0e3960cd084eb8eaf1353cf3c730.png',
<del> linkAppStore: 'https://itunes.apple.com/us/app/airbnb/id401626263?mt=8&bev=1472279725_4ITWKWGX6KrmU6pT&utm_medium=web&utm_source=airbnb&_branch_match_id=307510898795870823',
<del> linkPlayStore: 'https://play.google.com/store/apps/details?id=com.airbnb.android&hl=en&referrer=bev%3D1472279725_4ITWKWGX6KrmU6pT%26utm_medium%3Dweb%26utm_source%3Dairbnb',
<del> infoLink: 'https://www.youtube.com/watch?v=tUfgQtmG3R0',
<del> infoTitle: 'Tech Talk: Hybrid React Native Apps at Airbnb',
<del> defaultLink: 'https://www.airbnb.com/mobile',
<del> pinned: true,
<del> },
<del> {
<del> name: 'Baidu(手机百度)',
<del> icon: 'http://a3.mzstatic.com/us/r30/Purple62/v4/90/7c/9b/907c9b4e-556d-1a45-45d4-0ea801719abd/icon175x175.png',
<del> linkPlayStore: 'http://shouji.baidu.com/software/9896302.html',
<del> linkAppStore: 'https://itunes.apple.com/en/app/shou-ji-bai-du-hai-liang-xin/id382201985?l=en&mt=8',
<del> infoLink: 'http://baike.baidu.com/link?url=TW8YhcVN4tO_Jz5VqMclCjGhf12EEqMD_TeVC6efe2REZlx80r6T0dX96hdmNl36XogLyExXzrvFU9rFeqxg_K',
<del> infoTitle: 'Baidu is a search engine that has 600 million users.',
<del> defaultLink: 'http://baike.baidu.com/link?url=TW8YhcVN4tO_Jz5VqMclCjGhf12EEqMD_TeVC6efe2REZlx80r6T0dX96hdmNl36XogLyExXzrvFU9rFeqxg_K',
<del> pinned: true,
<del> },
<del> {
<del> name: 'Discord',
<del> icon: 'http://a5.mzstatic.com/us/r30/Purple5/v4/c1/2f/4c/c12f4cba-1d9a-f6bf-2240-04085d3470ec/icon175x175.jpeg',
<del> linkAppStore: 'https://itunes.apple.com/us/app/discord-chat-for-gamers/id985746746?mt=8',
<del> infoLink: 'https://discord.engineering/react-native-deep-dive-91fd5e949933#.5jnqftgof',
<del> infoTitle: 'Using React Native: One Year Later',
<del> defaultLink: 'https://itunes.apple.com/us/app/discord-chat-for-gamers/id985746746?mt=8',
<del> pinned: true,
<del> },
<del> {
<del> name: 'Gyroscope',
<del> icon: 'https://media.gyrosco.pe/images/magneto/180x180.png',
<del> linkAppStore: 'https://itunes.apple.com/app/apple-store/id1104085053?pt=117927205&ct=website&mt=8',
<del> infoLink: 'https://blog.gyrosco.pe/building-the-app-1dac1a97d253',
<del> infoTitle: '"Building a visualization experience with React Native."',
<del> defaultLink: 'https://itunes.apple.com/app/apple-store/id1104085053?pt=117927205&ct=website&mt=8',
<del> pinned: true,
<del> },
<del> {
<del> name: 'li.st',
<del> icon: 'https://lh3.googleusercontent.com/tXt0HgJ7dCgOnuQ-lQr1P7E57mnOYfwXhRsV9lGcPwHPVvrDAN6YmpLVFgy88qKrkFI=w300',
<del> linkPlayStore: 'https://play.google.com/store/apps/details?id=st.li.listapp',
<del> infoLink: 'https://www.youtube.com/watch?v=cI9bDvDEsYE',
<del> infoTitle: 'Building li.st for Android with React Native',
<del> defaultLink: 'https://play.google.com/store/apps/details?id=st.li.listapp',
<del> pinned: true,
<del> },
<del> {
<del> name: 'QQ',
<del> icon: 'http://pp.myapp.com/ma_icon/0/icon_6633_1461768893/96',
<del> linkPlayStore: 'http://android.myapp.com/myapp/detail.htm?apkName=com.tencent.mobileqq',
<del> infoLink: 'https://en.wikipedia.org/wiki/Tencent_QQ',
<del> infoTitle: 'QQ is a Chinese messaging service with 829 million active accounts',
<del> defaultLink: 'http://android.myapp.com/myapp/detail.htm?apkName=com.tencent.mobileqq',
<del> pinned: true,
<del> },
<del> {
<del> name: 'Townske',
<del> icon: 'http://a3.mzstatic.com/us/r30/Purple69/v4/8b/42/20/8b4220af-5165-91fd-0f05-014332df73ef/icon175x175.png',
<del> linkAppStore: 'https://itunes.apple.com/us/app/townske-stunning-city-guides/id1018136179?ls=1&mt=8',
<del> infoLink: 'https://hackernoon.com/townske-app-in-react-native-6ad557de7a7c',
<del> infoTitle: '"I would recommend React Native in a heartbeat."',
<del> defaultLink: 'https://itunes.apple.com/us/app/townske-stunning-city-guides/id1018136179?ls=1&mt=8',
<del> pinned: true,
<del> },
<del> {
<del> name: 'Vogue',
<del> icon: 'http://a2.mzstatic.com/us/r30/Purple30/v4/06/24/92/0624927f-a389-746c-27f9-e2466d59e55b/icon175x175.jpeg',
<del> linkAppStore: 'https://itunes.apple.com/app/apple-store/id1087973225?pt=45076&ct=site-promo&mt=8',
<del> infoLink: 'http://www.vogue.com/app',
<del> infoTitle: '',
<del> defaultLink: 'https://itunes.apple.com/app/apple-store/id1087973225?pt=45076&ct=site-promo&mt=8',
<del> pinned: true,
<del> }
<del>];
<del>
<del>module.exports = { featured, pinned }; | 3 |
Javascript | Javascript | introduce imagekind constants | 42cbb5b4406edaa8a9bf810c1e14135366e588f5 | <ide><path>src/core/evaluator.js
<ide> */
<ide> /* globals assert, assertWellFormed, ColorSpace, Dict, Encodings, error,
<ide> ErrorFont, Font, FONT_IDENTITY_MATRIX, fontCharsToUnicode, FontFlags,
<del> info, isArray, isCmd, isDict, isEOF, isName, isNum,
<add> ImageKind, info, isArray, isCmd, isDict, isEOF, isName, isNum,
<ide> isStream, isString, JpegStream, Lexer, Metrics, Name, Parser,
<ide> Pattern, PDFImage, PDFJS, serifFonts, stdFontMap, symbolsFonts,
<ide> getTilingPatternIR, warn, Util, Promise, LegacyPromise,
<ide> var PartialEvaluator = (function PartialEvaluatorClosure() {
<ide> (w + h) < SMALL_IMAGE_DIMENSIONS) {
<ide> var imageObj = new PDFImage(this.xref, resources, image,
<ide> inline, null, null);
<del> // We force the use of 'rgba_32bpp' images here, because we can't
<del> // handle any other kind.
<add> // We force the use of RGBA_32BPP images here, because we can't handle
<add> // any other kind.
<ide> var imgData = imageObj.createImageData(/* forceRGBA = */ true);
<ide> operatorList.addOp(OPS.paintInlineImageXObject, [imgData]);
<ide> return;
<ide> var PartialEvaluator = (function PartialEvaluatorClosure() {
<ide> // replacing queue items
<ide> squash(fnArray, j, count * 4, OPS.paintInlineImageXObjectGroup);
<ide> argsArray.splice(j, count * 4,
<del> [{width: imgWidth, height: imgHeight, kind: 'rgba_32bpp',
<add> [{width: imgWidth, height: imgHeight, kind: ImageKind.RGBA_32BPP,
<ide> data: imgData}, map]);
<ide> i = j;
<ide> ii = argsArray.length;
<ide><path>src/core/image.js
<ide> * See the License for the specific language governing permissions and
<ide> * limitations under the License.
<ide> */
<del>/* globals ColorSpace, error, isArray, isStream, JpegStream, Name, Promise,
<del> Stream, warn, LegacyPromise */
<add>/* globals ColorSpace, error, isArray, ImageKind, isStream, JpegStream, Name,
<add> Promise, Stream, warn, LegacyPromise */
<ide>
<ide> 'use strict';
<ide>
<ide> var PDFImage = (function PDFImageClosure() {
<ide> // complications, we avoid expanding by 1.333x to RGBA form.
<ide> var kind;
<ide> if (this.colorSpace.name === 'DeviceGray' && bpc === 1) {
<del> kind = 'grayscale_1bpp';
<add> kind = ImageKind.GRAYSCALE_1BPP;
<ide> } else if (this.colorSpace.name === 'DeviceRGB' && bpc === 8) {
<del> kind = 'rgb_24bpp';
<add> kind = ImageKind.RGB_24BPP;
<ide> }
<ide> if (kind && !this.smask && !this.mask && !this.needsDecode &&
<ide> drawWidth === originalWidth && drawHeight === originalHeight) {
<ide> var PDFImage = (function PDFImageClosure() {
<ide>
<ide> this.undoPreblend(rgbaBuf, drawWidth, actualHeight);
<ide>
<del> imgData.kind = 'rgba_32bpp';
<add> imgData.kind = ImageKind.RGBA_32BPP;
<ide> imgData.data = rgbaBuf;
<ide> return imgData;
<ide> },
<ide><path>src/display/canvas.js
<ide> * limitations under the License.
<ide> */
<ide> /* globals ColorSpace, DeviceCmykCS, DeviceGrayCS, DeviceRgbCS, error,
<del> FONT_IDENTITY_MATRIX, IDENTITY_MATRIX, ImageData, isArray, isNum,
<del> TilingPattern, OPS, Promise, Util, warn, assert, info, shadow,
<del> TextRenderingMode, getShadingPatternFromIR */
<add> FONT_IDENTITY_MATRIX, IDENTITY_MATRIX, ImageData, ImageKind,
<add> isArray, isNum, TilingPattern, OPS, Promise, Util, warn, assert,
<add> info, shadow, TextRenderingMode, getShadingPatternFromIR */
<ide>
<ide> 'use strict';
<ide>
<ide> var CanvasGraphics = (function CanvasGraphicsClosure() {
<ide> // There are multiple forms in which the pixel data can be passed, and
<ide> // imgData.kind tells us which one this is.
<ide>
<del> if (imgData.kind === 'grayscale_1bpp') {
<add> if (imgData.kind === ImageKind.GRAYSCALE_1BPP) {
<ide> // Grayscale, 1 bit per pixel (i.e. black-and-white).
<ide> var destDataLength = dest.length;
<ide> var srcLength = src.byteLength;
<ide> var CanvasGraphics = (function CanvasGraphicsClosure() {
<ide> ctx.putImageData(chunkImgData, 0, i * fullChunkHeight);
<ide> }
<ide>
<del> } else if (imgData.kind === 'rgba_32bpp') {
<add> } else if (imgData.kind === ImageKind.RGBA_32BPP) {
<ide> // RGBA, 32-bits per pixel.
<ide> var haveSetAndSubarray = 'set' in dest && 'subarray' in src;
<ide>
<ide> var CanvasGraphics = (function CanvasGraphicsClosure() {
<ide> ctx.putImageData(chunkImgData, 0, i * fullChunkHeight);
<ide> }
<ide>
<del> } else if (imgData.kind === 'rgb_24bpp') {
<add> } else if (imgData.kind === ImageKind.RGB_24BPP) {
<ide> // RGB, 24-bits per pixel.
<ide> for (var i = 0; i < totalChunks; i++) {
<ide> var thisChunkHeight =
<ide><path>src/shared/util.js
<ide> var TextRenderingMode = {
<ide> ADD_TO_PATH_FLAG: 4
<ide> };
<ide>
<add>var ImageKind = {
<add> GRAYSCALE_1BPP: 1,
<add> RGB_24BPP: 2,
<add> RGBA_32BPP: 3
<add>};
<add>
<ide> // The global PDFJS object exposes the API
<ide> // In production, it will be declared outside a global wrapper
<ide> // In development, it will be declared here | 4 |
Go | Go | enable nat port mapping | 4393be71005e63ab305f4d87481dbd23b7594d18 | <ide><path>daemon/container_windows.go
<ide> func (container *Container) setupWorkingDirectory() error {
<ide>
<ide> func populateCommand(c *Container, env []string) error {
<ide> en := &execdriver.Network{
<del> Mtu: c.daemon.config.Mtu,
<ide> Interface: nil,
<ide> }
<ide>
<ide> parts := strings.SplitN(string(c.hostConfig.NetworkMode), ":", 2)
<ide> switch parts[0] {
<del>
<ide> case "none":
<ide> case "default", "": // empty string to support existing containers
<ide> if !c.Config.NetworkDisabled {
<ide> en.Interface = &execdriver.NetworkInterface{
<del> MacAddress: c.Config.MacAddress,
<del> Bridge: c.daemon.config.Bridge.VirtualSwitchName,
<add> MacAddress: c.Config.MacAddress,
<add> Bridge: c.daemon.config.Bridge.VirtualSwitchName,
<add> PortBindings: c.hostConfig.PortBindings,
<add>
<add> // TODO Windows. Include IPAddress. There already is a
<add> // property IPAddress on execDrive.CommonNetworkInterface,
<add> // but there is no CLI option in docker to pass through
<add> // an IPAddress on docker run.
<ide> }
<ide> }
<ide> default:
<ide><path>daemon/execdriver/driver.go
<ide> type Driver interface {
<ide> Stats(id string) (*ResourceStats, error)
<ide> }
<ide>
<del>// Network settings of the container
<del>type Network struct {
<del> Interface *NetworkInterface `json:"interface"` // if interface is nil then networking is disabled
<del> Mtu int `json:"mtu"`
<del> ContainerID string `json:"container_id"` // id of the container to join network.
<del> NamespacePath string `json:"namespace_path"`
<del> HostNetworking bool `json:"host_networking"`
<del>}
<del>
<ide> // Ipc settings of the container
<ide> // It is for IPC namespace setting. Usually different containers
<ide> // have their own IPC namespace, however this specifies to use
<ide> type UTS struct {
<ide> HostUTS bool `json:"host_uts"`
<ide> }
<ide>
<del>// NetworkInterface contains all network configs for a driver
<del>type NetworkInterface struct {
<del> Gateway string `json:"gateway"`
<del> IPAddress string `json:"ip"`
<del> IPPrefixLen int `json:"ip_prefix_len"`
<del> MacAddress string `json:"mac"`
<del> Bridge string `json:"bridge"`
<del> GlobalIPv6Address string `json:"global_ipv6"`
<del> LinkLocalIPv6Address string `json:"link_local_ipv6"`
<del> GlobalIPv6PrefixLen int `json:"global_ipv6_prefix_len"`
<del> IPv6Gateway string `json:"ipv6_gateway"`
<del> HairpinMode bool `json:"hairpin_mode"`
<del>}
<del>
<ide> // Resources contains all resource configs for a driver.
<ide> // Currently these are all for cgroup configs.
<ide> // TODO Windows: Factor out ulimit.Rlimit
<add><path>daemon/execdriver/driver_unix.go
<del><path>daemon/execdriver/driver_linux.go
<add>// +build !windows
<add>
<ide> package execdriver
<ide>
<ide> import (
<ide> import (
<ide> "github.com/opencontainers/runc/libcontainer/configs"
<ide> )
<ide>
<add>// Network settings of the container
<add>type Network struct {
<add> Mtu int `json:"mtu"`
<add> ContainerID string `json:"container_id"` // id of the container to join network.
<add> NamespacePath string `json:"namespace_path"`
<add> HostNetworking bool `json:"host_networking"`
<add>}
<add>
<ide> // InitContainer is the initialization of a container config.
<ide> // It returns the initial configs for a container. It's mostly
<ide> // defined by the default template.
<ide><path>daemon/execdriver/driver_windows.go
<add>package execdriver
<add>
<add>import "github.com/docker/docker/pkg/nat"
<add>
<add>// Network settings of the container
<add>type Network struct {
<add> Interface *NetworkInterface `json:"interface"`
<add> ContainerID string `json:"container_id"` // id of the container to join network.
<add>}
<add>
<add>// NetworkInterface contains network configs for a driver
<add>type NetworkInterface struct {
<add> MacAddress string `json:"mac"`
<add> Bridge string `json:"bridge"`
<add> IPAddress string `json:"ip"`
<add>
<add> // PortBindings is the port mapping between the exposed port in the
<add> // container and the port on the host.
<add> PortBindings nat.PortMap `json:"port_bindings"`
<add>}
<ide><path>daemon/execdriver/lxc/lxc_template.go
<ide> lxc.{{$value}}
<ide> {{end}}
<ide> {{end}}
<ide>
<del>{{if .Network.Interface}}
<del>{{if .Network.Interface.IPAddress}}
<del>lxc.network.ipv4 = {{.Network.Interface.IPAddress}}/{{.Network.Interface.IPPrefixLen}}
<del>{{end}}
<del>{{if .Network.Interface.Gateway}}
<del>lxc.network.ipv4.gateway = {{.Network.Interface.Gateway}}
<del>{{end}}
<del>{{if .Network.Interface.MacAddress}}
<del>lxc.network.hwaddr = {{.Network.Interface.MacAddress}}
<del>{{end}}
<del>{{end}}
<ide> {{if .ProcessConfig.Env}}
<ide> lxc.utsname = {{getHostname .ProcessConfig.Env}}
<ide> {{end}}
<ide><path>daemon/execdriver/lxc/lxc_template_unit_test.go
<ide> func TestLXCConfig(t *testing.T) {
<ide> CPUShares: int64(cpu),
<ide> },
<ide> Network: &execdriver.Network{
<del> Mtu: 1500,
<del> Interface: nil,
<add> Mtu: 1500,
<ide> },
<ide> AllowedDevices: make([]*configs.Device, 0),
<ide> ProcessConfig: execdriver.ProcessConfig{},
<ide> func TestCustomLxcConfig(t *testing.T) {
<ide> "lxc.cgroup.cpuset.cpus = 0,1",
<ide> },
<ide> Network: &execdriver.Network{
<del> Mtu: 1500,
<del> Interface: nil,
<add> Mtu: 1500,
<ide> },
<ide> ProcessConfig: processConfig,
<ide> }
<ide> func TestCustomLxcConfigMounts(t *testing.T) {
<ide> "lxc.cgroup.cpuset.cpus = 0,1",
<ide> },
<ide> Network: &execdriver.Network{
<del> Mtu: 1500,
<del> Interface: nil,
<add> Mtu: 1500,
<ide> },
<ide> Mounts: mounts,
<ide> ProcessConfig: processConfig,
<ide> func TestCustomLxcConfigMisc(t *testing.T) {
<ide> "lxc.cgroup.cpuset.cpus = 0,1",
<ide> },
<ide> Network: &execdriver.Network{
<del> Mtu: 1500,
<del> Interface: nil,
<add> Mtu: 1500,
<ide> },
<ide> ProcessConfig: processConfig,
<ide> CapAdd: []string{"net_admin", "syslog"},
<ide> func TestCustomLxcConfigMiscOverride(t *testing.T) {
<ide> "lxc.network.ipv4 = 172.0.0.1",
<ide> },
<ide> Network: &execdriver.Network{
<del> Mtu: 1500,
<del> Interface: nil,
<add> Mtu: 1500,
<ide> },
<ide> ProcessConfig: processConfig,
<ide> CapAdd: []string{"NET_ADMIN", "SYSLOG"},
<ide><path>daemon/execdriver/windows/run.go
<ide> import (
<ide> "encoding/json"
<ide> "errors"
<ide> "fmt"
<add> "os"
<add> "strconv"
<ide> "strings"
<ide>
<ide> "github.com/Sirupsen/logrus"
<ide> import (
<ide> "github.com/natefinch/npipe"
<ide> )
<ide>
<add>// defaultContainerNAT is the default name of the container NAT device that is
<add>// preconfigured on the server.
<add>const defaultContainerNAT = "ContainerNAT"
<add>
<ide> type layer struct {
<ide> ID string
<ide> Path string
<ide> type defConfig struct {
<ide> DefFile string
<ide> }
<ide>
<add>type portBinding struct {
<add> Protocol string
<add> InternalPort int
<add> ExternalPort int
<add>}
<add>
<add>type natSettings struct {
<add> Name string
<add> PortBindings []portBinding
<add>}
<add>
<ide> type networkConnection struct {
<ide> NetworkName string
<del> EnableNat bool
<add> // TODO Windows: Add Ip4Address string to this structure when hooked up in
<add> // docker CLI. This is present in the HCS JSON handler.
<add> EnableNat bool
<add> Nat natSettings
<ide> }
<ide> type networkSettings struct {
<ide> MacAddress string
<ide> func (d *Driver) Run(c *execdriver.Command, pipes *execdriver.Pipes, startCallba
<ide> })
<ide> }
<ide>
<add> // TODO Windows. At some point, when there is CLI on docker run to
<add> // enable the IP Address of the container to be passed into docker run,
<add> // the IP Address needs to be wired through to HCS in the JSON. It
<add> // would be present in c.Network.Interface.IPAddress. See matching
<add> // TODO in daemon\container_windows.go, function populateCommand.
<add>
<ide> if c.Network.Interface != nil {
<add>
<add> var pbs []portBinding
<add>
<add> // Enumerate through the port bindings specified by the user and convert
<add> // them into the internal structure matching the JSON blob that can be
<add> // understood by the HCS.
<add> for i, v := range c.Network.Interface.PortBindings {
<add> proto := strings.ToUpper(i.Proto())
<add> if proto != "TCP" && proto != "UDP" {
<add> return execdriver.ExitStatus{ExitCode: -1}, fmt.Errorf("invalid protocol %s", i.Proto())
<add> }
<add>
<add> if len(v) > 1 {
<add> return execdriver.ExitStatus{ExitCode: -1}, fmt.Errorf("Windows does not support more than one host port in NAT settings")
<add> }
<add>
<add> for _, v2 := range v {
<add> var (
<add> iPort, ePort int
<add> err error
<add> )
<add> if len(v2.HostIP) != 0 {
<add> return execdriver.ExitStatus{ExitCode: -1}, fmt.Errorf("Windows does not support host IP addresses in NAT settings")
<add> }
<add> if ePort, err = strconv.Atoi(v2.HostPort); err != nil {
<add> return execdriver.ExitStatus{ExitCode: -1}, fmt.Errorf("invalid container port %s: %s", v2.HostPort, err)
<add> }
<add> if iPort, err = strconv.Atoi(i.Port()); err != nil {
<add> return execdriver.ExitStatus{ExitCode: -1}, fmt.Errorf("invalid internal port %s: %s", i.Port(), err)
<add> }
<add> if iPort < 0 || iPort > 65535 || ePort < 0 || ePort > 65535 {
<add> return execdriver.ExitStatus{ExitCode: -1}, fmt.Errorf("specified NAT port is not in allowed range")
<add> }
<add> pbs = append(pbs,
<add> portBinding{ExternalPort: ePort,
<add> InternalPort: iPort,
<add> Protocol: proto})
<add> }
<add> }
<add>
<add> // TODO Windows: TP3 workaround. Allow the user to override the name of
<add> // the Container NAT device through an environment variable. This will
<add> // ultimately be a global daemon parameter on Windows, similar to -b
<add> // for the name of the virtual switch (aka bridge).
<add> cn := os.Getenv("DOCKER_CONTAINER_NAT")
<add> if len(cn) == 0 {
<add> cn = defaultContainerNAT
<add> }
<add>
<ide> dev := device{
<ide> DeviceType: "Network",
<ide> Connection: &networkConnection{
<ide> NetworkName: c.Network.Interface.Bridge,
<del> EnableNat: false,
<add> // TODO Windows: Fixme, next line. Needs HCS fix.
<add> EnableNat: false,
<add> Nat: natSettings{
<add> Name: cn,
<add> PortBindings: pbs,
<add> },
<ide> },
<ide> }
<ide>
<ide> func (d *Driver) Run(c *execdriver.Command, pipes *execdriver.Pipes, startCallba
<ide> MacAddress: windowsStyleMAC,
<ide> }
<ide> }
<del>
<del> logrus.Debugf("Virtual switch '%s', mac='%s'", c.Network.Interface.Bridge, c.Network.Interface.MacAddress)
<del>
<ide> cu.Devices = append(cu.Devices, dev)
<ide> } else {
<ide> logrus.Debugln("No network interface")
<ide><path>daemon/network/settings.go
<ide> type Address struct {
<ide> }
<ide>
<ide> // Settings stores configuration details about the daemon network config
<add>// TODO Windows. Many of these fields can be factored out.,
<ide> type Settings struct {
<ide> Bridge string
<ide> EndpointID string | 8 |
Python | Python | mock the bigquery client in the unit test. | a1adc50bc44ed2a0055481a1639f76a26f46f310 | <ide><path>official/utils/logs/logger_test.py
<ide> def test_config_benchmark_file_logger(self):
<ide> logger.BenchmarkFileLogger)
<ide>
<ide> @unittest.skipIf(bigquery is None, 'Bigquery dependency is not installed.')
<del> def test_config_benchmark_bigquery_logger(self):
<add> @mock.patch.object(bigquery, "Client")
<add> def test_config_benchmark_bigquery_logger(self, mock_bigquery_client):
<ide> with flagsaver.flagsaver(benchmark_logger_type='BenchmarkBigQueryLogger'):
<ide> logger.config_benchmark_logger()
<ide> self.assertIsInstance(logger.get_benchmark_logger(), | 1 |
Text | Text | release notes for 1.2.13 | c086f831fbcb4e658993c2d7136d52eed04e486c | <ide><path>CHANGELOG.md
<add><a name="1.2.13"></a>
<add># 1.2.13 romantic-transclusion (2014-02-14)
<add>
<add>
<add>## Bug Fixes
<add>
<add>- **$animate:** ensure $animate doesn't break natural CSS transitions
<add> ([4f84f6b3](https://github.com/angular/angular.js/commit/4f84f6b3e4210ae1eb14728a46d43dd961700a0c),
<add> [#6019](https://github.com/angular/angular.js/issues/6019))
<add>- **$compile:**
<add> - ensure element transclusion directives are linked with comment element
<add> ([e7338d3f](https://github.com/angular/angular.js/commit/e7338d3f27e8824196136a18e1c3e0fcf51a0e28),
<add> [#6006](https://github.com/angular/angular.js/issues/6006), [#6101](https://github.com/angular/angular.js/issues/6101))
<add> - support templates with table content root nodes
<add> ([e7338d3f](https://github.com/angular/angular.js/commit/31c450bcee53d0a3827b7e0a611e9013b2496506),
<add> [#2848](https://github.com/angular/angular.js/issues/2848), [#1459](https://github.com/angular/angular.js/issues/1459), [#3647](https://github.com/angular/angular.js/issues/3647), [#3241](https://github.com/angular/angular.js/issues/3241))
<add>- **input:**
<add> - don't apply textInput to `<input type="file">`
<add> ([a9fcb0d0](https://github.com/angular/angular.js/commit/a9fcb0d0fc6456f80501b8820d02b04d7c15b6d6),
<add> [#6247](https://github.com/angular/angular.js/issues/6247), [#6231](https://github.com/angular/angular.js/issues/6231))
<add> - setViewValue on compositionend
<add> ([2b730271](https://github.com/angular/angular.js/commit/2b7302713674506fdbcdc396c38f18dcb90dee8c),
<add> [#6058](https://github.com/angular/angular.js/issues/6058), [#5433](https://github.com/angular/angular.js/issues/5433))
<add>
<add>
<add>## Features
<add>
<add>- **filterFilter:** support deeply nested predicate objects
<add> ([b4eed8ad](https://github.com/angular/angular.js/commit/b4eed8ad94ce9719540462c1ee969dfd3c6b2355),
<add> [#6215](https://github.com/angular/angular.js/issues/6215))
<add>
<add>
<add>## Breaking Changes
<add>
<add>- **$animate:**
<add> - due to [4f84f6b3](https://github.com/angular/angular.js/commit/4f84f6b3e4210ae1eb14728a46d43dd961700a0c),
<add> ngClass and {{ class }} will now call the `setClass`
<add> animation callback instead of addClass / removeClass when both a
<add> addClass/removeClass operation is being executed on the element during the animation.
<add>
<add> Please include the setClass animation callback as well as addClass and removeClass within
<add> your JS animations to work with ngClass and {{ class }} directives.
<add>
<add>
<add> - due to [cf5e463a](https://github.com/angular/angular.js/commit/cf5e463abd2c23f62e9c2e6361e6c53048c8910e),
<add> Both the `$animate:before` and `$animate:after` DOM events must be now
<add> registered prior to the $animate operation taking place. The `$animate:close` event
<add> can be registered anytime afterwards.
<add>
<add> DOM callbacks used to fired for each and every animation operation that occurs within the
<add> $animate service provided in the ngAnimate module. This may end up slowing down an
<add> application if 100s of elements are being inserted into the page. Therefore after this
<add> change callbacks are only fired if registered on the element being animated.
<add>
<add>
<ide> <a name="1.2.12"></a>
<ide> # 1.2.12 cauliflower-eradication (2014-02-07)
<ide> | 1 |
PHP | PHP | fix error where routes would be incorrectly parsed | 31f656b6c1e6b3c908e8ac33c136f5111b4b3d4f | <ide><path>src/Routing/RouteCollection.php
<ide> public function add(Route $route, $options = []) {
<ide> */
<ide> public function parse($url) {
<ide> foreach (array_keys($this->_paths) as $path) {
<del> if (strpos($url, $path) === 0) {
<del> break;
<add> if (strpos($url, $path) !== 0) {
<add> continue;
<ide> }
<del> }
<ide>
<del> $queryParameters = null;
<del> if (strpos($url, '?') !== false) {
<del> list($url, $queryParameters) = explode('?', $url, 2);
<del> parse_str($queryParameters, $queryParameters);
<del> }
<del> foreach ($this->_paths[$path] as $route) {
<del> $r = $route->parse($url);
<del> if ($r === false) {
<del> continue;
<add> $queryParameters = null;
<add> if (strpos($url, '?') !== false) {
<add> list($url, $queryParameters) = explode('?', $url, 2);
<add> parse_str($queryParameters, $queryParameters);
<ide> }
<del> if ($queryParameters) {
<del> $r['?'] = $queryParameters;
<add> foreach ($this->_paths[$path] as $route) {
<add> $r = $route->parse($url);
<add> if ($r === false) {
<add> continue;
<add> }
<add> if ($queryParameters) {
<add> $r['?'] = $queryParameters;
<add> }
<add> return $r;
<ide> }
<del> return $r;
<ide> }
<ide> throw new MissingRouteException(['url' => $url]);
<ide> }
<ide><path>tests/TestCase/Routing/RouteCollectionTest.php
<ide> public function testParse() {
<ide> $this->assertEquals($expected, $result);
<ide> }
<ide>
<add>/**
<add> * Test that parsing checks all the related path scopes.
<add> *
<add> * @return void
<add> */
<add> public function testParseFallback() {
<add> $routes = new RouteBuilder($this->collection, '/', []);
<add>
<add> $routes->resources('Articles');
<add> $routes->connect('/:controller', ['action' => 'index'], [], ['routeClass' => 'InflectedRoute']);
<add> $routes->connect('/:controller/:action', [], ['routeClass' => 'InflectedRoute']);
<add>
<add> $result = $this->collection->parse('/articles/add');
<add> $expected = [
<add> 'controller' => 'Articles',
<add> 'action' => 'add',
<add> 'plugin' => null,
<add> 'pass' => []
<add> ];
<add> $this->assertEquals($expected, $result);
<add> }
<add>
<ide> /**
<ide> * Test match() throws an error on unknown routes.
<ide> * | 2 |
PHP | PHP | fix failing tests and phpcs errors | c68ec840201e1877226e95760ce003ff7432c723 | <ide><path>src/Database/SqlDialectTrait.php
<ide> protected function _transformDistinct($query) {
<ide> }
<ide> return $query;
<ide> }
<add>
<ide> /**
<ide> *
<ide> * Apply translation steps to delete queries.
<ide> protected function _deleteQueryTranslator($query) {
<ide> }
<ide> $conditions = $query->clause('where');
<ide> if ($conditions) {
<del> $conditions->iterateParts(function($condition, $key) {
<add> $conditions->traverse(function($condition) {
<ide> if (!($condition instanceof Comparison)) {
<ide> return $condition;
<ide> }
<ide><path>tests/TestCase/Database/QueryTest.php
<ide> public function testDeleteWithAliasedFrom() {
<ide>
<ide> $query->delete()
<ide> ->from(['a ' => 'authors'])
<del> ->where(['a.id <' => 99]);
<add> ->where(['a.id !=' => 99]);
<ide>
<ide> $result = $query->sql();
<del> $this->assertQuotedQuery('DELETE <a> FROM <authors> AS <a>', $result, true);
<add> $this->assertQuotedQuery('DELETE FROM <authors> WHERE <id> != :c0', $result, true);
<ide>
<ide> $result = $query->execute();
<ide> $this->assertInstanceOf('Cake\Database\StatementInterface', $result); | 2 |
Ruby | Ruby | remove deprecation warnings | 5b9d0a6272ca74f33cd62a4ff3fd3072fe533c09 | <ide><path>actionpack/test/fixtures/project.rb
<ide> class Project < ActiveRecord::Base
<del> has_and_belongs_to_many :developers, :uniq => true
<add> has_and_belongs_to_many :developers, -> { uniq }
<ide> end
<ide><path>actionpack/test/fixtures/reply.rb
<ide> class Reply < ActiveRecord::Base
<ide> scope :base, -> { scoped }
<del> belongs_to :topic, :include => [:replies]
<add> belongs_to :topic, -> { includes(:replies) }
<ide> belongs_to :developer
<ide>
<ide> validates_presence_of :content | 2 |
Ruby | Ruby | fix misprint in urlhelper module | e925d56529406cade161b4f453f34504ae0b3d62 | <ide><path>actionpack/lib/action_view/helpers/url_helper.rb
<ide> module UrlHelper
<ide> include ActionDispatch::Routing::UrlFor
<ide> include TagHelper
<ide>
<del> # We need to override url_optoins, _routes_context
<add> # We need to override url_options, _routes_context
<ide> # and optimize_routes_generation? to consider the controller.
<ide>
<ide> def url_options #:nodoc: | 1 |
Ruby | Ruby | create templates with format=nil | c2145462178d2b28135fac38ebbceeaadfa151df | <ide><path>actionmailer/lib/action_mailer/base.rb
<ide> def collect_responses_from_templates(headers)
<ide> templates_name = headers[:template_name] || action_name
<ide>
<ide> each_template(Array(templates_path), templates_name).map do |template|
<del> self.formats = [template.format]
<add> format = template.format || self.formats.first
<add> self.formats = [format]
<ide> {
<ide> body: render(template: template),
<del> content_type: template.type.to_s
<add> content_type: Mime[format].to_s
<ide> }
<ide> end
<ide> end
<ide><path>actionview/lib/action_view/rendering.rb
<ide> def _render_template(options)
<ide> renderer.render_to_object(context, options)
<ide> end
<ide>
<del> @rendered_format = Template::Types[rendered_template.format]
<add> rendered_format = rendered_template.format || lookup_context.formats.first
<add> @rendered_format = Template::Types[rendered_format]
<ide>
<ide> rendered_template.body
<ide> end
<ide><path>actionview/lib/action_view/template/resolver.rb
<ide> def extract_handler_and_format_and_variant(path, query_format)
<ide> if handler.respond_to?(:default_format) # default_format can return nil
<ide> handler.default_format
<ide> else
<del> query_format
<add> nil
<ide> end
<ide> end
<ide>
<ide> # Template::Types[format] and handler.default_format can return nil
<del> [handler, format || query_format, variant]
<add> [handler, format, variant]
<ide> end
<ide> end
<ide>
<ide><path>actionview/test/template/lookup_context_test.rb
<ide> def teardown
<ide> assert_equal "Hello texty phone!", template.source
<ide> end
<ide>
<del> test "found templates respects given formats if one cannot be found from template or handler" do
<add> test "found templates have nil format if one cannot be found from template or handler" do
<ide> assert_called(ActionView::Template::Handlers::Builder, :default_format, returns: nil) do
<ide> @lookup_context.formats = [:text]
<ide> template = @lookup_context.find("hello", %w(test))
<del> assert_equal :text, template.format
<add> assert_nil template.format
<ide> end
<ide> end
<ide>
<ide><path>actionview/test/template/resolver_patterns_test.rb
<ide> def test_should_return_template_for_declared_path
<ide> assert_equal 1, templates.size, "expected one template"
<ide> assert_equal "Hello custom patterns!", templates.first.source
<ide> assert_equal "custom_pattern/path", templates.first.virtual_path
<del> assert_equal :html, templates.first.format
<add> assert_nil templates.first.format
<ide> end
<ide>
<ide> def test_should_return_all_templates_when_ambiguous_pattern
<ide><path>actionview/test/template/testing/fixture_resolver_test.rb
<ide> def test_should_return_template_for_declared_path
<ide> assert_equal 1, templates.size, "expected one template"
<ide> assert_equal "this text", templates.first.source
<ide> assert_equal "arbitrary/path", templates.first.virtual_path
<del> assert_equal :html, templates.first.format
<add> assert_nil templates.first.format
<ide> end
<ide> end | 6 |
Javascript | Javascript | add test for transition.remove | 51c7e58fdb12f45ee4aef8bda013d5d2d29725d8 | <ide><path>d3.js
<ide> function d3_transition(groups) {
<ide> node = this,
<ide> delay = groups[j][i].delay - elapsed,
<ide> duration = groups[j][i].duration,
<del> lock = node.__transition__ || (node.__transition__ = {active: 0});
<add> lock = node.__transition__;
<ide>
<del> lock.owner = id;
<add> if (!lock) lock = node.__transition__ = {active: 0, owner: id};
<add> else if (lock.owner < id) lock.owner = id;
<ide> delay <= 0 ? start(0) : d3.timer(start, delay);
<ide>
<ide> function start(elapsed) {
<ide><path>d3.min.js
<del>(function(){function dj(){return"circle"}function di(){return 64}function dh(a,b){var c=(a.ownerSVGElement||a).createSVGPoint();if(dg<0&&(window.scrollX||window.scrollY)){var d=d3.select(document.body).append("svg:svg").style("position","absolute").style("top",0).style("left",0),e=d[0][0].getScreenCTM();dg=!e.f&&!e.e,d.remove()}dg?(c.x=b.pageX,c.y=b.pageY):(c.x=b.clientX,c.y=b.clientY),c=c.matrixTransform(a.getScreenCTM().inverse());return[c.x,c.y]}function df(a){return function(){var b=a.apply(this,arguments),c=b[0],d=b[1]+cr;return[c*Math.cos(d),c*Math.sin(d)]}}function de(a){return[a.x,a.y]}function dd(a){return a.endAngle}function dc(a){return a.startAngle}function db(a){return a.radius}function da(a){return a.target}function c_(a){return a.source}function c$(a){return function(b,c){return a[c][1]}}function cZ(a){return function(b,c){return a[c][0]}}function cY(a){function i(f){if(f.length<1)return null;var i=cy(this,f,b,d),j=cy(this,f,b===c?cZ(i):c,d===e?c$(i):e);return"M"+g(a(j),h)+"L"+g(a(i.reverse()),h)+"Z"}var b=cz,c=cz,d=0,e=cA,f="linear",g=cB[f],h=.7;i.x=function(a){if(!arguments.length)return c;b=c=a;return i},i.x0=function(a){if(!arguments.length)return b;b=a;return i},i.x1=function(a){if(!arguments.length)return c;c=a;return i},i.y=function(a){if(!arguments.length)return e;d=e=a;return i},i.y0=function(a){if(!arguments.length)return d;d=a;return i},i.y1=function(a){if(!arguments.length)return e;e=a;return i},i.interpolate=function(a){if(!arguments.length)return f;g=cB[f=a];return i},i.tension=function(a){if(!arguments.length)return h;h=a;return i};return i}function cX(a){var b,c=-1,d=a.length,e,f;while(++c<d)b=a[c],e=b[0],f=b[1]+cr,b[0]=e*Math.cos(f),b[1]=e*Math.sin(f);return a}function cW(a){return a.length<3?cC(a):a[0]+cI(a,cV(a))}function cV(a){var b=[],c,d,e,f,g=cU(a),h=-1,i=a.length-1;while(++h<i)c=cT(a[h],a[h+1]),Math.abs(c)<1e-6?g[h]=g[h+1]=0:(d=g[h]/c,e=g[h+1]/c,f=d*d+e*e,f>9&&(f=c*3/Math.sqrt(f),g[h]=f*d,g[h+1]=f*e));h=-1;while(++h<=i)f=(a[Math.min(i,h+1)][0]-a[Math.max(0,h-1)][0])/(6*(1+g[h]*g[h])),b.push([f||0,g[h]*f||0]);return b}function cU(a){var b=0,c=a.length-1,d=[],e=a[0],f=a[1],g=d[0]=cT(e,f);while(++b<c)d[b]=g+(g=cT(e=f,f=a[b+1]));d[b]=g;return d}function cT(a,b){return(b[1]-a[1])/(b[0]-a[0])}function cS(a,b,c){a.push("C",cO(cP,b),",",cO(cP,c),",",cO(cQ,b),",",cO(cQ,c),",",cO(cR,b),",",cO(cR,c))}function cO(a,b){return a[0]*b[0]+a[1]*b[1]+a[2]*b[2]+a[3]*b[3]}function cN(a,b){var c=a.length-1,d=a[0][0],e=a[0][1],f=a[c][0]-d,g=a[c][1]-e,h=-1,i,j;while(++h<=c)i=a[h],j=h/c,i[0]=b*i[0]+(1-b)*(d+j*f),i[1]=b*i[1]+(1-b)*(e+j*g);return cK(a)}function cM(a){var b,c=-1,d=a.length,e=d+4,f,g=[],h=[];while(++c<4)f=a[c%d],g.push(f[0]),h.push(f[1]);b=[cO(cR,g),",",cO(cR,h)],--c;while(++c<e)f=a[c%d],g.shift(),g.push(f[0]),h.shift(),h.push(f[1]),cS(b,g,h);return b.join("")}function cL(a){if(a.length<4)return cC(a);var b=[],c=-1,d=a.length,e,f=[0],g=[0];while(++c<3)e=a[c],f.push(e[0]),g.push(e[1]);b.push(cO(cR,f)+","+cO(cR,g)),--c;while(++c<d)e=a[c],f.shift(),f.push(e[0]),g.shift(),g.push(e[1]),cS(b,f,g);return b.join("")}function cK(a){if(a.length<3)return cC(a);var b=[],c=1,d=a.length,e=a[0],f=e[0],g=e[1],h=[f,f,f,(e=a[1])[0]],i=[g,g,g,e[1]];b.push(f,",",g),cS(b,h,i);while(++c<d)e=a[c],h.shift(),h.push(e[0]),i.shift(),i.push(e[1]),cS(b,h,i);c=-1;while(++c<2)h.shift(),h.push(e[0]),i.shift(),i.push(e[1]),cS(b,h,i);return b.join("")}function cJ(a,b){var c=[],d=(1-b)/2,e,f=a[0],g=a[1],h=1,i=a.length;while(++h<i)e=f,f=g,g=a[h],c.push([d*(g[0]-e[0]),d*(g[1]-e[1])]);return c}function cI(a,b){if(b.length<1||a.length!=b.length&&a.length!=b.length+2)return cC(a);var c=a.length!=b.length,d="",e=a[0],f=a[1],g=b[0],h=g,i=1;c&&(d+="Q"+(f[0]-g[0]*2/3)+","+(f[1]-g[1]*2/3)+","+f[0]+","+f[1],e=a[1],i=2);if(b.length>1){h=b[1],f=a[i],i++,d+="C"+(e[0]+g[0])+","+(e[1]+g[1])+","+(f[0]-h[0])+","+(f[1]-h[1])+","+f[0]+","+f[1];for(var j=2;j<b.length;j++,i++)f=a[i],h=b[j],d+="S"+(f[0]-h[0])+","+(f[1]-h[1])+","+f[0]+","+f[1]}if(c){var k=a[i];d+="Q"+(f[0]+h[0]*2/3)+","+(f[1]+h[1]*2/3)+","+k[0]+","+k[1]}return d}function cH(a,b,c){return a.length<3?cC(a):a[0]+cI(a,cJ(a,b))}function cG(a,b){return a.length<3?cC(a):a[0]+cI((a.push(a[0]),a),cJ([a[a.length-2]].concat(a,[a[1]]),b))}function cF(a,b){return a.length<4?cC(a):a[1]+cI(a.slice(1,a.length-1),cJ(a,b))}function cE(a){var b=[],c=0,d=a.length,e=a[0];b.push(e[0],",",e[1]);while(++c<d)b.push("H",(e=a[c])[0],"V",e[1]);return b.join("")}function cD(a){var b=[],c=0,d=a.length,e=a[0];b.push(e[0],",",e[1]);while(++c<d)b.push("V",(e=a[c])[1],"H",e[0]);return b.join("")}function cC(a){var b=[],c=0,d=a.length,e=a[0];b.push(e[0],",",e[1]);while(++c<d)b.push("L",(e=a[c])[0],",",e[1]);return b.join("")}function cA(a){return a[1]}function cz(a){return a[0]}function cy(a,b,c,d){var e=[],f=-1,g=b.length,h=typeof c=="function",i=typeof d=="function",j;if(h&&i)while(++f<g)e.push([c.call(a,j=b[f],f),d.call(a,j,f)]);else if(h)while(++f<g)e.push([c.call(a,b[f],f),d]);else if(i)while(++f<g)e.push([c,d.call(a,b[f],f)]);else while(++f<g)e.push([c,d]);return e}function cx(a){function g(d){return d.length<1?null:"M"+e(a(cy(this,d,b,c)),f)}var b=cz,c=cA,d="linear",e=cB[d],f=.7;g.x=function(a){if(!arguments.length)return b;b=a;return g},g.y=function(a){if(!arguments.length)return c;c=a;return g},g.interpolate=function(a){if(!arguments.length)return d;e=cB[d=a];return g},g.tension=function(a){if(!arguments.length)return f;f=a;return g};return g}function cw(a){return a.endAngle}function cv(a){return a.startAngle}function cu(a){return a.outerRadius}function ct(a){return a.innerRadius}function cq(a,b,c){function g(){d=c.length/(b-a),e=c.length-1;return f}function f(b){return c[Math.max(0,Math.min(e,Math.floor(d*(b-a))))]}var d,e;f.domain=function(c){if(!arguments.length)return[a,b];a=+c[0],b=+c[c.length-1];return g()},f.range=function(a){if(!arguments.length)return c;c=a;return g()},f.copy=function(){return cq(a,b,c)};return g()}function cp(a,b){function e(a){return isNaN(a=+a)?NaN:b[d3.bisect(c,a)]}function d(){var d=0,f=a.length,g=b.length;c=[];while(++d<g)c[d-1]=d3.quantile(a,d/g);return e}var c;e.domain=function(b){if(!arguments.length)return a;a=b.filter(function(a){return!isNaN(a)}).sort(d3.ascending);return d()},e.range=function(a){if(!arguments.length)return b;b=a;return d()},e.quantiles=function(){return c},e.copy=function(){return cp(a,b)};return d()}function ck(a,b,c){function f(c){return d[((a[c]||(a[c]=++b))-1)%d.length]}var d,e;f.domain=function(d){if(!arguments.length)return d3.keys(a);a={},b=0;var e=-1,g=d.length,h;while(++e<g)a[h=d[e]]||(a[h]=++b);return f[c.t](c.x,c.p)},f.range=function(a){if(!arguments.length)return d;d=a,e=0,c={t:"range",x:a};return f},f.rangePoints=function(a,g){arguments.length<2&&(g=0);var h=a[0],i=a[1],j=(i-h)/(b-1+g);d=b<2?[(h+i)/2]:d3.range(h+j*g/2,i+j/2,j),e=0,c={t:"rangePoints",x:a,p:g};return f},f.rangeBands=function(a,g){arguments.length<2&&(g=0);var h=a[0],i=a[1],j=(i-h)/(b+g);d=d3.range(h+j*g,i,j),e=j*(1-g),c={t:"rangeBands",x:a,p:g};return f},f.rangeRoundBands=function(a,g){arguments.length<2&&(g=0);var h=a[0],i=a[1],j=Math.floor((i-h)/(b+g)),k=i-h-(b-g)*j;d=d3.range(h+Math.round(k/2),i,j),e=Math.round(j*(1-g)),c={t:"rangeRoundBands",x:a,p:g};return f},f.rangeBand=function(){return e},f.copy=function(){var d={},e;for(e in a)d[e]=a[e];return ck(d,b,c)};return f[c.t](c.x,c.p)}function cj(a){return function(b){return b<0?-Math.pow(-b,a):Math.pow(b,a)}}function ci(a,b){function e(b){return a(c(b))}var c=cj(b),d=cj(1/b);e.invert=function(b){return d(a.invert(b))},e.domain=function(b){if(!arguments.length)return a.domain().map(d);a.domain(b.map(c));return e},e.ticks=function(a){return ca(e.domain(),a)},e.tickFormat=function(a){return cb(e.domain(),a)},e.nice=function(){return e.domain(bW(e.domain(),b$))},e.exponent=function(a){if(!arguments.length)return b;var f=e.domain();c=cj(b=a),d=cj(1/b);return e.domain(f)},e.copy=function(){return ci(a.copy(),b)};return bZ(e,a)}function ch(a){return a.toPrecision(1)}function cg(a){return-Math.log(-a)/Math.LN10}function cf(a){return Math.log(a)/Math.LN10}function ce(a,b){function d(c){return a(b(c))}var c=b.pow;d.invert=function(b){return c(a.invert(b))},d.domain=function(e){if(!arguments.length)return a.domain().map(c);b=e[0]<0?cg:cf,c=b.pow,a.domain(e.map(b));return d},d.nice=function(){a.domain(bW(a.domain(),bX));return d},d.ticks=function(){var d=bV(a.domain()),e=[];if(d.every(isFinite)){var f=Math.floor(d[0]),g=Math.ceil(d[1]),h=c(d[0]),i=c(d[1]);if(b===cg){e.push(c(f));for(;f++<g;)for(var j=9;j>0;j--)e.push(c(f)*j)}else{for(;f<g;f++)for(var j=1;j<10;j++)e.push(c(f)*j);e.push(c(f))}for(f=0;e[f]<h;f++);for(g=e.length;e[g-1]>i;g--);e=e.slice(f,g)}return e},d.tickFormat=function(){return ch},d.copy=function(){return ce(a.copy(),b)};return bZ(d,a)}function cd(a,b,c,d){var e=[],f=[],g=0,h=a.length;while(++g<h)e.push(c(a[g-1],a[g])),f.push(d(b[g-1],b[g]));return function(b){var c=d3.bisect(a,b,1,a.length-1)-1;return f[c](e[c](b))}}function cc(a,b,c,d){var e=c(a[0],a[1]),f=d(b[0],b[1]);return function(a){return f(e(a))}}function cb(a,b){return d3.format(",."+Math.max(0,-Math.floor(Math.log(b_(a,b)[2])/Math.LN10+.01))+"f")}function ca(a,b){return d3.range.apply(d3,b_(a,b))}function b_(a,b){var c=bV(a),d=c[1]-c[0],e=Math.pow(10,Math.floor(Math.log(d/b)/Math.LN10)),f=b/d*e;f<=.15?e*=10:f<=.35?e*=5:f<=.75&&(e*=2),c[0]=Math.ceil(c[0]/e)*e,c[1]=Math.floor(c[1]/e)*e+e*.5,c[2]=e;return c}function b$(a){a=Math.pow(10,Math.round(Math.log(a)/Math.LN10)-1);return{floor:function(b){return Math.floor(b/a)*a},ceil:function(b){return Math.ceil(b/a)*a}}}function bZ(a,b){a.range=d3.rebind(a,b.range),a.rangeRound=d3.rebind(a,b.rangeRound),a.interpolate=d3.rebind(a,b.interpolate),a.clamp=d3.rebind(a,b.clamp);return a}function bY(a,b,c,d){function h(a){return e(a)}function g(){var g=a.length==2?cc:cd,i=d?G:F;e=g(a,b,i,c),f=g(b,a,i,d3.interpolate);return h}var e,f;h.invert=function(a){return f(a)},h.domain=function(b){if(!arguments.length)return a;a=b.map(Number);return g()},h.range=function(a){if(!arguments.length)return b;b=a;return g()},h.rangeRound=function(a){return h.range(a).interpolate(d3.interpolateRound)},h.clamp=function(a){if(!arguments.length)return d;d=a;return g()},h.interpolate=function(a){if(!arguments.length)return c;c=a;return g()},h.ticks=function(b){return ca(a,b)},h.tickFormat=function(b){return cb(a,b)},h.nice=function(){bW(a,b$);return g()},h.copy=function(){return bY(a,b,c,d)};return g()}function bX(){return Math}function bW(a,b){var c=0,d=a.length-1,e=a[c],f=a[d],g;f<e&&(g=c,c=d,d=g,g=e,e=f,f=g),b=b(f-e),a[c]=b.floor(e),a[d]=b.ceil(f);return a}function bV(a){var b=a[0],c=a[a.length-1];return b<c?[b,c]:[c,b]}function bU(){}function bS(){var a=null,b=bO,c=Infinity;while(b)b.flush?b=a?a.next=b.next:bO=b.next:(c=Math.min(c,b.then+b.delay),b=(a=b).next);return c}function bR(){var a,b=Date.now(),c=bO;while(c)a=b-c.then,a>=c.delay&&(c.flush=c.callback(a)),c=c.next;var d=bS()-b;d>24?(isFinite(d)&&(clearTimeout(bQ),bQ=setTimeout(bR,d)),bP=0):(bP=1,bT(bR))}function bN(a){for(var b=0,c=this.length;b<c;b++)for(var d=this[b],e=0,f=d.length;e<f;e++){var g=d[e];g&&a.call(g=g.node,g.__data__,e,b)}return this}function bM(a){var b=this;return b.each(typeof a=="function"?function(c,d,e){b[e][d].duration=+a.apply(this,arguments)}:(a=+a,function(c,d,e){b[e][d].duration=a}))}function bL(a){var b=this;return b.each(typeof a=="function"?function(c,d,e){b[e][d].delay=+a.apply(this,arguments)}:(a=+a,function(c,d,e){b[e][d].delay=a}))}function bK(){return this.each("end",function(){var a;!this.__transition__&&(a=this.parentNode)&&a.removeChild(this)})}function bJ(a){return this.tween("text",function(b,c){this.textContent=typeof a=="function"?a.call(this,b,c):a})}function bI(a,b,c){arguments.length<3&&(c=null);return this.tween("style."+a,function(d,e){var f=b.call(this,d,e,window.getComputedStyle(this,null).getPropertyValue(a));return f&&function(b){this.style.setProperty(a,f(b),c)}})}function bH(a,b,c){arguments.length<3&&(c=null);return this.styleTween(a,by(b),c)}function bG(a,b){function d(c,d){var e=b.call(this,c,d,this.getAttributeNS(a.space,a.local));return e&&function(b){this.setAttributeNS(a.space,a.local,e(b))}}function c(c,d){var e=b.call(this,c,d,this.getAttribute(a));return e&&function(b){this.setAttribute(a,e(b))}}a=d3.ns.qualify(a);return this.tween("attr."+a,a.local?d:c)}function bF(a,b){return this.attrTween(a,by(b))}function bE(a){var b=[],c,d;typeof a!="function"&&(a=$(a));for(var e=-1,f=this.length;++e<f;)for(var g=this[e],h=-1,i=g.length;++h<i;)if(d=g[h]){b.push(c=a(d.node));for(var j=-1,k=c.length;++j<k;)c[j]={node:c[j],delay:d.delay,duration:d.duration}}return bx(b).ease(this.ease())}function bD(a){var b=[],c,d,e;typeof a!="function"&&(a=Y(a));for(var f=-1,g=this.length;++f<g;){b.push(c=[]);for(var h=this[f],i=-1,j=h.length;++i<j;)(e=h[i])&&(d=a(e.node))?("__data__"in e.node&&(d.__data__=e.node.__data__),c.push({node:d,delay:e.delay,duration:e.duration})):c.push(null)}return bx(b).ease(this.ease())}function by(a){return typeof a=="function"?function(b,c,d){var e=a.call(this,b,c)+"";return d!=e&&d3.interpolate(d,e)}:(a=a+"",function(b,c,d){return d!=a&&d3.interpolate(d,a)})}function bx(a){e(a,bz);var b=bB||++bA,c={},d=d3.dispatch("start","end"),f=bC;a.tween=function(b,d){if(arguments.length<2)return c[b];d==null?delete c[b]:c[b]=d;return a},a.ease=function(b){if(!arguments.length)return f;f=typeof b=="function"?b:d3.ease.apply(d3,arguments);return a},a.each=function(b,c){if(arguments.length<2)return bN.call(a,b);d[b].add(c);return a},d3.timer(function(e){a.each(function(g,h,i){function p(a){if(n.active!==b)return!0;var c=Math.min(1,(a-l)/m),e=f(c),i=j.length;while(--i>=0)j[i].call(k,e);if(c===1){n.active=0,n.owner===b&&delete k.__transition__,bB=b,d.end.dispatch.call(k,g,h),bB=0;return!0}}function o(a){if(n.active<=b){n.active=b,d.start.dispatch.call(k,g,h);for(var e in c)(e=c[e].call(k,g,h))&&j.push(e);l-=a,d3.timer(p)}return!0}var j=[],k=this,l=a[i][h].delay-e,m=a[i][h].duration,n=k.__transition__||(k.__transition__={active:0});n.owner=b,l<=0?o(0):d3.timer(o,l)});return!0});return a}function bw(){var a=[],b,c;for(var d=-1,e=this.length;++d<e;){a.push(b=[]);for(var f=this[d],g=-1,h=f.length;++g<h;)b.push((c=f[g])?{node:c,delay:0,duration:250}:null)}return bx(a)}function bv(a){for(var b=0,c=this.length;b<c;b++)for(var d=this[b],e=0,f=d.length;e<f;e++){var g=d[e];if(g)return g}return null}function bu(){return!this.node()}function bt(a){a.apply(this,(arguments[0]=this,arguments));return this}function bs(a){for(var b=-1,c=this.length;++b<c;)for(var d=this[b],e=-1,f=d.length;++e<f;){var g=d[e];g&&a.call(g,g.__data__,e,b)}return this}function br(a,b,c){arguments.length<3&&(c=!1);var d=a.indexOf("."),e=d===-1?a:a.substring(0,d),f="__on"+a;return this.each(function(a,d){function h(a){var c=d3.event;d3.event=a;try{b.call(this,g.__data__,d)}finally{d3.event=c}}this[f]&&this.removeEventListener(e,this[f],c),b&&this.addEventListener(e,this[f]=h,c);var g=this})}function bq(a){arguments.length||(a=d3.ascending);return function(b,c){return a(b&&b.__data__,c&&c.__data__)}}function bp(a){a=bq.apply(this,arguments);for(var b=0,c=this.length;b<c;b++)for(var d=this[b].sort(a),e=1,f=d.length,g=d[0];e<f;e++){var h=d[e];h&&(g&&g.parentNode.insertBefore(h,g.nextSibling),g=h)}return this}function bo(a){return this.each(function(){this.__data__=a.apply(this,arguments)})}function bn(a){var b=[],c,d,e;for(var f=0,g=this.length;f<g;f++){b.push(c=[]),c.parentNode=(d=this[f]).parentNode;for(var h=0,i=d.length;h<i;h++)(e=d[h])&&a.call(e,e.__data__,h)&&c.push(e)}return S(b)}function bm(a){var b=[],c,d,e,f,g;for(var h=-1,i=this.length;++h<i;){e=(f=this[h]).update,b.push(c=[]),c.parentNode=f.parentNode;for(var j=-1,k=f.length;++j<k;)(g=f[j])?(c.push(e[j]=d=a(f.parentNode)),d.__data__=g.__data__):c.push(null)}return S(b)}function bk(a){e(a,bl);return a}function bj(a){return{__data__:a}}function bi(a,b){function f(a,f){var g,h=a.length,i=f.length,j=Math.min(h,i),k=Math.max(h,i),l=[],m=[],n=[],o,p;if(b){var q={},r=[],s,t=f.length;for(g=-1;++g<h;)s=b.call(o=a[g],o.__data__,g),s in q?n[t++]=o:q[s]=o,r.push(s);for(g=-1;++g<i;)o=q[s=b.call(f,p=f[g],g)],o?(o.__data__=p,l[g]=o,m[g]=n[g]=null):(m[g]=bj(p),l[g]=n[g]=null),delete q[s];for(g=-1;++g<h;)r[g]in q&&(n[g]=a[g])}else{for(g=-1;++g<j;)o=a[g],p=f[g],o?(o.__data__=p,l[g]=o,m[g]=n[g]=null):(m[g]=bj(p),l[g]=n[g]=null);for(;g<i;++g)m[g]=bj(f[g]),l[g]=n[g]=null;for(;g<k;++g)n[g]=a[g],m[g]=l[g]=null}m.update=l,m.parentNode=l.parentNode=n.parentNode=a.parentNode,c.push(m),d.push(l),e.push(n)}var c=[],d=[],e=[],g=-1,h=this.length,i;if(typeof a=="function")while(++g<h)f(i=this[g],a.call(i,i.parentNode.__data__,g));else while(++g<h)f(i=this[g],a);var j=S(d);j.enter=function(){return bk(c)},j.exit=function(){return S(e)};return j}function bh(){return this.each(function(){var a=this.parentNode;a&&a.removeChild(this)})}function bg(a,b){function d(c){return c.insertBefore(document.createElementNS(a.space,a.local),U(b,c))}function c(c){return c.insertBefore(document.createElement(a),U(b,c))}a=d3.ns.qualify(a);return this.select(a.local?d:c)}function bf(a){function c(b){return b.appendChild(document.createElementNS(a.space,a.local))}function b(b){return b.appendChild(document.createElement(a))}a=d3.ns.qualify(a);return this.select(a.local?c:b)}function be(a){return arguments.length<1?this.node().innerHTML:this.each(typeof a=="function"?function(){this.innerHTML=a.apply(this,arguments)}:function(){this.innerHTML=a})}function bd(a){return arguments.length<1?this.node().textContent:this.each(typeof a=="function"?function(){this.textContent=a.apply(this,arguments)}:function(){this.textContent=a})}function bc(a,b){function e(){var c=b.apply(this,arguments);c==null?delete this[a]:this[a]=c}function d(){this[a]=b}function c(){delete this[a]}return arguments.length<2?this.node()[a]:this.each(b==null?c:typeof b=="function"?e:d)}function bb(a,b,c){function f(){var d=b.apply(this,arguments);d==null?this.style.removeProperty(a):this.style.setProperty(a,d,c)}function e(){this.style.setProperty(a,b,c)}function d(){this.style.removeProperty(a)}arguments.length<3&&(c="");return arguments.length<2?window.getComputedStyle(this.node(),null).getPropertyValue(a):this.each(b==null?d:typeof b=="function"?f:e)}function ba(a,b){function i(){(b.apply(this,arguments)?f:g).call(this)}function g(){if(b=this.classList)return b.remove(a);var b=this.className,d=b.baseVal!=null,e=d?b.baseVal:b;e=h(e.replace(c," ")),d?b.baseVal=e:this.className=e}function f(){if(b=this.classList)return b.add(a);var b=this.className,d=b.baseVal!=null,e=d?b.baseVal:b;c.lastIndex=0,c.test(e)||(e=h(e+" "+a),d?b.baseVal=e:this.className=e)}var c=new RegExp("(^|\\s+)"+d3.requote(a)+"(\\s+|$)","g");if(arguments.length<2){var d=this.node();if(e=d.classList)return e.contains(a);var e=d.className;c.lastIndex=0;return c.test(e.baseVal!=null?e.baseVal:e)}return this.each(typeof b=="function"?i:b?f:g)}function _(a,b){function i(){var c=b.apply(this,arguments);c==null?this.removeAttributeNS(a.space,a.local):this.setAttributeNS(a.space,a.local,c)}function h(){var c=b.apply(this,arguments);c==null?this.removeAttribute(a):this.setAttribute(a,c)}function g(){this.setAttributeNS(a.space,a.local,b)}function f(){this.setAttribute(a,b)}function e(){this.removeAttributeNS(a.space,a.local)}function d(){this.removeAttribute(a)}a=d3.ns.qualify(a);if(arguments.length<2){var c=this.node();return a.local?c.getAttributeNS(a.space,a.local):c.getAttribute(a)}return this.each(b==null?a.local?e:d:typeof b=="function"?a.local?i:h:a.local?g:f)}function $(a){return function(b){return V(a,b)}}function Z(a){var b=[],c,d;typeof a!="function"&&(a=$(a));for(var e=-1,f=this.length;++e<f;)for(var g=this[e],h=-1,i=g.length;++h<i;)if(d=g[h])b.push(c=a(d)),c.parentNode=d;return S(b)}function Y(a){return function(b){return U(a,b)}}function X(a){var b=[],c,d,e,f;typeof a!="function"&&(a=Y(a));for(var g=-1,h=this.length;++g<h;){b.push(c=[]),c.parentNode=(e=this[g]).parentNode;for(var i=-1,j=e.length;++i<j;)(f=e[i])?(c.push(d=a(f)),d&&"__data__"in f&&(d.__data__=f.__data__)):c.push(null)}return S(b)}function S(a){e(a,T);return a}function R(a,b,c){function g(a){return Math.round(f(a)*255)}function f(a){a>360?a-=360:a<0&&(a+=360);return a<60?d+(e-d)*a/60:a<180?e:a<240?d+(e-d)*(240-a)/60:d}var d,e;a=a%360,a<0&&(a+=360),b=b<0?0:b>1?1:b,c=c<0?0:c>1?1:c,e=c<=.5?c*(1+b):c+b-c*b,d=2*c-e;return H(g(a+120),g(a),g(a-120))}function Q(a,b,c){this.h=a,this.s=b,this.l=c}function P(a,b,c){return new Q(a,b,c)}function M(a){var b=parseFloat(a);return a.charAt(a.length-1)==="%"?Math.round(b*2.55):b}function L(a,b,c){var d=Math.min(a/=255,b/=255,c/=255),e=Math.max(a,b,c),f=e-d,g,h,i=(e+d)/2;f?(h=i<.5?f/(e+d):f/(2-e-d),a==e?g=(b-c)/f+(b<c?6:0):b==e?g=(c-a)/f+2:g=(a-b)/f+4,g*=60):h=g=0;return P(g,h,i)}function K(a,b,c){var d=0,e=0,f=0,g,h,i;g=/([a-z]+)\((.*)\)/i.exec(a);if(g){h=g[2].split(",");switch(g[1]){case"hsl":return c(parseFloat(h[0]),parseFloat(h[1])/100,parseFloat(h[2])/100);case"rgb":return b(M(h[0]),M(h[1]),M(h[2]))}}if(i=N[a])return b(i.r,i.g,i.b);a!=null&&a.charAt(0)==="#"&&(a.length===4?(d=a.charAt(1),d+=d,e=a.charAt(2),e+=e,f=a.charAt(3),f+=f):a.length===7&&(d=a.substring(1,3),e=a.substring(3,5),f=a.substring(5,7)),d=parseInt(d,16),e=parseInt(e,16),f=parseInt(f,16));return b(d,e,f)}function J(a){return a<16?"0"+a.toString(16):a.toString(16)}function I(a,b,c){this.r=a,this.g=b,this.b=c}function H(a,b,c){return new I(a,b,c)}function G(a,b){b=1/(b-(a=+a));return function(c){return Math.max(0,Math.min(1,(c-a)*b))}}function F(a,b){b=1/(b-(a=+a));return function(c){return(c-a)*b}}function E(a){return a in D||/\bcolor\b/.test(a)?d3.interpolateRgb:d3.interpolate}function B(a){return a<1/2.75?7.5625*a*a:a<2/2.75?7.5625*(a-=1.5/2.75)*a+.75:a<2.5/2.75?7.5625*(a-=2.25/2.75)*a+.9375:7.5625*(a-=2.625/2.75)*a+.984375}function A(a){a||(a=1.70158);return function(b){return b*b*((a+1)*b-a)}}function z(a,b){var c;arguments.length<2&&(b=.45),arguments.length<1?(a=1,c=b/4):c=b/(2*Math.PI)*Math.asin(1/a);return function(d){return 1+a*Math.pow(2,10*-d)*Math.sin((d-c)*2*Math.PI/b)}}function y(a){return 1-Math.sqrt(1-a*a)}function x(a){return Math.pow(2,10*(a-1))}function w(a){return 1-Math.cos(a*Math.PI/2)}function v(a){return function(b){return Math.pow(b,a)}}function u(a){return a}function t(a){return function(b){return.5*(b<.5?a(2*b):2-a(2-2*b))}}function s(a){return function(b){return 1-a(1-b)}}function n(a){var b=a.lastIndexOf("."),c=b>=0?a.substring(b):(b=a.length,""),d=[];while(b>0)d.push(a.substring(b-=3,b+3));return d.reverse().join(",")+c}function m(a){return a+""}function j(a){var b={},c=[];b.add=function(a){for(var d=0;d<c.length;d++)if(c[d].listener==a)return b;c.push({listener:a,on:!0});return b},b.remove=function(a){for(var d=0;d<c.length;d++){var e=c[d];if(e.listener==a){e.on=!1,c=c.slice(0,d).concat(c.slice(d+1));break}}return b},b.dispatch=function(){var a=c;for(var b=0,d=a.length;b<d;b++){var e=a[b];e.on&&e.listener.apply(this,arguments)}};return b}function h(a){return a.replace(/(^\s+)|(\s+$)/g,"").replace(/\s+/g," ")}function g(a){return a==null}function f(a){return a.length}function c(a){return Array.prototype.slice.call(a)}function b(a){var b=-1,c=a.length,d=[];while(++b<c)d.push(a[b]);return d}d3={version:"1.29.6"},Date.now||(Date.now=function(){return+(new Date)}),Object.create||(Object.create=function(a){function b(){}b.prototype=a;return new b});var a=c;try{a(document.documentElement.childNodes)[0].nodeType}catch(d){a=b}var e=[].__proto__?function(a,b){a.__proto__=b}:function(a,b){for(var c in b)a[c]=b[c]};d3.functor=function(a){return typeof a=="function"?a:function(){return a}},d3.rebind=function(a,b){return function(){var c=b.apply(a,arguments);return arguments.length?a:c}},d3.ascending=function(a,b){return a<b?-1:a>b?1:a>=b?0:NaN},d3.descending=function(a,b){return b<a?-1:b>a?1:b>=a?0:NaN},d3.min=function(a,b){var c=-1,d=a.length,e,f;if(arguments.length===1){while(++c<d&&((e=a[c])==null||e!=e))e=undefined;while(++c<d)(f=a[c])!=null&&e>f&&(e=f)}else{while(++c<d&&((e=b.call(a,a[c],c))==null||e!=e))e=undefined;while(++c<d)(f=b.call(a,a[c],c))!=null&&e>f&&(e=f)}return e},d3.max=function(a,b){var c=-1,d=a.length,e,f;if(arguments.length===1){while(++c<d&&((e=a[c])==null||e!=e))e=undefined;while(++c<d)(f=a[c])!=null&&f>e&&(e=f)}else{while(++c<d&&((e=b.call(a,a[c],c))==null||e!=e))e=undefined;while(++c<d)(f=b.call(a,a[c],c))!=null&&f>e&&(e=f)}return e},d3.sum=function(a,b){var c=0,d=a.length,e,f=-1;if(arguments.length===1)while(++f<d)isNaN(e=+a[f])||(c+=e);else while(++f<d)isNaN(e=+b.call(a,a[f],f))||(c+=e);return c},d3.quantile=function(a,b){var c=(a.length-1)*b+1,d=Math.floor(c),e=a[d-1],f=c-d;return f?e+f*(a[d]-e):e},d3.zip=function(){if(!(e=arguments.length))return[];for(var a=-1,b=d3.min(arguments,f),c=Array(b);++a<b;)for(var d=-1,e,g=c[a]=Array(e);++d<e;)g[d]=arguments[d][a];return c},d3.bisectLeft=function(a,b,c,d){arguments.length<3&&(c=0),arguments.length<4&&(d=a.length);while(c<d){var e=c+d>>1;a[e]<b?c=e+1:d=e}return c},d3.bisect=d3.bisectRight=function(a,b,c,d){arguments.length<3&&(c=0),arguments.length<4&&(d=a.length);while(c<d){var e=c+d>>1;b<a[e]?d=e:c=e+1}return c},d3.first=function(a,b){var c=0,d=a.length,e=a[0],f;arguments.length===1&&(b=d3.ascending);while(++c<d)b.call(a,e,f=a[c])>0&&(e=f);return e},d3.last=function(a,b){var c=0,d=a.length,e=a[0],f;arguments.length===1&&(b=d3.ascending);while(++c<d)b.call(a,e,f=a[c])<=0&&(e=f);return e},d3.nest=function(){function g(a,d){if(d>=b.length)return a;var e=[],f=c[d++],h;for(h in a)e.push({key:h,values:g(a[h],d)});f&&e.sort(function(a,b){return f(a.key,b.key)});return e}function f(c,g){if(g>=b.length)return e?e.call(a,c):d?c.sort(d):c;var h=-1,i=c.length,j=b[g++],k,l,m={};while(++h<i)(k=j(l=c[h]))in m?m[k].push(l):m[k]=[l];for(k in m)m[k]=f(m[k],g);return m}var a={},b=[],c=[],d,e;a.map=function(a){return f(a,0)},a.entries=function(a){return g(f(a,0),0)},a.key=function(c){b.push(c);return a},a.sortKeys=function(d){c[b.length-1]=d;return a},a.sortValues=function(b){d=b;return a},a.rollup=function(b){e=b;return a};return a},d3.keys=function(a){var b=[];for(var c in a)b.push(c);return b},d3.values=function(a){var b=[];for(var c in a)b.push(a[c]);return b},d3.entries=function(a){var b=[];for(var c in a)b.push({key:c,value:a[c]});return b},d3.permute=function(a,b){var c=[],d=-1,e=b.length;while(++d<e)c[d]=a[b[d]];return c},d3.merge=function(a){return Array.prototype.concat.apply([],a)},d3.split=function(a,b){var c=[],d=[],e,f=-1,h=a.length;arguments.length<2&&(b=g);while(++f<h)b.call(d,e=a[f],f)?d=[]:(d.length||c.push(d),d.push(e));return c},d3.range=function(a,b,c){arguments.length<3&&(c=1,arguments.length<2&&(b=a,a=0));if((b-a)/c==Infinity)throw new Error("infinite range");var d=[],e=-1,f;if(c<0)while((f=a+c*++e)>b)d.push(f);else while((f=a+c*++e)<b)d.push(f);return d},d3.requote=function(a){return a.replace(i,"\\$&")};var i=/[\\\^\$\*\+\?\|\[\]\(\)\.\{\}]/g;d3.round=function(a,b){return b?Math.round(a*Math.pow(10,b))*Math.pow(10,-b):Math.round(a)},d3.xhr=function(a,b,c){var d=new XMLHttpRequest;arguments.length<3?c=b:b&&d.overrideMimeType&&d.overrideMimeType(b),d.open("GET",a,!0),d.onreadystatechange=function(){d.readyState===4&&c(d.status<300?d:null)},d.send(null)},d3.text=function(a,b,c){function d(a){c(a&&a.responseText)}arguments.length<3&&(c=b,b=null),d3.xhr(a,b,d)},d3.json=function(a,b){d3.text(a,"application/json",function(a){b(a?JSON.parse(a):null)})},d3.html=function(a,b){d3.text(a,"text/html",function(a){if(a!=null){var c=document.createRange();c.selectNode(document.body),a=c.createContextualFragment(a)}b(a)})},d3.xml=function(a,b,c){function d(a){c(a&&a.responseXML)}arguments.length<3&&(c=b,b=null),d3.xhr(a,b,d)},d3.ns={prefix:{svg:"http://www.w3.org/2000/svg",xhtml:"http://www.w3.org/1999/xhtml",xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"},qualify:function(a){var b=a.indexOf(":");return b<0?a:{space:d3.ns.prefix[a.substring(0,b)],local:a.substring(b+1)}}},d3.dispatch=function(a){var b={},c;for(var d=0,e=arguments.length;d<e;d++)c=arguments[d],b[c]=j(c);return b},d3.format=function(a){var b=k.exec(a),c=b[1]||" ",d=b[3]||"",e=b[5],f=+b[6],g=b[7],h=b[8],i=b[9],j=!1,o=!1;h&&(h=h.substring(1)),e&&(c="0",g&&(f-=Math.floor((f-1)/4)));switch(i){case"n":g=!0,i="g";break;case"%":j=!0,i="f";break;case"p":j=!0,i="r";break;case"d":o=!0,h="0"}i=l[i]||m;return function(a){var b=j?a*100:+a,k=b<0&&(b=-b)?"−":d;if(o&&b%1)return"";a=i(b,h);if(e){var l=a.length+k.length;l<f&&(a=Array(f-l+1).join(c)+a),g&&(a=n(a)),a=k+a}else{g&&(a=n(a)),a=k+a;var l=a.length;l<f&&(a=Array(f-l+1).join(c)+a)}j&&(a+="%");return a}};var k=/(?:([^{])?([<>=^]))?([+\- ])?(#)?(0)?([0-9]+)?(,)?(\.[0-9]+)?([a-zA-Z%])?/,l={g:function(a,b){return a.toPrecision(b)},e:function(a,b){return a.toExponential(b)},f:function(a,b){return a.toFixed(b)},r:function(a,b){var c=1+Math.floor(1e-15+Math.log(a)/Math.LN10);return d3.round(a,b-c).toFixed(Math.max(0,Math.min(20,b-c)))}},o=v(2),p=v(3),q={linear:function(){return u},poly:v,quad:function(){return o},cubic:function(){return p},sin:function(){return w},exp:function(){return x},circle:function(){return y},elastic:z,back:A,bounce:function(){return B}},r={"in":function(a){return a},out:s,"in-out":t,"out-in":function(a){return t(s(a))}};d3.ease=function(a){var b=a.indexOf("-"),c=b>=0?a.substring(0,b):a,d=b>=0?a.substring(b+1):"in";return r[d](q[c].apply(null,Array.prototype.slice.call(arguments,1)))},d3.event=null,d3.interpolate=function(a,b){var c=d3.interpolators.length,d;while(--c>=0&&!(d=d3.interpolators[c](a,b)));return d},d3.interpolateNumber=function(a,b){b-=a;return function(c){return a+b*c}},d3.interpolateRound=function(a,b){b-=a;return function(c){return Math.round(a+b*c)}},d3.interpolateString=function(a,b){var c,d,e,f=0,g=0,h=[],i=[],j,k;C.lastIndex=0;for(d=0;c=C.exec(b);++d)c.index&&h.push(b.substring(f,g=c.index)),i.push({i:h.length,x:c[0]}),h.push(null),f=C.lastIndex;f<b.length&&h.push(b.substring(f));for(d=0,j=i.length;(c=C.exec(a))&&d<j;++d){k=i[d];if(k.x==c[0]){if(k.i)if(h[k.i+1]==null){h[k.i-1]+=k.x,h.splice(k.i,1);for(e=d+1;e<j;++e)i[e].i--}else{h[k.i-1]+=k.x+h[k.i+1],h.splice(k.i,2);for(e=d+1;e<j;++e)i[e].i-=2}else if(h[k.i+1]==null)h[k.i]=k.x;else{h[k.i]=k.x+h[k.i+1],h.splice(k.i+1,1);for(e=d+1;e<j;++e)i[e].i--}i.splice(d,1),j--,d--}else k.x=d3.interpolateNumber(parseFloat(c[0]),parseFloat(k.x))}while(d<j)k=i.pop(),h[k.i+1]==null?h[k.i]=k.x:(h[k.i]=k.x+h[k.i+1],h.splice(k.i+1,1)),j--;return h.length===1?h[0]==null?i[0].x:function(){return b}:function(a){for(d=0;d<j;++d)h[(k=i[d]).i]=k.x(a);return h.join("")}},d3.interpolateRgb=function(a,b){a=d3.rgb(a),b=d3.rgb(b);var c=a.r,d=a.g,e=a.b,f=b.r-c,g=b.g-d,h=b.b-e;return function(a){return"rgb("+Math.round(c+f*a)+","+Math.round(d+g*a)+","+Math.round(e+h*a)+")"}},d3.interpolateHsl=function(a,b){a=d3.hsl(a),b=d3.hsl(b);var c=a.h,d=a.s,e=a.l,f=b.h-c,g=b.s-d,h=b.l-e;return function(a){return R(c+f*a,d+g*a,e+h*a).toString()}},d3.interpolateArray=function(a,b){var c=[],d=[],e=a.length,f=b.length,g=Math.min(a.length,b.length),h;for(h=0;h<g;++h)c.push(d3.interpolate(a[h],b[h]));for(;h<e;++h)d[h]=a[h];for(;h<f;++h)d[h]=b[h];return function(a){for(h=0;h<g;++h)d[h]=c[h](a);return d}},d3.interpolateObject=function(a,b){var c={},d={},e;for(e in a)e in b?c[e]=E(e)(a[e],b[e]):d[e]=a[e];for(e in b)e in a||(d[e]=b[e]);return function(a){for(e in c)d[e]=c[e](a);return d}};var C=/[-+]?(?:\d+\.\d+|\d+\.|\.\d+|\d+)(?:[eE][-]?\d+)?/g,D={background:1,fill:1,stroke:1};d3.interpolators=[d3.interpolateObject,function(a,b){return b instanceof Array&&d3.interpolateArray(a,b)},function(a,b){return typeof b=="string"&&d3.interpolateString(String(a),b)},function(a,b){return(typeof b=="string"?b in N||/^(#|rgb\(|hsl\()/.test(b):b instanceof I||b instanceof Q)&&d3.interpolateRgb(String(a),b)},function(a,b){return typeof b=="number"&&d3.interpolateNumber(+a,b)}],d3.rgb=function(a,b,c){return arguments.length===1?K(""+a,H,R):H(~~a,~~b,~~c)},I.prototype.brighter=function(a){a=Math.pow(.7,arguments.length?a:1);var b=this.r,c=this.g,d=this.b,e=30;if(!b&&!c&&!d)return H(e,e,e);b&&b<e&&(b=e),c&&c<e&&(c=e),d&&d<e&&(d=e);return H(Math.min(255,Math.floor(b/a)),Math.min(255,Math.floor(c/a)),Math.min(255,Math.floor(d/a)))},I.prototype.darker=function(a){a=Math.pow(.7,arguments.length?a:1);return H(Math.max(0,Math.floor(a*this.r)),Math.max(0,Math.floor(a*this.g)),Math.max(0,Math.floor(a*this.b)))},I.prototype.hsl=function(){return L(this.r,this.g,this.b)},I.prototype.toString=function(){return"#"+J(this.r)+J(this.g)+J(this.b)};var N={aliceblue:"#f0f8ff",antiquewhite:"#faebd7",aqua:"#00ffff",aquamarine:"#7fffd4"
<del>,azure:"#f0ffff",beige:"#f5f5dc",bisque:"#ffe4c4",black:"#000000",blanchedalmond:"#ffebcd",blue:"#0000ff",blueviolet:"#8a2be2",brown:"#a52a2a",burlywood:"#deb887",cadetblue:"#5f9ea0",chartreuse:"#7fff00",chocolate:"#d2691e",coral:"#ff7f50",cornflowerblue:"#6495ed",cornsilk:"#fff8dc",crimson:"#dc143c",cyan:"#00ffff",darkblue:"#00008b",darkcyan:"#008b8b",darkgoldenrod:"#b8860b",darkgray:"#a9a9a9",darkgreen:"#006400",darkgrey:"#a9a9a9",darkkhaki:"#bdb76b",darkmagenta:"#8b008b",darkolivegreen:"#556b2f",darkorange:"#ff8c00",darkorchid:"#9932cc",darkred:"#8b0000",darksalmon:"#e9967a",darkseagreen:"#8fbc8f",darkslateblue:"#483d8b",darkslategray:"#2f4f4f",darkslategrey:"#2f4f4f",darkturquoise:"#00ced1",darkviolet:"#9400d3",deeppink:"#ff1493",deepskyblue:"#00bfff",dimgray:"#696969",dimgrey:"#696969",dodgerblue:"#1e90ff",firebrick:"#b22222",floralwhite:"#fffaf0",forestgreen:"#228b22",fuchsia:"#ff00ff",gainsboro:"#dcdcdc",ghostwhite:"#f8f8ff",gold:"#ffd700",goldenrod:"#daa520",gray:"#808080",green:"#008000",greenyellow:"#adff2f",grey:"#808080",honeydew:"#f0fff0",hotpink:"#ff69b4",indianred:"#cd5c5c",indigo:"#4b0082",ivory:"#fffff0",khaki:"#f0e68c",lavender:"#e6e6fa",lavenderblush:"#fff0f5",lawngreen:"#7cfc00",lemonchiffon:"#fffacd",lightblue:"#add8e6",lightcoral:"#f08080",lightcyan:"#e0ffff",lightgoldenrodyellow:"#fafad2",lightgray:"#d3d3d3",lightgreen:"#90ee90",lightgrey:"#d3d3d3",lightpink:"#ffb6c1",lightsalmon:"#ffa07a",lightseagreen:"#20b2aa",lightskyblue:"#87cefa",lightslategray:"#778899",lightslategrey:"#778899",lightsteelblue:"#b0c4de",lightyellow:"#ffffe0",lime:"#00ff00",limegreen:"#32cd32",linen:"#faf0e6",magenta:"#ff00ff",maroon:"#800000",mediumaquamarine:"#66cdaa",mediumblue:"#0000cd",mediumorchid:"#ba55d3",mediumpurple:"#9370db",mediumseagreen:"#3cb371",mediumslateblue:"#7b68ee",mediumspringgreen:"#00fa9a",mediumturquoise:"#48d1cc",mediumvioletred:"#c71585",midnightblue:"#191970",mintcream:"#f5fffa",mistyrose:"#ffe4e1",moccasin:"#ffe4b5",navajowhite:"#ffdead",navy:"#000080",oldlace:"#fdf5e6",olive:"#808000",olivedrab:"#6b8e23",orange:"#ffa500",orangered:"#ff4500",orchid:"#da70d6",palegoldenrod:"#eee8aa",palegreen:"#98fb98",paleturquoise:"#afeeee",palevioletred:"#db7093",papayawhip:"#ffefd5",peachpuff:"#ffdab9",peru:"#cd853f",pink:"#ffc0cb",plum:"#dda0dd",powderblue:"#b0e0e6",purple:"#800080",red:"#ff0000",rosybrown:"#bc8f8f",royalblue:"#4169e1",saddlebrown:"#8b4513",salmon:"#fa8072",sandybrown:"#f4a460",seagreen:"#2e8b57",seashell:"#fff5ee",sienna:"#a0522d",silver:"#c0c0c0",skyblue:"#87ceeb",slateblue:"#6a5acd",slategray:"#708090",slategrey:"#708090",snow:"#fffafa",springgreen:"#00ff7f",steelblue:"#4682b4",tan:"#d2b48c",teal:"#008080",thistle:"#d8bfd8",tomato:"#ff6347",turquoise:"#40e0d0",violet:"#ee82ee",wheat:"#f5deb3",white:"#ffffff",whitesmoke:"#f5f5f5",yellow:"#ffff00",yellowgreen:"#9acd32"};for(var O in N)N[O]=K(N[O],H,R);d3.hsl=function(a,b,c){return arguments.length===1?K(""+a,L,P):P(+a,+b,+c)},Q.prototype.brighter=function(a){a=Math.pow(.7,arguments.length?a:1);return P(this.h,this.s,this.l/a)},Q.prototype.darker=function(a){a=Math.pow(.7,arguments.length?a:1);return P(this.h,this.s,a*this.l)},Q.prototype.rgb=function(){return R(this.h,this.s,this.l)},Q.prototype.toString=function(){return"hsl("+this.h+","+this.s*100+"%,"+this.l*100+"%)"},d3.select=function(a){return typeof a=="string"?W.select(a):S([[a]])},d3.selectAll=function(b){return typeof b=="string"?W.selectAll(b):S([a(b)])};var T=[];T.select=X,T.selectAll=Z,T.attr=_,T.classed=ba,T.style=bb,T.property=bc,T.text=bd,T.html=be,T.append=bf,T.insert=bg,T.remove=bh,T.data=bi,T.filter=bn,T.map=bo,T.sort=bp,T.on=br,T.transition=bw,T.each=bs,T.call=bt,T.empty=bu,T.node=bv;var U=function(a,b){return b.querySelector(a)},V=function(b,c){return a(c.querySelectorAll(b))};typeof Sizzle=="function"&&(U=function(a,b){return Sizzle(a,b)[0]},V=function(a,b){return Sizzle.uniqueSort(Sizzle(a,b))});var W=S([[document]]);W[0].parentNode=document.documentElement;var bl=[];bl.select=bm,bl.append=bf,bl.insert=bg,bl.empty=bu;var bz=[],bA=0,bB=0,bC=d3.ease("cubic-in-out");bz.select=bD,bz.selectAll=bE,bz.attr=bF,bz.attrTween=bG,bz.style=bH,bz.styleTween=bI,bz.text=bJ,bz.remove=bK,bz.delay=bL,bz.duration=bM,bz.call=bt,d3.transition=function(){return W.transition()};var bO=null,bP,bQ;d3.timer=function(a,b){var c=Date.now(),d=!1,e,f=bO;if(arguments.length<2)b=0;else if(!isFinite(b))return;while(f){if(f.callback===a){f.then=c,f.delay=b,d=!0;break}e=f,f=f.next}d||(bO={callback:a,then:c,delay:b,next:bO}),bP||(bQ=clearTimeout(bQ),bP=1,bT(bR))},d3.timer.flush=function(){var a,b=Date.now(),c=bO;while(c)a=b-c.then,c.delay||(c.flush=c.callback(a)),c=c.next;bS()};var bT=window.requestAnimationFrame||window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||window.oRequestAnimationFrame||window.msRequestAnimationFrame||function(a){setTimeout(a,17)};d3.scale={},d3.scale.linear=function(){return bY([0,1],[0,1],d3.interpolate,!1)},d3.scale.log=function(){return ce(d3.scale.linear(),cf)},cf.pow=function(a){return Math.pow(10,a)},cg.pow=function(a){return-Math.pow(10,-a)},d3.scale.pow=function(){return ci(d3.scale.linear(),1)},d3.scale.sqrt=function(){return d3.scale.pow().exponent(.5)},d3.scale.ordinal=function(){return ck({},0,{t:"range",x:[]})},d3.scale.category10=function(){return d3.scale.ordinal().range(cl)},d3.scale.category20=function(){return d3.scale.ordinal().range(cm)},d3.scale.category20b=function(){return d3.scale.ordinal().range(cn)},d3.scale.category20c=function(){return d3.scale.ordinal().range(co)};var cl=["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],cm=["#1f77b4","#aec7e8","#ff7f0e","#ffbb78","#2ca02c","#98df8a","#d62728","#ff9896","#9467bd","#c5b0d5","#8c564b","#c49c94","#e377c2","#f7b6d2","#7f7f7f","#c7c7c7","#bcbd22","#dbdb8d","#17becf","#9edae5"],cn=["#393b79","#5254a3","#6b6ecf","#9c9ede","#637939","#8ca252","#b5cf6b","#cedb9c","#8c6d31","#bd9e39","#e7ba52","#e7cb94","#843c39","#ad494a","#d6616b","#e7969c","#7b4173","#a55194","#ce6dbd","#de9ed6"],co=["#3182bd","#6baed6","#9ecae1","#c6dbef","#e6550d","#fd8d3c","#fdae6b","#fdd0a2","#31a354","#74c476","#a1d99b","#c7e9c0","#756bb1","#9e9ac8","#bcbddc","#dadaeb","#636363","#969696","#bdbdbd","#d9d9d9"];d3.scale.quantile=function(){return cp([],[])},d3.scale.quantize=function(){return cq(0,1,[0,1])},d3.svg={},d3.svg.arc=function(){function e(){var e=a.apply(this,arguments),f=b.apply(this,arguments),g=c.apply(this,arguments)+cr,h=d.apply(this,arguments)+cr,i=(h<g&&(i=g,g=h,h=i),h-g),j=i<Math.PI?"0":"1",k=Math.cos(g),l=Math.sin(g),m=Math.cos(h),n=Math.sin(h);return i>=cs?e?"M0,"+f+"A"+f+","+f+" 0 1,1 0,"+ -f+"A"+f+","+f+" 0 1,1 0,"+f+"M0,"+e+"A"+e+","+e+" 0 1,1 0,"+ -e+"A"+e+","+e+" 0 1,1 0,"+e+"Z":"M0,"+f+"A"+f+","+f+" 0 1,1 0,"+ -f+"A"+f+","+f+" 0 1,1 0,"+f+"Z":e?"M"+f*k+","+f*l+"A"+f+","+f+" 0 "+j+",1 "+f*m+","+f*n+"L"+e*m+","+e*n+"A"+e+","+e+" 0 "+j+",0 "+e*k+","+e*l+"Z":"M"+f*k+","+f*l+"A"+f+","+f+" 0 "+j+",1 "+f*m+","+f*n+"L0,0"+"Z"}var a=ct,b=cu,c=cv,d=cw;e.innerRadius=function(b){if(!arguments.length)return a;a=d3.functor(b);return e},e.outerRadius=function(a){if(!arguments.length)return b;b=d3.functor(a);return e},e.startAngle=function(a){if(!arguments.length)return c;c=d3.functor(a);return e},e.endAngle=function(a){if(!arguments.length)return d;d=d3.functor(a);return e},e.centroid=function(){var e=(a.apply(this,arguments)+b.apply(this,arguments))/2,f=(c.apply(this,arguments)+d.apply(this,arguments))/2+cr;return[Math.cos(f)*e,Math.sin(f)*e]};return e};var cr=-Math.PI/2,cs=2*Math.PI-1e-6;d3.svg.line=function(){return cx(Object)};var cB={linear:cC,"step-before":cD,"step-after":cE,basis:cK,"basis-open":cL,"basis-closed":cM,bundle:cN,cardinal:cH,"cardinal-open":cF,"cardinal-closed":cG,monotone:cW},cP=[0,2/3,1/3,0],cQ=[0,1/3,2/3,0],cR=[0,1/6,2/3,1/6];d3.svg.line.radial=function(){var a=cx(cX);a.radius=a.x,delete a.x,a.angle=a.y,delete a.y;return a},d3.svg.area=function(){return cY(Object)},d3.svg.area.radial=function(){var a=cY(cX);a.radius=a.x,delete a.x,a.innerRadius=a.x0,delete a.x0,a.outerRadius=a.x1,delete a.x1,a.angle=a.y,delete a.y,a.startAngle=a.y0,delete a.y0,a.endAngle=a.y1,delete a.y1;return a},d3.svg.chord=function(){function j(a,b,c,d){return"Q 0,0 "+d}function i(a,b){return"A"+a+","+a+" 0 0,1 "+b}function h(a,b){return a.a0==b.a0&&a.a1==b.a1}function g(a,b,f,g){var h=b.call(a,f,g),i=c.call(a,h,g),j=d.call(a,h,g)+cr,k=e.call(a,h,g)+cr;return{r:i,a0:j,a1:k,p0:[i*Math.cos(j),i*Math.sin(j)],p1:[i*Math.cos(k),i*Math.sin(k)]}}function f(c,d){var e=g(this,a,c,d),f=g(this,b,c,d);return"M"+e.p0+i(e.r,e.p1)+(h(e,f)?j(e.r,e.p1,e.r,e.p0):j(e.r,e.p1,f.r,f.p0)+i(f.r,f.p1)+j(f.r,f.p1,e.r,e.p0))+"Z"}var a=c_,b=da,c=db,d=cv,e=cw;f.radius=function(a){if(!arguments.length)return c;c=d3.functor(a);return f},f.source=function(b){if(!arguments.length)return a;a=d3.functor(b);return f},f.target=function(a){if(!arguments.length)return b;b=d3.functor(a);return f},f.startAngle=function(a){if(!arguments.length)return d;d=d3.functor(a);return f},f.endAngle=function(a){if(!arguments.length)return e;e=d3.functor(a);return f};return f},d3.svg.diagonal=function(){function d(d,e){var f=a.call(this,d,e),g=b.call(this,d,e),h=(f.y+g.y)/2,i=[f,{x:f.x,y:h},{x:g.x,y:h},g];i=i.map(c);return"M"+i[0]+"C"+i[1]+" "+i[2]+" "+i[3]}var a=c_,b=da,c=de;d.source=function(b){if(!arguments.length)return a;a=d3.functor(b);return d},d.target=function(a){if(!arguments.length)return b;b=d3.functor(a);return d},d.projection=function(a){if(!arguments.length)return c;c=a;return d};return d},d3.svg.diagonal.radial=function(){var a=d3.svg.diagonal(),b=de,c=a.projection;a.projection=function(a){return arguments.length?c(df(b=a)):b};return a},d3.svg.mouse=function(a){return dh(a,d3.event)};var dg=/WebKit/.test(navigator.userAgent)?-1:0;d3.svg.touches=function(b){var c=d3.event.touches;return c?a(c).map(function(a){var c=dh(b,a);c.identifier=a.identifier;return c}):[]},d3.svg.symbol=function(){function c(c,d){return(dk[a.call(this,c,d)]||dk.circle)(b.call(this,c,d))}var a=dj,b=di;c.type=function(b){if(!arguments.length)return a;a=d3.functor(b);return c},c.size=function(a){if(!arguments.length)return b;b=d3.functor(a);return c};return c};var dk={circle:function(a){var b=Math.sqrt(a/Math.PI);return"M0,"+b+"A"+b+","+b+" 0 1,1 0,"+ -b+"A"+b+","+b+" 0 1,1 0,"+b+"Z"},cross:function(a){var b=Math.sqrt(a/5)/2;return"M"+ -3*b+","+ -b+"H"+ -b+"V"+ -3*b+"H"+b+"V"+ -b+"H"+3*b+"V"+b+"H"+b+"V"+3*b+"H"+ -b+"V"+b+"H"+ -3*b+"Z"},diamond:function(a){var b=Math.sqrt(a/(2*dm)),c=b*dm;return"M0,"+ -b+"L"+c+",0"+" 0,"+b+" "+ -c+",0"+"Z"},square:function(a){var b=Math.sqrt(a)/2;return"M"+ -b+","+ -b+"L"+b+","+ -b+" "+b+","+b+" "+ -b+","+b+"Z"},"triangle-down":function(a){var b=Math.sqrt(a/dl),c=b*dl/2;return"M0,"+c+"L"+b+","+ -c+" "+ -b+","+ -c+"Z"},"triangle-up":function(a){var b=Math.sqrt(a/dl),c=b*dl/2;return"M0,"+ -c+"L"+b+","+c+" "+ -b+","+c+"Z"}};d3.svg.symbolTypes=d3.keys(dk);var dl=Math.sqrt(3),dm=Math.tan(30*Math.PI/180)})()
<ide>\ No newline at end of file
<add>(function(){function dj(){return"circle"}function di(){return 64}function dh(a,b){var c=(a.ownerSVGElement||a).createSVGPoint();if(dg<0&&(window.scrollX||window.scrollY)){var d=d3.select(document.body).append("svg:svg").style("position","absolute").style("top",0).style("left",0),e=d[0][0].getScreenCTM();dg=!e.f&&!e.e,d.remove()}dg?(c.x=b.pageX,c.y=b.pageY):(c.x=b.clientX,c.y=b.clientY),c=c.matrixTransform(a.getScreenCTM().inverse());return[c.x,c.y]}function df(a){return function(){var b=a.apply(this,arguments),c=b[0],d=b[1]+cr;return[c*Math.cos(d),c*Math.sin(d)]}}function de(a){return[a.x,a.y]}function dd(a){return a.endAngle}function dc(a){return a.startAngle}function db(a){return a.radius}function da(a){return a.target}function c_(a){return a.source}function c$(a){return function(b,c){return a[c][1]}}function cZ(a){return function(b,c){return a[c][0]}}function cY(a){function i(f){if(f.length<1)return null;var i=cy(this,f,b,d),j=cy(this,f,b===c?cZ(i):c,d===e?c$(i):e);return"M"+g(a(j),h)+"L"+g(a(i.reverse()),h)+"Z"}var b=cz,c=cz,d=0,e=cA,f="linear",g=cB[f],h=.7;i.x=function(a){if(!arguments.length)return c;b=c=a;return i},i.x0=function(a){if(!arguments.length)return b;b=a;return i},i.x1=function(a){if(!arguments.length)return c;c=a;return i},i.y=function(a){if(!arguments.length)return e;d=e=a;return i},i.y0=function(a){if(!arguments.length)return d;d=a;return i},i.y1=function(a){if(!arguments.length)return e;e=a;return i},i.interpolate=function(a){if(!arguments.length)return f;g=cB[f=a];return i},i.tension=function(a){if(!arguments.length)return h;h=a;return i};return i}function cX(a){var b,c=-1,d=a.length,e,f;while(++c<d)b=a[c],e=b[0],f=b[1]+cr,b[0]=e*Math.cos(f),b[1]=e*Math.sin(f);return a}function cW(a){return a.length<3?cC(a):a[0]+cI(a,cV(a))}function cV(a){var b=[],c,d,e,f,g=cU(a),h=-1,i=a.length-1;while(++h<i)c=cT(a[h],a[h+1]),Math.abs(c)<1e-6?g[h]=g[h+1]=0:(d=g[h]/c,e=g[h+1]/c,f=d*d+e*e,f>9&&(f=c*3/Math.sqrt(f),g[h]=f*d,g[h+1]=f*e));h=-1;while(++h<=i)f=(a[Math.min(i,h+1)][0]-a[Math.max(0,h-1)][0])/(6*(1+g[h]*g[h])),b.push([f||0,g[h]*f||0]);return b}function cU(a){var b=0,c=a.length-1,d=[],e=a[0],f=a[1],g=d[0]=cT(e,f);while(++b<c)d[b]=g+(g=cT(e=f,f=a[b+1]));d[b]=g;return d}function cT(a,b){return(b[1]-a[1])/(b[0]-a[0])}function cS(a,b,c){a.push("C",cO(cP,b),",",cO(cP,c),",",cO(cQ,b),",",cO(cQ,c),",",cO(cR,b),",",cO(cR,c))}function cO(a,b){return a[0]*b[0]+a[1]*b[1]+a[2]*b[2]+a[3]*b[3]}function cN(a,b){var c=a.length-1,d=a[0][0],e=a[0][1],f=a[c][0]-d,g=a[c][1]-e,h=-1,i,j;while(++h<=c)i=a[h],j=h/c,i[0]=b*i[0]+(1-b)*(d+j*f),i[1]=b*i[1]+(1-b)*(e+j*g);return cK(a)}function cM(a){var b,c=-1,d=a.length,e=d+4,f,g=[],h=[];while(++c<4)f=a[c%d],g.push(f[0]),h.push(f[1]);b=[cO(cR,g),",",cO(cR,h)],--c;while(++c<e)f=a[c%d],g.shift(),g.push(f[0]),h.shift(),h.push(f[1]),cS(b,g,h);return b.join("")}function cL(a){if(a.length<4)return cC(a);var b=[],c=-1,d=a.length,e,f=[0],g=[0];while(++c<3)e=a[c],f.push(e[0]),g.push(e[1]);b.push(cO(cR,f)+","+cO(cR,g)),--c;while(++c<d)e=a[c],f.shift(),f.push(e[0]),g.shift(),g.push(e[1]),cS(b,f,g);return b.join("")}function cK(a){if(a.length<3)return cC(a);var b=[],c=1,d=a.length,e=a[0],f=e[0],g=e[1],h=[f,f,f,(e=a[1])[0]],i=[g,g,g,e[1]];b.push(f,",",g),cS(b,h,i);while(++c<d)e=a[c],h.shift(),h.push(e[0]),i.shift(),i.push(e[1]),cS(b,h,i);c=-1;while(++c<2)h.shift(),h.push(e[0]),i.shift(),i.push(e[1]),cS(b,h,i);return b.join("")}function cJ(a,b){var c=[],d=(1-b)/2,e,f=a[0],g=a[1],h=1,i=a.length;while(++h<i)e=f,f=g,g=a[h],c.push([d*(g[0]-e[0]),d*(g[1]-e[1])]);return c}function cI(a,b){if(b.length<1||a.length!=b.length&&a.length!=b.length+2)return cC(a);var c=a.length!=b.length,d="",e=a[0],f=a[1],g=b[0],h=g,i=1;c&&(d+="Q"+(f[0]-g[0]*2/3)+","+(f[1]-g[1]*2/3)+","+f[0]+","+f[1],e=a[1],i=2);if(b.length>1){h=b[1],f=a[i],i++,d+="C"+(e[0]+g[0])+","+(e[1]+g[1])+","+(f[0]-h[0])+","+(f[1]-h[1])+","+f[0]+","+f[1];for(var j=2;j<b.length;j++,i++)f=a[i],h=b[j],d+="S"+(f[0]-h[0])+","+(f[1]-h[1])+","+f[0]+","+f[1]}if(c){var k=a[i];d+="Q"+(f[0]+h[0]*2/3)+","+(f[1]+h[1]*2/3)+","+k[0]+","+k[1]}return d}function cH(a,b,c){return a.length<3?cC(a):a[0]+cI(a,cJ(a,b))}function cG(a,b){return a.length<3?cC(a):a[0]+cI((a.push(a[0]),a),cJ([a[a.length-2]].concat(a,[a[1]]),b))}function cF(a,b){return a.length<4?cC(a):a[1]+cI(a.slice(1,a.length-1),cJ(a,b))}function cE(a){var b=[],c=0,d=a.length,e=a[0];b.push(e[0],",",e[1]);while(++c<d)b.push("H",(e=a[c])[0],"V",e[1]);return b.join("")}function cD(a){var b=[],c=0,d=a.length,e=a[0];b.push(e[0],",",e[1]);while(++c<d)b.push("V",(e=a[c])[1],"H",e[0]);return b.join("")}function cC(a){var b=[],c=0,d=a.length,e=a[0];b.push(e[0],",",e[1]);while(++c<d)b.push("L",(e=a[c])[0],",",e[1]);return b.join("")}function cA(a){return a[1]}function cz(a){return a[0]}function cy(a,b,c,d){var e=[],f=-1,g=b.length,h=typeof c=="function",i=typeof d=="function",j;if(h&&i)while(++f<g)e.push([c.call(a,j=b[f],f),d.call(a,j,f)]);else if(h)while(++f<g)e.push([c.call(a,b[f],f),d]);else if(i)while(++f<g)e.push([c,d.call(a,b[f],f)]);else while(++f<g)e.push([c,d]);return e}function cx(a){function g(d){return d.length<1?null:"M"+e(a(cy(this,d,b,c)),f)}var b=cz,c=cA,d="linear",e=cB[d],f=.7;g.x=function(a){if(!arguments.length)return b;b=a;return g},g.y=function(a){if(!arguments.length)return c;c=a;return g},g.interpolate=function(a){if(!arguments.length)return d;e=cB[d=a];return g},g.tension=function(a){if(!arguments.length)return f;f=a;return g};return g}function cw(a){return a.endAngle}function cv(a){return a.startAngle}function cu(a){return a.outerRadius}function ct(a){return a.innerRadius}function cq(a,b,c){function g(){d=c.length/(b-a),e=c.length-1;return f}function f(b){return c[Math.max(0,Math.min(e,Math.floor(d*(b-a))))]}var d,e;f.domain=function(c){if(!arguments.length)return[a,b];a=+c[0],b=+c[c.length-1];return g()},f.range=function(a){if(!arguments.length)return c;c=a;return g()},f.copy=function(){return cq(a,b,c)};return g()}function cp(a,b){function e(a){return isNaN(a=+a)?NaN:b[d3.bisect(c,a)]}function d(){var d=0,f=a.length,g=b.length;c=[];while(++d<g)c[d-1]=d3.quantile(a,d/g);return e}var c;e.domain=function(b){if(!arguments.length)return a;a=b.filter(function(a){return!isNaN(a)}).sort(d3.ascending);return d()},e.range=function(a){if(!arguments.length)return b;b=a;return d()},e.quantiles=function(){return c},e.copy=function(){return cp(a,b)};return d()}function ck(a,b,c){function f(c){return d[((a[c]||(a[c]=++b))-1)%d.length]}var d,e;f.domain=function(d){if(!arguments.length)return d3.keys(a);a={},b=0;var e=-1,g=d.length,h;while(++e<g)a[h=d[e]]||(a[h]=++b);return f[c.t](c.x,c.p)},f.range=function(a){if(!arguments.length)return d;d=a,e=0,c={t:"range",x:a};return f},f.rangePoints=function(a,g){arguments.length<2&&(g=0);var h=a[0],i=a[1],j=(i-h)/(b-1+g);d=b<2?[(h+i)/2]:d3.range(h+j*g/2,i+j/2,j),e=0,c={t:"rangePoints",x:a,p:g};return f},f.rangeBands=function(a,g){arguments.length<2&&(g=0);var h=a[0],i=a[1],j=(i-h)/(b+g);d=d3.range(h+j*g,i,j),e=j*(1-g),c={t:"rangeBands",x:a,p:g};return f},f.rangeRoundBands=function(a,g){arguments.length<2&&(g=0);var h=a[0],i=a[1],j=Math.floor((i-h)/(b+g)),k=i-h-(b-g)*j;d=d3.range(h+Math.round(k/2),i,j),e=Math.round(j*(1-g)),c={t:"rangeRoundBands",x:a,p:g};return f},f.rangeBand=function(){return e},f.copy=function(){var d={},e;for(e in a)d[e]=a[e];return ck(d,b,c)};return f[c.t](c.x,c.p)}function cj(a){return function(b){return b<0?-Math.pow(-b,a):Math.pow(b,a)}}function ci(a,b){function e(b){return a(c(b))}var c=cj(b),d=cj(1/b);e.invert=function(b){return d(a.invert(b))},e.domain=function(b){if(!arguments.length)return a.domain().map(d);a.domain(b.map(c));return e},e.ticks=function(a){return ca(e.domain(),a)},e.tickFormat=function(a){return cb(e.domain(),a)},e.nice=function(){return e.domain(bW(e.domain(),b$))},e.exponent=function(a){if(!arguments.length)return b;var f=e.domain();c=cj(b=a),d=cj(1/b);return e.domain(f)},e.copy=function(){return ci(a.copy(),b)};return bZ(e,a)}function ch(a){return a.toPrecision(1)}function cg(a){return-Math.log(-a)/Math.LN10}function cf(a){return Math.log(a)/Math.LN10}function ce(a,b){function d(c){return a(b(c))}var c=b.pow;d.invert=function(b){return c(a.invert(b))},d.domain=function(e){if(!arguments.length)return a.domain().map(c);b=e[0]<0?cg:cf,c=b.pow,a.domain(e.map(b));return d},d.nice=function(){a.domain(bW(a.domain(),bX));return d},d.ticks=function(){var d=bV(a.domain()),e=[];if(d.every(isFinite)){var f=Math.floor(d[0]),g=Math.ceil(d[1]),h=c(d[0]),i=c(d[1]);if(b===cg){e.push(c(f));for(;f++<g;)for(var j=9;j>0;j--)e.push(c(f)*j)}else{for(;f<g;f++)for(var j=1;j<10;j++)e.push(c(f)*j);e.push(c(f))}for(f=0;e[f]<h;f++);for(g=e.length;e[g-1]>i;g--);e=e.slice(f,g)}return e},d.tickFormat=function(){return ch},d.copy=function(){return ce(a.copy(),b)};return bZ(d,a)}function cd(a,b,c,d){var e=[],f=[],g=0,h=a.length;while(++g<h)e.push(c(a[g-1],a[g])),f.push(d(b[g-1],b[g]));return function(b){var c=d3.bisect(a,b,1,a.length-1)-1;return f[c](e[c](b))}}function cc(a,b,c,d){var e=c(a[0],a[1]),f=d(b[0],b[1]);return function(a){return f(e(a))}}function cb(a,b){return d3.format(",."+Math.max(0,-Math.floor(Math.log(b_(a,b)[2])/Math.LN10+.01))+"f")}function ca(a,b){return d3.range.apply(d3,b_(a,b))}function b_(a,b){var c=bV(a),d=c[1]-c[0],e=Math.pow(10,Math.floor(Math.log(d/b)/Math.LN10)),f=b/d*e;f<=.15?e*=10:f<=.35?e*=5:f<=.75&&(e*=2),c[0]=Math.ceil(c[0]/e)*e,c[1]=Math.floor(c[1]/e)*e+e*.5,c[2]=e;return c}function b$(a){a=Math.pow(10,Math.round(Math.log(a)/Math.LN10)-1);return{floor:function(b){return Math.floor(b/a)*a},ceil:function(b){return Math.ceil(b/a)*a}}}function bZ(a,b){a.range=d3.rebind(a,b.range),a.rangeRound=d3.rebind(a,b.rangeRound),a.interpolate=d3.rebind(a,b.interpolate),a.clamp=d3.rebind(a,b.clamp);return a}function bY(a,b,c,d){function h(a){return e(a)}function g(){var g=a.length==2?cc:cd,i=d?G:F;e=g(a,b,i,c),f=g(b,a,i,d3.interpolate);return h}var e,f;h.invert=function(a){return f(a)},h.domain=function(b){if(!arguments.length)return a;a=b.map(Number);return g()},h.range=function(a){if(!arguments.length)return b;b=a;return g()},h.rangeRound=function(a){return h.range(a).interpolate(d3.interpolateRound)},h.clamp=function(a){if(!arguments.length)return d;d=a;return g()},h.interpolate=function(a){if(!arguments.length)return c;c=a;return g()},h.ticks=function(b){return ca(a,b)},h.tickFormat=function(b){return cb(a,b)},h.nice=function(){bW(a,b$);return g()},h.copy=function(){return bY(a,b,c,d)};return g()}function bX(){return Math}function bW(a,b){var c=0,d=a.length-1,e=a[c],f=a[d],g;f<e&&(g=c,c=d,d=g,g=e,e=f,f=g),b=b(f-e),a[c]=b.floor(e),a[d]=b.ceil(f);return a}function bV(a){var b=a[0],c=a[a.length-1];return b<c?[b,c]:[c,b]}function bU(){}function bS(){var a=null,b=bO,c=Infinity;while(b)b.flush?b=a?a.next=b.next:bO=b.next:(c=Math.min(c,b.then+b.delay),b=(a=b).next);return c}function bR(){var a,b=Date.now(),c=bO;while(c)a=b-c.then,a>=c.delay&&(c.flush=c.callback(a)),c=c.next;var d=bS()-b;d>24?(isFinite(d)&&(clearTimeout(bQ),bQ=setTimeout(bR,d)),bP=0):(bP=1,bT(bR))}function bN(a){for(var b=0,c=this.length;b<c;b++)for(var d=this[b],e=0,f=d.length;e<f;e++){var g=d[e];g&&a.call(g=g.node,g.__data__,e,b)}return this}function bM(a){var b=this;return b.each(typeof a=="function"?function(c,d,e){b[e][d].duration=+a.apply(this,arguments)}:(a=+a,function(c,d,e){b[e][d].duration=a}))}function bL(a){var b=this;return b.each(typeof a=="function"?function(c,d,e){b[e][d].delay=+a.apply(this,arguments)}:(a=+a,function(c,d,e){b[e][d].delay=a}))}function bK(){return this.each("end",function(){var a;!this.__transition__&&(a=this.parentNode)&&a.removeChild(this)})}function bJ(a){return this.tween("text",function(b,c){this.textContent=typeof a=="function"?a.call(this,b,c):a})}function bI(a,b,c){arguments.length<3&&(c=null);return this.tween("style."+a,function(d,e){var f=b.call(this,d,e,window.getComputedStyle(this,null).getPropertyValue(a));return f&&function(b){this.style.setProperty(a,f(b),c)}})}function bH(a,b,c){arguments.length<3&&(c=null);return this.styleTween(a,by(b),c)}function bG(a,b){function d(c,d){var e=b.call(this,c,d,this.getAttributeNS(a.space,a.local));return e&&function(b){this.setAttributeNS(a.space,a.local,e(b))}}function c(c,d){var e=b.call(this,c,d,this.getAttribute(a));return e&&function(b){this.setAttribute(a,e(b))}}a=d3.ns.qualify(a);return this.tween("attr."+a,a.local?d:c)}function bF(a,b){return this.attrTween(a,by(b))}function bE(a){var b=[],c,d;typeof a!="function"&&(a=$(a));for(var e=-1,f=this.length;++e<f;)for(var g=this[e],h=-1,i=g.length;++h<i;)if(d=g[h]){b.push(c=a(d.node));for(var j=-1,k=c.length;++j<k;)c[j]={node:c[j],delay:d.delay,duration:d.duration}}return bx(b).ease(this.ease())}function bD(a){var b=[],c,d,e;typeof a!="function"&&(a=Y(a));for(var f=-1,g=this.length;++f<g;){b.push(c=[]);for(var h=this[f],i=-1,j=h.length;++i<j;)(e=h[i])&&(d=a(e.node))?("__data__"in e.node&&(d.__data__=e.node.__data__),c.push({node:d,delay:e.delay,duration:e.duration})):c.push(null)}return bx(b).ease(this.ease())}function by(a){return typeof a=="function"?function(b,c,d){var e=a.call(this,b,c)+"";return d!=e&&d3.interpolate(d,e)}:(a=a+"",function(b,c,d){return d!=a&&d3.interpolate(d,a)})}function bx(a){e(a,bz);var b=bB||++bA,c={},d=d3.dispatch("start","end"),f=bC;a.tween=function(b,d){if(arguments.length<2)return c[b];d==null?delete c[b]:c[b]=d;return a},a.ease=function(b){if(!arguments.length)return f;f=typeof b=="function"?b:d3.ease.apply(d3,arguments);return a},a.each=function(b,c){if(arguments.length<2)return bN.call(a,b);d[b].add(c);return a},d3.timer(function(e){a.each(function(g,h,i){function p(a){if(n.active!==b)return!0;var c=Math.min(1,(a-l)/m),e=f(c),i=j.length;while(--i>=0)j[i].call(k,e);if(c===1){n.active=0,n.owner===b&&delete k.__transition__,bB=b,d.end.dispatch.call(k,g,h),bB=0;return!0}}function o(a){if(n.active<=b){n.active=b,d.start.dispatch.call(k,g,h);for(var e in c)(e=c[e].call(k,g,h))&&j.push(e);l-=a,d3.timer(p)}return!0}var j=[],k=this,l=a[i][h].delay-e,m=a[i][h].duration,n=k.__transition__;n?n.owner<b&&(n.owner=b):n=k.__transition__={active:0,owner:b},l<=0?o(0):d3.timer(o,l)});return!0});return a}function bw(){var a=[],b,c;for(var d=-1,e=this.length;++d<e;){a.push(b=[]);for(var f=this[d],g=-1,h=f.length;++g<h;)b.push((c=f[g])?{node:c,delay:0,duration:250}:null)}return bx(a)}function bv(a){for(var b=0,c=this.length;b<c;b++)for(var d=this[b],e=0,f=d.length;e<f;e++){var g=d[e];if(g)return g}return null}function bu(){return!this.node()}function bt(a){a.apply(this,(arguments[0]=this,arguments));return this}function bs(a){for(var b=-1,c=this.length;++b<c;)for(var d=this[b],e=-1,f=d.length;++e<f;){var g=d[e];g&&a.call(g,g.__data__,e,b)}return this}function br(a,b,c){arguments.length<3&&(c=!1);var d=a.indexOf("."),e=d===-1?a:a.substring(0,d),f="__on"+a;return this.each(function(a,d){function h(a){var c=d3.event;d3.event=a;try{b.call(this,g.__data__,d)}finally{d3.event=c}}this[f]&&this.removeEventListener(e,this[f],c),b&&this.addEventListener(e,this[f]=h,c);var g=this})}function bq(a){arguments.length||(a=d3.ascending);return function(b,c){return a(b&&b.__data__,c&&c.__data__)}}function bp(a){a=bq.apply(this,arguments);for(var b=0,c=this.length;b<c;b++)for(var d=this[b].sort(a),e=1,f=d.length,g=d[0];e<f;e++){var h=d[e];h&&(g&&g.parentNode.insertBefore(h,g.nextSibling),g=h)}return this}function bo(a){return this.each(function(){this.__data__=a.apply(this,arguments)})}function bn(a){var b=[],c,d,e;for(var f=0,g=this.length;f<g;f++){b.push(c=[]),c.parentNode=(d=this[f]).parentNode;for(var h=0,i=d.length;h<i;h++)(e=d[h])&&a.call(e,e.__data__,h)&&c.push(e)}return S(b)}function bm(a){var b=[],c,d,e,f,g;for(var h=-1,i=this.length;++h<i;){e=(f=this[h]).update,b.push(c=[]),c.parentNode=f.parentNode;for(var j=-1,k=f.length;++j<k;)(g=f[j])?(c.push(e[j]=d=a(f.parentNode)),d.__data__=g.__data__):c.push(null)}return S(b)}function bk(a){e(a,bl);return a}function bj(a){return{__data__:a}}function bi(a,b){function f(a,f){var g,h=a.length,i=f.length,j=Math.min(h,i),k=Math.max(h,i),l=[],m=[],n=[],o,p;if(b){var q={},r=[],s,t=f.length;for(g=-1;++g<h;)s=b.call(o=a[g],o.__data__,g),s in q?n[t++]=o:q[s]=o,r.push(s);for(g=-1;++g<i;)o=q[s=b.call(f,p=f[g],g)],o?(o.__data__=p,l[g]=o,m[g]=n[g]=null):(m[g]=bj(p),l[g]=n[g]=null),delete q[s];for(g=-1;++g<h;)r[g]in q&&(n[g]=a[g])}else{for(g=-1;++g<j;)o=a[g],p=f[g],o?(o.__data__=p,l[g]=o,m[g]=n[g]=null):(m[g]=bj(p),l[g]=n[g]=null);for(;g<i;++g)m[g]=bj(f[g]),l[g]=n[g]=null;for(;g<k;++g)n[g]=a[g],m[g]=l[g]=null}m.update=l,m.parentNode=l.parentNode=n.parentNode=a.parentNode,c.push(m),d.push(l),e.push(n)}var c=[],d=[],e=[],g=-1,h=this.length,i;if(typeof a=="function")while(++g<h)f(i=this[g],a.call(i,i.parentNode.__data__,g));else while(++g<h)f(i=this[g],a);var j=S(d);j.enter=function(){return bk(c)},j.exit=function(){return S(e)};return j}function bh(){return this.each(function(){var a=this.parentNode;a&&a.removeChild(this)})}function bg(a,b){function d(c){return c.insertBefore(document.createElementNS(a.space,a.local),U(b,c))}function c(c){return c.insertBefore(document.createElement(a),U(b,c))}a=d3.ns.qualify(a);return this.select(a.local?d:c)}function bf(a){function c(b){return b.appendChild(document.createElementNS(a.space,a.local))}function b(b){return b.appendChild(document.createElement(a))}a=d3.ns.qualify(a);return this.select(a.local?c:b)}function be(a){return arguments.length<1?this.node().innerHTML:this.each(typeof a=="function"?function(){this.innerHTML=a.apply(this,arguments)}:function(){this.innerHTML=a})}function bd(a){return arguments.length<1?this.node().textContent:this.each(typeof a=="function"?function(){this.textContent=a.apply(this,arguments)}:function(){this.textContent=a})}function bc(a,b){function e(){var c=b.apply(this,arguments);c==null?delete this[a]:this[a]=c}function d(){this[a]=b}function c(){delete this[a]}return arguments.length<2?this.node()[a]:this.each(b==null?c:typeof b=="function"?e:d)}function bb(a,b,c){function f(){var d=b.apply(this,arguments);d==null?this.style.removeProperty(a):this.style.setProperty(a,d,c)}function e(){this.style.setProperty(a,b,c)}function d(){this.style.removeProperty(a)}arguments.length<3&&(c="");return arguments.length<2?window.getComputedStyle(this.node(),null).getPropertyValue(a):this.each(b==null?d:typeof b=="function"?f:e)}function ba(a,b){function i(){(b.apply(this,arguments)?f:g).call(this)}function g(){if(b=this.classList)return b.remove(a);var b=this.className,d=b.baseVal!=null,e=d?b.baseVal:b;e=h(e.replace(c," ")),d?b.baseVal=e:this.className=e}function f(){if(b=this.classList)return b.add(a);var b=this.className,d=b.baseVal!=null,e=d?b.baseVal:b;c.lastIndex=0,c.test(e)||(e=h(e+" "+a),d?b.baseVal=e:this.className=e)}var c=new RegExp("(^|\\s+)"+d3.requote(a)+"(\\s+|$)","g");if(arguments.length<2){var d=this.node();if(e=d.classList)return e.contains(a);var e=d.className;c.lastIndex=0;return c.test(e.baseVal!=null?e.baseVal:e)}return this.each(typeof b=="function"?i:b?f:g)}function _(a,b){function i(){var c=b.apply(this,arguments);c==null?this.removeAttributeNS(a.space,a.local):this.setAttributeNS(a.space,a.local,c)}function h(){var c=b.apply(this,arguments);c==null?this.removeAttribute(a):this.setAttribute(a,c)}function g(){this.setAttributeNS(a.space,a.local,b)}function f(){this.setAttribute(a,b)}function e(){this.removeAttributeNS(a.space,a.local)}function d(){this.removeAttribute(a)}a=d3.ns.qualify(a);if(arguments.length<2){var c=this.node();return a.local?c.getAttributeNS(a.space,a.local):c.getAttribute(a)}return this.each(b==null?a.local?e:d:typeof b=="function"?a.local?i:h:a.local?g:f)}function $(a){return function(b){return V(a,b)}}function Z(a){var b=[],c,d;typeof a!="function"&&(a=$(a));for(var e=-1,f=this.length;++e<f;)for(var g=this[e],h=-1,i=g.length;++h<i;)if(d=g[h])b.push(c=a(d)),c.parentNode=d;return S(b)}function Y(a){return function(b){return U(a,b)}}function X(a){var b=[],c,d,e,f;typeof a!="function"&&(a=Y(a));for(var g=-1,h=this.length;++g<h;){b.push(c=[]),c.parentNode=(e=this[g]).parentNode;for(var i=-1,j=e.length;++i<j;)(f=e[i])?(c.push(d=a(f)),d&&"__data__"in f&&(d.__data__=f.__data__)):c.push(null)}return S(b)}function S(a){e(a,T);return a}function R(a,b,c){function g(a){return Math.round(f(a)*255)}function f(a){a>360?a-=360:a<0&&(a+=360);return a<60?d+(e-d)*a/60:a<180?e:a<240?d+(e-d)*(240-a)/60:d}var d,e;a=a%360,a<0&&(a+=360),b=b<0?0:b>1?1:b,c=c<0?0:c>1?1:c,e=c<=.5?c*(1+b):c+b-c*b,d=2*c-e;return H(g(a+120),g(a),g(a-120))}function Q(a,b,c){this.h=a,this.s=b,this.l=c}function P(a,b,c){return new Q(a,b,c)}function M(a){var b=parseFloat(a);return a.charAt(a.length-1)==="%"?Math.round(b*2.55):b}function L(a,b,c){var d=Math.min(a/=255,b/=255,c/=255),e=Math.max(a,b,c),f=e-d,g,h,i=(e+d)/2;f?(h=i<.5?f/(e+d):f/(2-e-d),a==e?g=(b-c)/f+(b<c?6:0):b==e?g=(c-a)/f+2:g=(a-b)/f+4,g*=60):h=g=0;return P(g,h,i)}function K(a,b,c){var d=0,e=0,f=0,g,h,i;g=/([a-z]+)\((.*)\)/i.exec(a);if(g){h=g[2].split(",");switch(g[1]){case"hsl":return c(parseFloat(h[0]),parseFloat(h[1])/100,parseFloat(h[2])/100);case"rgb":return b(M(h[0]),M(h[1]),M(h[2]))}}if(i=N[a])return b(i.r,i.g,i.b);a!=null&&a.charAt(0)==="#"&&(a.length===4?(d=a.charAt(1),d+=d,e=a.charAt(2),e+=e,f=a.charAt(3),f+=f):a.length===7&&(d=a.substring(1,3),e=a.substring(3,5),f=a.substring(5,7)),d=parseInt(d,16),e=parseInt(e,16),f=parseInt(f,16));return b(d,e,f)}function J(a){return a<16?"0"+a.toString(16):a.toString(16)}function I(a,b,c){this.r=a,this.g=b,this.b=c}function H(a,b,c){return new I(a,b,c)}function G(a,b){b=1/(b-(a=+a));return function(c){return Math.max(0,Math.min(1,(c-a)*b))}}function F(a,b){b=1/(b-(a=+a));return function(c){return(c-a)*b}}function E(a){return a in D||/\bcolor\b/.test(a)?d3.interpolateRgb:d3.interpolate}function B(a){return a<1/2.75?7.5625*a*a:a<2/2.75?7.5625*(a-=1.5/2.75)*a+.75:a<2.5/2.75?7.5625*(a-=2.25/2.75)*a+.9375:7.5625*(a-=2.625/2.75)*a+.984375}function A(a){a||(a=1.70158);return function(b){return b*b*((a+1)*b-a)}}function z(a,b){var c;arguments.length<2&&(b=.45),arguments.length<1?(a=1,c=b/4):c=b/(2*Math.PI)*Math.asin(1/a);return function(d){return 1+a*Math.pow(2,10*-d)*Math.sin((d-c)*2*Math.PI/b)}}function y(a){return 1-Math.sqrt(1-a*a)}function x(a){return Math.pow(2,10*(a-1))}function w(a){return 1-Math.cos(a*Math.PI/2)}function v(a){return function(b){return Math.pow(b,a)}}function u(a){return a}function t(a){return function(b){return.5*(b<.5?a(2*b):2-a(2-2*b))}}function s(a){return function(b){return 1-a(1-b)}}function n(a){var b=a.lastIndexOf("."),c=b>=0?a.substring(b):(b=a.length,""),d=[];while(b>0)d.push(a.substring(b-=3,b+3));return d.reverse().join(",")+c}function m(a){return a+""}function j(a){var b={},c=[];b.add=function(a){for(var d=0;d<c.length;d++)if(c[d].listener==a)return b;c.push({listener:a,on:!0});return b},b.remove=function(a){for(var d=0;d<c.length;d++){var e=c[d];if(e.listener==a){e.on=!1,c=c.slice(0,d).concat(c.slice(d+1));break}}return b},b.dispatch=function(){var a=c;for(var b=0,d=a.length;b<d;b++){var e=a[b];e.on&&e.listener.apply(this,arguments)}};return b}function h(a){return a.replace(/(^\s+)|(\s+$)/g,"").replace(/\s+/g," ")}function g(a){return a==null}function f(a){return a.length}function c(a){return Array.prototype.slice.call(a)}function b(a){var b=-1,c=a.length,d=[];while(++b<c)d.push(a[b]);return d}d3={version:"1.29.6"},Date.now||(Date.now=function(){return+(new Date)}),Object.create||(Object.create=function(a){function b(){}b.prototype=a;return new b});var a=c;try{a(document.documentElement.childNodes)[0].nodeType}catch(d){a=b}var e=[].__proto__?function(a,b){a.__proto__=b}:function(a,b){for(var c in b)a[c]=b[c]};d3.functor=function(a){return typeof a=="function"?a:function(){return a}},d3.rebind=function(a,b){return function(){var c=b.apply(a,arguments);return arguments.length?a:c}},d3.ascending=function(a,b){return a<b?-1:a>b?1:a>=b?0:NaN},d3.descending=function(a,b){return b<a?-1:b>a?1:b>=a?0:NaN},d3.min=function(a,b){var c=-1,d=a.length,e,f;if(arguments.length===1){while(++c<d&&((e=a[c])==null||e!=e))e=undefined;while(++c<d)(f=a[c])!=null&&e>f&&(e=f)}else{while(++c<d&&((e=b.call(a,a[c],c))==null||e!=e))e=undefined;while(++c<d)(f=b.call(a,a[c],c))!=null&&e>f&&(e=f)}return e},d3.max=function(a,b){var c=-1,d=a.length,e,f;if(arguments.length===1){while(++c<d&&((e=a[c])==null||e!=e))e=undefined;while(++c<d)(f=a[c])!=null&&f>e&&(e=f)}else{while(++c<d&&((e=b.call(a,a[c],c))==null||e!=e))e=undefined;while(++c<d)(f=b.call(a,a[c],c))!=null&&f>e&&(e=f)}return e},d3.sum=function(a,b){var c=0,d=a.length,e,f=-1;if(arguments.length===1)while(++f<d)isNaN(e=+a[f])||(c+=e);else while(++f<d)isNaN(e=+b.call(a,a[f],f))||(c+=e);return c},d3.quantile=function(a,b){var c=(a.length-1)*b+1,d=Math.floor(c),e=a[d-1],f=c-d;return f?e+f*(a[d]-e):e},d3.zip=function(){if(!(e=arguments.length))return[];for(var a=-1,b=d3.min(arguments,f),c=Array(b);++a<b;)for(var d=-1,e,g=c[a]=Array(e);++d<e;)g[d]=arguments[d][a];return c},d3.bisectLeft=function(a,b,c,d){arguments.length<3&&(c=0),arguments.length<4&&(d=a.length);while(c<d){var e=c+d>>1;a[e]<b?c=e+1:d=e}return c},d3.bisect=d3.bisectRight=function(a,b,c,d){arguments.length<3&&(c=0),arguments.length<4&&(d=a.length);while(c<d){var e=c+d>>1;b<a[e]?d=e:c=e+1}return c},d3.first=function(a,b){var c=0,d=a.length,e=a[0],f;arguments.length===1&&(b=d3.ascending);while(++c<d)b.call(a,e,f=a[c])>0&&(e=f);return e},d3.last=function(a,b){var c=0,d=a.length,e=a[0],f;arguments.length===1&&(b=d3.ascending);while(++c<d)b.call(a,e,f=a[c])<=0&&(e=f);return e},d3.nest=function(){function g(a,d){if(d>=b.length)return a;var e=[],f=c[d++],h;for(h in a)e.push({key:h,values:g(a[h],d)});f&&e.sort(function(a,b){return f(a.key,b.key)});return e}function f(c,g){if(g>=b.length)return e?e.call(a,c):d?c.sort(d):c;var h=-1,i=c.length,j=b[g++],k,l,m={};while(++h<i)(k=j(l=c[h]))in m?m[k].push(l):m[k]=[l];for(k in m)m[k]=f(m[k],g);return m}var a={},b=[],c=[],d,e;a.map=function(a){return f(a,0)},a.entries=function(a){return g(f(a,0),0)},a.key=function(c){b.push(c);return a},a.sortKeys=function(d){c[b.length-1]=d;return a},a.sortValues=function(b){d=b;return a},a.rollup=function(b){e=b;return a};return a},d3.keys=function(a){var b=[];for(var c in a)b.push(c);return b},d3.values=function(a){var b=[];for(var c in a)b.push(a[c]);return b},d3.entries=function(a){var b=[];for(var c in a)b.push({key:c,value:a[c]});return b},d3.permute=function(a,b){var c=[],d=-1,e=b.length;while(++d<e)c[d]=a[b[d]];return c},d3.merge=function(a){return Array.prototype.concat.apply([],a)},d3.split=function(a,b){var c=[],d=[],e,f=-1,h=a.length;arguments.length<2&&(b=g);while(++f<h)b.call(d,e=a[f],f)?d=[]:(d.length||c.push(d),d.push(e));return c},d3.range=function(a,b,c){arguments.length<3&&(c=1,arguments.length<2&&(b=a,a=0));if((b-a)/c==Infinity)throw new Error("infinite range");var d=[],e=-1,f;if(c<0)while((f=a+c*++e)>b)d.push(f);else while((f=a+c*++e)<b)d.push(f);return d},d3.requote=function(a){return a.replace(i,"\\$&")};var i=/[\\\^\$\*\+\?\|\[\]\(\)\.\{\}]/g;d3.round=function(a,b){return b?Math.round(a*Math.pow(10,b))*Math.pow(10,-b):Math.round(a)},d3.xhr=function(a,b,c){var d=new XMLHttpRequest;arguments.length<3?c=b:b&&d.overrideMimeType&&d.overrideMimeType(b),d.open("GET",a,!0),d.onreadystatechange=function(){d.readyState===4&&c(d.status<300?d:null)},d.send(null)},d3.text=function(a,b,c){function d(a){c(a&&a.responseText)}arguments.length<3&&(c=b,b=null),d3.xhr(a,b,d)},d3.json=function(a,b){d3.text(a,"application/json",function(a){b(a?JSON.parse(a):null)})},d3.html=function(a,b){d3.text(a,"text/html",function(a){if(a!=null){var c=document.createRange();c.selectNode(document.body),a=c.createContextualFragment(a)}b(a)})},d3.xml=function(a,b,c){function d(a){c(a&&a.responseXML)}arguments.length<3&&(c=b,b=null),d3.xhr(a,b,d)},d3.ns={prefix:{svg:"http://www.w3.org/2000/svg",xhtml:"http://www.w3.org/1999/xhtml",xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"},qualify:function(a){var b=a.indexOf(":");return b<0?a:{space:d3.ns.prefix[a.substring(0,b)],local:a.substring(b+1)}}},d3.dispatch=function(a){var b={},c;for(var d=0,e=arguments.length;d<e;d++)c=arguments[d],b[c]=j(c);return b},d3.format=function(a){var b=k.exec(a),c=b[1]||" ",d=b[3]||"",e=b[5],f=+b[6],g=b[7],h=b[8],i=b[9],j=!1,o=!1;h&&(h=h.substring(1)),e&&(c="0",g&&(f-=Math.floor((f-1)/4)));switch(i){case"n":g=!0,i="g";break;case"%":j=!0,i="f";break;case"p":j=!0,i="r";break;case"d":o=!0,h="0"}i=l[i]||m;return function(a){var b=j?a*100:+a,k=b<0&&(b=-b)?"−":d;if(o&&b%1)return"";a=i(b,h);if(e){var l=a.length+k.length;l<f&&(a=Array(f-l+1).join(c)+a),g&&(a=n(a)),a=k+a}else{g&&(a=n(a)),a=k+a;var l=a.length;l<f&&(a=Array(f-l+1).join(c)+a)}j&&(a+="%");return a}};var k=/(?:([^{])?([<>=^]))?([+\- ])?(#)?(0)?([0-9]+)?(,)?(\.[0-9]+)?([a-zA-Z%])?/,l={g:function(a,b){return a.toPrecision(b)},e:function(a,b){return a.toExponential(b)},f:function(a,b){return a.toFixed(b)},r:function(a,b){var c=1+Math.floor(1e-15+Math.log(a)/Math.LN10);return d3.round(a,b-c).toFixed(Math.max(0,Math.min(20,b-c)))}},o=v(2),p=v(3),q={linear:function(){return u},poly:v,quad:function(){return o},cubic:function(){return p},sin:function(){return w},exp:function(){return x},circle:function(){return y},elastic:z,back:A,bounce:function(){return B}},r={"in":function(a){return a},out:s,"in-out":t,"out-in":function(a){return t(s(a))}};d3.ease=function(a){var b=a.indexOf("-"),c=b>=0?a.substring(0,b):a,d=b>=0?a.substring(b+1):"in";return r[d](q[c].apply(null,Array.prototype.slice.call(arguments,1)))},d3.event=null,d3.interpolate=function(a,b){var c=d3.interpolators.length,d;while(--c>=0&&!(d=d3.interpolators[c](a,b)));return d},d3.interpolateNumber=function(a,b){b-=a;return function(c){return a+b*c}},d3.interpolateRound=function(a,b){b-=a;return function(c){return Math.round(a+b*c)}},d3.interpolateString=function(a,b){var c,d,e,f=0,g=0,h=[],i=[],j,k;C.lastIndex=0;for(d=0;c=C.exec(b);++d)c.index&&h.push(b.substring(f,g=c.index)),i.push({i:h.length,x:c[0]}),h.push(null),f=C.lastIndex;f<b.length&&h.push(b.substring(f));for(d=0,j=i.length;(c=C.exec(a))&&d<j;++d){k=i[d];if(k.x==c[0]){if(k.i)if(h[k.i+1]==null){h[k.i-1]+=k.x,h.splice(k.i,1);for(e=d+1;e<j;++e)i[e].i--}else{h[k.i-1]+=k.x+h[k.i+1],h.splice(k.i,2);for(e=d+1;e<j;++e)i[e].i-=2}else if(h[k.i+1]==null)h[k.i]=k.x;else{h[k.i]=k.x+h[k.i+1],h.splice(k.i+1,1);for(e=d+1;e<j;++e)i[e].i--}i.splice(d,1),j--,d--}else k.x=d3.interpolateNumber(parseFloat(c[0]),parseFloat(k.x))}while(d<j)k=i.pop(),h[k.i+1]==null?h[k.i]=k.x:(h[k.i]=k.x+h[k.i+1],h.splice(k.i+1,1)),j--;return h.length===1?h[0]==null?i[0].x:function(){return b}:function(a){for(d=0;d<j;++d)h[(k=i[d]).i]=k.x(a);return h.join("")}},d3.interpolateRgb=function(a,b){a=d3.rgb(a),b=d3.rgb(b);var c=a.r,d=a.g,e=a.b,f=b.r-c,g=b.g-d,h=b.b-e;return function(a){return"rgb("+Math.round(c+f*a)+","+Math.round(d+g*a)+","+Math.round(e+h*a)+")"}},d3.interpolateHsl=function(a,b){a=d3.hsl(a),b=d3.hsl(b);var c=a.h,d=a.s,e=a.l,f=b.h-c,g=b.s-d,h=b.l-e;return function(a){return R(c+f*a,d+g*a,e+h*a).toString()}},d3.interpolateArray=function(a,b){var c=[],d=[],e=a.length,f=b.length,g=Math.min(a.length,b.length),h;for(h=0;h<g;++h)c.push(d3.interpolate(a[h],b[h]));for(;h<e;++h)d[h]=a[h];for(;h<f;++h)d[h]=b[h];return function(a){for(h=0;h<g;++h)d[h]=c[h](a);return d}},d3.interpolateObject=function(a,b){var c={},d={},e;for(e in a)e in b?c[e]=E(e)(a[e],b[e]):d[e]=a[e];for(e in b)e in a||(d[e]=b[e]);return function(a){for(e in c)d[e]=c[e](a);return d}};var C=/[-+]?(?:\d+\.\d+|\d+\.|\.\d+|\d+)(?:[eE][-]?\d+)?/g,D={background:1,fill:1,stroke:1};d3.interpolators=[d3.interpolateObject,function(a,b){return b instanceof Array&&d3.interpolateArray(a,b)},function(a,b){return typeof b=="string"&&d3.interpolateString(String(a),b)},function(a,b){return(typeof b=="string"?b in N||/^(#|rgb\(|hsl\()/.test(b):b instanceof I||b instanceof Q)&&d3.interpolateRgb(String(a),b)},function(a,b){return typeof b=="number"&&d3.interpolateNumber(+a,b)}],d3.rgb=function(a,b,c){return arguments.length===1?K(""+a,H,R):H(~~a,~~b,~~c)},I.prototype.brighter=function(a){a=Math.pow(.7,arguments.length?a:1);var b=this.r,c=this.g,d=this.b,e=30;if(!b&&!c&&!d)return H(e,e,e);b&&b<e&&(b=e),c&&c<e&&(c=e),d&&d<e&&(d=e);return H(Math.min(255,Math.floor(b/a)),Math.min(255,Math.floor(c/a)),Math.min(255,Math.floor(d/a)))},I.prototype.darker=function(a){a=Math.pow(.7,arguments.length?a:1);return H(Math.max(0,Math.floor(a*this.r)),Math.max(0,Math.floor(a*this.g)),Math.max(0,Math.floor(a*this.b)))},I.prototype.hsl=function(){return L(this.r,this.g,this.b)},I.prototype.toString=function(){return"#"+J(this.r)+J(this.g)+J(this.b)};var N={aliceblue:"#f0f8ff",antiquewhite:"#faebd7",aqua:"#00ffff"
<add>,aquamarine:"#7fffd4",azure:"#f0ffff",beige:"#f5f5dc",bisque:"#ffe4c4",black:"#000000",blanchedalmond:"#ffebcd",blue:"#0000ff",blueviolet:"#8a2be2",brown:"#a52a2a",burlywood:"#deb887",cadetblue:"#5f9ea0",chartreuse:"#7fff00",chocolate:"#d2691e",coral:"#ff7f50",cornflowerblue:"#6495ed",cornsilk:"#fff8dc",crimson:"#dc143c",cyan:"#00ffff",darkblue:"#00008b",darkcyan:"#008b8b",darkgoldenrod:"#b8860b",darkgray:"#a9a9a9",darkgreen:"#006400",darkgrey:"#a9a9a9",darkkhaki:"#bdb76b",darkmagenta:"#8b008b",darkolivegreen:"#556b2f",darkorange:"#ff8c00",darkorchid:"#9932cc",darkred:"#8b0000",darksalmon:"#e9967a",darkseagreen:"#8fbc8f",darkslateblue:"#483d8b",darkslategray:"#2f4f4f",darkslategrey:"#2f4f4f",darkturquoise:"#00ced1",darkviolet:"#9400d3",deeppink:"#ff1493",deepskyblue:"#00bfff",dimgray:"#696969",dimgrey:"#696969",dodgerblue:"#1e90ff",firebrick:"#b22222",floralwhite:"#fffaf0",forestgreen:"#228b22",fuchsia:"#ff00ff",gainsboro:"#dcdcdc",ghostwhite:"#f8f8ff",gold:"#ffd700",goldenrod:"#daa520",gray:"#808080",green:"#008000",greenyellow:"#adff2f",grey:"#808080",honeydew:"#f0fff0",hotpink:"#ff69b4",indianred:"#cd5c5c",indigo:"#4b0082",ivory:"#fffff0",khaki:"#f0e68c",lavender:"#e6e6fa",lavenderblush:"#fff0f5",lawngreen:"#7cfc00",lemonchiffon:"#fffacd",lightblue:"#add8e6",lightcoral:"#f08080",lightcyan:"#e0ffff",lightgoldenrodyellow:"#fafad2",lightgray:"#d3d3d3",lightgreen:"#90ee90",lightgrey:"#d3d3d3",lightpink:"#ffb6c1",lightsalmon:"#ffa07a",lightseagreen:"#20b2aa",lightskyblue:"#87cefa",lightslategray:"#778899",lightslategrey:"#778899",lightsteelblue:"#b0c4de",lightyellow:"#ffffe0",lime:"#00ff00",limegreen:"#32cd32",linen:"#faf0e6",magenta:"#ff00ff",maroon:"#800000",mediumaquamarine:"#66cdaa",mediumblue:"#0000cd",mediumorchid:"#ba55d3",mediumpurple:"#9370db",mediumseagreen:"#3cb371",mediumslateblue:"#7b68ee",mediumspringgreen:"#00fa9a",mediumturquoise:"#48d1cc",mediumvioletred:"#c71585",midnightblue:"#191970",mintcream:"#f5fffa",mistyrose:"#ffe4e1",moccasin:"#ffe4b5",navajowhite:"#ffdead",navy:"#000080",oldlace:"#fdf5e6",olive:"#808000",olivedrab:"#6b8e23",orange:"#ffa500",orangered:"#ff4500",orchid:"#da70d6",palegoldenrod:"#eee8aa",palegreen:"#98fb98",paleturquoise:"#afeeee",palevioletred:"#db7093",papayawhip:"#ffefd5",peachpuff:"#ffdab9",peru:"#cd853f",pink:"#ffc0cb",plum:"#dda0dd",powderblue:"#b0e0e6",purple:"#800080",red:"#ff0000",rosybrown:"#bc8f8f",royalblue:"#4169e1",saddlebrown:"#8b4513",salmon:"#fa8072",sandybrown:"#f4a460",seagreen:"#2e8b57",seashell:"#fff5ee",sienna:"#a0522d",silver:"#c0c0c0",skyblue:"#87ceeb",slateblue:"#6a5acd",slategray:"#708090",slategrey:"#708090",snow:"#fffafa",springgreen:"#00ff7f",steelblue:"#4682b4",tan:"#d2b48c",teal:"#008080",thistle:"#d8bfd8",tomato:"#ff6347",turquoise:"#40e0d0",violet:"#ee82ee",wheat:"#f5deb3",white:"#ffffff",whitesmoke:"#f5f5f5",yellow:"#ffff00",yellowgreen:"#9acd32"};for(var O in N)N[O]=K(N[O],H,R);d3.hsl=function(a,b,c){return arguments.length===1?K(""+a,L,P):P(+a,+b,+c)},Q.prototype.brighter=function(a){a=Math.pow(.7,arguments.length?a:1);return P(this.h,this.s,this.l/a)},Q.prototype.darker=function(a){a=Math.pow(.7,arguments.length?a:1);return P(this.h,this.s,a*this.l)},Q.prototype.rgb=function(){return R(this.h,this.s,this.l)},Q.prototype.toString=function(){return"hsl("+this.h+","+this.s*100+"%,"+this.l*100+"%)"},d3.select=function(a){return typeof a=="string"?W.select(a):S([[a]])},d3.selectAll=function(b){return typeof b=="string"?W.selectAll(b):S([a(b)])};var T=[];T.select=X,T.selectAll=Z,T.attr=_,T.classed=ba,T.style=bb,T.property=bc,T.text=bd,T.html=be,T.append=bf,T.insert=bg,T.remove=bh,T.data=bi,T.filter=bn,T.map=bo,T.sort=bp,T.on=br,T.transition=bw,T.each=bs,T.call=bt,T.empty=bu,T.node=bv;var U=function(a,b){return b.querySelector(a)},V=function(b,c){return a(c.querySelectorAll(b))};typeof Sizzle=="function"&&(U=function(a,b){return Sizzle(a,b)[0]},V=function(a,b){return Sizzle.uniqueSort(Sizzle(a,b))});var W=S([[document]]);W[0].parentNode=document.documentElement;var bl=[];bl.select=bm,bl.append=bf,bl.insert=bg,bl.empty=bu;var bz=[],bA=0,bB=0,bC=d3.ease("cubic-in-out");bz.select=bD,bz.selectAll=bE,bz.attr=bF,bz.attrTween=bG,bz.style=bH,bz.styleTween=bI,bz.text=bJ,bz.remove=bK,bz.delay=bL,bz.duration=bM,bz.call=bt,d3.transition=function(){return W.transition()};var bO=null,bP,bQ;d3.timer=function(a,b){var c=Date.now(),d=!1,e,f=bO;if(arguments.length<2)b=0;else if(!isFinite(b))return;while(f){if(f.callback===a){f.then=c,f.delay=b,d=!0;break}e=f,f=f.next}d||(bO={callback:a,then:c,delay:b,next:bO}),bP||(bQ=clearTimeout(bQ),bP=1,bT(bR))},d3.timer.flush=function(){var a,b=Date.now(),c=bO;while(c)a=b-c.then,c.delay||(c.flush=c.callback(a)),c=c.next;bS()};var bT=window.requestAnimationFrame||window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||window.oRequestAnimationFrame||window.msRequestAnimationFrame||function(a){setTimeout(a,17)};d3.scale={},d3.scale.linear=function(){return bY([0,1],[0,1],d3.interpolate,!1)},d3.scale.log=function(){return ce(d3.scale.linear(),cf)},cf.pow=function(a){return Math.pow(10,a)},cg.pow=function(a){return-Math.pow(10,-a)},d3.scale.pow=function(){return ci(d3.scale.linear(),1)},d3.scale.sqrt=function(){return d3.scale.pow().exponent(.5)},d3.scale.ordinal=function(){return ck({},0,{t:"range",x:[]})},d3.scale.category10=function(){return d3.scale.ordinal().range(cl)},d3.scale.category20=function(){return d3.scale.ordinal().range(cm)},d3.scale.category20b=function(){return d3.scale.ordinal().range(cn)},d3.scale.category20c=function(){return d3.scale.ordinal().range(co)};var cl=["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],cm=["#1f77b4","#aec7e8","#ff7f0e","#ffbb78","#2ca02c","#98df8a","#d62728","#ff9896","#9467bd","#c5b0d5","#8c564b","#c49c94","#e377c2","#f7b6d2","#7f7f7f","#c7c7c7","#bcbd22","#dbdb8d","#17becf","#9edae5"],cn=["#393b79","#5254a3","#6b6ecf","#9c9ede","#637939","#8ca252","#b5cf6b","#cedb9c","#8c6d31","#bd9e39","#e7ba52","#e7cb94","#843c39","#ad494a","#d6616b","#e7969c","#7b4173","#a55194","#ce6dbd","#de9ed6"],co=["#3182bd","#6baed6","#9ecae1","#c6dbef","#e6550d","#fd8d3c","#fdae6b","#fdd0a2","#31a354","#74c476","#a1d99b","#c7e9c0","#756bb1","#9e9ac8","#bcbddc","#dadaeb","#636363","#969696","#bdbdbd","#d9d9d9"];d3.scale.quantile=function(){return cp([],[])},d3.scale.quantize=function(){return cq(0,1,[0,1])},d3.svg={},d3.svg.arc=function(){function e(){var e=a.apply(this,arguments),f=b.apply(this,arguments),g=c.apply(this,arguments)+cr,h=d.apply(this,arguments)+cr,i=(h<g&&(i=g,g=h,h=i),h-g),j=i<Math.PI?"0":"1",k=Math.cos(g),l=Math.sin(g),m=Math.cos(h),n=Math.sin(h);return i>=cs?e?"M0,"+f+"A"+f+","+f+" 0 1,1 0,"+ -f+"A"+f+","+f+" 0 1,1 0,"+f+"M0,"+e+"A"+e+","+e+" 0 1,1 0,"+ -e+"A"+e+","+e+" 0 1,1 0,"+e+"Z":"M0,"+f+"A"+f+","+f+" 0 1,1 0,"+ -f+"A"+f+","+f+" 0 1,1 0,"+f+"Z":e?"M"+f*k+","+f*l+"A"+f+","+f+" 0 "+j+",1 "+f*m+","+f*n+"L"+e*m+","+e*n+"A"+e+","+e+" 0 "+j+",0 "+e*k+","+e*l+"Z":"M"+f*k+","+f*l+"A"+f+","+f+" 0 "+j+",1 "+f*m+","+f*n+"L0,0"+"Z"}var a=ct,b=cu,c=cv,d=cw;e.innerRadius=function(b){if(!arguments.length)return a;a=d3.functor(b);return e},e.outerRadius=function(a){if(!arguments.length)return b;b=d3.functor(a);return e},e.startAngle=function(a){if(!arguments.length)return c;c=d3.functor(a);return e},e.endAngle=function(a){if(!arguments.length)return d;d=d3.functor(a);return e},e.centroid=function(){var e=(a.apply(this,arguments)+b.apply(this,arguments))/2,f=(c.apply(this,arguments)+d.apply(this,arguments))/2+cr;return[Math.cos(f)*e,Math.sin(f)*e]};return e};var cr=-Math.PI/2,cs=2*Math.PI-1e-6;d3.svg.line=function(){return cx(Object)};var cB={linear:cC,"step-before":cD,"step-after":cE,basis:cK,"basis-open":cL,"basis-closed":cM,bundle:cN,cardinal:cH,"cardinal-open":cF,"cardinal-closed":cG,monotone:cW},cP=[0,2/3,1/3,0],cQ=[0,1/3,2/3,0],cR=[0,1/6,2/3,1/6];d3.svg.line.radial=function(){var a=cx(cX);a.radius=a.x,delete a.x,a.angle=a.y,delete a.y;return a},d3.svg.area=function(){return cY(Object)},d3.svg.area.radial=function(){var a=cY(cX);a.radius=a.x,delete a.x,a.innerRadius=a.x0,delete a.x0,a.outerRadius=a.x1,delete a.x1,a.angle=a.y,delete a.y,a.startAngle=a.y0,delete a.y0,a.endAngle=a.y1,delete a.y1;return a},d3.svg.chord=function(){function j(a,b,c,d){return"Q 0,0 "+d}function i(a,b){return"A"+a+","+a+" 0 0,1 "+b}function h(a,b){return a.a0==b.a0&&a.a1==b.a1}function g(a,b,f,g){var h=b.call(a,f,g),i=c.call(a,h,g),j=d.call(a,h,g)+cr,k=e.call(a,h,g)+cr;return{r:i,a0:j,a1:k,p0:[i*Math.cos(j),i*Math.sin(j)],p1:[i*Math.cos(k),i*Math.sin(k)]}}function f(c,d){var e=g(this,a,c,d),f=g(this,b,c,d);return"M"+e.p0+i(e.r,e.p1)+(h(e,f)?j(e.r,e.p1,e.r,e.p0):j(e.r,e.p1,f.r,f.p0)+i(f.r,f.p1)+j(f.r,f.p1,e.r,e.p0))+"Z"}var a=c_,b=da,c=db,d=cv,e=cw;f.radius=function(a){if(!arguments.length)return c;c=d3.functor(a);return f},f.source=function(b){if(!arguments.length)return a;a=d3.functor(b);return f},f.target=function(a){if(!arguments.length)return b;b=d3.functor(a);return f},f.startAngle=function(a){if(!arguments.length)return d;d=d3.functor(a);return f},f.endAngle=function(a){if(!arguments.length)return e;e=d3.functor(a);return f};return f},d3.svg.diagonal=function(){function d(d,e){var f=a.call(this,d,e),g=b.call(this,d,e),h=(f.y+g.y)/2,i=[f,{x:f.x,y:h},{x:g.x,y:h},g];i=i.map(c);return"M"+i[0]+"C"+i[1]+" "+i[2]+" "+i[3]}var a=c_,b=da,c=de;d.source=function(b){if(!arguments.length)return a;a=d3.functor(b);return d},d.target=function(a){if(!arguments.length)return b;b=d3.functor(a);return d},d.projection=function(a){if(!arguments.length)return c;c=a;return d};return d},d3.svg.diagonal.radial=function(){var a=d3.svg.diagonal(),b=de,c=a.projection;a.projection=function(a){return arguments.length?c(df(b=a)):b};return a},d3.svg.mouse=function(a){return dh(a,d3.event)};var dg=/WebKit/.test(navigator.userAgent)?-1:0;d3.svg.touches=function(b){var c=d3.event.touches;return c?a(c).map(function(a){var c=dh(b,a);c.identifier=a.identifier;return c}):[]},d3.svg.symbol=function(){function c(c,d){return(dk[a.call(this,c,d)]||dk.circle)(b.call(this,c,d))}var a=dj,b=di;c.type=function(b){if(!arguments.length)return a;a=d3.functor(b);return c},c.size=function(a){if(!arguments.length)return b;b=d3.functor(a);return c};return c};var dk={circle:function(a){var b=Math.sqrt(a/Math.PI);return"M0,"+b+"A"+b+","+b+" 0 1,1 0,"+ -b+"A"+b+","+b+" 0 1,1 0,"+b+"Z"},cross:function(a){var b=Math.sqrt(a/5)/2;return"M"+ -3*b+","+ -b+"H"+ -b+"V"+ -3*b+"H"+b+"V"+ -b+"H"+3*b+"V"+b+"H"+b+"V"+3*b+"H"+ -b+"V"+b+"H"+ -3*b+"Z"},diamond:function(a){var b=Math.sqrt(a/(2*dm)),c=b*dm;return"M0,"+ -b+"L"+c+",0"+" 0,"+b+" "+ -c+",0"+"Z"},square:function(a){var b=Math.sqrt(a)/2;return"M"+ -b+","+ -b+"L"+b+","+ -b+" "+b+","+b+" "+ -b+","+b+"Z"},"triangle-down":function(a){var b=Math.sqrt(a/dl),c=b*dl/2;return"M0,"+c+"L"+b+","+ -c+" "+ -b+","+ -c+"Z"},"triangle-up":function(a){var b=Math.sqrt(a/dl),c=b*dl/2;return"M0,"+ -c+"L"+b+","+c+" "+ -b+","+c+"Z"}};d3.svg.symbolTypes=d3.keys(dk);var dl=Math.sqrt(3),dm=Math.tan(30*Math.PI/180)})()
<ide>\ No newline at end of file
<ide><path>src/core/transition.js
<ide> function d3_transition(groups) {
<ide> node = this,
<ide> delay = groups[j][i].delay - elapsed,
<ide> duration = groups[j][i].duration,
<del> lock = node.__transition__ || (node.__transition__ = {active: 0});
<add> lock = node.__transition__;
<ide>
<del> lock.owner = id;
<add> if (!lock) lock = node.__transition__ = {active: 0, owner: id};
<add> else if (lock.owner < id) lock.owner = id;
<ide> delay <= 0 ? start(0) : d3.timer(start, delay);
<ide>
<ide> function start(elapsed) {
<ide><path>test/core/timer-test.js
<ide> suite.addBatch({
<ide> "with no delay": {
<ide> topic: timer(),
<ide> "first calls after 17 ms or less": function(info) {
<del> assert.inDelta(info.start - info.scheduled, 17, 15);
<add> assert.inDelta(info.start - info.scheduled, 17, 20);
<ide> },
<ide> "calls until the function returns true": function(info) {
<ide> assert.equal(info.count, 4);
<ide> },
<ide> "calls every 17 ms": function(info) {
<del> assert.inDelta(info.stop - info.start, 17 * 3, 15);
<add> assert.inDelta(info.stop - info.start, 17 * 3, 20);
<ide> }
<ide> },
<ide> "with a specified delay": {
<ide> topic: timer(250),
<ide> "first calls after the delay": function(info) {
<del> assert.inDelta(info.start - info.scheduled, 250, 15);
<add> assert.inDelta(info.start - info.scheduled, 250, 20);
<ide> },
<ide> "calls until the function returns true": function(info) {
<ide> assert.equal(info.count, 4);
<ide> },
<ide> "calls every 17 ms": function(info) {
<del> assert.inDelta(info.stop - info.start, 17 * 3, 15);
<add> assert.inDelta(info.stop - info.start, 17 * 3, 20);
<ide> }
<ide> }
<ide> }
<ide><path>test/core/transition-test-each.js
<ide> module.exports = {
<ide> },
<ide>
<ide> "invokes the listener after the specified delay": function(result) {
<del> assert.inDelta(result.delay, [150, 150], 17);
<add> assert.inDelta(result.delay, [150, 150], 20);
<ide> },
<ide> "invokes each listener exactly once, in order": function(result) {
<ide> assert.deepEqual(result.count, [2, 4]);
<ide> module.exports = {
<ide> },
<ide>
<ide> "invokes the listener after the specified delay": function(result) {
<del> assert.inDelta(result.delay, [150, 150], 17);
<add> assert.inDelta(result.delay, [150, 150], 20);
<ide> },
<ide> "invokes each listener exactly once, in order": function(result) {
<ide> assert.deepEqual(result.count, [2, 4]);
<ide><path>test/core/transition-test-remove.js
<add>require("../env");
<add>require("../../d3");
<add>
<add>var assert = require("assert");
<add>
<add>module.exports = {
<add> topic: function() {
<add> var cb = this.callback,
<add> t = d3.select("body").append("div").transition().remove();
<add> t.each("end", function() { cb(null, t); });
<add> },
<add> "removes the selected elements": function(transition) {
<add> assert.domEqual(transition[0][0].node.parentNode, null);
<add> },
<add>
<add> "when the element is already removed": {
<add> topic: function() {
<add> var cb = this.callback,
<add> t = d3.select("body").append("div").remove().transition().remove();
<add> t.each("end", function() { cb(null, t); });
<add> },
<add> "does nothing": function(transition) {
<add> assert.domEqual(transition[0][0].node.parentNode, null);
<add> }
<add> },
<add>
<add> // Since these tests are triggered inside the end event of the above topic,
<add> // transitions will inherit ids from the original transition. But we want to
<add> // test concurrent transitions, so we use timeouts to avoid inheritance. This
<add> // test also verifies that if multiple transitions are created at the same
<add> // time, the last transition becomes the owner.
<add>
<add> "when another transition is scheduled": {
<add> topic: function() {
<add> var cb = this.callback,
<add> s = d3.select("body").append("div");
<add> setTimeout(function() {
<add> s.transition().duration(150).remove().each("end", function() { cb(null, s); });
<add> s.transition().delay(250);
<add> }, 10);
<add> },
<add> "does nothing": function(selection) {
<add> assert.domEqual(selection[0][0].parentNode, document.body);
<add> }
<add> }
<add>};
<ide><path>test/core/transition-test.js
<ide> suite.addBatch({
<ide> "attr": require("./transition-test-attr"),
<ide> "style": require("./transition-test-style"),
<ide> "text": require("./transition-test-text"),
<del> // remove
<add> "remove": require("./transition-test-remove"),
<ide>
<ide> // Animation
<ide> "delay": require("./transition-test-delay"), | 7 |
Javascript | Javascript | remove workaround for firefox bug | b366f0352abccfe4c4868b5a9e8c0b88659bd1ee | <ide><path>src/ng/directive/input.js
<ide> function badInputChecker(scope, element, attr, ctrl) {
<ide> if (nativeValidation) {
<ide> ctrl.$parsers.push(function(value) {
<ide> var validity = element.prop(VALIDITY_STATE_PROPERTY) || {};
<del> // Detect bug in FF35 for input[email] (https://bugzilla.mozilla.org/show_bug.cgi?id=1064430):
<del> // - also sets validity.badInput (should only be validity.typeMismatch).
<del> // - see http://www.whatwg.org/specs/web-apps/current-work/multipage/forms.html#e-mail-state-(type=email)
<del> // - can ignore this case as we can still read out the erroneous email...
<del> return validity.badInput && !validity.typeMismatch ? undefined : value;
<add> return validity.badInput || validity.typeMismatch ? undefined : value;
<ide> });
<ide> }
<ide> } | 1 |
PHP | PHP | fix additional failing tests under old sqlserver | db1663034f4c20d5aae4f5829689970313b36a70 | <ide><path>src/Database/Dialect/SqlserverDialectTrait.php
<ide> protected function _selectQueryTranslator($query) {
<ide> $query->order($query->newExpr()->add('SELECT NULL'));
<ide> }
<ide>
<del> if ($this->_version() < 11 && $offset) {
<add> if ($this->_version() < 11 && $offset !== null) {
<ide> return $this->_pagingSubquery($query, $limit, $offset);
<ide> }
<ide>
<ide> public function _version() {
<ide> * @param int $offset The number of rows to offset.
<ide> * @return \Cake\Database\Query Modified query object.
<ide> */
<del> protected function _pagingSubquery($query, $limit, $offset) {
<add> protected function _pagingSubquery($original, $limit, $offset) {
<ide> $field = '_cake_paging_._cake_page_rownum_';
<ide>
<add> $query = clone $original;
<ide> $order = $query->clause('order') ?: new OrderByExpression('NULL');
<ide> $query->select([
<ide> '_cake_page_rownum_' => new UnaryExpression($order, [], 'ROW_NUMBER() OVER')
<ide> protected function _pagingSubquery($query, $limit, $offset) {
<ide> $outer = new Query($query->connection());
<ide> $outer->select('*')
<ide> ->from(['_cake_paging_' => $query]);
<add>
<ide> if ($offset) {
<ide> $outer->where(["$field >" => $offset]);
<ide> }
<ide> if ($limit) {
<ide> $outer->where(["$field <=" => (int)$offset + (int)$limit]);
<ide> }
<del> return $outer->decorateResults(function ($row) {
<add>
<add> // Decorate the original query as that is what the
<add> // end developer will be calling execute() on originally.
<add> $original->decorateResults(function ($row) {
<ide> if (isset($row['_cake_page_rownum_'])) {
<ide> unset($row['_cake_page_rownum_']);
<ide> }
<ide> return $row;
<ide> });
<add>
<add> return $outer;
<ide> }
<ide>
<ide> /**
<ide><path>tests/TestCase/Database/QueryTest.php
<ide> public function testSelectOffset() {
<ide> $query = new Query($this->connection);
<ide> $result = $query->select('id')->from('comments')
<ide> ->limit(1)
<del> ->offset(0)->execute();
<add> ->offset(0)
<add> ->order(['id' => 'ASC'])
<add> ->execute();
<ide> $this->assertCount(1, $result);
<ide> $this->assertEquals(['id' => 1], $result->fetch('assoc'));
<ide>
<ide> public function testSelectOffset() {
<ide>
<ide> $query = new Query($this->connection);
<ide> $result = $query->select('id')->from('articles')
<del> ->order(['id' => 'desc'])
<add> ->order(['id' => 'DESC'])
<ide> ->limit(1)
<del> ->offset(0)->execute();
<add> ->offset(0)
<add> ->execute();
<ide> $this->assertCount(1, $result);
<ide> $this->assertEquals(['id' => 3], $result->fetch('assoc'));
<ide> | 2 |
Javascript | Javascript | link spec for finding icon dir in install script | cef511c5d2dd60e7f2a34eb89cd068a7515fc0d9 | <ide><path>script/lib/install-application.js
<ide> function install (installationDirPath, packagedAppFileName, packagedAppPath) {
<ide> fs.copySync(packagedAppPath, installationDirPath)
<ide> }
<ide>
<add>/**
<add> * Finds the path to the base directory of the icon default icon theme
<add> * This follows the freedesktop Icon Theme Specification:
<add> * https://standards.freedesktop.org/icon-theme-spec/icon-theme-spec-latest.html#install_icons
<add> * and the XDG Base Directory Specification:
<add> * https://standards.freedesktop.org/basedir-spec/basedir-spec-latest.html#variables
<add> */
<ide> function findBaseIconThemeDirPath () {
<ide> const defaultBaseIconThemeDir = '/usr/share/icons/hicolor'
<ide> const dataDirsString = process.env.XDG_DATA_DIRS | 1 |
Ruby | Ruby | remove another unnecessary check | 2f052a2f65ea245c63c777656a50aee5d82a2c2f | <ide><path>Library/Homebrew/os/mac.rb
<ide> def locate tool
<ide> # If it's not there, or xcode-select is misconfigured, we have to
<ide> # look in dev_tools_path, and finally in xctoolchain_path, because the
<ide> # tools were split over two locations beginning with Xcode 4.3+.
<del> xcrun_path = unless Xcode.bad_xcode_select_path?
<add> xcrun_path = begin
<ide> path = `/usr/bin/xcrun -find #{tool} 2>/dev/null`.chomp
<ide> # If xcrun finds a superenv tool then discard the result.
<ide> path unless path.include?("Library/ENV")
<ide> def dev_tools_path
<ide> elsif tools_in_prefix? "/"
<ide> # probably a safe enough assumption (the unix way)
<ide> Pathname.new "/usr/bin"
<del> elsif not Xcode.bad_xcode_select_path? and not `/usr/bin/xcrun -find make 2>/dev/null`.empty?
<add> elsif not `/usr/bin/xcrun -find make 2>/dev/null`.empty?
<ide> # Note that the exit status of system "xcrun foo" isn't always accurate
<ide> # Wherever "make" is there are the dev tools.
<ide> Pathname.new(`/usr/bin/xcrun -find make`.chomp).dirname
<ide> def sdk_path(v = version)
<ide> (@sdk_path ||= {}).fetch(v.to_s) do |key|
<ide> opts = []
<ide> # First query Xcode itself
<del> opts << `#{locate('xcodebuild')} -version -sdk macosx#{v} Path 2>/dev/null`.chomp unless Xcode.bad_xcode_select_path?
<add> opts << `#{locate('xcodebuild')} -version -sdk macosx#{v} Path 2>/dev/null`.chomp
<ide> # Xcode.prefix is pretty smart, so lets look inside to find the sdk
<ide> opts << "#{Xcode.prefix}/Platforms/MacOSX.platform/Developer/SDKs/MacOSX#{v}.sdk"
<ide> # Xcode < 4.3 style | 1 |
Mixed | Text | use yaml.unsafe_load for encrypted configuration | d5b65c082ef0c17241de26d5131e5b4d8a01b186 | <ide><path>activesupport/CHANGELOG.md
<add>* Fix `ActiveSupport::EncryptedConfiguration` to be compatible with Psych 4
<add>
<add> *Stephen Sugden*
<add>
<ide> * Improve `File.atomic_write` error handling
<ide>
<ide> * Fix `Class#descendants` and `DescendantsTracker#descendants` compatibility with Ruby 3.1.
<ide><path>activesupport/lib/active_support/encrypted_configuration.rb
<ide> def options
<ide> end
<ide>
<ide> def deserialize(config)
<del> YAML.load(config).presence || {}
<add> doc = YAML.respond_to?(:unsafe_load) ? YAML.unsafe_load(config) : YAML.load(config)
<add> doc.presence || {}
<ide> end
<ide> end
<ide> end | 2 |
Ruby | Ruby | replace implicit formats with a case statement | 0e0cff0f27eb76e84fd2226396f16bb52fe754bd | <ide><path>actionpack/lib/action_controller/metal/strong_parameters.rb
<ide> def inspect
<ide> end
<ide>
<ide> def init_with(coder) # :nodoc:
<del> if coder.map['elements']
<del> # YAML 2.0.9's Hash subclass format from Rails 4.2, where keys and values
<add> case coder.tag
<add> when '!ruby/hash:ActionController::Parameters'
<add> # YAML 2.0.8's format where hash instance variables weren't stored.
<add> @parameters = coder.map.with_indifferent_access
<add> @permitted = false
<add> when '!ruby/hash-with-ivars:ActionController::Parameters'
<add> # YAML 2.0.9's Hash subclass format where keys and values
<ide> # were stored under an elements hash and `permitted` within an ivars hash.
<ide> @parameters = coder.map['elements'].with_indifferent_access
<ide> @permitted = coder.map['ivars'][:@permitted]
<del> elsif coder.map['parameters']
<add> when '!ruby/object:ActionController::Parameters'
<ide> # YAML's Object format. Only needed because of the format
<ide> # backwardscompability above, otherwise equivalent to YAML's initialization.
<ide> @parameters, @permitted = coder.map['parameters'], coder.map['permitted']
<del> else
<del> # YAML 2.0.8's format where hash instance variables weren't stored.
<del> @parameters = coder.map.with_indifferent_access
<del> @permitted = false
<ide> end
<ide> end
<ide> | 1 |
Ruby | Ruby | fix mistype in doc about \z regexp | 18674529f4f3882598ac1f6bee1fbbb93bc3e70b | <ide><path>activemodel/lib/active_model/validations/format.rb
<ide> module HelperMethods
<ide> # with: ->(person) { person.admin? ? /\A[a-z0-9][a-z0-9_\-]*\z/i : /\A[a-z][a-z0-9_\-]*\z/i }
<ide> # end
<ide> #
<del> # Note: use <tt>\A</tt> and <tt>\Z</tt> to match the start and end of the
<add> # Note: use <tt>\A</tt> and <tt>\z</tt> to match the start and end of the
<ide> # string, <tt>^</tt> and <tt>$</tt> match the start/end of a line.
<ide> #
<ide> # Due to frequent misuse of <tt>^</tt> and <tt>$</tt>, you need to pass | 1 |
Javascript | Javascript | allow listener for native animated.event | 33817b83d6c7d6b4cf5d8c250ee88a2c401422a1 | <ide><path>Libraries/Animated/src/AnimatedImplementation.js
<ide> class AnimatedEvent {
<ide> this._listener = config.listener;
<ide> this.__isNative = shouldUseNativeDriver(config);
<ide>
<del> if (this.__isNative) {
<del> invariant(!this._listener, 'Listener is not supported for native driven events.');
<del> }
<del>
<ide> if (__DEV__) {
<ide> this._validateMapping();
<ide> }
<ide> class AnimatedEvent {
<ide> }
<ide>
<ide> __getHandler() {
<add> if (this.__isNative) {
<add> return this._listener;
<add> }
<add>
<ide> return (...args) => {
<ide> const traverse = (recMapping, recEvt, key) => {
<ide> if (typeof recEvt === 'number' && recMapping instanceof AnimatedValue) { | 1 |
PHP | PHP | fix expectations for mock objects | 649996aaba2aa7719de5b9eac90d0c5c11ece0b8 | <ide><path>tests/Database/DatabaseEloquentModelTest.php
<ide> public function testUpdateProcess()
<ide> $model = $this->getMock('EloquentModelStub', array('newQuery', 'updateTimestamps'));
<ide> $query = m::mock('Illuminate\Database\Eloquent\Builder');
<ide> $query->shouldReceive('where')->once()->with('id', '=', 1);
<del> $query->shouldReceive('update')->once()->with(array('id' => 1, 'name' => 'taylor'));
<add> $query->shouldReceive('update')->once()->with(array('name' => 'taylor'));
<ide> $model->expects($this->once())->method('newQuery')->will($this->returnValue($query));
<ide> $model->expects($this->once())->method('updateTimestamps');
<ide> $model->setEventDispatcher($events = m::mock('Illuminate\Events\Dispatcher'));
<ide> public function testUpdateProcessDoesntOverrideTimestamps()
<ide> $model = $this->getMock('EloquentModelStub', array('newQuery'));
<ide> $query = m::mock('Illuminate\Database\Eloquent\Builder');
<ide> $query->shouldReceive('where')->once()->with('id', '=', 1);
<del> $query->shouldReceive('update')->once()->with(array('id' => 1, 'created_at' => 'foo', 'updated_at' => 'bar'));
<add> $query->shouldReceive('update')->once()->with(array('created_at' => 'foo', 'updated_at' => 'bar'));
<ide> $model->expects($this->once())->method('newQuery')->will($this->returnValue($query));
<ide> $model->setEventDispatcher($events = m::mock('Illuminate\Events\Dispatcher'));
<ide> $events->shouldReceive('until');
<ide> public function testUpdateProcessWithoutTimestamps()
<ide> $model->timestamps = false;
<ide> $query = m::mock('Illuminate\Database\Eloquent\Builder');
<ide> $query->shouldReceive('where')->once()->with('id', '=', 1);
<del> $query->shouldReceive('update')->once()->with(array('id' => 1, 'name' => 'taylor'));
<add> $query->shouldReceive('update')->once()->with(array('name' => 'taylor'));
<ide> $model->expects($this->once())->method('newQuery')->will($this->returnValue($query));
<ide> $model->expects($this->never())->method('updateTimestamps');
<ide> $model->expects($this->any())->method('fireModelEvent')->will($this->returnValue(true)); | 1 |
Python | Python | add regression test for #740 | e9e99a56706ab13d6b187b4c1fc409c986e447b9 | <ide><path>spacy/tests/regression/test_issue740.py
<add># coding: utf-8
<add>
<add>from __future__ import unicode_literals
<add>
<add>import pytest
<add>
<add>
<add>@pytest.mark.parametrize('text', ["3/4/2012", "01/12/1900"])
<add>def test_issue740(en_tokenizer, text):
<add> """Test that dates are not split and kept as one token. This behaviour is currently inconsistent, since dates separated by hyphens are still split.
<add> This will be hard to prevent without causing clashes with numeric ranges."""
<add> tokens = en_tokenizer(text)
<add> assert len(tokens) == 1 | 1 |
Text | Text | add blog post about reactelement changes in 0.13 | cd47798c59d7acda50e7c7c2bd51d12f95f50b16 | <ide><path>docs/_posts/2015-02-24-streamlining-react-elements.md
<add>---
<add>title: "Streamlining React Elements"
<add>author: Sebastian Markbåge
<add>---
<add>
<add>React v0.13 is right around the corner and so we wanted to discuss some upcoming changes to ReactElement. In particular, we added several warnings to some esoteric use cases of ReactElement. There are no runtime behavior changes for ReactElement - we're adding these warnings in the hope that we can change some behavior in v0.14 if the changes are valuable to the community.
<add>
<add>If you use React in an idiomatic way, chances are, you’ll never see any of these warnings. In that case, you can skip this blog post. You can just enjoy the benefits! These changes will unlock simplified semantics, better error messages, stack traces and compiler optimizations!
<add>
<add>## Immutable Props
<add>
<add>In React 0.12, the props object was mutable. It allows you to do patterns like this:
<add>
<add>```js
<add>var element = <Foo bar={false} />;
<add>if (shouldUseFoo) {
<add> element.props.foo = 10;
<add> element.props.bar = true;
<add>}
<add>```
<add>
<add>The problem is that we don’t have a convenient way to tell when you’re done mutating.
<add>
<add>### Problem: Mutating Props You Don’t Own
<add>
<add>If you mutate something, you destroy the original value. Therefore, there is nothing to diff against. Imaging something like this:
<add>
<add>```js
<add>var element = this.props.child;
<add>element.props.count = this.state.count;
<add>return element;
<add>```
<add>
<add>You take a ReactElement through `props.child` and mutate its property before rendering it. If this component's state updates, this render function won't actually get a new ReactElement in `props.child`. It will be the same one. You're mutating the same props.
<add>
<add>You could imagine that this would work. However, this disables the ability for any component to use `shouldComponentUpdate`. It looks like the component never changed because the previous value is always the same as the next one. Since the DOM layer does diffing, this pattern doesn't even work in this case. The change will never propagate down to the DOM except the first time.
<add>
<add>Additionally, if this element is reused in other places or used to switch back and forth between two modes, then you have all kinds of weird race conditions.
<add>
<add>It has always been broken to mutate the props of something passed into you. The problem is that we can’t warn you about this special case if you accidentally do this.
<add>
<add>### Problem: Too Late Validation
<add>
<add>In React 0.12, we do PropType validation very deep inside React during mounting. This means that by the time you get an error, the debugger stack is long gone. This makes it difficult to find complex issues during debugging. We have to do this since it is fairly common for extra props to be added between the call to React.createElement and the mount time. So the type is incomplete until then.
<add>
<add>The static analysis in Flow is also impaired by this. There is no convenient place in the code where Flow can determine that the props are finalized.
<add>
<add>### Solution: Immutable Props
<add>
<add>Therefore, we would like to be able to freeze the element.props object so that it is immediately immutable at the JSX callsite (or createElement). In React 0.13 we will start warning you if you mutate `element.props` after this point.
<add>
<add>You can generally refactor these pattern to simply use two different JSX calls:
<add>
<add>```js
<add>if (shouldUseFoo) {
<add> return <Foo foo={10} bar={true} />;
<add>} else {
<add> return <Foo bar={false} />;
<add>}
<add>```
<add>
<add>However, if you really need to dynamically build up your props you can just use a temporary object and spread it into JSX:
<add>
<add>```js
<add>var props = { bar: false };
<add>if (shouldUseFoo) {
<add> props.foo = 10;
<add> props.bar = true;
<add>}
<add>return <Foo {...props} />;
<add>```
<add>
<add>It is still OK to do deep mutations of objects. E.g:
<add>
<add>```js
<add>return <Foo nestedObject={this.state.myModel} />;
<add>```
<add>
<add>In this case it's still ok to mutate the myModel object in state. We recommend that you use fully immutable models. E.g. by using immutable-js. However, we realize that mutable models are still convenient in many cases. Therefore we're only considering shallow freezing the props object that belongs to the ReactElement itself. Not nested objects.
<add>
<add>### Solution: Early PropType Warnings
<add>
<add>We will also start warning you for PropTypes at the JSX or createElement callsite. This will help debugging as you’ll have the stack trace right there. Similarly, Flow also validates PropTypes at this callsite.
<add>
<add>Note: There are valid patterns that clones a ReactElement and adds additional props to it. In that case these additional props needs to be optional.
<add>
<add>```js
<add>var element1 = <Foo />; // extra prop is optional
<add>var element2 = React.addons.cloneWithProps(element1, { extra: 'prop' });
<add>```
<add>
<add>## Owner
<add>
<add>In React each child has both a "parent" and an “owner”. The owner is the component that created a ReactElement. I.e. the render method which contains the JSX or createElement callsite.
<add>
<add>```js
<add>class Foo {
<add> render() {
<add> return <div><span /></div>;
<add> }
<add>}
<add>```
<add>
<add>In this example, the owner of the `span` is `Foo` but the parent is the `div`.
<add>
<add>There is also an undocumented feature called "context" that also relies on the concept of an “owner” to pass hidden props down the tree.
<add>
<add>### Problem: The Semantics are Opaque and Confusing
<add>
<add>The problem is that these are hidden artifacts attached to the ReactElement. In fact, you probably didn’t even know about it. It silently changes semantics. Take this for example:
<add>
<add>```js
<add>var foo = <input className="foo" />;
<add>class Component {
<add> render() {
<add> return bar ? <input className="bar" /> : foo;
<add> }
<add>}
<add>```
<add>
<add>These two inputs have different owners, therefore React will not keep its state when the conditional switches. There is nothing in the code to indicate that. Similarly, if you use `React.addons.cloneWithProps`, the owner changes.
<add>
<add>### Problem: Timing Matters
<add>
<add>The owner is tracked by the currently executing stack. This means that the semantics of a ReactElement varies depending on when it is executed. Take this example:
<add>
<add>```js
<add>class A {
<add> render() {
<add> return <B renderer={text => <span>{text}</span>} />;
<add> }
<add>}
<add>class B {
<add> render() {
<add> return this.props.renderer('foo');
<add> }
<add>}
<add>```
<add>
<add>The owner of the `span` is actually `B`, not `A` because of the timing of the callback. This all adds complexity and suffers from similar problems as mutation.
<add>
<add>### Problem: It Couples JSX to React
<add>
<add>Have you wondered why JSX depends on React? Couldn’t the transpiler have that built-in to its runtime? The reason you need to have `React.createElement` in scope is because we depend on internal state of React to capture the current "owner". Without this, you wouldn’t need to have React in scope.
<add>
<add>### Solution: Make Context Parent-Based Instead of Owner-Based
<add>
<add>The first thing we’re doing is warning you if you’re using the "owner" feature in a way that relies on it propagating through owners. Instead, we’re planning on propagating it through parents to its children. In almost all cases, this shouldn’t matter. In fact, parent-based contexts is simply a superset.
<add>
<add>### Solution: Remove the Semantic Implications of Owner
<add>
<add>It turns out that there are very few cases where owners are actually important part of state-semantics. As a precaution, we’ll warn you if it turns out that the owner is important to determine state. In almost every case this shouldn’t matter. Unless you’re doing some weird optimizations, you shouldn’t see this warning.
<add>
<add>### Pending: Change the refs Semantics
<add>
<add>Refs are still based on "owner". We haven’t fully solved this special case just yet.
<add>
<add>In 0.13 we introduced a new callback-refs API that doesn’t suffer from these problems but we’ll keep on a nice declarative alternative to the current semantics for refs. As always, we won’t deprecate something until we’re sure that you’ll have a nice upgrade path.
<add>
<add>## Keyed Objects as Maps
<add>
<add>In React 0.12, and earlier, you could use keyed objects to provide an external key to an element or a set. This pattern isn’t actually widely used. It shouldn’t be an issue for most of you.
<add>
<add>```js
<add><div>{{ a: <span />, b: <span /> }}</div>
<add>```
<add>
<add>### Problem: Relies on Enumeration Order
<add>
<add>The problem with this pattern is that it relies on enumeration order of objects. This is technically unspecified, even though implementations now agree to use insertion order. Except for the special case when numeric keys are used.
<add>
<add>### Problem: Using Objects as Maps is Bad
<add>
<add>It is generally accepted that using objects as maps screw up type systems, VM optimizations, compilers etc. It is much better to use a dedicated data structure like ES6 Maps.
<add>
<add>More importantly, this can have important security implications. For example this has a potential security problem:
<add>
<add>```js
<add>var children = {};
<add>items.forEach(item => children[item.title] = <span />);
<add>return <div>{children}</div>;
<add>```
<add>
<add>Imagine if `item.title === '__proto__'` for example.
<add>
<add>### Problem: Can’t be Differentiated from Arbitrary Objects
<add>
<add>Since these objects can have any keys with almost any value, we can’t differentiate them from a mistake. If you put some random object, we will try our best to traverse it and render it, instead of failing with a helpful warning. In fact, this is one of the few places where you can accidentally get an infinite loop in React.
<add>
<add>To differentiate ReactElements from one of these objects, we have to tag them with `_isReactElement`. This is another issue preventing us from inlining ReactElements as simple object literals.
<add>
<add>### Solution: Just use an Array and key={…}
<add>
<add>Most of the time you can just use an array with keyed ReactElements.
<add>
<add>```js
<add>var children = items.map(item => <span key={item.title} />);
<add><div>{children}</div>
<add>```
<add>
<add>### Solution: React.addons.createFragment
<add>
<add>However, this is not always possible if you’re trying to add a prefix key to an unknown set (e.g. this.props.children). It is also not always the easiest upgrade path. Therefore, we are adding a helper to `React.addons` called `createFragment()`. This accepts a keyed object and returns an opaque type.
<add>
<add>```js
<add><div>{React.addons.createFragment({ a: <div />, b: this.props.children })}</div>
<add>```
<add>
<add>The exact signature of this kind of fragment will be determined later. It will likely be some kind of immutable sequence.
<add>
<add>Note: This will still not be valid as the direct return value of `render()`. Unfortunately, they still need to be wrapped in a `<div />` or some other element.
<add>
<add>## Compiler Optimizations: Unlocked!
<add>
<add>These changes also unlock several possible compiler optimizations for static content in React 0.14. These optimizations were previously only available to template-based frameworks. They will now also be possible for React code! Both for JSX and `React.createElement/Factory`*!
<add>
<add>See these GitHub Issues for a deep dive into compiler optimizations:
<add>
<add>- [Reuse Constant Value Types](https://github.com/facebook/react/issues/3226)
<add>- [Tagging ReactElements](https://github.com/facebook/react/issues/3227)
<add>- [Inline ReactElements](https://github.com/facebook/react/issues/3228)
<add>
<add>\* If you use the recommended pattern of explicit React.createFactory calls on the consumer side - since they are easily statically analyzed.
<add>
<add>## Rationale
<add>
<add>I thought that these changes were particularly important because the mere existence of these patterns means that even components that DON’T use these patterns have to pay the price. There are other problematic patterns such as mutating state, but they’re at least localized to a component subtree so they don’t harm the ecosystem.
<add>
<add>As always, we’d love to hear your feedback and if you have any trouble upgrading, please let us know. | 1 |
Python | Python | make airflowdatetimepickerwidget a required field | d74e6776fce1da2c887e33d79e2fb66c83c6ff82 | <ide><path>airflow/www/widgets.py
<ide> def __call__(self, field, **kwargs):
<ide> kwargs.setdefault("id", field.id)
<ide> kwargs.setdefault("name", field.name)
<ide> if not field.data:
<del> field.data = ""
<add> field.data = ''
<ide> template = self.data_template
<ide>
<del> return Markup(template % {"text": html_params(type="text", value=field.data, **kwargs)})
<add> return Markup(
<add> template % {"text": html_params(type="text", value=field.data, required=True, **kwargs)}
<add> )
<ide>
<ide>
<ide> class AirflowDateTimePickerROWidget(AirflowDateTimePickerWidget): | 1 |
Javascript | Javascript | install electron shims in benchmarks | a22870fa42fd5d94fbbbba398055a2a709a8c295 | <ide><path>src/initialize-benchmark-window.js
<ide> export default async function () {
<ide> const ApplicationDelegate = require('../src/application-delegate')
<ide> const AtomEnvironment = require('../src/atom-environment')
<ide> const TextEditor = require('../src/text-editor')
<add> require('../src/electron-shims')
<ide>
<ide> const exportsPath = path.join(resourcePath, 'exports')
<ide> require('module').globalPaths.push(exportsPath) // Add 'exports' to module search path. | 1 |
Javascript | Javascript | fix warnings in clonewithprops test | 514f5fb98b655acf1323c81438ec9de8662d53a0 | <ide><path>src/utils/__tests__/cloneWithProps-test.js
<ide> describe('cloneWithProps', function() {
<ide>
<ide> var Grandparent = React.createClass({
<ide> render: function() {
<del> return <Parent><Component key="abc" ref="abc" /></Parent>;
<add> return <Parent><Component key="abc" /></Parent>;
<ide> }
<ide> });
<ide> | 1 |
Ruby | Ruby | fix bad rdoc markup on update_all | 1b6a8287397f1cdb2eebed1947450ed3a280fb4d | <ide><path>activerecord/lib/active_record/base.rb
<ide> def destroy(id)
<ide> #
<ide> # ==== Parameters
<ide> #
<del> # * +updates+ - A string of column and value pairs that will be set on any records that match conditions.
<del> # What goes into the SET clause.
<add> # * +updates+ - A string of column and value pairs that will be set on any records that match conditions. This creates the SET clause of the generated SQL.
<ide> # * +conditions+ - An SQL fragment like "administrator = 1" or [ "user_name = ?", username ]. See conditions in the intro for more info.
<ide> # * +options+ - Additional options are <tt>:limit</tt> and <tt>:order</tt>, see the examples for usage.
<ide> # | 1 |
Javascript | Javascript | add test of policy about parse error | a565853dddcf03cd33cc826cda5452fe75144055 | <ide><path>test/parallel/test-policy-parse-integrity.js
<add>'use strict';
<add>
<add>const common = require('../common');
<add>if (!common.hasCrypto) common.skip('missing crypto');
<add>
<add>const tmpdir = require('../common/tmpdir');
<add>const assert = require('assert');
<add>const { spawnSync } = require('child_process');
<add>const crypto = require('crypto');
<add>const fs = require('fs');
<add>const path = require('path');
<add>const { pathToFileURL } = require('url');
<add>
<add>tmpdir.refresh();
<add>
<add>function hash(algo, body) {
<add> const h = crypto.createHash(algo);
<add> h.update(body);
<add> return h.digest('base64');
<add>}
<add>
<add>const policyFilepath = path.join(tmpdir.path, 'policy');
<add>
<add>const parentFilepath = path.join(tmpdir.path, 'parent.js');
<add>const parentBody = "require('./dep.js')";
<add>
<add>const depFilepath = path.join(tmpdir.path, 'dep.js');
<add>const depURL = pathToFileURL(depFilepath);
<add>const depBody = '';
<add>
<add>fs.writeFileSync(parentFilepath, parentBody);
<add>fs.writeFileSync(depFilepath, depBody);
<add>
<add>const tmpdirURL = pathToFileURL(tmpdir.path);
<add>if (!tmpdirURL.pathname.endsWith('/')) {
<add> tmpdirURL.pathname += '/';
<add>}
<add>
<add>function test({ shouldFail, integrity }) {
<add> const resources = {
<add> [depURL]: {
<add> body: depBody,
<add> integrity
<add> }
<add> };
<add> const manifest = {
<add> resources: {},
<add> };
<add> for (const [url, { body, integrity }] of Object.entries(resources)) {
<add> manifest.resources[url] = {
<add> integrity,
<add> };
<add> fs.writeFileSync(new URL(url, tmpdirURL.href), body);
<add> }
<add> fs.writeFileSync(policyFilepath, JSON.stringify(manifest, null, 2));
<add> const { status } = spawnSync(process.execPath, [
<add> '--experimental-policy',
<add> policyFilepath,
<add> depFilepath
<add> ]);
<add> if (shouldFail) {
<add> assert.notStrictEqual(status, 0);
<add> } else {
<add> assert.strictEqual(status, 0);
<add> }
<add>}
<add>
<add>test({
<add> shouldFail: false,
<add> integrity: `sha256-${hash('sha256', depBody)}`,
<add>});
<add>test({
<add> shouldFail: true,
<add> integrity: `1sha256-${hash('sha256', depBody)}`,
<add>});
<add>test({
<add> shouldFail: true,
<add> integrity: 'hoge',
<add>});
<add>test({
<add> shouldFail: true,
<add> integrity: `sha256-${hash('sha256', depBody)}sha256-${hash(
<add> 'sha256',
<add> depBody
<add> )}`,
<add>}); | 1 |
Text | Text | fix typo in autoloading_and_reloading_constants | ec812fc5943f838bee332398da5a63280bf2bd52 | <ide><path>guides/source/autoloading_and_reloading_constants.md
<ide> end
<ide> Rails.autoloaders
<ide> -----------------
<ide>
<del>The Zeitwerk instances managing your application are availabe at
<add>The Zeitwerk instances managing your application are available at
<ide>
<ide> ```ruby
<ide> Rails.autoloaders.main | 1 |
Go | Go | add watch retrigger when store restarts | 5ef8d0f038155eaa42866e9529be798c8d1747ca | <ide><path>libnetwork/controller.go
<ide> func (c *controller) initDiscovery(watcher discovery.Watcher) error {
<ide> }
<ide>
<ide> c.discovery = hostdiscovery.NewHostDiscovery(watcher)
<del> return c.discovery.Watch(c.hostJoinCallback, c.hostLeaveCallback)
<add> return c.discovery.Watch(c.activeCallback, c.hostJoinCallback, c.hostLeaveCallback)
<add>}
<add>
<add>func (c *controller) activeCallback() {
<add> ds := c.getStore(datastore.GlobalScope)
<add> if ds != nil && !ds.Active() {
<add> ds.RestartWatch()
<add> }
<ide> }
<ide>
<ide> func (c *controller) hostJoinCallback(nodes []net.IP) {
<ide><path>libnetwork/datastore/datastore.go
<ide> type DataStore interface {
<ide> Watchable() bool
<ide> // Watch for changes on a KVObject
<ide> Watch(kvObject KVObject, stopCh <-chan struct{}) (<-chan KVObject, error)
<add> // RestartWatch retriggers stopped Watches
<add> RestartWatch()
<add> // Active returns if the store is active
<add> Active() bool
<ide> // List returns of a list of KVObjects belonging to the parent
<ide> // key. The caller must pass a KVObject of the same type as
<ide> // the objects that need to be listed
<ide> var (
<ide> )
<ide>
<ide> type datastore struct {
<del> scope string
<del> store store.Store
<del> cache *cache
<add> scope string
<add> store store.Store
<add> cache *cache
<add> watchCh chan struct{}
<add> active bool
<ide> sync.Mutex
<ide> }
<ide>
<ide> func newClient(scope string, kv string, addr string, config *store.Config, cache
<ide> return nil, err
<ide> }
<ide>
<del> ds := &datastore{scope: scope, store: store}
<add> ds := &datastore{scope: scope, store: store, active: true, watchCh: make(chan struct{})}
<ide> if cached {
<ide> ds.cache = newCache(ds)
<ide> }
<ide> func (ds *datastore) Scope() string {
<ide> return ds.scope
<ide> }
<ide>
<add>func (ds *datastore) Active() bool {
<add> return ds.active
<add>}
<add>
<ide> func (ds *datastore) Watchable() bool {
<ide> return ds.scope != LocalScope
<ide> }
<ide> func (ds *datastore) Watch(kvObject KVObject, stopCh <-chan struct{}) (<-chan KV
<ide> kvoCh := make(chan KVObject)
<ide>
<ide> go func() {
<add> retry_watch:
<add> var err error
<add>
<add> // Make sure to get a new instance of watch channel
<add> ds.Lock()
<add> watchCh := ds.watchCh
<add> ds.Unlock()
<add>
<add> loop:
<ide> for {
<ide> select {
<ide> case <-stopCh:
<ide> func (ds *datastore) Watch(kvObject KVObject, stopCh <-chan struct{}) (<-chan KV
<ide> // for the watch can exit resulting in a nil value in
<ide> // channel.
<ide> if kvPair == nil {
<del> close(sCh)
<del> return
<add> ds.Lock()
<add> ds.active = false
<add> ds.Unlock()
<add> break loop
<ide> }
<add>
<ide> dstO := ctor.New()
<ide>
<del> if err := dstO.SetValue(kvPair.Value); err != nil {
<add> if err = dstO.SetValue(kvPair.Value); err != nil {
<ide> log.Printf("Could not unmarshal kvpair value = %s", string(kvPair.Value))
<ide> break
<ide> }
<ide> func (ds *datastore) Watch(kvObject KVObject, stopCh <-chan struct{}) (<-chan KV
<ide> kvoCh <- dstO
<ide> }
<ide> }
<add>
<add> // Wait on watch channel for a re-trigger when datastore becomes active
<add> <-watchCh
<add>
<add> kvpCh, err = ds.store.Watch(Key(kvObject.Key()...), sCh)
<add> if err != nil {
<add> log.Printf("Could not watch the key %s in store: %v", Key(kvObject.Key()...), err)
<add> }
<add>
<add> goto retry_watch
<ide> }()
<ide>
<ide> return kvoCh, nil
<ide> }
<ide>
<add>func (ds *datastore) RestartWatch() {
<add> ds.Lock()
<add> defer ds.Unlock()
<add>
<add> ds.active = true
<add> watchCh := ds.watchCh
<add> ds.watchCh = make(chan struct{})
<add> close(watchCh)
<add>}
<add>
<ide> func (ds *datastore) KVStore() store.Store {
<ide> return ds.store
<ide> }
<ide><path>libnetwork/hostdiscovery/hostdiscovery.go
<ide> func NewHostDiscovery(watcher discovery.Watcher) HostDiscovery {
<ide> return &hostDiscovery{watcher: watcher, nodes: mapset.NewSet(), stopChan: make(chan struct{})}
<ide> }
<ide>
<del>func (h *hostDiscovery) Watch(joinCallback JoinCallback, leaveCallback LeaveCallback) error {
<add>func (h *hostDiscovery) Watch(activeCallback ActiveCallback, joinCallback JoinCallback, leaveCallback LeaveCallback) error {
<ide> h.Lock()
<ide> d := h.watcher
<ide> h.Unlock()
<ide> if d == nil {
<ide> return types.BadRequestErrorf("invalid discovery watcher")
<ide> }
<ide> discoveryCh, errCh := d.Watch(h.stopChan)
<del> go h.monitorDiscovery(discoveryCh, errCh, joinCallback, leaveCallback)
<add> go h.monitorDiscovery(discoveryCh, errCh, activeCallback, joinCallback, leaveCallback)
<ide> return nil
<ide> }
<ide>
<del>func (h *hostDiscovery) monitorDiscovery(ch <-chan discovery.Entries, errCh <-chan error, joinCallback JoinCallback, leaveCallback LeaveCallback) {
<add>func (h *hostDiscovery) monitorDiscovery(ch <-chan discovery.Entries, errCh <-chan error,
<add> activeCallback ActiveCallback, joinCallback JoinCallback, leaveCallback LeaveCallback) {
<ide> for {
<ide> select {
<ide> case entries := <-ch:
<del> h.processCallback(entries, joinCallback, leaveCallback)
<add> h.processCallback(entries, activeCallback, joinCallback, leaveCallback)
<ide> case err := <-errCh:
<ide> if err != nil {
<ide> log.Errorf("discovery error: %v", err)
<ide> func (h *hostDiscovery) StopDiscovery() error {
<ide> return nil
<ide> }
<ide>
<del>func (h *hostDiscovery) processCallback(entries discovery.Entries, joinCallback JoinCallback, leaveCallback LeaveCallback) {
<add>func (h *hostDiscovery) processCallback(entries discovery.Entries,
<add> activeCallback ActiveCallback, joinCallback JoinCallback, leaveCallback LeaveCallback) {
<ide> updated := hosts(entries)
<ide> h.Lock()
<ide> existing := h.nodes
<ide> added, removed := diff(existing, updated)
<ide> h.nodes = updated
<ide> h.Unlock()
<ide>
<add> activeCallback()
<ide> if len(added) > 0 {
<ide> joinCallback(added)
<ide> }
<ide><path>libnetwork/hostdiscovery/hostdiscovery_api.go
<ide> import "net"
<ide> // JoinCallback provides a callback event for new node joining the cluster
<ide> type JoinCallback func(entries []net.IP)
<ide>
<add>// ActiveCallback provides a callback event for active discovery event
<add>type ActiveCallback func()
<add>
<ide> // LeaveCallback provides a callback event for node leaving the cluster
<ide> type LeaveCallback func(entries []net.IP)
<ide>
<ide> // HostDiscovery primary interface
<ide> type HostDiscovery interface {
<ide> //Watch Node join and leave cluster events
<del> Watch(joinCallback JoinCallback, leaveCallback LeaveCallback) error
<add> Watch(activeCallback ActiveCallback, joinCallback JoinCallback, leaveCallback LeaveCallback) error
<ide> // StopDiscovery stops the discovery perocess
<ide> StopDiscovery() error
<ide> // Fetch returns a list of host IPs that are currently discovered
<ide><path>libnetwork/hostdiscovery/hostdiscovery_test.go
<ide> func TestAddedCallback(t *testing.T) {
<ide>
<ide> added := false
<ide> removed := false
<del> hd.processCallback(update, func(hosts []net.IP) { added = true }, func(hosts []net.IP) { removed = true })
<add> hd.processCallback(update, func() {}, func(hosts []net.IP) { added = true }, func(hosts []net.IP) { removed = true })
<ide> if !added {
<ide> t.Fatalf("Expecting a Added callback notification. But none received")
<ide> }
<ide> func TestRemovedCallback(t *testing.T) {
<ide>
<ide> added := false
<ide> removed := false
<del> hd.processCallback(update, func(hosts []net.IP) { added = true }, func(hosts []net.IP) { removed = true })
<add> hd.processCallback(update, func() {}, func(hosts []net.IP) { added = true }, func(hosts []net.IP) { removed = true })
<ide> if !removed {
<ide> t.Fatalf("Expecting a Removed callback notification. But none received")
<ide> }
<ide> func TestNoCallback(t *testing.T) {
<ide>
<ide> added := false
<ide> removed := false
<del> hd.processCallback(update, func(hosts []net.IP) { added = true }, func(hosts []net.IP) { removed = true })
<add> hd.processCallback(update, func() {}, func(hosts []net.IP) { added = true }, func(hosts []net.IP) { removed = true })
<ide> if added || removed {
<ide> t.Fatalf("Not expecting any callback notification. But received a callback")
<ide> } | 5 |
Javascript | Javascript | remove use of array destructuring | f34d8de65af034463358cb6144f35308e9b841d9 | <ide><path>lib/_http_server.js
<ide> Server.prototype.setTimeout = function setTimeout(msecs, callback) {
<ide> Server.prototype[EE.captureRejectionSymbol] = function(err, event, ...args) {
<ide> switch (event) {
<ide> case 'request':
<del> const [ , res] = args;
<add> const { 1: res } = args;
<ide> if (!res.headersSent && !res.writableEnded) {
<ide> // Don't leak headers.
<ide> ArrayPrototypeForEach(res.getHeaderNames(),
<ide><path>lib/assert.js
<ide> function getErrMessage(message, fn) {
<ide> }
<ide> fd = openSync(filename, 'r', 0o666);
<ide> // Reset column and message.
<del> [column, message] = getCode(fd, line, column);
<add> ({ 0: column, 1: message } = getCode(fd, line, column));
<ide> // Flush unfinished multi byte characters.
<ide> decoder.end();
<ide> } else {
<ide> for (let i = 0; i < line; i++) {
<ide> code = StringPrototypeSlice(code,
<ide> StringPrototypeIndexOf(code, '\n') + 1);
<ide> }
<del> [column, message] = parseCode(code, column);
<add> ({ 0: column, 1: message } = parseCode(code, column));
<ide> }
<ide> // Always normalize indentation, otherwise the message could look weird.
<ide> if (StringPrototypeIncludes(message, '\n')) {
<ide><path>lib/events.js
<ide> function enhanceStackTrace(err, own) {
<ide> const errStack = err.stack.split('\n').slice(1);
<ide> const ownStack = own.stack.split('\n').slice(1);
<ide>
<del> const [ len, off ] = identicalSequenceRange(ownStack, errStack);
<add> const { 0: len, 1: off } = identicalSequenceRange(ownStack, errStack);
<ide> if (len > 0) {
<ide> ownStack.splice(off + 1, len - 2,
<ide> ' [... lines matching original stack trace ...]');
<ide><path>lib/fs.js
<ide> function copyFileSync(src, dest, mode) {
<ide> function lazyLoadStreams() {
<ide> if (!ReadStream) {
<ide> ({ ReadStream, WriteStream } = require('internal/fs/streams'));
<del> [ FileReadStream, FileWriteStream ] = [ ReadStream, WriteStream ];
<add> FileReadStream = ReadStream;
<add> FileWriteStream = WriteStream;
<ide> }
<ide> }
<ide>
<ide><path>lib/internal/bootstrap/loaders.js
<ide> class NativeModule {
<ide> // To be called during pre-execution when --expose-internals is on.
<ide> // Enables the user-land module loader to access internal modules.
<ide> static exposeInternals() {
<del> for (const [id, mod] of NativeModule.map) {
<add> for (const { 0: id, 1: mod } of NativeModule.map) {
<ide> // Do not expose this to user land even with --expose-internals.
<ide> if (id !== loaderId) {
<ide> mod.canBeRequiredByUsers = true;
<ide><path>lib/internal/cluster/primary.js
<ide> const cluster = new EventEmitter();
<ide> const intercom = new EventEmitter();
<ide> const SCHED_NONE = 1;
<ide> const SCHED_RR = 2;
<del>const [ minPort, maxPort ] = [ 1024, 65535 ];
<add>const minPort = 1024;
<add>const maxPort = 65535;
<ide> const { validatePort } = require('internal/validators');
<ide>
<ide> module.exports = cluster;
<ide><path>lib/internal/cluster/round_robin_handle.js
<ide> RoundRobinHandle.prototype.remove = function(worker) {
<ide>
<ide> RoundRobinHandle.prototype.distribute = function(err, handle) {
<ide> ArrayPrototypePush(this.handles, handle);
<del> const [ workerEntry ] = this.free;
<add> // eslint-disable-next-line node-core/no-array-destructuring
<add> const [ workerEntry ] = this.free; // this.free is a SafeMap
<ide>
<ide> if (ArrayIsArray(workerEntry)) {
<del> const [ workerId, worker ] = workerEntry;
<add> const { 0: workerId, 1: worker } = workerEntry;
<ide> this.free.delete(workerId);
<ide> this.handoff(worker);
<ide> }
<ide><path>lib/internal/console/constructor.js
<ide> const consoleMethods = {
<ide> length++;
<ide> }
<ide> } else {
<del> for (const [k, v] of tabularData) {
<add> for (const { 0: k, 1: v } of tabularData) {
<ide> ArrayPrototypePush(keys, _inspect(k));
<ide> ArrayPrototypePush(values, _inspect(v));
<ide> length++;
<ide><path>lib/internal/crypto/keys.js
<ide> for (const m of [[kKeyEncodingPKCS1, 'pkcs1'], [kKeyEncodingPKCS8, 'pkcs8'],
<ide> // which requires the KeyObject base class to be implemented in C++.
<ide> // The creation requires a callback to make sure that the NativeKeyObject
<ide> // base class cannot exist without the other KeyObject implementations.
<del>const [
<del> KeyObject,
<del> SecretKeyObject,
<del> PublicKeyObject,
<del> PrivateKeyObject,
<del>] = createNativeKeyObjectClass((NativeKeyObject) => {
<add>const {
<add> 0: KeyObject,
<add> 1: SecretKeyObject,
<add> 2: PublicKeyObject,
<add> 3: PrivateKeyObject,
<add>} = createNativeKeyObjectClass((NativeKeyObject) => {
<ide> // Publicly visible KeyObject class.
<ide> class KeyObject extends NativeKeyObject {
<ide> constructor(type, handle) {
<ide><path>lib/internal/errors.js
<ide> const captureLargerStackTrace = hideStackFrames(
<ide> * @returns {Error}
<ide> */
<ide> const uvException = hideStackFrames(function uvException(ctx) {
<del> const [code, uvmsg] = uvErrmapGet(ctx.errno) || uvUnmappedError;
<add> const { 0: code, 1: uvmsg } = uvErrmapGet(ctx.errno) || uvUnmappedError;
<ide> let message = `${code}: ${ctx.message || uvmsg}, ${ctx.syscall}`;
<ide>
<ide> let path;
<ide> const uvException = hideStackFrames(function uvException(ctx) {
<ide> */
<ide> const uvExceptionWithHostPort = hideStackFrames(
<ide> function uvExceptionWithHostPort(err, syscall, address, port) {
<del> const [code, uvmsg] = uvErrmapGet(err) || uvUnmappedError;
<add> const { 0: code, 1: uvmsg } = uvErrmapGet(err) || uvUnmappedError;
<ide> const message = `${syscall} ${code}: ${uvmsg}`;
<ide> let details = '';
<ide>
<ide> E('ERR_MANIFEST_ASSERT_INTEGRITY',
<ide> }" does not match the expected integrity.`;
<ide> if (realIntegrities.size) {
<ide> const sri = ArrayPrototypeJoin(
<del> ArrayFrom(realIntegrities.entries(), ([alg, dgs]) => `${alg}-${dgs}`),
<add> ArrayFrom(realIntegrities.entries(),
<add> ({ 0: alg, 1: dgs }) => `${alg}-${dgs}`),
<ide> ' '
<ide> );
<ide> msg += ` Integrities found are: ${sri}`;
<ide><path>lib/internal/main/print_help.js
<ide> function format(
<ide> let text = '';
<ide> let maxFirstColumnUsed = 0;
<ide>
<del> for (const [
<del> name, { helpText, type, value },
<del> ] of ArrayPrototypeSort([...options.entries()])) {
<add> for (const {
<add> 0: name, 1: { helpText, type, value }
<add> } of ArrayPrototypeSort([...options.entries()])) {
<ide> if (!helpText) continue;
<ide>
<ide> let displayName = name;
<ide> const argDescription = getArgDescription(type);
<ide> if (argDescription)
<ide> displayName += `=${argDescription}`;
<ide>
<del> for (const [ from, to ] of aliases) {
<add> for (const { 0: from, 1: to } of aliases) {
<ide> // For cases like e.g. `-e, --eval`.
<ide> if (to[0] === name && to.length === 1) {
<ide> displayName = `${from}, ${displayName}`;
<ide><path>lib/internal/modules/cjs/loader.js
<ide> function Module(id = '', parent) {
<ide> }
<ide>
<ide> const builtinModules = [];
<del>for (const [id, mod] of NativeModule.map) {
<add>for (const { 0: id, 1: mod } of NativeModule.map) {
<ide> if (mod.canBeRequiredByUsers) {
<ide> ArrayPrototypePush(builtinModules, id);
<ide> }
<ide><path>lib/internal/policy/manifest.js
<ide> class Manifest {
<ide> };
<ide>
<ide> for (let i = 0; i < jsonResourcesEntries.length; i++) {
<del> const [originalHREF, resourceDescriptor] = jsonResourcesEntries[i];
<add> const { 0: originalHREF, 1: resourceDescriptor } =
<add> jsonResourcesEntries[i];
<ide> const cascade = resourceDescriptor.cascade;
<ide> const dependencyMap = resourceDescriptor.dependencies;
<ide> const resourceHREF = resolve(originalHREF);
<ide> class Manifest {
<ide>
<ide> const scopeIntegrities = this.#scopeIntegrities;
<ide> for (let i = 0; i < jsonScopesEntries.length; i++) {
<del> const [originalHREF, scopeDescriptor] = jsonScopesEntries[i];
<add> const { 0: originalHREF, 1: scopeDescriptor } = jsonScopesEntries[i];
<ide> const integrity = scopeDescriptor.integrity;
<ide> const cascade = scopeDescriptor.cascade;
<ide> const dependencyMap = scopeDescriptor.dependencies;
<ide><path>lib/internal/util/comparisons.js
<ide> function mapHasEqualEntry(set, map, key1, item1, strict, memo) {
<ide> function mapEquiv(a, b, strict, memo) {
<ide> let set = null;
<ide>
<del> for (const [key, item1] of a) {
<add> for (const { 0: key, 1: item1 } of a) {
<ide> if (typeof key === 'object' && key !== null) {
<ide> if (set === null) {
<ide> set = new SafeSet();
<ide> function mapEquiv(a, b, strict, memo) {
<ide> }
<ide>
<ide> if (set !== null) {
<del> for (const [key, item] of b) {
<add> for (const { 0: key, 1: item } of b) {
<ide> if (typeof key === 'object' && key !== null) {
<ide> if (!mapHasEqualEntry(set, a, key, item, strict, memo))
<ide> return false;
<ide><path>lib/internal/util/inspect.js
<ide> function formatSet(value, ctx, ignored, recurseTimes) {
<ide> function formatMap(value, ctx, ignored, recurseTimes) {
<ide> const output = [];
<ide> ctx.indentationLvl += 2;
<del> for (const [k, v] of value) {
<add> for (const { 0: k, 1: v } of value) {
<ide> output.push(`${formatValue(ctx, k, recurseTimes)} => ` +
<ide> formatValue(ctx, v, recurseTimes));
<ide> }
<ide> function formatWeakMap(ctx, value, recurseTimes) {
<ide> }
<ide>
<ide> function formatIterator(braces, ctx, value, recurseTimes) {
<del> const [entries, isKeyValue] = previewEntries(value, true);
<add> const { 0: entries, 1: isKeyValue } = previewEntries(value, true);
<ide> if (isKeyValue) {
<ide> // Mark entry iterators as such.
<ide> braces[0] = braces[0].replace(/ Iterator] {$/, ' Entries] {');
<ide> function formatIterator(braces, ctx, value, recurseTimes) {
<ide>
<ide> function formatPromise(ctx, value, recurseTimes) {
<ide> let output;
<del> const [state, result] = getPromiseDetails(value);
<add> const { 0: state, 1: result } = getPromiseDetails(value);
<ide> if (state === kPending) {
<ide> output = [ctx.stylize('<pending>', 'special')];
<ide> } else {
<ide><path>lib/internal/worker/js_transferable.js
<ide> function setup() {
<ide> // from .postMessage() calls. The format of `deserializeInfo` is generally
<ide> // 'module:Constructor', e.g. 'internal/fs/promises:FileHandle'.
<ide> setDeserializerCreateObjectFunction((deserializeInfo) => {
<del> const [ module, ctor ] = StringPrototypeSplit(deserializeInfo, ':');
<add> const { 0: module, 1: ctor } = StringPrototypeSplit(deserializeInfo, ':');
<ide> const Ctor = require(module)[ctor];
<ide> if (typeof Ctor !== 'function' ||
<ide> !(Ctor.prototype instanceof JSTransferable)) {
<ide><path>lib/os.js
<ide> function getCheckedFunction(fn) {
<ide> });
<ide> }
<ide>
<del>const [
<del> type,
<del> version,
<del> release,
<del>] = _getOSInformation();
<add>const {
<add> 0: type,
<add> 1: version,
<add> 2: release,
<add>} = _getOSInformation();
<ide>
<ide> const getHomeDirectory = getCheckedFunction(_getHomeDirectory);
<ide> const getHostname = getCheckedFunction(_getHostname);
<ide><path>lib/repl.js
<ide> function REPLServer(prompt,
<ide> let entry;
<ide> const tmpCompletionEnabled = self.isCompletionEnabled;
<ide> while (entry = ArrayPrototypeShift(pausedBuffer)) {
<del> const [type, payload, isCompletionEnabled] = entry;
<add> const { 0: type, 1: payload, 2: isCompletionEnabled } = entry;
<ide> switch (type) {
<ide> case 'key': {
<del> const [d, key] = payload;
<add> const { 0: d, 1: key } = payload;
<ide> self.isCompletionEnabled = isCompletionEnabled;
<ide> self._ttyWrite(d, key);
<ide> break;
<ide> function complete(line, callback) {
<ide> REPLServer.prototype.completeOnEditorMode = (callback) => (err, results) => {
<ide> if (err) return callback(err);
<ide>
<del> const [completions, completeOn = ''] = results;
<add> const { 0: completions, 1: completeOn = '' } = results;
<ide> let result = ArrayPrototypeFilter(completions, Boolean);
<ide>
<ide> if (completeOn && result.length !== 0) { | 18 |
Python | Python | fix behavior of `_` when searching for dags | eda089334864547e18b71cb22fa231872edd4e8b | <ide><path>airflow/www/views.py
<ide> def index(self):
<ide> dags_query = session.query(DagModel).filter(~DagModel.is_subdag, DagModel.is_active)
<ide>
<ide> if arg_search_query:
<add> escaped_arg_search_query = arg_search_query.replace("_", r"\_")
<ide> dags_query = dags_query.filter(
<del> DagModel.dag_id.ilike('%' + arg_search_query + '%')
<del> | DagModel.owners.ilike('%' + arg_search_query + '%')
<add> DagModel.dag_id.ilike("%" + escaped_arg_search_query + "%", escape="\\")
<add> | DagModel.owners.ilike("%" + escaped_arg_search_query + "%", escape="\\")
<ide> )
<ide>
<ide> if arg_tags_filter:
<ide><path>tests/www/views/test_views_home.py
<ide> def client_single_dag(app, user_single_dag):
<ide> )
<ide>
<ide>
<del>TEST_FILTER_DAG_IDS = ["filter_test_1", "filter_test_2", "a_first_dag_id_asc"]
<add>TEST_FILTER_DAG_IDS = ["filter_test_1", "filter_test_2", "a_first_dag_id_asc", "filter.test"]
<ide>
<ide>
<ide> def _process_file(file_path, session):
<ide> def test_home_dag_list_filtered_singledag_user(working_dags, client_single_dag):
<ide> check_content_not_in_response(f"dag_id={dag_id}", resp)
<ide>
<ide>
<add>def test_home_dag_list_search(working_dags, user_client):
<add> resp = user_client.get("home?search=filter_test", follow_redirects=True)
<add> check_content_in_response("dag_id=filter_test_1", resp)
<add> check_content_in_response("dag_id=filter_test_2", resp)
<add> check_content_not_in_response("dag_id=filter.test", resp)
<add> check_content_not_in_response("dag_id=a_first_dag_id_asc", resp)
<add>
<add>
<ide> def test_home_robots_header_in_response(user_client):
<ide> # Responses should include X-Robots-Tag header
<ide> resp = user_client.get("home", follow_redirects=True) | 2 |
Ruby | Ruby | fix path prepend | 1f89a332132d8c33e6c9d86d90dbc79005256fce | <ide><path>Library/Homebrew/requirements/ruby_requirement.rb
<ide> def initialize(tags)
<ide> satisfy(build_env: false) { new_enough_ruby }
<ide>
<ide> env do
<del> ENV.prepend_path "PATH", new_enough_ruby
<add> ENV.prepend_path "PATH", new_enough_ruby.dirname
<ide> end
<ide>
<ide> def message | 1 |
Text | Text | fix typo in readme_zh-hans.md | dc06e4358042ba3f08b0403daf5fa062448e835e | <ide><path>README_zh-hans.md
<ide> conda install -c huggingface transformers
<ide>
<ide> 目前的检查点数量: 
<ide>
<del>🤗 Transformers 目前支持如下的架构(模型概述请阅 [here](https://huggingface.co/transformers/model_summary.html)):
<add>🤗 Transformers 目前支持如下的架构(模型概述请阅[这里](https://huggingface.co/transformers/model_summary.html)):
<ide>
<ide> 1. **[ALBERT](https://huggingface.co/transformers/model_doc/albert.html)** (来自 Google Research and the Toyota Technological Institute at Chicago) 伴随论文 [ALBERT: A Lite BERT for Self-supervised Learning of Language Representations](https://arxiv.org/abs/1909.11942), 由 Zhenzhong Lan, Mingda Chen, Sebastian Goodman, Kevin Gimpel, Piyush Sharma, Radu Soricut 发布。
<ide> 1. **[BART](https://huggingface.co/transformers/model_doc/bart.html)** (来自 Facebook) 伴随论文 [BART: Denoising Sequence-to-Sequence Pre-training for Natural Language Generation, Translation, and Comprehension](https://arxiv.org/pdf/1910.13461.pdf) 由 Mike Lewis, Yinhan Liu, Naman Goyal, Marjan Ghazvininejad, Abdelrahman Mohamed, Omer Levy, Ves Stoyanov and Luke Zettlemoyer 发布。 | 1 |
Python | Python | reset pidbox node on channel failure | 4fc9e9c6247c2abf7d8be3b69f490f4974d7205d | <ide><path>celery/events/__init__.py
<ide> def flush(self):
<ide> type, fields, _ = self._outbound_buffer.popleft()
<ide> self.send(type, **fields)
<ide>
<add> def copy_buffer(self, other):
<add> self._outbound_buffer = other._outbound_buffer
<add>
<ide> def close(self):
<ide> """Close the event dispatcher."""
<ide> self._lock.locked() and self._lock.release()
<ide><path>celery/tests/test_worker.py
<ide> class MockEventDispatcher(object):
<ide> sent = []
<ide> closed = False
<ide> flushed = False
<add> _outbound_buffer = []
<ide>
<ide> def send(self, event, *args, **kwargs):
<ide> self.sent.append(event)
<ide> def test_receieve_message_eta(self):
<ide> finally:
<ide> l.app.conf.BROKER_CONNECTION_RETRY = p
<ide> l.stop_consumers()
<del> self.assertTrue(dispatcher.flushed)
<ide> l.event_dispatcher = MockEventDispatcher()
<ide> l.receive_message(m.decode(), m)
<ide> l.eta_schedule.stop()
<ide><path>celery/worker/consumer.py
<ide> def start(self):
<ide> self.init_callback(self)
<ide>
<ide> while 1:
<del> self.reset_connection()
<ide> try:
<add> self.reset_connection()
<ide> self.consume_messages()
<ide> except self.connection_errors:
<ide> self.logger.error("Consumer: Connection to broker lost."
<ide> def on_control(self, body, message):
<ide> self.logger.error(
<ide> "Error occurred while handling control command: %r\n%r" % (
<ide> exc, traceback.format_exc()), exc_info=sys.exc_info())
<add> self.reset_pidbox_node()
<ide>
<ide> def apply_eta_task(self, task):
<ide> state.task_reserved(task)
<ide> def on_decode_error(self, message, exc):
<ide> message.content_encoding, message.body))
<ide> message.ack()
<ide>
<add> def reset_pidbox_node(self):
<add> if self.pidbox_node.channel:
<add> try:
<add> self.pidbox_node.channel.close()
<add> except self.connection_errors + self.channel_errors:
<add> pass
<add>
<add> self.pidbox_node.channel = self.connection.channel()
<add> self.broadcast_consumer = self.pidbox_node.listen(
<add> callback=self.on_control)
<add>
<ide> def reset_connection(self):
<ide> """Re-establish connection and set up consumers."""
<ide> self.logger.debug(
<ide> def reset_connection(self):
<ide>
<ide> self.task_consumer.register_callback(self.receive_message)
<ide>
<del> self.pidbox_node.channel = self.connection.channel()
<del> self.broadcast_consumer = self.pidbox_node.listen(
<del> callback=self.on_control)
<add> # Pidbox
<add> self.reset_pidbox_node()
<ide>
<ide> # Flush events sent while connection was down.
<del> if self.event_dispatcher:
<del> self.event_dispatcher.flush()
<add> prev_event_dispatcher = self.event_dispatcher
<ide> self.event_dispatcher = self.app.events.Dispatcher(self.connection,
<ide> hostname=self.hostname,
<ide> enabled=self.send_events)
<add> if prev_event_dispatcher:
<add> self.event_dispatcher.copy_buffer(prev_event_dispatcher)
<add> self.event_dispatcher.flush()
<add>
<ide> self.restart_heartbeat()
<ide>
<ide> self._state = RUN | 3 |
Text | Text | add a link to makeitopen.com | f2e45bcd4874b3f64fc8761b047e9eaa4f5cbe9f | <ide><path>docs/Tutorial.md
<ide> This tutorial aims to get you up to speed with writing iOS and Android apps usin
<ide>
<ide> We assume you have experience writing applications with React. If not, you can learn about it on the [React website](http://facebook.github.io/react/).
<ide>
<add>### Building a real-world app
<add>
<add>This tutorial explains how to build a simple app to get you started. If you're looking for a more advanced tutorial on building a real-world app, check out [makeitopen.com](http://makeitopen.com/).
<ide>
<ide> ## Setup
<ide> | 1 |
Javascript | Javascript | reset decoder on end | d2a6110d3fa78ef6680a9ef5faa279a4f35f486c | <ide><path>lib/string_decoder.js
<ide> function utf8Text(buf, i) {
<ide> // character.
<ide> function utf8End(buf) {
<ide> const r = (buf && buf.length ? this.write(buf) : '');
<del> if (this.lastNeed)
<add> if (this.lastNeed) {
<add> this.lastNeed = 0;
<add> this.lastTotal = 0;
<ide> return r + '\ufffd';
<add> }
<ide> return r;
<ide> }
<ide>
<ide> function utf16End(buf) {
<ide> const r = (buf && buf.length ? this.write(buf) : '');
<ide> if (this.lastNeed) {
<ide> const end = this.lastTotal - this.lastNeed;
<add> this.lastNeed = 0;
<add> this.lastTotal = 0;
<ide> return r + this.lastChar.toString('utf16le', 0, end);
<ide> }
<ide> return r;
<ide> function base64Text(buf, i) {
<ide>
<ide> function base64End(buf) {
<ide> const r = (buf && buf.length ? this.write(buf) : '');
<del> if (this.lastNeed)
<del> return r + this.lastChar.toString('base64', 0, 3 - this.lastNeed);
<add> if (this.lastNeed) {
<add> const end = 3 - this.lastNeed;
<add> this.lastNeed = 0;
<add> this.lastTotal = 0;
<add> return r + this.lastChar.toString('base64', 0, end);
<add> }
<ide> return r;
<ide> }
<ide>
<ide><path>test/parallel/test-string-decoder-end.js
<ide> for (let i = 1; i <= 16; i++) {
<ide>
<ide> encodings.forEach(testEncoding);
<ide>
<add>testEnd('utf8', Buffer.of(0xE2), Buffer.of(0x61), '\uFFFDa');
<add>testEnd('utf8', Buffer.of(0xE2), Buffer.of(0x82), '\uFFFD\uFFFD');
<add>testEnd('utf8', Buffer.of(0xE2), Buffer.of(0xE2), '\uFFFD\uFFFD');
<add>testEnd('utf8', Buffer.of(0xE2, 0x82), Buffer.of(0x61), '\uFFFDa');
<add>testEnd('utf8', Buffer.of(0xE2, 0x82), Buffer.of(0xAC), '\uFFFD\uFFFD');
<add>testEnd('utf8', Buffer.of(0xE2, 0x82), Buffer.of(0xE2), '\uFFFD\uFFFD');
<add>testEnd('utf8', Buffer.of(0xE2, 0x82, 0xAC), Buffer.of(0x61), '€a');
<add>
<add>testEnd('utf16le', Buffer.of(0x3D), Buffer.of(0x61, 0x00), 'a');
<add>testEnd('utf16le', Buffer.of(0x3D), Buffer.of(0xD8, 0x4D, 0xDC), '\u4DD8');
<add>testEnd('utf16le', Buffer.of(0x3D, 0xD8), Buffer.of(), '\uD83D');
<add>testEnd('utf16le', Buffer.of(0x3D, 0xD8), Buffer.of(0x61, 0x00), '\uD83Da');
<add>testEnd(
<add> 'utf16le',
<add> Buffer.of(0x3D, 0xD8),
<add> Buffer.of(0x4D, 0xDC),
<add> '\uD83D\uDC4D'
<add>);
<add>testEnd('utf16le', Buffer.of(0x3D, 0xD8, 0x4D), Buffer.of(), '\uD83D');
<add>testEnd(
<add> 'utf16le',
<add> Buffer.of(0x3D, 0xD8, 0x4D),
<add> Buffer.of(0x61, 0x00),
<add> '\uD83Da'
<add>);
<add>testEnd('utf16le', Buffer.of(0x3D, 0xD8, 0x4D), Buffer.of(0xDC), '\uD83D');
<add>testEnd(
<add> 'utf16le',
<add> Buffer.of(0x3D, 0xD8, 0x4D, 0xDC),
<add> Buffer.of(0x61, 0x00),
<add> '👍a'
<add>);
<add>
<add>testEnd('base64', Buffer.of(0x61), Buffer.of(), 'YQ==');
<add>testEnd('base64', Buffer.of(0x61), Buffer.of(0x61), 'YQ==YQ==');
<add>testEnd('base64', Buffer.of(0x61, 0x61), Buffer.of(), 'YWE=');
<add>testEnd('base64', Buffer.of(0x61, 0x61), Buffer.of(0x61), 'YWE=YQ==');
<add>testEnd('base64', Buffer.of(0x61, 0x61, 0x61), Buffer.of(), 'YWFh');
<add>testEnd('base64', Buffer.of(0x61, 0x61, 0x61), Buffer.of(0x61), 'YWFhYQ==');
<add>
<ide> function testEncoding(encoding) {
<ide> bufs.forEach((buf) => {
<ide> testBuf(encoding, buf);
<ide> function testBuf(encoding, buf) {
<ide> assert.strictEqual(res1, res3, 'one byte at a time should match toString');
<ide> assert.strictEqual(res2, res3, 'all bytes at once should match toString');
<ide> }
<add>
<add>function testEnd(encoding, incomplete, next, expected) {
<add> let res = '';
<add> const s = new SD(encoding);
<add> res += s.write(incomplete);
<add> res += s.end();
<add> res += s.write(next);
<add> res += s.end();
<add>
<add> assert.strictEqual(res, expected);
<add>} | 2 |
Python | Python | use divider inbetween steps | 9b719dfb1aa1226425fac3bc00b047857d522089 | <ide><path>spacy/cli/debug_model.py
<ide> def debug_model(model: Model, *, print_settings: Optional[Dict[str, Any]] = None
<ide> # STEP 0: Printing before training
<ide> msg.info(f"Analysing model with ID {model.id}")
<ide> if print_settings.get("print_before_training"):
<del> msg.info(f"Before training:")
<add> msg.divider(f"STEP 0 - before training")
<ide> _print_model(model, print_settings)
<ide>
<ide> # STEP 1: Initializing the model and printing again
<ide> def debug_model(model: Model, *, print_settings: Optional[Dict[str, Any]] = None
<ide> with data_validation(False):
<ide> model.initialize(X=_get_docs(), Y=Y)
<ide> if print_settings.get("print_after_init"):
<del> msg.info(f"After initialization:")
<add> msg.divider(f"STEP 1 - after initialization")
<ide> _print_model(model, print_settings)
<ide>
<ide> # STEP 2: Updating the model and printing again
<ide> def debug_model(model: Model, *, print_settings: Optional[Dict[str, Any]] = None
<ide> get_dX(dY)
<ide> model.finish_update(optimizer)
<ide> if print_settings.get("print_after_training"):
<del> msg.info(f"After training:")
<add> msg.divider(f"STEP 2 - after training")
<ide> _print_model(model, print_settings)
<ide>
<ide> # STEP 3: the final prediction
<ide> prediction = model.predict(_get_docs())
<ide> if print_settings.get("print_prediction"):
<del> msg.info(f"Prediction:", str(prediction))
<add> msg.divider(f"STEP 3 - prediction")
<add> msg.info(str(prediction))
<ide>
<ide>
<ide> def get_gradient(model, Y): | 1 |
PHP | PHP | use null coalescing operator | d509ee469f927650dd977a71471f04a5743958f3 | <ide><path>src/Datasource/ModelAwareTrait.php
<ide> protected function _setModelClass(string $name): void
<ide> */
<ide> public function loadModel(?string $modelClass = null, ?string $modelType = null): RepositoryInterface
<ide> {
<del> if ($modelClass === null) {
<del> $modelClass = $this->modelClass;
<del> }
<add> $modelClass = $modelClass ?? $this->modelClass;
<ide> if (empty($modelClass)) {
<ide> throw new UnexpectedValueException('Default modelClass is empty');
<ide> }
<del> if ($modelType === null) {
<del> $modelType = $this->getModelType();
<del> }
<add> $modelType = $modelType ?? $this->getModelType();
<ide>
<ide> $options = [];
<ide> if (strpos($modelClass, '\\') === false) {
<ide> public function loadModel(?string $modelClass = null, ?string $modelType = null)
<ide> return $this->{$alias};
<ide> }
<ide>
<del> if (isset($this->_modelFactories[$modelType])) {
<del> $factory = $this->_modelFactories[$modelType];
<del> }
<del> if (!isset($factory)) {
<del> $factory = FactoryLocator::get($modelType);
<del> }
<del>
<add> $factory = $this->_modelFactories[$modelType] ?? FactoryLocator::get($modelType);
<ide> if ($factory instanceof LocatorInterface) {
<ide> $this->{$alias} = $factory->get($modelClass, $options);
<ide> } else { | 1 |
Python | Python | support args on get_object_or_404 | 3e94f4dc709143d577433c164873654e7c0579f8 | <ide><path>rest_framework/generics.py
<ide> def strict_positive_int(integer_string, cutoff=None):
<ide> ret = min(ret, cutoff)
<ide> return ret
<ide>
<del>def get_object_or_404(queryset, **filter_kwargs):
<add>def get_object_or_404(queryset, *filter_args, **filter_kwargs):
<ide> """
<ide> Same as Django's standard shortcut, but make sure to raise 404
<ide> if the filter_kwargs don't match the required types.
<ide> """
<ide> try:
<del> return _get_object_or_404(queryset, **filter_kwargs)
<add> return _get_object_or_404(queryset, *filter_args, **filter_kwargs)
<ide> except (TypeError, ValueError):
<ide> raise Http404
<ide> | 1 |
Ruby | Ruby | fix the fixture path | 80d1e2778860d1825d749aad274e70e0ea810bc6 | <ide><path>actionpack/test/abstract_unit.rb
<ide> I18n.backend.store_translations 'pt-BR', {}
<ide> ORIGINAL_LOCALES = I18n.available_locales.map {|locale| locale.to_s }.sort
<ide>
<del>FIXTURE_LOAD_PATH = File.join(File.dirname(__FILE__), '../fixtures')
<add>FIXTURE_LOAD_PATH = File.join(File.dirname(__FILE__), 'fixtures')
<ide>
<ide> module ActionView
<ide> class TestCase | 1 |
Python | Python | skip some f2py tests on mac | 7c98513f6c1daac61cb66ffc3a9e5a769233ea19 | <ide><path>numpy/f2py/tests/test_return_real.py
<ide> from __future__ import division, absolute_import, print_function
<ide>
<add>import platform
<ide> import pytest
<ide>
<ide> from numpy import array
<ide> def check_function(self, t):
<ide> pass
<ide>
<ide>
<add>
<add>@pytest.mark.skipif(
<add> platform.system() == 'Darwin',
<add> reason="Prone to error when run with numpy/f2py/tests on mac os, "
<add> "but not when run in isolation")
<ide> class TestCReturnReal(TestReturnReal):
<ide> suffix = ".pyf"
<ide> module_name = "c_ext_return_real"
<ide><path>numpy/f2py/tests/test_semicolon_split.py
<ide> from . import util
<ide> from numpy.testing import assert_equal
<ide>
<add>@pytest.mark.skipif(
<add> platform.system() == 'Darwin',
<add> reason="Prone to error when run with numpy/f2py/tests on mac os, "
<add> "but not when run in isolation")
<ide> class TestMultiline(util.F2PyTest):
<ide> suffix = ".pyf"
<ide> module_name = "multiline"
<ide> class TestMultiline(util.F2PyTest):
<ide> end python module {module}
<ide> """.format(module=module_name)
<ide>
<del> @pytest.mark.skipif(platform.system() == 'Darwin',
<del> reason="Prone to error when run with "
<del> "numpy/f2py/tests on mac os, "
<del> "but not when run in isolation")
<ide> def test_multiline(self):
<ide> assert_equal(self.module.foo(), 42)
<ide>
<add>
<add>@pytest.mark.skipif(
<add> platform.system() == 'Darwin',
<add> reason="Prone to error when run with numpy/f2py/tests on mac os, "
<add> "but not when run in isolation")
<ide> class TestCallstatement(util.F2PyTest):
<ide> suffix = ".pyf"
<ide> module_name = "callstatement" | 2 |
Javascript | Javascript | update alert api examples in rntester | 1b943a99e0b5c47b7452d8847eb5b798aa172719 | <ide><path>packages/rn-tester/e2e/__tests__/Alert-test.js
<add>/**
<add> * Copyright (c) Facebook, Inc. and its affiliates.
<add> *
<add> * This source code is licensed under the MIT license found in the
<add> * LICENSE file in the root directory of this source tree.
<add> *
<add> * @format
<add> */
<add>
<add>/* global device, element, by, expect, waitFor */
<add>const {openExampleWithTitle} = require('../e2e-helpers');
<add>
<add>describe('Alert', () => {
<add> beforeAll(async () => {
<add> await element(by.id('apis-tab')).tap();
<add> await element(by.id('explorer_search')).replaceText('Alert');
<add> await element(by.label('Alerts')).tap();
<add> });
<add>
<add> afterAll(async () => {
<add> await element(by.label('Back')).tap();
<add> });
<add>
<add> it('AlertWithDefaultButton: should show alert dialog with message and default button', async () => {
<add> const alertMessage = 'An external USB drive has been detected!';
<add>
<add> await openExampleWithTitle('Alert with default Button');
<add> await element(by.id('alert-with-default-button')).tap();
<add> await expect(element(by.text(alertMessage))).toBeVisible();
<add> await element(by.text('OK')).tap();
<add> });
<add>
<add> it('AlertWithThreeButtons: should show alert dialog with three buttons', async () => {
<add> const alertMessage = 'Do you want to save your changes?';
<add>
<add> await openExampleWithTitle('Alert with three Buttons');
<add> await element(by.id('alert-with-three-buttons')).tap();
<add> await expect(element(by.text(alertMessage))).toBeVisible();
<add> await expect(element(by.text('Cancel'))).toBeVisible();
<add> await expect(element(by.text('No'))).toBeVisible();
<add> await expect(element(by.text('Yes'))).toBeVisible();
<add> await element(by.text('Yes')).tap();
<add> });
<add>
<add> it('AlertWithThreeButtons: should successfully call the callback on button press', async () => {
<add> await openExampleWithTitle('Alert with three Buttons');
<add> await element(by.id('alert-with-three-buttons')).tap();
<add> await element(by.text('Cancel')).tap();
<add> await expect(element(by.text('Log: Cancel Pressed!'))).toBeVisible();
<add> });
<add>});
<ide><path>packages/rn-tester/js/examples/Alert/AlertExample.js
<ide>
<ide> 'use strict';
<ide>
<del>const React = require('react');
<del>const {
<del> Alert,
<del> StyleSheet,
<del> Text,
<del> TouchableHighlight,
<del> View,
<del>} = require('react-native');
<del>
<del>// corporate ipsum > lorem ipsum
<del>const alertMessage =
<del> 'Credibly reintermediate next-generation potentialities after goal-oriented ' +
<del> 'catalysts for change. Dynamically revolutionize.';
<add>import React, {useState} from 'react';
<add>import {Alert, StyleSheet, Text, TouchableHighlight, View} from 'react-native';
<add>
<add>// Shows log on the screen
<add>const Log = ({message}) =>
<add> message ? (
<add> <View style={styles.logContainer}>
<add> <Text>
<add> <Text style={styles.bold}>Log</Text>: {message}
<add> </Text>
<add> </View>
<add> ) : null;
<ide>
<ide> /**
<ide> * Simple alert examples.
<ide> */
<del>type Props = $ReadOnly<{||}>;
<del>
<del>class SimpleAlertExampleBlock extends React.Component<Props> {
<del> render() {
<del> return (
<del> <View>
<del> <TouchableHighlight
<del> style={styles.wrapper}
<del> onPress={() => Alert.alert('Alert Title', alertMessage)}>
<del> <View style={styles.button}>
<del> <Text>Alert with message and default button</Text>
<del> </View>
<del> </TouchableHighlight>
<del> <TouchableHighlight
<del> style={styles.wrapper}
<del> onPress={() =>
<del> Alert.alert('Alert Title', alertMessage, [
<del> {text: 'OK', onPress: () => console.log('OK Pressed!')},
<del> ])
<del> }>
<del> <View style={styles.button}>
<del> <Text>Alert with one button</Text>
<del> </View>
<del> </TouchableHighlight>
<del> <TouchableHighlight
<del> style={styles.wrapper}
<del> onPress={() =>
<del> Alert.alert('Alert Title', alertMessage, [
<del> {text: 'Cancel', onPress: () => console.log('Cancel Pressed!')},
<del> {text: 'OK', onPress: () => console.log('OK Pressed!')},
<del> ])
<del> }>
<del> <View style={styles.button}>
<del> <Text>Alert with two buttons</Text>
<del> </View>
<del> </TouchableHighlight>
<del> <TouchableHighlight
<del> style={styles.wrapper}
<del> onPress={() =>
<del> Alert.alert('Alert Title', null, [
<del> {text: 'Foo', onPress: () => console.log('Foo Pressed!')},
<del> {text: 'Bar', onPress: () => console.log('Bar Pressed!')},
<del> {text: 'Baz', onPress: () => console.log('Baz Pressed!')},
<del> ])
<del> }>
<del> <View style={styles.button}>
<del> <Text>Alert with three buttons</Text>
<del> </View>
<del> </TouchableHighlight>
<del> <TouchableHighlight
<del> style={styles.wrapper}
<del> onPress={() =>
<del> Alert.alert(
<del> 'Foo Title',
<del> alertMessage,
<del> '..............'.split('').map((dot, index) => ({
<del> text: 'Button ' + index,
<del> onPress: () => console.log('Pressed ' + index),
<del> })),
<del> )
<del> }>
<del> <View style={styles.button}>
<del> <Text>Alert with too many buttons</Text>
<del> </View>
<del> </TouchableHighlight>
<del> <TouchableHighlight
<del> style={styles.wrapper}
<del> onPress={() =>
<del> Alert.alert(
<del> 'Alert Title',
<del> null,
<del> [{text: 'OK', onPress: () => console.log('OK Pressed!')}],
<del> {
<del> cancelable: false,
<del> },
<del> )
<del> }>
<del> <View style={styles.button}>
<del> <Text>Alert that cannot be dismissed</Text>
<del> </View>
<del> </TouchableHighlight>
<del> <TouchableHighlight
<del> style={styles.wrapper}
<del> onPress={() =>
<del> Alert.alert('', alertMessage, [
<del> {text: 'OK', onPress: () => console.log('OK Pressed!')},
<del> ])
<del> }>
<del> <View style={styles.button}>
<del> <Text>Alert without title</Text>
<del> </View>
<del> </TouchableHighlight>
<del> </View>
<del> );
<del> }
<del>}
<add>
<add>const AlertWithDefaultButton = () => {
<add> const alertMessage = 'An external USB drive has been detected!';
<add>
<add> return (
<add> <View>
<add> <TouchableHighlight
<add> testID="alert-with-default-button"
<add> style={styles.wrapper}
<add> onPress={() => Alert.alert('Alert', alertMessage)}>
<add> <View style={styles.button}>
<add> <Text>Tap to view alert</Text>
<add> </View>
<add> </TouchableHighlight>
<add> </View>
<add> );
<add>};
<add>
<add>const AlertWithTwoButtons = () => {
<add> const [message, setMessage] = useState('');
<add>
<add> const alertMessage = 'Your subscription has expired!';
<add>
<add> return (
<add> <View>
<add> <TouchableHighlight
<add> style={styles.wrapper}
<add> onPress={() =>
<add> Alert.alert('Action Required!', alertMessage, [
<add> {text: 'Ignore', onPress: () => setMessage('Ignore Pressed!')},
<add> {text: 'Renew', onPress: () => setMessage('Renew Pressed!')},
<add> ])
<add> }>
<add> <View style={styles.button}>
<add> <Text>Tap to view alert</Text>
<add> </View>
<add> </TouchableHighlight>
<add> <Log message={message} />
<add> </View>
<add> );
<add>};
<add>
<add>const AlertWithThreeButtons = () => {
<add> const [message, setMessage] = useState('');
<add>
<add> const alertMessage = 'Do you want to save your changes?';
<add>
<add> return (
<add> <View>
<add> <TouchableHighlight
<add> testID="alert-with-three-buttons"
<add> style={styles.wrapper}
<add> onPress={() =>
<add> Alert.alert('Unsaved Changes!', alertMessage, [
<add> {text: 'Cancel', onPress: () => setMessage('Cancel Pressed!')},
<add> {text: 'No', onPress: () => setMessage('No Pressed!')},
<add> {text: 'Yes', onPress: () => setMessage('Yes Pressed!')},
<add> ])
<add> }>
<add> <View style={styles.button}>
<add> <Text>Tap to view alert</Text>
<add> </View>
<add> </TouchableHighlight>
<add> <Log message={message} />
<add> </View>
<add> );
<add>};
<add>
<add>const AlertWithManyButtons = () => {
<add> const [message, setMessage] = useState('');
<add>
<add> const alertMessage =
<add> 'Credibly reintermediate next-generation potentialities after goal-oriented ' +
<add> 'catalysts for change. Dynamically revolutionize.';
<add>
<add> return (
<add> <View>
<add> <TouchableHighlight
<add> style={styles.wrapper}
<add> onPress={() =>
<add> Alert.alert(
<add> 'Foo Title',
<add> alertMessage,
<add> '..............'.split('').map((dot, index) => ({
<add> text: 'Button ' + index,
<add> onPress: () => setMessage(`Button ${index} Pressed!`),
<add> })),
<add> )
<add> }>
<add> <View style={styles.button}>
<add> <Text>Tap to view alert</Text>
<add> </View>
<add> </TouchableHighlight>
<add> <Log message={message} />
<add> </View>
<add> );
<add>};
<add>
<add>const AlertWithCancelableTrue = () => {
<add> const [message, setMessage] = useState('');
<add>
<add> const alertMessage = 'Tapping outside this dialog will dismiss this alert.';
<add>
<add> return (
<add> <View>
<add> <TouchableHighlight
<add> style={styles.wrapper}
<add> onPress={() =>
<add> Alert.alert(
<add> 'Alert Title',
<add> alertMessage,
<add> [{text: 'OK', onPress: () => setMessage('OK Pressed!')}],
<add> {
<add> cancelable: true,
<add> onDismiss: () =>
<add> setMessage(
<add> 'This alert was dismissed by tapping outside of the alert dialog.',
<add> ),
<add> },
<add> )
<add> }>
<add> <View style={styles.button}>
<add> <Text>Tap to view alert</Text>
<add> </View>
<add> </TouchableHighlight>
<add> <Log message={message} />
<add> </View>
<add> );
<add>};
<add>
<add>const AlertWithStyles = () => {
<add> const [message, setMessage] = useState('');
<add>
<add> const alertMessage = 'Look at the button styles!';
<add>
<add> return (
<add> <View>
<add> <TouchableHighlight
<add> style={styles.wrapper}
<add> onPress={() =>
<add> Alert.alert('Styled Buttons!', alertMessage, [
<add> {
<add> text: 'Default',
<add> onPress: () => setMessage('Default Pressed!'),
<add> style: 'default',
<add> },
<add> {
<add> text: 'Cancel',
<add> onPress: () => setMessage('Cancel Pressed!'),
<add> style: 'cancel',
<add> },
<add> {
<add> text: 'Destructive',
<add> onPress: () => setMessage('Destructive Pressed!'),
<add> style: 'destructive',
<add> },
<add> ])
<add> }>
<add> <View style={styles.button}>
<add> <Text>Tap to view alert</Text>
<add> </View>
<add> </TouchableHighlight>
<add> <Log message={message} />
<add> </View>
<add> );
<add>};
<ide>
<ide> const styles = StyleSheet.create({
<ide> wrapper: {
<ide> const styles = StyleSheet.create({
<ide> backgroundColor: '#eeeeee',
<ide> padding: 10,
<ide> },
<add> logContainer: {
<add> paddingVertical: 8,
<add> paddingHorizontal: 5,
<add> },
<add> bold: {
<add> fontWeight: 'bold',
<add> },
<ide> });
<ide>
<del>exports.title = 'Alert';
<del>exports.category = 'UI';
<add>exports.title = 'Alerts';
<ide> exports.description =
<ide> 'Alerts display a concise and informative message ' +
<ide> 'and prompt the user to make a decision.';
<add>exports.documentationURL = 'https://reactnative.dev/docs/alert';
<ide> exports.examples = [
<ide> {
<del> title: 'Alerts',
<add> title: 'Alert with default Button',
<add> description:
<add> "It can be used to show some information to user that doesn't require an action.",
<ide> render(): React.Node {
<del> return <SimpleAlertExampleBlock />;
<add> return <AlertWithDefaultButton />;
<add> },
<add> },
<add> {
<add> title: 'Alert with two Buttons',
<add> description: 'It can be used when an action is required from the user.',
<add> render(): React.Node {
<add> return <AlertWithTwoButtons />;
<add> },
<add> },
<add> {
<add> title: 'Alert with three Buttons',
<add> description: 'It can be used when there are three possible actions',
<add> render(): React.Node {
<add> return <AlertWithThreeButtons />;
<add> },
<add> },
<add> {
<add> title: 'Alert with many Buttons',
<add> platform: 'ios',
<add> description: 'It can be used when more than three actions are required.',
<add> render(): React.Node {
<add> return <AlertWithManyButtons />;
<add> },
<add> },
<add> {
<add> title: 'Alert with cancelable={true}',
<add> platform: 'android',
<add> description:
<add> 'By passing cancelable={false} prop to alerts on Android, they can be dismissed by tapping outside of the alert box.',
<add> render(): React.Node {
<add> return <AlertWithCancelableTrue />;
<add> },
<add> },
<add> {
<add> title: 'Alert with styles',
<add> platform: 'ios',
<add> description:
<add> "Alert buttons can be styled. There are three button styles - 'default' | 'cancel' | 'destructive'.",
<add> render(): React.Node {
<add> return <AlertWithStyles />;
<ide> },
<ide> },
<ide> ];
<del>
<del>exports.SimpleAlertExampleBlock = SimpleAlertExampleBlock;
<ide><path>packages/rn-tester/js/examples/Alert/AlertIOSExample.js
<ide> 'use strict';
<ide>
<ide> const React = require('react');
<del>
<del>const {SimpleAlertExampleBlock} = require('./AlertExample');
<ide> const {
<ide> StyleSheet,
<ide> View,
<ide> const {
<ide> Alert,
<ide> } = require('react-native');
<ide>
<add>const {examples: SharedAlertExamples} = require('./AlertExample');
<add>
<add>import type {RNTesterExampleModuleItem} from '../../types/RNTesterTypes';
<add>
<ide> type Props = $ReadOnly<{||}>;
<ide> type State = {|promptValue: ?string|};
<ide>
<ide> const styles = StyleSheet.create({
<ide> });
<ide>
<ide> exports.framework = 'React';
<del>exports.title = 'Alert';
<add>exports.title = 'Alerts';
<ide> exports.description = 'iOS alerts and action sheets';
<del>exports.examples = [
<del> {
<del> title: 'Alerts',
<del> render(): React.Node {
<del> return <SimpleAlertExampleBlock />;
<del> },
<del> },
<add>exports.documentationURL = 'https://reactnative.dev/docs/alert';
<add>exports.examples = ([
<add> ...SharedAlertExamples,
<ide> {
<ide> title: 'Prompt Options',
<ide> render(): React.Element<any> {
<ide> exports.examples = [
<ide> );
<ide> },
<ide> },
<del>];
<add>]: RNTesterExampleModuleItem[]); | 3 |
Text | Text | fix broken links | 6abafcb4248f0a4374b3df0b67bf82b3c32194f3 | <ide><path>CHANGELOG.md
<ide> docs. The biggest improvements and changes are listed below.
<ide> `ng:foo`. The new compiler doesn't distinguish between these and other name styles (all of them
<ide> are [equally supported](http://docs-next.angularjs.org/api/angular.module.ng.$compileProvider.directive)),
<ide> the main difference is that `ng-foo` is easier to select with css selectors. Check out the
<del> [Internet Explorer Compatibility](http://docs-next.angularjs.org/guide/ie.ngdoc)
<add> [Internet Explorer Compatibility](http://docs-next.angularjs.org/guide/ie)
<ide> doc to learn about various IE-related requirements for different directive naming styles.
<ide>
<ide> - `angular.directive`, `angular.widget`, `angular.attrWidget` were merged into a single concept: a
<ide> behavior and migrate your controllers one at a time: <https://gist.github.com/16
<ide>
<ide> ## Docs
<ide>
<del>- new [Modules dev guide article](http://docs-next.angularjs.org/guide/module.ngdoc)
<add>- new [Modules dev guide article](http://docs-next.angularjs.org/guide/module)
<ide>
<ide>
<ide> ## Small bug fixes | 1 |
Javascript | Javascript | fix two bugs in version bump script | a2716d087e2d2f08b1fe946e180d93ae6882ee67 | <ide><path>scripts/release-manager/commands/version.js
<ide> function updateJSON(path, fields, value) {
<ide> data = JSON.parse(fs.readFileSync(path, 'utf8'));
<ide> } catch (e) {
<ide> this.log(chalk.red('ERROR') + ` ${path} doesn't exist… skipping.`);
<add> return;
<ide> }
<ide> fields.forEach((field) => {
<ide> let fieldPath = field.split('.');
<ide> module.exports = function(vorpal, app) {
<ide> file: 'packages/react-native-renderer/package.json',
<ide> fields: ['version', 'peerDependencies.react'],
<ide> },
<add> {
<add> file: 'packages/react-noop-renderer/package.json',
<add> fields: ['version'],
<add> },
<ide> {
<ide> file: 'packages/react-test-renderer/package.json',
<ide> fields: ['version', 'peerDependencies.react'], | 1 |
Javascript | Javascript | fix typos in lib code comments | 69f487efc734f2b9bb67f46f99cd98e1c1e13d9b | <ide><path>lib/_http_incoming.js
<ide> IncomingMessage.prototype._destroy = function _destroy(err, cb) {
<ide> // If aborted and the underlying socket is not already destroyed,
<ide> // destroy it.
<ide> // We have to check if the socket is already destroyed because finished
<del> // does not call the callback when this methdod is invoked from `_http_client`
<add> // does not call the callback when this method is invoked from `_http_client`
<ide> // in `test/parallel/test-http-client-spurious-aborted.js`
<ide> if (this.socket && !this.socket.destroyed && this.aborted) {
<ide> this.socket.destroy(err);
<ide><path>lib/events.js
<ide> function emitUnhandledRejectionOrErr(ee, err, type, args) {
<ide> // we might end up in an infinite loop.
<ide> const prev = ee[kCapture];
<ide>
<del> // If the error handler throws, it is not catcheable and it
<add> // If the error handler throws, it is not catchable and it
<ide> // will end up in 'uncaughtException'. We restore the previous
<ide> // value of kCapture in case the uncaughtException is present
<ide> // and the exception is handled.
<ide><path>lib/path.js
<ide> const win32 = {
<ide> },
<ide>
<ide> /**
<del> * It will solve the relative path from `from` to `to`, for instancee
<add> * It will solve the relative path from `from` to `to`, for instance
<ide> * from = 'C:\\orandea\\test\\aaa'
<ide> * to = 'C:\\orandea\\impl\\bbb'
<ide> * The output of the function should be: '..\\..\\impl\\bbb' | 3 |
Python | Python | remove celeryctl from scripts | 8ec433db7ab55b2e3df883fec0f905faf7961a06 | <ide><path>setup.py
<ide> def run(self):
<ide> url=celery.__homepage__,
<ide> platforms=["any"],
<ide> packages=find_packages(exclude=['ez_setup']),
<del> scripts=["bin/celeryd", "bin/celeryctl"],
<add> scripts=["bin/celeryd"],
<ide> zip_safe=False,
<ide> install_requires=[
<ide> 'carrot>=0.4.5', | 1 |
Text | Text | fix code formatting missing in 3.5 announcement | 1aa6dff0b54e39d1fe7a0c7058f6f74ee01475fd | <ide><path>docs/topics/3.5-announcement.md
<ide> be deprecated at a later date.
<ide> ### ModelSerializer 'fields' and 'exclude'
<ide>
<ide> ModelSerializer and HyperlinkedModelSerializer must include either a fields
<del>option, or an exclude option. The fields = '__all__' shortcut may be used to
<add>option, or an exclude option. The `fields = '__all__'` shortcut may be used to
<ide> explicitly include all fields.
<ide>
<ide> Failing to set either `fields` or `exclude` raised a pending deprecation warning | 1 |
Javascript | Javascript | restore previous rendertarget after update() | 26a4288b01e45d0ba61dc59bb0588642d587db49 | <ide><path>examples/js/pmrem/PMREMGenerator.js
<ide> THREE.PMREMGenerator.prototype = {
<ide> var gammaOutput = renderer.gammaOutput;
<ide> var toneMapping = renderer.toneMapping;
<ide> var toneMappingExposure = renderer.toneMappingExposure;
<add> var renderTarget = renderer.getCurrentRenderTarget();
<ide>
<ide> renderer.toneMapping = THREE.LinearToneMapping;
<ide> renderer.toneMappingExposure = 1.0;
<ide> THREE.PMREMGenerator.prototype = {
<ide>
<ide> }
<ide>
<add> renderer.setRenderTarget(renderTarget);
<ide> renderer.toneMapping = toneMapping;
<ide> renderer.toneMappingExposure = toneMappingExposure;
<ide> renderer.gammaInput = gammaInput; | 1 |
Javascript | Javascript | fix shared handles on windows" | ff6117b8ed57089001bdc3659b79d23bea1107fe | <ide><path>lib/net.js
<ide> var createServerHandle = exports._createServerHandle =
<ide> return err;
<ide> }
<ide>
<add> if (process.platform === 'win32') {
<add> // On Windows, we always listen to the socket before sending it to
<add> // the worker (see uv_tcp_duplicate_socket). So we better do it here
<add> // so that we can handle any bind-time or listen-time errors early.
<add> err = _listen(handle);
<add> if (err) {
<add> handle.close();
<add> return err;
<add> }
<add> }
<add>
<ide> return handle;
<ide> };
<ide>
<ide> Server.prototype._listen2 = function(address, port, addressType, backlog, fd) {
<ide> debug('listen2', address, port, addressType, backlog);
<ide> var self = this;
<ide>
<add> var alreadyListening = false;
<add>
<ide> // If there is not yet a handle, we need to create one and bind.
<ide> // In the case of a server sent via IPC, we don't need to do this.
<ide> if (!self._handle) {
<ide> Server.prototype._listen2 = function(address, port, addressType, backlog, fd) {
<ide> });
<ide> return;
<ide> }
<add> alreadyListening = (process.platform === 'win32');
<ide> self._handle = rval;
<ide> } else {
<ide> debug('_listen2: have a handle already');
<ide> Server.prototype._listen2 = function(address, port, addressType, backlog, fd) {
<ide> self._handle.onconnection = onconnection;
<ide> self._handle.owner = self;
<ide>
<del> var err = _listen(self._handle, backlog);
<add> var err = 0;
<add> if (!alreadyListening)
<add> err = _listen(self._handle, backlog);
<ide>
<ide> if (err) {
<ide> var ex = errnoException(err, 'listen'); | 1 |
Ruby | Ruby | add repository_dispatch api | 4bb66c12e8afa79d838fd9f0b4c86021050c33eb | <ide><path>Library/Homebrew/utils/github.rb
<ide> def issue_comment_exists?(user, repo, pr, body)
<ide> comments.any? { |comment| comment["body"].eql?(body) }
<ide> end
<ide>
<add> def dispatch(user, repo, event, **payload)
<add> url = "#{API_URL}/repos/#{user}/#{repo}/dispatches"
<add> open_api(url, data: { event_type: event, client_payload: payload },
<add> request_method: :POST,
<add> scopes: CREATE_ISSUE_FORK_OR_PR_SCOPES)
<add> end
<add>
<ide> def api_errors
<ide> [GitHub::AuthenticationFailedError, GitHub::HTTPNotFoundError,
<ide> GitHub::RateLimitExceededError, GitHub::Error, JSON::ParserError].freeze | 1 |
Mixed | Go | add missing docs for volume ls filter=label | 5171b8349578a89efca69942f81f7e3c560840b9 | <ide><path>api/client/volume/list.go
<ide> func newListCommand(dockerCli *client.DockerCli) *cobra.Command {
<ide> flags := cmd.Flags()
<ide> flags.BoolVarP(&opts.quiet, "quiet", "q", false, "Only display volume names")
<ide> flags.StringVar(&opts.format, "format", "", "Pretty-print networks using a Go template")
<del> flags.StringSliceVarP(&opts.filter, "filter", "f", []string{}, "Provide filter values (i.e. 'dangling=true')")
<add> flags.StringSliceVarP(&opts.filter, "filter", "f", []string{}, "Provide filter values (e.g. 'dangling=true')")
<ide>
<ide> return cmd
<ide> }
<ide> Lists all the volumes Docker knows about. You can filter using the **-f** or
<ide> more than one filter, pass multiple flags (for example,
<ide> **--filter "foo=bar" --filter "bif=baz"**)
<ide>
<del>There is a single supported filter **dangling=value** which takes a boolean of
<del>**true** or **false**.
<add>The currently supported filters are:
<add>
<add>* **dangling** (boolean - **true** or **false**, **1** or **0**)
<add>* **driver** (a volume driver's name)
<add>* **label** (**label=<key>** or **label=<key>=<value>**)
<add>* **name** (a volume's name)
<ide>
<ide> `
<ide><path>docs/reference/commandline/volume_ls.md
<ide> Aliases:
<ide> ls, list
<ide>
<ide> Options:
<del> -f, --filter value Provide filter values (i.e. 'dangling=true') (default [])
<add> -f, --filter value Provide filter values (e.g. 'dangling=true') (default [])
<ide> - dangling=<boolean> a volume if referenced or not
<ide> - driver=<string> a volume's driver name
<add> - label=<key> or label=<key>=<value>
<ide> - name=<string> a volume's name
<ide> --format string Pretty-print volumes using a Go template
<ide> --help Print usage
<ide> Lists all the volumes Docker knows about. You can filter using the `-f` or `--fi
<ide>
<ide> Example output:
<ide>
<del> $ docker volume create --name rosemary
<del> rosemary
<del> $docker volume create --name tyler
<del> tyler
<del> $ docker volume ls
<del> DRIVER VOLUME NAME
<del> local rosemary
<del> local tyler
<add>```bash
<add>$ docker volume create --name rosemary
<add>rosemary
<add>$docker volume create --name tyler
<add>tyler
<add>$ docker volume ls
<add>DRIVER VOLUME NAME
<add>local rosemary
<add>local tyler
<add>```
<ide>
<ide> ## Filtering
<ide>
<ide> The currently supported filters are:
<ide>
<ide> * dangling (boolean - true or false, 0 or 1)
<ide> * driver (a volume driver's name)
<add>* label (`label=<key>` or `label=<key>=<value>`)
<ide> * name (a volume's name)
<ide>
<ide> ### dangling
<ide>
<ide> The `dangling` filter matches on all volumes not referenced by any containers
<ide>
<del> $ docker run -d -v tyler:/tmpwork busybox
<del> f86a7dd02898067079c99ceacd810149060a70528eff3754d0b0f1a93bd0af18
<del> $ docker volume ls -f dangling=true
<del> DRIVER VOLUME NAME
<del> local rosemary
<add>```bash
<add>$ docker run -d -v tyler:/tmpwork busybox
<add>
<add>f86a7dd02898067079c99ceacd810149060a70528eff3754d0b0f1a93bd0af18
<add>$ docker volume ls -f dangling=true
<add>DRIVER VOLUME NAME
<add>local rosemary
<add>```
<ide>
<ide> ### driver
<ide>
<ide> The `driver` filter matches on all or part of a volume's driver name.
<ide>
<ide> The following filter matches all volumes with a driver name containing the `local` string.
<ide>
<del> $ docker volume ls -f driver=local
<del> DRIVER VOLUME NAME
<del> local rosemary
<del> local tyler
<add>```bash
<add>$ docker volume ls -f driver=local
<add>
<add>DRIVER VOLUME NAME
<add>local rosemary
<add>local tyler
<add>```
<add>
<add>#### Label
<add>
<add>The `label` filter matches volumes based on the presence of a `label` alone or
<add>a `label` and a value.
<add>
<add>First, let's create some volumes to illustrate this;
<add>
<add>```bash
<add>$ docker volume create --name the-doctor --label is-timelord=yes
<add>the-doctor
<add>$ docker volume create --name daleks --label is-timelord=no
<add>daleks
<add>```
<add>
<add>The following example filter matches volumes with the `is-timelord` label
<add>regardless of its value.
<add>
<add>```bash
<add>$ docker volume ls --filter label=is-timelord
<add>
<add>DRIVER NAME
<add>local daleks
<add>local the-doctor
<add>```
<add>
<add>As can be seen in the above example, both volumes with `is-timelord=yes`, and
<add>`is-timelord=no` are returned.
<add>
<add>Filtering on both `key` *and* `value` of the label, produces the expected result:
<add>
<add>```bash
<add>$ docker volume ls --filter label=is-timelord=yes
<add>
<add>DRIVER NAME
<add>local the-doctor
<add>```
<add>
<add>Specifying multiple label filter produces an "and" search; all conditions
<add>should be met;
<add>
<add>```bash
<add>$ docker volume ls --filter label=is-timelord=yes --filter label=is-timelord=no
<add>
<add>DRIVER NAME
<add>```
<ide>
<ide> ### name
<ide> | 2 |
Python | Python | fix bad format string | 1435f6ce0ce7491af7e5771d1fec158109ad69d9 | <ide><path>glances/plugins/glances_ports.py
<ide> def _port_scan_tcp(self, port):
<ide> try:
<ide> ret = _socket.connect_ex((ip, int(port['port'])))
<ide> except Exception as e:
<del> logger.debug("0}: Error while scanning port {} ({})".format(self.plugin_name, port, e))
<add> logger.debug("{}: Error while scanning port {} ({})".format(self.plugin_name, port, e))
<ide> else:
<ide> if ret == 0:
<ide> port['status'] = counter.get() | 1 |
Javascript | Javascript | add missing import | 636412927fcfa61ccff81f632e20986779889066 | <ide><path>src/behavior/zoom.js
<ide> import "../event/event";
<ide> import "../event/mouse";
<ide> import "../event/touches";
<ide> import "../selection/selection";
<add>import "behavior";
<ide>
<ide> d3.behavior.zoom = function() {
<ide> var translate = [0, 0], | 1 |
Ruby | Ruby | read source modified time from tabfile | 7958343f1694a72c8f15b7bf0e00a888fa321996 | <ide><path>Library/Homebrew/cmd/bottle.rb
<ide> def bottle_output(bottle)
<ide> erb.result(bottle.instance_eval { binding }).gsub(/^\s*$\n/, "")
<ide> end
<ide>
<del> def most_recent_mtime(pathname)
<del> pathname.to_enum(:find).select(&:exist?).map(&:mtime).max
<del> end
<del>
<ide> def bottle_formula(f)
<ide> unless f.installed?
<ide> return ofail "Formula not installed or up-to-date: #{f.full_name}"
<ide> def bottle_formula(f)
<ide> relocatable = false
<ide> skip_relocation = false
<ide>
<del> formula_source_time = f.stable.stage do
<del> most_recent_mtime(Pathname.pwd)
<del> end
<del>
<ide> keg.lock do
<ide> original_tab = nil
<ide>
<ide> def bottle_formula(f)
<ide> tab.time = nil
<ide> tab.write
<ide>
<del> keg.find {|k| File.utime(File.atime(k), formula_source_time, k) }
<add> keg.find {|k| File.utime(File.atime(k), tab.source_modified_time, k) }
<ide>
<ide> cd cellar do
<ide> safe_system "tar", "cf", tar_path, "#{f.name}/#{f.pkg_version}"
<del> File.utime(File.atime(tar_path), formula_source_time, tar_path)
<add> File.utime(File.atime(tar_path), tab.source_modified_time, tar_path)
<ide> relocatable_tar_path = "#{f}-bottle.tar"
<ide> mv tar_path, relocatable_tar_path
<ide> # Use gzip, faster to compress than bzip2, faster to uncompress than bzip2 | 1 |
Ruby | Ruby | avoid implicit `create_with` for `sticlass.all` | bdaf273cbedcfca5a5a6ec7643a524acde7bd18c | <ide><path>activerecord/lib/active_record/core.rb
<ide> def relation
<ide>
<ide> if finder_needs_type_condition? && !ignore_default_scope?
<ide> relation.where!(type_condition)
<del> relation.create_with!(inheritance_column.to_s => sti_name)
<ide> else
<ide> relation
<ide> end
<ide><path>activerecord/lib/active_record/relation.rb
<ide> def where_values_hash(relation_table_name = klass.table_name)
<ide>
<ide> def scope_for_create
<ide> hash = where_values_hash
<add> hash.delete(klass.inheritance_column) if klass.finder_needs_type_condition?
<ide> create_with_value.each { |k, v| hash[k.to_s] = v } unless create_with_value.empty?
<ide> hash
<ide> end
<ide><path>activerecord/test/cases/relation/or_test.rb
<ide> def test_or_inside_named_scope
<ide> assert_equal expected, Post.order(id: :desc).typographically_interesting
<ide> end
<ide>
<add> def test_or_with_sti_relation
<add> expected = Post.where("id = 1 or id = 2").sort_by(&:id)
<add> assert_equal expected, Post.where(id: 1).or(SpecialPost.all).sort_by(&:id)
<add> end
<add>
<ide> def test_or_on_loaded_relation
<ide> expected = Post.where("id = 1 or id = 2").to_a
<ide> p = Post.where("id = 1")
<ide><path>activerecord/test/models/post.rb
<ide> def predicate_builder
<ide> Post.predicate_builder
<ide> end
<ide>
<add> def finder_needs_type_condition?
<add> false
<add> end
<add>
<ide> def base_class?
<ide> true
<ide> end | 4 |
Go | Go | add the possibility to use multiple -h | dede1585ee00f957e153691c464aab293c2dc469 | <ide><path>commands.go
<ide> func (cli *DockerCli) CmdHelp(args ...string) error {
<ide> return nil
<ide> }
<ide> }
<del> help := fmt.Sprintf("Usage: docker [OPTIONS] COMMAND [arg...]\n -H=\"%s:%d\": Host:port to bind/connect to\n\nA self-sufficient runtime for linux containers.\n\nCommands:\n", DEFAULTHTTPHOST, DEFAULTHTTPPORT)
<add> help := fmt.Sprintf("Usage: docker [OPTIONS] COMMAND [arg...]\n -H=[tcp://%s:%d]: tcp://host:port to bind/connect to or unix://path/to/socker to use\n\nA self-sufficient runtime for linux containers.\n\nCommands:\n", DEFAULTHTTPHOST, DEFAULTHTTPPORT)
<ide> for _, command := range [][2]string{
<ide> {"attach", "Attach to a running container"},
<ide> {"build", "Build a container from a Dockerfile"},
<ide><path>docker/docker.go
<ide> func main() {
<ide> flAutoRestart := flag.Bool("r", false, "Restart previously running containers")
<ide> bridgeName := flag.String("b", "", "Attach containers to a pre-existing network bridge")
<ide> pidfile := flag.String("p", "/var/run/docker.pid", "File containing process PID")
<del> flHost := flag.String("H", fmt.Sprintf("%s:%d", docker.DEFAULTHTTPHOST, docker.DEFAULTHTTPPORT), "Host:port to bind/connect to")
<ide> flEnableCors := flag.Bool("api-enable-cors", false, "Enable CORS requests in the remote api.")
<ide> flDns := flag.String("dns", "", "Set custom dns servers")
<add> flHosts := docker.ListOpts{fmt.Sprintf("tcp://%s:%d", docker.DEFAULTHTTPHOST, docker.DEFAULTHTTPPORT)}
<add> flag.Var(&flHosts, "H", "tcp://host:port to bind/connect to or unix://path/to/socket to use")
<ide> flag.Parse()
<add> if len(flHosts) > 1 {
<add> flHosts = flHosts[1:len(flHosts)] //trick to display a nice defaul value in the usage
<add> }
<add> for i, flHost := range flHosts {
<add> flHosts[i] = utils.ParseHost(docker.DEFAULTHTTPHOST, docker.DEFAULTHTTPPORT, flHost)
<add> }
<add>
<ide> if *bridgeName != "" {
<ide> docker.NetworkBridgeIface = *bridgeName
<ide> } else {
<ide> docker.NetworkBridgeIface = docker.DefaultNetworkBridge
<ide> }
<del>
<del> protoAddr := parseHost(*flHost)
<del> protoAddrs := []string{protoAddr}
<del>
<ide> if *flDebug {
<ide> os.Setenv("DEBUG", "1")
<ide> }
<ide> func main() {
<ide> flag.Usage()
<ide> return
<ide> }
<del> if err := daemon(*pidfile, protoAddrs, *flAutoRestart, *flEnableCors, *flDns); err != nil {
<add> if err := daemon(*pidfile, flHosts, *flAutoRestart, *flEnableCors, *flDns); err != nil {
<ide> log.Fatal(err)
<ide> os.Exit(-1)
<ide> }
<ide> } else {
<del> protoAddrParts := strings.SplitN(protoAddrs[0], "://", 2)
<add> if len(flHosts) > 1 {
<add> log.Fatal("Please specify only one -H")
<add> return
<add> }
<add> protoAddrParts := strings.SplitN(flHosts[0], "://", 2)
<ide> if err := docker.ParseCommands(protoAddrParts[0], protoAddrParts[1], flag.Args()...); err != nil {
<ide> log.Fatal(err)
<ide> os.Exit(-1)
<ide> func daemon(pidfile string, protoAddrs []string, autoRestart, enableCors bool, f
<ide> return nil
<ide> }
<ide>
<del>func parseHost(addr string) string {
<del> if strings.HasPrefix(addr, "unix://") {
<del> return addr
<del> }
<del> host := docker.DEFAULTHTTPHOST
<del> port := docker.DEFAULTHTTPPORT
<del> if strings.HasPrefix(addr, "tcp://") {
<del> addr = strings.TrimPrefix(addr, "tcp://")
<del> }
<del> if strings.Contains(addr, ":") {
<del> hostParts := strings.Split(addr, ":")
<del> if len(hostParts) != 2 {
<del> log.Fatal("Invalid bind address format.")
<del> os.Exit(-1)
<del> }
<del> if hostParts[0] != "" {
<del> host = hostParts[0]
<del> }
<del> if p, err := strconv.Atoi(hostParts[1]); err == nil {
<del> port = p
<del> }
<del> } else {
<del> host = addr
<del> }
<del> return fmt.Sprintf("tcp://%s:%d", host, port)
<del>}
<ide><path>utils/utils.go
<ide> import (
<ide> "index/suffixarray"
<ide> "io"
<ide> "io/ioutil"
<add> "log"
<ide> "net/http"
<ide> "os"
<ide> "os/exec"
<ide> func CheckLocalDns() bool {
<ide> return false
<ide> }
<ide>
<add>func ParseHost(host string, port int, addr string) string {
<add> if strings.HasPrefix(addr, "unix://") {
<add> return addr
<add> }
<add> if strings.HasPrefix(addr, "tcp://") {
<add> addr = strings.TrimPrefix(addr, "tcp://")
<add> }
<add> if strings.Contains(addr, ":") {
<add> hostParts := strings.Split(addr, ":")
<add> if len(hostParts) != 2 {
<add> log.Fatal("Invalid bind address format.")
<add> os.Exit(-1)
<add> }
<add> if hostParts[0] != "" {
<add> host = hostParts[0]
<add> }
<add> if p, err := strconv.Atoi(hostParts[1]); err == nil {
<add> port = p
<add> }
<add> } else {
<add> host = addr
<add> }
<add> return fmt.Sprintf("tcp://%s:%d", host, port)
<add>}
<add>
<ide> | 3 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.