text:
__author__ = 'chris'

import event as Event
import Logger
import config_simple as CONFIG

class fileWatcher:
    def __init__(self, button=None):
        self.logger = Logger.Logger(self.__class__.__name__).get()
        self.logger.debug("initializing buttonWatcher event handler for button " + str(button))
        self.buttonTriggered = Event()

        self.watchButton(button)

    def watchButton(self, button, state=False):
        if state:
            self.logger.debug("button " + button + " fired an event")


text:
module RuboCop
  module Cop
    module Style
      # This cop checks for redundant `begin` blocks.
      #
      # Currently it checks for code like this:
      #
      # @example
      #
      #   # bad
      #   def redundant
      #     begin
      #       ala
      #       bala
      #     rescue StandardError => e
      #       something
      #     end
      #   end
      #
      #   # good
      #   def preferred
      #     ala
      #     bala
      #   rescue StandardError => e
      #     something
      #   end
      #
      #   # bad
      #   # When using Ruby 2.5 or later.
      #   do_something do
      #     begin
      #       something
      #     rescue => ex
      #       anything
      #     end
      #   end
      #
      #   # good
      #   # In Ruby 2.5 or later, you can omit `begin` in `do-end` block.
      #   do_something do
      #     something
      #   rescue => ex
      #     anything
      #   end
      class RedundantBegin < Cop
        MSG = 'Redundant `begin` block detected.'.freeze

        def on_def(node)
          check(node)
        end
        alias on_defs on_def

        def on_block(node)
          return if target_ruby_version < 2.5
          return if node.braces?
          check(node)
        end

        def autocorrect(node)
          lambda do |corrector|
            corrector.remove(node.loc.begin)
            corrector.remove(node.loc.end)
          end
        end

        private

        def check(node)
          return unless node.body && node.body.kwbegin_type?

          add_offense(node.body, location: :begin)
        end
      end
    end
  end
end

redpajama_set_name: RedPajamaGithub


text:
package org.seasar.doma.internal.jdbc.dialect;

import org.seasar.doma.internal.jdbc.sql.node.FragmentNode;
import org.seasar.doma.internal.jdbc.sql.node.OrderByClauseNode;
import org.seasar.doma.internal.jdbc.sql.node.SelectStatementNode;
import org.seasar.doma.jdbc.SqlNode;

public class SqlitePagingTransformer extends StandardPagingTransformer {

  protected static final String MAXIMUM_LIMIT = String.valueOf(Long.MAX_VALUE);

  public SqlitePagingTransformer(long offset, long limit) {
    super(offset, limit);
  }

  @Override
  public SqlNode visitSelectStatementNode(SelectStatementNode node, Void p) {
    if (processed) {
      return node;
    }
    processed = true;

    OrderByClauseNode originalOrderBy = node.getOrderByClauseNode();
    OrderByClauseNode orderBy;
    if (originalOrderBy != null) {
      orderBy = new OrderByClauseNode(originalOrderBy.getWordNode());
      for (SqlNode child : originalOrderBy.getChildren()) {
        orderBy.appendNode(child);
      }
    } else {
      orderBy = new OrderByClauseNode("");
    }
    String offset = this.offset <= 0 ? "0" : String.valueOf(this.offset);
    String limit = this.limit <= 0 ? MAXIMUM_LIMIT : String.valueOf(this.limit);
    orderBy.appendNode(new FragmentNode(" limit "));
    orderBy.appendNode(new FragmentNode(limit));
    orderBy.appendNode(new FragmentNode(" offset "));
    orderBy.appendNode(new FragmentNode(offset));

    SelectStatementNode result = new SelectStatementNode();
    result.setSelectClauseNode(node.getSelectClauseNode());
    result.setFromClauseNode(node.getFromClauseNode());
    result.setWhereClauseNode(node.getWhereClauseNode());
    result.setGroupByClauseNode(node.getGroupByClauseNode());
    result.setHavingClauseNode(node.getHavingClauseNode());
    result.setOrderByClauseNode(orderBy);
    result.setForUpdateClauseNode(node.getForUpdateClauseNode());
    result.setOptionClauseNode(node.getOptionClauseNode());
    return result;
  }
}


text:
#ifndef _LZEXPAND_H
#define _LZEXPAND_H
#pragma GCC system_header
#include <_mingw.h>

#ifdef __cplusplus
extern "C" {
#endif

#define LZERROR_BADINHANDLE	(-1)
#define LZERROR_BADOUTHANDLE	(-2)
#define LZERROR_READ	(-3)
#define LZERROR_WRITE	(-4)
#define LZERROR_GLOBALLOC	(-5)
#define LZERROR_GLOBLOCK	(-6)
#define LZERROR_BADVALUE	(-7)
#define LZERROR_UNKNOWNALG	(-8)
LONG WINAPI CopyLZFile(INT,INT);
INT WINAPI GetExpandedNameA(LPSTR,LPSTR);
INT WINAPI GetExpandedNameW(LPWSTR,LPWSTR);
VOID APIENTRY LZClose(INT);
LONG APIENTRY LZCopy(INT,INT);
VOID WINAPI LZDone(VOID);
INT WINAPI LZInit(INT);
INT WINAPI LZOpenFileA(LPSTR,LPOFSTRUCT,WORD);
INT WINAPI LZOpenFileW(LPWSTR,LPOFSTRUCT,WORD);
INT WINAPI LZRead(INT,LPSTR,INT);
LONG WINAPI LZSeek(INT,LONG,INT);
INT WINAPI LZStart(VOID);
#define GetExpandedName __AW(GetExpandedName)
#define LZOpenFile  __AW(LZOpenFile)

#ifdef __cplusplus
}

#endif
#endif


text:
"""Block I/O being done in asyncio."""
from http.client import HTTPConnection

from homeassistant.util.async_ import protect_loop

def enable() -> None:
    """Enable the detection of I/O in the event loop."""
    # Prevent urllib3 and requests doing I/O in event loop
    HTTPConnection.putrequest = protect_loop(HTTPConnection.putrequest)

    # Currently disabled. pytz doing I/O when getting timezone.
    # Prevent files being opened inside the event loop
    # builtins.open = protect_loop(builtins.open)


text:
* sudo: new option
* docs: cache pages with gatsby-plugin-catch-links
* lighthouse: activate manifest and offline plugins
* appBar: add icon and mouse over background
* intro: text size on mobile landscape
* home: tune homepage intro background
* plugins: add google analytics tracking code
* gatsby v2 migration
* all: reflect changes in callback 2nd argument
* menu: order by sort then slug
* retry: new page
* once: new page
* sleep: new page
* handler: new page doc
* cascade: new page
* template: remove unsued import
* AppBar: issues link
* Menu: close temporary drawer on click
* drawer: activate transition
* drawer: fix in mobile
* material-ui: fix css loading
* package: use yarn
* changelog: new page
* footer: set main section links
* conditions: add assertions
* particles: new osi logo
* options: new page
* contribute: import guidelines
* about: new page
* theme: apply color in non visited links
* menu: sort first level menu
* menu: dissociate toggle button from menu item
* option debug: typos
* layout: unlimited 1st level menu
* options attempt: new doc
* layout: multiple esthetic improvements
* pages: handle redirects


text:
=============
Release Notes
=============

Elephant 0.11.2 release notes
=============================

New functionality and features
------------------------------
*  new installation option to not compile c-extensions, e.g. `pip install elephant --install-option='--no-compile'`  (#494)

Bug fixes
---------
* added CUDA/OpenCL sources for ASSET GPU acceleration to `manifest.in`, they are now included in the distribution package (#483)
* fixed bug in `elephant.kernels` when passing a multi-dimensional kernel sigma, handling was added for 1-dimensional case (#499)
* fixed bug in `unitary_event_analysis` that broke elephants build on arm based systems (#500)
* fixed bug in `elephant/spade_src/include/FPGrowth.h` when using current versions of GCC for compilation (#508)
* fixed bug in `welch_psd`, `welch_cohere`, replace 'hanning' with 'hann', to ensure compatibility with scipy=>1.9.0 (#511)

Documentation
-------------
* fixed bug in CI documentation build (#492)
* reformatted code examples to be used as doctests in the future (#502)
* added specification and example for entries in the bibtex file to the "Contributing to Elephant" section (#504)
* updated documentation on running unit tests from `nosetest` to `pytest` (#505)
* fixed broken citation in `change_point_detection`, updated entry in bibtex file, added DOI (#513)

Optimizations
-------------
* Include `spike_train_synchrony` in the `init` of elephant, now `spike_train_synchrony` module is imported automatically (#518)

Validations
-----------
* added two validation tests for Victor-Purpura-distance to validate against original Matlab implementation in spike train dissimilarity (#482)

Other changes
-------------
* re-added report to coveralls.io to github action CI (#480)
* added OpenSSF (Open Source Security Foundations) best practices badge  (#495)
* improved documentation by adding links to documentation, bug tracker and source code on pypi (#496) (see: https://pypi.org/project/elephant/)
* CI workflows for macOS updated from version 10 to macOS 11 and 12 (#509)

Selected dependency changes
---------------------------
* removed scipy version cap on GitHub actions runners "docs" and "test-conda", by updating to `libstdcxx-ng 12.1.0` from conda-forge (#490)
* `nixio` added to test requirements, now nix files can be used in unit tests (#515)

Elephant 0.11.1 release notes
=============================

Bug fixes
---------
* Fix installation on macOS (#472)

Documentation
-------------
* Added example to `asset.discretise_spiketimes` docstring  (#468)

Optimizations
-------------
* Performance improvement of Spike Time Tiling Coefficient (STTC) (#438)

Other changes
-------------
* Continuous Integration (CI): added two workflows for macOS (#474)
* Fixed failing unit test asset on macOS (#474)

Selected dependency changes
---------------------------
* scipy >=1.5.4 (#473)

Elephant 0.11.0 release notes
=============================

Breaking changes
----------------

* For current source density measures electrode coordinates can no longer be supplied via a `RecordingChannelGroup` object as it is no longer supported in Neo v0.10.0 (#447)

New functionality and features
------------------------------

* Redesigned `elephant.spike_train_generation` module using classes (old API is retained for compatibility) (#416)
* Added function to calculate the multitaper power spectral density estimate in `elephant.spectral` (#417)
* Added a boundary correction for the firing rate estimator `elephant.statistics.instantaneous_rate` with Gaussian kernels (#414)
* Function to discretise spiketimes for a given spiketrain in `elephant.conversion` (#454)
* Support for the new `SpikeTrainList` object of Neo (#447)

Bug fixes
---------

* Issue with unit scaling in `BinnedSpikeTrain` (#425)
* Changed `BinnedSpikeTrain` to support quantities<0.12.4 (#418)
* Fix `FloatingPointError` in ICSD (#421)
* `t_start` information was lost while transposing LFP for `current_source_density` module (#432)
* Fix `neo_tools` unit tests to work with Neo 0.10.0+ (#446)
* Fixed various issues with consistency of bin boundaries of instantaneous rates (#453)

Documentation
-------------

* Update tutorials ASSET and UE tutorial and datasets to use nixio >=1.5.0 (#441)
* Updated `spade` tutorial to work with viziphant 0.2.0 (#444)
* Fixed figures in the Granger causality tutorial (#434)
* Add DOIs to documentation (#456)
* Fixed random seed selection in some tutorials (#430)

Optimizations
-------------

* Highly optimized run-time of the SPADE analysis (#419)
* More efficient storage of spike complexities by the `elephant.statistics.Complexity` class (#412)
* Updated `elephant.signal_processing.zscore` function for in-place operations (#440)

Other changes
-------------

* Continuous Integration (CI) was moved to github actions (#451)
* Change test framework from Nose to pytest (#413)
* Added DOI with zenodo (#445)
* Versioning for associated `elephant-data` repository for example datasets introduced (#463)

Selected dependency changes
---------------------------
* nixio >= 1.5.0
* neo >= 0.10.0
* python >= 3.7

Elephant 0.10.0 release notes
=============================

Documentation
-------------
The documentation is revised and restructured by categories (https://github.com/NeuralEnsemble/elephant/pull/386) to simplify navigation on readthedocs and improve user experience. All citations used in Elephant are stored in a single [BibTex file](https://github.com/NeuralEnsemble/elephant/blob/master/doc/bib/elephant.bib).

Optimizations
-------------

CUDA and OpenCL support
***********************
[Analysis of Sequences of Synchronous EvenTs](https://elephant.readthedocs.io/en/latest/reference/asset.html) has become the first module in Elephant that supports CUDA and OpenCL (https://github.com/NeuralEnsemble/elephant/pull/351, https://github.com/NeuralEnsemble/elephant/pull/404, https://github.com/NeuralEnsemble/elephant/pull/399). Whether you have an Nvidia GPU or just run the analysis on a laptop with a built-in Intel graphics card, the speed-up is **X100** and **X1000** compared to a single CPU core. The computations are optimized to a degree that you can analyse and look for spike patterns in real data in several minutes of compute time on a laptop. The installation instructions are described in the [install](https://elephant.readthedocs.io/en/latest/install.html) section.

Other optimizations
*******************
* Surrogates: sped up bin shuffling (https://github.com/NeuralEnsemble/elephant/pull/400) and reimplemented the continuous time version (https://github.com/NeuralEnsemble/elephant/pull/397)
* Improved memory efficiency of creating a BinnedSpikeTrain (https://github.com/NeuralEnsemble/elephant/pull/395)

New functionality and features
------------------------------
* Synchrofact detection (https://github.com/NeuralEnsemble/elephant/pull/322) is a method to detect highly synchronous spikes (at the level of sampling rate precision with an option to extend this to jittered synchrony) and annotate or optionally remove them.
* Added `phase_locking_value`, `mean_phase_vector`, and `phase_difference` functions (https://github.com/NeuralEnsemble/elephant/pull/385/files)
* BinnedSpikeTrain:
  - added `to_spike_trains` and `time_slice` functions (https://github.com/NeuralEnsemble/elephant/pull/390). Now you can slice a binned spike train as `bst[:, i:j]` or `bst.time_slice(t_start, t_stop)`. Also, with `to_spike_trains` function, you can generate a realization of spike trains that maps to the same BinnedSpikeTrain object when binned.
  - optional CSC format (https://github.com/NeuralEnsemble/elephant/pull/402)
  - the `copy` parameter (False by default) in the `binarize` function makes a *shallow* copy, if set to True, of the output BinnedSpikeTrain object (https://github.com/NeuralEnsemble/elephant/pull/402)
* Granger causality tutorial notebook (https://github.com/NeuralEnsemble/elephant/pull/393)
* Unitary Event Analysis support multiple pattern hashes (https://github.com/NeuralEnsemble/elephant/pull/387)

Bug fixes
---------
* Account for unidirectional spiketrain->segment links in synchrofact deletion (https://github.com/NeuralEnsemble/elephant/pull/398)
* Joint-ISI dithering: fixed a bug regarding first ISI bin (https://github.com/NeuralEnsemble/elephant/pull/396)
* Fix LvR values from being off when units are in seconds (https://github.com/NeuralEnsemble/elephant/pull/389)

Elephant 0.9.0 release notes
============================
This release is titled to accompany the [2nd Elephant User Workshop](https://www.humanbrainproject.eu/en/education/participatecollaborate/infrastructure-events-trainings/2nd-elephant-user-workshop/)

Viziphant
---------
Meet Viziphant, the visualization of Elephant analysis methods, at https://viziphant.readthedocs.io/en/latest/. This package provides support to easily plot and visualize the output of Elephant functions in a few lines of code.

Provenance tracking
-------------------
Provenance is becoming a separate direction in Elephant. Many things are still to come, and we started with annotating `time_histogram`, `instantaneous_rate` and `cross_correlation_histogram` outputs to carry the information about the parameters these functions used. This allowed Viziphant, the visualization of Elephant analyses, to look for the `.annotations` dictionary of the output of these function to "understand" how the object has been generated and label the plot axes accordingly.

New functionality and features
------------------------------
* Time-domain pairwise and conditional pairwise Granger causality measures (https://github.com/NeuralEnsemble/elephant/pull/332, https://github.com/NeuralEnsemble/elephant/pull/359)
* Spike contrast function that measures the synchrony of spike trains (https://github.com/NeuralEnsemble/elephant/pull/354; thanks to @Broxy7 for bringing this in Elephant).
* Revised local variability LvR (https://github.com/NeuralEnsemble/elephant/pull/346) as an alternative to the LV measure.
* Three surrogate methods: Trial-shifting, Bin Shuffling, ISI dithering (https://github.com/NeuralEnsemble/elephant/pull/343).
* Added a new function to generate spike trains: `inhomogeneous_gamma_process` (https://github.com/NeuralEnsemble/elephant/pull/339).
* The output of `instantaneous_rate` function is now a 2D matrix of shape `(time, len(spiketrains))` (https://github.com/NeuralEnsemble/elephant/issues/363). Not only can the users assess the averaged instantaneous rate (`rates.mean(axis=1)`) but also explore how much the instantaneous rate deviates from trial to trial (`rates.std(axis=1)`) (originally asked in https://github.com/NeuralEnsemble/elephant/issues/363).

Python 3 only
-------------
* Python 2.7 and 3.5 support is dropped. You can still however enjoy the features of Elephant v0.9.0 with Python 2.7 or 3.5 by installing Elephant from [this](https://github.com/NeuralEnsemble/elephant/tree/295c6bd7fea196cf9665a78649fafedab5840cfa) commit `pip install git+https://github.com/NeuralEnsemble/elephant@295c6bd7fea196cf9665a78649fafedab5840cfa#egg=elephant[extras]`
* Added Python 3.9 support.

Optimization
------------
* You have been asking for direct numpy support for years. Added `_t_start`, `_t_stop`, and `_bin_size` attributes of BinnedSpikeTrain are guaranteed to be of the same units and hence are unitless (https://github.com/NeuralEnsemble/elephant/pull/378). It doesn't mean though that you need to care about units on your own: `t_start`, `t_stop`, and `bin_size` properties are still quantities with units. The `.rescale()` method of a BinnedSpikeTrain rescales the internal units to new ones in-place. The following Elephant functions are optimized with unitless BinnedSpikeTrain:
  - cross_correlation_histogram
  - bin_shuffling (one of the surrogate methods)
  - spike_train_timescale
* X4 faster binning and overall BinnedSpikeTrain object creation (https://github.com/NeuralEnsemble/elephant/pull/368).
* `instantaneous_rate` function is vectorized to work with a list of spike train trials rather than computing them in a loop (previously, `for spiketrain in spiketrains; do compute instantaneous_rate(spiketrain); done`), which brought X25 speedup (https://github.com/NeuralEnsemble/elephant/pull/362; thanks to @gyyang for the idea and original implementation).
* Memory-efficient `zscore` function (https://github.com/NeuralEnsemble/elephant/pull/372).
* Don't sort the input array in ISI function (https://github.com/NeuralEnsemble/elephant/pull/371), which reduces function algorithmic time complexity from `O(N logN)` to linear `O(N)`. Now, when the input time array is not sorted, a warning is shown.
* Vectorized Current Source Density `generate_lfp` function (https://github.com/NeuralEnsemble/elephant/pull/358).

Breaking changes
----------------
* mpi4py package is removed from the extra requirements to allow `pip install elephant[extras]` on machines without MPI installed system-wide. Refer to [MPI support](https://elephant.readthedocs.io/en/latest/install.html#mpi-support) installation page in elephant.
* BinnedSpikeTrain (https://github.com/NeuralEnsemble/elephant/pull/368, https://github.com/NeuralEnsemble/elephant/pull/377):
  - previously, when t_start/stop, if set manually, was outside of the shared time interval, only the shared [t_start_shared=max(t_start), t_stop_shared=min(t_stop)] interval was implicitly considered without any warnings. Now an error is thrown with a description on how to fix it.
  - removed `lst_input`, `input_spiketrains`, `matrix_columns`, `matrix_rows` (in favor of the new attribute - `shape`), `tolerance`, `is_spiketrain`, `is_binned` attributes from BinnedSpikeTrain class. Part of them are confusing (e.g., `is_binned` was just the opposite of `is_spiketrain`, but one can erroneously think that it's data is clipped to 0 and 1), and part of them - `lst_input`, `input_spiketrains` input data - should not have been saved as attributes of an object in the first place because the input spike trains are not used after the sparse matrix is created.
  - now the users can directly access `.sparse_matrix` attribute of BinnedSpikeTrain to do efficient (yet unsafe in general) operations. For this reason, `to_sparse_array()` function, which does not make a copy, as one could think of, is deprecated.
* `instantaneous_rate` function (https://github.com/NeuralEnsemble/elephant/pull/362):
  - in case of multiple input spike trains, the output of the instantaneous rate function is (always) a 2D matrix of shape `(time, len(spiketrains))` instead of a pseudo 1D array (previous behavior) of shape `(time, 1)` that contained the instantaneous rate summed across input spike trains;
  - in case of multiple input spike trains, the user needs to manually provide the input kernel instead of `auto`, which is set by default, for the reason that it's currently not clear how to estimate the common kernel for a set of spike trains. If you have an idea how to do this, we`d appreciate if you let us know by [getting in touch with us](https://elephant.readthedocs.io/en/latest/get_in_touch.html).

Other changes
-------------
* `waveform_snr` function now directly takes a 2D or 3D waveforms matrix rather than a spike train (deprecated behavior).
* Added a warning in fanofactor function when the input spiketrains vary in their durations (https://github.com/NeuralEnsemble/elephant/pull/341).
* SPADE: New way to count patterns for multiple testing (https://github.com/NeuralEnsemble/elephant/pull/347)
* GPFA renamed 'xsm' -> 'latent_variable' and 'xorth' -> 'latent_variable_orth'

Bug fixes
---------
* Instantaneous rate arrays were not centered at the origin for spike trains that are symmetric at t=0 with `center_kernel=True` option (https://github.com/NeuralEnsemble/elephant/pull/362).
* The number of discarded spikes that fall into the last bin of a BinnedSpikeTrain object was incorrectly calculated (https://github.com/NeuralEnsemble/elephant/pull/368).
* Fixed index selection in `spike_triggered_phase` (https://github.com/NeuralEnsemble/elephant/pull/382)
* Fixed surrogates bugs:
  - `joint-ISI` and `shuffle ISI` output spike trains were not sorted in time (https://github.com/NeuralEnsemble/elephant/pull/364);
  - surrogates get arbitrary sampling_rate (https://github.com/NeuralEnsemble/elephant/pull/353), which relates to the provenance tracking issue;

Elephant 0.8.0 release notes
============================
New features
------------
* The `parallel` module is a new experimental module (https://github.com/NeuralEnsemble/elephant/pull/307) to run python functions concurrently. Supports native (pythonic) ProcessPollExecutor and MPI. Not limited to Elephant functional.
* Added an optional `refractory_period` argument, set to None by default, to `dither_spikes` function (https://github.com/NeuralEnsemble/elephant/pull/297).
* Added `cdf` and `icdf` functions in Kernel class to correctly estimate the median index, needed for `instantaneous_rate` function in statistics.py (https://github.com/NeuralEnsemble/elephant/pull/313).
* Added an optional `center_kernel` argument, set to True by default (to behave as in Elephant <0.8.0 versions) to `instantaneous_rate` function in statistics.py (https://github.com/NeuralEnsemble/elephant/pull/313).

New tutorials
-------------
* Analysis of Sequences of Synchronous EvenTs (ASSET) tutorial: https://elephant.readthedocs.io/en/latest/tutorials/asset.html
* Parallel module tutorial: https://elephant.readthedocs.io/en/latest/tutorials/parallel.html

Optimization
------------
* Optimized ASSET runtime by a factor of 10 and more (https://github.com/NeuralEnsemble/elephant/pull/259, https://github.com/NeuralEnsemble/elephant/pull/333).

Python 2.7 and 3.5 deprecation
------------------------------
Python 2.7 and 3.5 are deprecated and will not be maintained by the end of 2020. Switch to Python 3.6+.

Breaking changes
----------------
* Naming convention changes (`binsize` -> `bin_size`, etc.) in almost all Elephant functions (https://github.com/NeuralEnsemble/elephant/pull/316).

Elephant 0.7.0 release notes
============================

Breaking changes
----------------
* [gpfa] GPFA dimensionality reduction method is rewritten in easy-to-use scikit-learn class style format (https://github.com/NeuralEnsemble/elephant/pull/287):

.. code-block:: python

    gpfa = GPFA(bin_size=20*pq.ms, x_dim=8)
    results = gpfa.fit_transform(spiketrains, returned_data=['xorth', 'xsm'])

New tutorials
-------------
* GPFA dimensionality reduction method: https://elephant.readthedocs.io/en/latest/tutorials/gpfa.html
* Unitary Event Analysis of coordinated spiking activity: https://elephant.readthedocs.io/en/latest/tutorials/unitary_event_analysis.html
* (Introductory) statistics module: https://elephant.readthedocs.io/en/latest/tutorials/statistics.html

Deprecations
------------
* **Python 2.7 support will be dropped on Dec 31, 2020.** Please switch to Python 3.6, 3.7, or 3.8.
* [spike train generation] `homogeneous_poisson_process_with_refr_period()`, introduced in v0.6.4, is deprecated and will be deleted in v0.8.0. Use `homogeneous_poisson_process(refractory_period=...)` instead.
* [pandas bridge] pandas\_bridge module is deprecated and will be deleted in v0.8.0.

New features
------------
* New documentation style, guidelines, tutorials, and more (https://github.com/NeuralEnsemble/elephant/pull/294).
* Python 3.8 support (https://github.com/NeuralEnsemble/elephant/pull/282).
* [spike train generation] Added `refractory_period` flag in `homogeneous_poisson_process()` (https://github.com/NeuralEnsemble/elephant/pull/292) and `inhomogeneous_poisson_process()` (https://github.com/NeuralEnsemble/elephant/pull/295) functions. The default is `refractory_period=None`, meaning no refractoriness.
* [spike train correlation] `cross_correlation_histogram()` supports different t_start and t_stop of input spiketrains.
* [waveform features] `waveform_width()` function extracts the width (trough-to-peak TTP) of a waveform (https://github.com/NeuralEnsemble/elephant/pull/279).
* [signal processing] Added `scaleopt` flag in `pairwise_cross_correlation()` to mimic the behavior of Matlab's `xcorr()` function (https://github.com/NeuralEnsemble/elephant/pull/277). The default is `scaleopt=unbiased` to be consistent with the previous versions of Elephant.
* [spike train surrogates] Joint-ISI dithering method via `JointISI` class (https://github.com/NeuralEnsemble/elephant/pull/275).

Bug fixes
---------
* [spike train correlation] Fix CCH Border Correction (https://github.com/NeuralEnsemble/elephant/pull/298). Now, the border correction in `cross_correlation_histogram()` correctly reflects the number of bins used for the calculation at each lag. The correction factor is now unity at full overlap.
* [phase analysis] `spike_triggered_phase()` incorrect behavior when the spike train and the analog signal had different time units (https://github.com/NeuralEnsemble/elephant/pull/270).

Performance
-----------
* [spade] SPADE x7 speedup (https://github.com/NeuralEnsemble/elephant/pull/280, https://github.com/NeuralEnsemble/elephant/pull/285, https://github.com/NeuralEnsemble/elephant/pull/286). Moreover, SPADE is now able to handle all surrogate types that are available in Elephant, as well as more types of statistical corrections.
* [conversion] Fast & memory-efficient `covariance()` and Pearson `corrcoef()` (https://github.com/NeuralEnsemble/elephant/pull/274). Added flag `fast=True` by default in both functions.
* [conversion] Use fast fftconvolve instead of np.correlate in `cross_correlation_histogram()` (https://github.com/NeuralEnsemble/elephant/pull/273).

Elephant 0.6.4 release notes
============================

This release has been made for the "1st Elephant User Workshop" (https://www.humanbrainproject.eu/en/education/participatecollaborate/infrastructure-events-trainings/1st-elephant-user-workshop-accelerate-structured-and-reproducibl).

Main features
-------------
* neo v0.8.0 compatible

New modules
-----------
* GPFA - Gaussian-process factor analysis - dimensionality reduction method for neural trajectory visualization (https://github.com/NeuralEnsemble/elephant/pull/233). _Note: the API could change in the future._

Bug fixes
---------
* [signal processing] Keep `array_annotations` in the output of signal processing functions (https://github.com/NeuralEnsemble/elephant/pull/258).
* [SPADE] Fixed the calculation of the duration of a pattern in the output (https://github.com/NeuralEnsemble/elephant/pull/254).
* [statistics] Fixed automatic kernel selection yields incorrect values (https://github.com/NeuralEnsemble/elephant/pull/246).

Improvements
------------
* Vectorized `spike_time_tiling_coefficient()` function - got rid of a double for-loop (https://github.com/NeuralEnsemble/elephant/pull/244)
* Reduced the number of warnings during the tests (https://github.com/NeuralEnsemble/elephant/pull/238).
* Removed unused debug code in `spade/fast_fca.py` (https://github.com/NeuralEnsemble/elephant/pull/249).
* Improved doc string of `covariance()` and `corrcoef()` (https://github.com/NeuralEnsemble/elephant/pull/260).

Elephant 0.6.3 release notes
============================
July 22nd 2019

The release v0.6.3 is mostly about improving maintenance.

New functions
-------------
* `waveform_features` module
    * Waveform signal-to-noise ratio (https://github.com/NeuralEnsemble/elephant/pull/219).
* Added support for Butterworth `sosfiltfilt` - numerically stable (in particular, higher order) filtering (https://github.com/NeuralEnsemble/elephant/pull/234).

Bug fixes
---------
* Fixed neo version typo in requirements file (https://github.com/NeuralEnsemble/elephant/pull/218)
* Fixed broken docs (https://github.com/NeuralEnsemble/elephant/pull/230, https://github.com/NeuralEnsemble/elephant/pull/232)
* Fixed issue with 32-bit arch (https://github.com/NeuralEnsemble/elephant/pull/229)

Other changes
-------------
* Added issue templates (https://github.com/NeuralEnsemble/elephant/pull/226)
* Single VERSION file (https://github.com/NeuralEnsemble/elephant/pull/231)

Elephant 0.6.2 release notes
============================
April 23rd 2019

New functions
-------------
* `signal_processing` module
    * New functions to calculate the area under a time series and the derivative of a time series.

Other changes
-------------
* Added support to initialize binned spike train representations with a matrix
* Multiple bug fixes

Elephant 0.6.1 release notes
============================
April 1st 2019

New functions
-------------
* `signal_processing` module
    * New function to calculate the cross-correlation function for analog signals.
* `spade` module
    * Spatio-temporal spike pattern detection now includes the option to assess significance also based on time-lags of patterns, in addition to patterns size and frequency (referred to as 3D pattern spectrum).

Other changes
-------------
* This release fixes a number of compatibility issues in relation to API breaking changes in the Neo library.
* Fixed error in STTC calculation (spike time tiling coefficient)
* Minor bug fixes

Elephant 0.6.0 release notes
============================
October 12th 2018

New functions
-------------
* `cell_assembly_detection` module
    * New function to detect higher-order correlation structures such as patterns in parallel spike trains based on Russo et al, 2017.
*  **wavelet_transform()** function in `signal_prosessing.py` module
    * Function for computing wavelet transform of a given time series based on Le van Quyen et al. (2001)

Other changes
-------------
* Switched to multiple `requirements.txt` files which are directly read into the `setup.py`
* `instantaneous_rate()` accepts now list of spiketrains
* Minor bug fixes

Elephant 0.5.0 release notes
============================
April 4nd 2018

New functions
-------------
* `change_point_detection` module:
    * New function to detect changes in the firing rate
* `spike_train_correlation` module:
    * New function to calculate the spike time tiling coefficient
* `phase_analysis` module:
    * New function to extract spike-triggered phases of an AnalogSignal
* `unitary_event_analysis` module:
    * Added new unit test to the UE function to verify the method based on data of a recent [Re]Science publication

Other changes
-------------
* Minor bug fixes

Elephant 0.4.3 release notes
============================
March 2nd 2018

Other changes
-------------
* Bug fixes in `spade` module:
    * Fixed an incompatibility with the latest version of an external library

Elephant 0.4.2 release notes
============================
March 1st 2018

New functions
-------------
* `spike_train_generation` module:
    * **inhomogeneous_poisson()** function
* Modules for Spatio Temporal Pattern Detection (SPADE) `spade_src`:
    * Module SPADE: `spade.py`
* Module `statistics.py`:
    * Added CV2 (coefficient of variation for non-stationary time series)
* Module `spike_train_correlation.py`:
    * Added normalization in **cross-correlation histogram()** (CCH)

Other changes
-------------
* Adapted the `setup.py` to automatically install the spade modules including the compiled `C` files `fim.so`
* Included testing environment for MPI in `travis.yml`
* Changed function arguments  in `current_source_density.py` to `neo.AnalogSignal` instead list of `neo.AnalogSignal` objects
* Fixes to travis and setup configuration files
* Fixed bug in ISI function `isi()`, `statistics.py` module
* Fixed bug in `dither_spikes()`, `spike_train_surrogates.py`
* Minor bug fixes

Elephant 0.4.1 release notes
============================
March 23rd 2017

Other changes
-------------
* Fix in `setup.py` to correctly import the current source density module

Elephant 0.4.0 release notes
============================
March 22nd 2017

New functions
-------------
* `spike_train_generation` module:
    * peak detection: **peak_detection()**
* Modules for Current Source Density: `current_source_density_src`
    * Module Current Source Density: `KCSD.py`
    * Module for Inverse Current Source Density: `icsd.py`

API changes
-----------
* Interoperability between Neo 0.5.0 and Elephant
    * Elephant has adapted its functions to the changes in Neo 0.5.0,
      most of the functionality behaves as before
    * See Neo documentation for recent changes: http://neo.readthedocs.io/en/latest/whatisnew.html

Other changes
-------------
* Fixes to travis and setup configuration files.
* Minor bug fixes.
* Added module `six` for Python 2.7 backwards compatibility

Elephant 0.3.0 release notes
============================
April 12st 2016

New functions
-------------
* `spike_train_correlation` module:
    * cross correlation histogram: **cross_correlation_histogram()**
* `spike_train_generation` module:
    * single interaction process (SIP): **single_interaction_process()**
    * compound Poisson process (CPP): **compound_poisson_process()**
* `signal_processing` module:
    * analytic signal: **hilbert()**
* `sta` module:
    * spike field coherence: **spike_field_coherence()**
* Module to represent kernels: `kernels` module
* Spike train metrics / dissimilarity / synchrony measures: `spike_train_dissimilarity` module
* Unitary Event (UE) analysis: `unitary_event_analysis` module
* Analysis of Sequences of Synchronous EvenTs (ASSET): `asset` module

API changes
-----------
* Function **instantaneous_rate()** now uses kernels as objects defined in the `kernels` module. The previous implementation of the function using the `make_kernel()` function is deprecated, but still temporarily available as `oldfct_instantaneous_rate()`.

Other changes
-------------
* Fixes to travis and readthedocs configuration files.

Elephant 0.2.1 release notes
============================
February 18th 2016

Other changes
-------------
Minor bug fixes.

Elephant 0.2.0 release notes
============================
September 22nd 2015

New functions
-------------
* Added covariance function **covariance()** in the `spike_train_correlation` module
* Added complexity pdf **complexity_pdf()** in the `statistics` module
* Added spike train extraction from analog signals via threshold detection the in `spike_train_generation` module
* Added **coherence()** function for analog signals in the `spectral` module
* Added **Cumulant Based Inference for higher-order of Correlation (CuBIC)** in the `cubic` module for correlation analysis of parallel recorded spike trains

API changes
-----------
* **Optimized kernel bandwidth** in `rate_estimation` function: Calculates the optimized kernel width when the paramter kernel width is specified as `auto`

Other changes
-------------
* **Optimized creation of sparse matrices**: The creation speed of the sparse matrix inside the `BinnedSpikeTrain` class is optimized
* Added **Izhikevich neuron simulator** in the `make_spike_extraction_test_data` module
* Minor improvements to the test and continous integration infrastructure


text:
* Apc
  * The Alternative Php Cache (APC) driver. A memory cache for regular performances.
* Apcu
  * The Alternative Php User Cache (APCU) driver. A memory cache for regular performances.
* Cassandra
  * A very high-performance NoSQL driver using a key-value pair system. Please note that the Driver rely on php's Datastax extension: https://github.com/datastax/php-driver
* Cookie
  * A cookie driver to store non-sensitive scalar (only) data. Limited storage up to 4Ko.
* Couchbase
  * A very high-performance NoSQL driver using a key-value pair system
* Couchdb
  * A very high-performance NoSQL driver using a key-value pair system
* Devfalse
   * A development driver that return false for everything except driverCheck()
* Devnull
   * A development driver that return null for driverRead() and driverIsHit() (get actions) and true for other action such as driverDelete, DriverClear() etc.
* Devtrue
   * A development driver that return true for everything including driverCheck()
* Files
  * A file driver that use serialization for storing data for regular performances. A _$path_ config must be specified, else the system temporary directory will be used.
* Leveldb
  * A NoSQL driver using a key-value pair system. A _$path_ config must be specified, else the system temporary directory will be used.
* Memcache
  * The Memcache driver. A memory cache for regular performances. Do not cross this driver with Memcached driver
* Memcached
  * The Memcached driver. A memory cache for regular performances. Do not cross this driver with Memcache driver
* Memstatic
  * The Memstatic driver is a memory static driver that expires when the script execution ends
* Mongodb
  * A very high-performance NoSQL driver using a key-value pair system
* Predis
  * A high-performance memory driver using a in-memory data structure storage. Less efficient than Redis driver as it is an embedded library
* Redis
  * A very high-performance memory driver using a in-memory data structure storage. More efficient than Predis driver as it is an compiled library
* Sqlite
  * A Sqlite driver that use serialization for storing data for regular performances. A _$path_ config must be specified, else the system temporary directory will be used.
* Ssdb
  * A very high-performance NoSQL driver using a key-value pair system
* Wincache
  * The Wincache driver. A memory cache for regular performances on Windows platforms.
* Xcache
  * The Xcache driver. A memory cache for regular performances.
* Zend Disk Cache ( * Requires ZendServer Version 4 or higher * )
  * The Zend Data Cache is a by ZendServer supported file cache. The cache is for regular performance.
* Zend Memory Cache ( * Requires ZendServer Version 4 or higher * )
  * The Zend Memory Cache is a by ZendServer supported memory cache. The cache is for high-performance applications.


text:
package com.loyagram.android.campaignsdk.models;

import android.os.Parcel;
import android.os.Parcelable;

import com.google.gson.annotations.SerializedName;

import java.math.BigDecimal;

public class ResponseAnswerText implements Parcelable {

    @SerializedName("id")
    private BigDecimal id = null;
    @SerializedName("response_answer_id")
    private String campaignedAnswerId = null;
    @SerializedName("text")
    private String text = null;

    /**
     **/

    public BigDecimal getId() {
        return id;
    }

    public void setId(BigDecimal id) {
        this.id = id;
    }

    /**
     **/

    public String getCampaignedAnswerId() {
        return campaignedAnswerId;
    }

    public void setCampaignedAnswerId(String campaignedAnswerId) {
        this.campaignedAnswerId = campaignedAnswerId;
    }

    /**
     **/

    public String getText() {
        return text;
    }

    public void setText(String text) {
        this.text = text;
    }

    public ResponseAnswerText() {
    }

    @SuppressWarnings("unused")
    public static final Parcelable.Creator<ResponseAnswerText> CREATOR = new Parcelable.Creator<ResponseAnswerText>() {
        @Override
        public ResponseAnswerText createFromParcel(Parcel in) {
            return new ResponseAnswerText(in);
        }

        @Override
        public ResponseAnswerText[] newArray(int size) {
            return new ResponseAnswerText[size];
        }
    };

    @Override
    public int describeContents() {
        return 0;
    }

    @Override
    public void writeToParcel(Parcel dest, int flags) {

        if (this.id == null) {
            dest.writeByte((byte) 0);
        } else {
            dest.writeByte((byte) 1);
            dest.writeSerializable(this.id);
        }

        if (this.campaignedAnswerId == null) {
            dest.writeByte((byte) 0);
        } else {
            dest.writeByte((byte) 1);
            dest.writeString(this.campaignedAnswerId);
        }

        if (this.text == null) {
            dest.writeByte((byte) 0);
        } else {
            dest.writeByte((byte) 1);
            dest.writeString(this.text);
        }

    }

    public ResponseAnswerText(Parcel in) {
        boolean isPresent = false;

        isPresent = in.readByte() == 1;
        if (isPresent) {
            this.id = (BigDecimal) in.readSerializable();
        } else {
            this.id = null;
        }

        isPresent = in.readByte() == 1;
        if (isPresent) {
            this.campaignedAnswerId = in.readString();
        } else {
            this.campaignedAnswerId = null;
        }

        isPresent = in.readByte() == 1;
        if (isPresent) {
            this.text = in.readString();
        } else {
            this.text = null;
        }

    }

    @Override
    public String toString() {
        StringBuilder sb = new StringBuilder();
        sb.append("class ResponseAnswerText {\n");
        sb.append("  id: ").append(id).append("\n");
        sb.append("  campaignedAnswerId: ").append(campaignedAnswerId).append("\n");
        sb.append("  text: ").append(text).append("\n");
        sb.append("}\n");
        return sb.toString();
    }
}


text:
package com.datatorrent.lib.join;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.apache.hadoop.classification.InterfaceStability.Evolving;
import com.datatorrent.api.Context.OperatorContext;
import com.datatorrent.api.DefaultInputPort;
import com.datatorrent.api.DefaultOutputPort;
import com.datatorrent.api.Operator;
import com.datatorrent.api.annotation.OperatorAnnotation;
import com.datatorrent.lib.streamquery.condition.Condition;
import com.datatorrent.lib.streamquery.index.Index;

/**
 * An implementation of Operator that reads table row data from two table data input ports.

 *

 * Operator anti-joins row on given condition and selected names, emits
 * anti-joined result at output port.
 *

 * StateFull : Yes, Operator aggregates input over application window.

 * Partitions : No,  will yield wrong result(s).

 *

 * Ports :

 *  inport1 :  Input port for table 1, expects HashMap<String, Object>

 *  inport2 :  Input port for table 2, expects HashMap<String, Object>

 *  outport :  Output anti-joined row port, emits HashMap<String, ArrayList<Object>>

 *

 *  Properties :
 *  joinCondition :  Join condition for table rows.

 *  table1Columns :  Columns to be selected from table1.

 *  table2Columns :  Columns to be selected from table2.

 *

 *
 * @displayName Anti join
 * @category Stream Manipulators
 * @tags sql, anti join operator
 * @since 0.3.3
 */
@OperatorAnnotation(partitionable = false)
@Evolving
public class AntiJoinOperator implements Operator
{

  /**
   * Join Condition;
   */
  private Condition joinCondition;

  /**
   * Table1 select columns.
   * Note: only left table (Table1) will be output in an Anti-join
   */
  private ArrayList<Index> table1Columns = new ArrayList<>();

  /**
   * Collect data rows from input port 1.
   */
  private List<Map<String, Object>> table1;

  /**
   * Collect data from input port 2.
   */
  private List<Map<String, Object>> table2;

  /**
   * Input port 1 that takes a map of <string,object>.
   */
  public final transient DefaultInputPort<Map<String, Object>> inport1 = new DefaultInputPort<Map<String, Object>>()
  {
    @Override
    public void process(Map<String, Object> tuple)
    {
      table1.add(tuple);
      for (int j = 0; j < table2.size(); j++) {
        if ((joinCondition != null) && (joinCondition.isValidJoin(tuple, table2.get(j)))) {
          table1.remove(tuple);
        }
      }
    }
  };

  /**
   * Input port 2 that takes a map of <string,object>.
   */
  public final transient DefaultInputPort<Map<String, Object>> inport2 = new DefaultInputPort<Map<String, Object>>()
  {
    @Override
    public void process(Map<String, Object> tuple)
    {
      table2.add(tuple);

      for (int j = 0; j < table1.size(); j++) {
        if ((joinCondition != null)
            && (joinCondition.isValidJoin(table1.get(j), tuple))) {
          table1.remove(table1.get(j));
        }
      }
    }
  };

  /**
   * Output port that emits a map of <string,object>.
   */
  public final transient DefaultOutputPort<Map<String, Object>> outport = new DefaultOutputPort<>();

  @Override
  public void setup(OperatorContext arg0)
  {
    table1 = new ArrayList<>();
    table2 = new ArrayList<>();
  }

  @Override
  public void teardown()
  {
  }

  @Override
  public void beginWindow(long arg0)
  {
  }

  @Override
  public void endWindow()
  {
    /* All joined rows have been removed
     * The ones left are the anti-joined result
     */
    for (int i = 0; i < table1.size(); i++) {
      joinRows(table1.get(i));
    }

    table1.clear();
    table2.clear();
  }

  /**
   * @return the joinCondition
   */
  public Condition getJoinCondition()
  {
    return joinCondition;
  }

  /**
   * Pick the supported condition. Currently only equal join is supported.
   *
   * @param joinCondition - join condition
   */
  public void setJoinCondition(Condition joinCondition)
  {
    this.joinCondition = joinCondition;
  }

  /**
   * Select table1 column name.
   */
  public void selectTable1Column(Index column)
  {
    table1Columns.add(column);
  }

  /**
   * Join row from table1 and table2.
   */
  protected void joinRows(Map<String, Object> row)
  {
    // joined row
    Map<String, Object> join = new HashMap<>();

    // filter table1 columns
    if (row != null) {
      for (Index index : table1Columns) {
        index.filter(row, join);
      }
    }

    // emit row
    outport.emit(join);
  }
}


text:
import variadic, go

############### Non Variadic ##############
nonvarResult = variadic.NonVariFunc(1, go.Slice_int([2,3,4]),5)
print("NonVariadic 1+[2+3+4]+5 = %d" % nonvarResult)

############### Variadic Over Int ##############
varResult = variadic.VariFunc(1,2,3,4,5)
print("Variadic 1+2+3+4+5 = %d" % varResult)

############### Variadic Over Struct ##############
varStructResult = variadic.VariStructFunc(variadic.NewIntStrUct(1), variadic.NewIntStrUct(2), variadic.NewIntStrUct(3))
print("Variadic Struct s(1)+s(2)+s(3) = %d" % varStructResult)

############### Variadic Over InterFace ##############
varInterFaceResult = variadic.VariInterFaceFunc(variadic.NewIntStrUct(1), variadic.NewIntStrUct(2), variadic.NewIntStrUct(3))
print("Variadic InterFace i(1)+i(2)+i(3) = %d" % varInterFaceResult)

############### Final ##############
if isinstance(varResult, int):
	print("Type OK")
else:
	print("Type Not OK")


text:
// -*- C++ -*-

//=============================================================================
/**
 *  @file    Timer_List.h
 *
 *  $Id: Timer_List.h 92580 2010-11-15 09:48:02Z johnnyw $
 *
 *  @author Doug Schmidt
 */
//=============================================================================

#ifndef ACE_TIMER_LIST_H
#define ACE_TIMER_LIST_H
#include /**/ "ace/pre.h"

#include "ace/Timer_List_T.h"

#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */

ACE_BEGIN_VERSIONED_NAMESPACE_DECL

// The following typedefs are here for ease of use and backward
// compatibility.
typedef ACE_Timer_List_T<ACE_Event_Handler *,
                         ACE_Event_Handler_Handle_Timeout_Upcall<ACE_SYNCH_RECURSIVE_MUTEX>,
                         ACE_SYNCH_RECURSIVE_MUTEX>
        ACE_Timer_List;

typedef ACE_Timer_List_Iterator_T<ACE_Event_Handler *,
                                  ACE_Event_Handler_Handle_Timeout_Upcall<ACE_SYNCH_RECURSIVE_MUTEX>,
                                  ACE_SYNCH_RECURSIVE_MUTEX>
        ACE_Timer_List_Iterator;

ACE_END_VERSIONED_NAMESPACE_DECL

#include /**/ "ace/post.h"
#endif /* ACE_TIMER_LIST_H */


text:
using System;
using System.IO;
using L10NSharp;
using SIL.DblBundle.Text;
using SIL.IO;
using SIL.Reporting;
using SIL.Xml;

namespace SIL.DblBundle
{
	///
	/// File utilities for DBL Bundles
	///
	public static class DblBundleFileUtils
	{
		/// Extension used on DBL bundles
		public const string kDblBundleExtension = ".zip";
		/// File that contains versification
		public const string kVersificationFileName = "versification.vrs";
		/// File that contains language definition
		public const string kLdmlFileName = "ldml.xml";
		/// File extension for language definition files
		public const string kUnzippedLdmlFileExtension = ".ldml";

		///
		/// Extract the contents of a zip file located in the specified path to a temp directory
		///
		/// <returns>path of the temporary directory</returns>
		public static string ExtractToTempDirectory(string zipFilePath)
		{
			if (!File.Exists(zipFilePath))
				throw new ArgumentException("Zip file must exist.", "zipFilePath");

			string tempPath = Path.Combine(Path.GetTempPath(), Path.GetRandomFileName());
			Directory.CreateDirectory(tempPath);

			ZipUtilities.ExtractToDirectory(zipFilePath, tempPath);

			return tempPath;
		}
	}

	///
	/// Interface representing a DBL bundle
	///
	public interface IBundle
	{
		///
		/// Unique hex ID for the DBL bundle
		///
		string Id { get; }
		///
		/// 3-letter ISO 639-2 code for the language of the DBL bundle
		///
		string LanguageIso { get; }
		///
		/// The name of the publication
		///
		string Name { get; }
	}

	///
	/// A DBL Bundle
	///
	public abstract class Bundle<TM, TL> : IBundle, IDisposable
		where TM : DblMetadataBase<TL>
		where TL : DblMetadataLanguage, new()
	{
		private readonly TM m_dblMetadata;
		/// temporary directory path where the zip bundle is extracted
		protected readonly string m_pathToZippedBundle;
		private string m_pathToUnzippedDirectory;

		///
		/// Create a DBL Bundle
		///
		/// <param name="pathToZippedBundle"></param>
		/// <exception cref="ApplicationException"></exception>
		protected Bundle(string pathToZippedBundle)
		{
			m_pathToZippedBundle = pathToZippedBundle;
			try
			{
				m_pathToUnzippedDirectory = DblBundleFileUtils.ExtractToTempDirectory(m_pathToZippedBundle);
			}
			catch (Exception ex)
			{
				throw new ApplicationException(LocalizationManager.GetString("DblBundle.UnableToExtractBundle",
						"Unable to read contents of Text Release Bundle:") +
					Environment.NewLine + m_pathToZippedBundle, ex);
			}

			m_dblMetadata = LoadMetadata();
		}

		#region Public properties
		///
		/// Typically, this should be set to SIL.WritingSystems.WellKnownSubtags.UnlistedLanguage by the client.
		/// We would have probably just hard-coded to that, but we didn't want to have to reference SIL.WritingSystems
		/// just for that. Anyway, this gives a bit more versatility.
		///
		public static string DefaultLanguageIsoCode { get; set; }

		///
		/// Path to the original (unzipped) DBL bundle
		///
		public string BundlePath { get { return m_pathToZippedBundle; } }

		///
		/// Representation of the metadata.xml file included in the bundle
		///
		public TM Metadata { get { return m_dblMetadata; } }

		///
		/// Unique hex ID for the DBL bundle
		///
		public string Id { get { return m_dblMetadata.Id; } }

		///
		/// 3-letter ISO 639-2 code for the language of the DBL bundle. If the metadata's language does
		/// not identify an ISO 639-2 code, this returns the default language ISO code, which clients
		/// are encouraged to set to "qaa" or some other value that will allow it to be properly
		/// treated as "unknown".
		///
		public string LanguageIso
		{
			get
			{
				var isoCode = m_dblMetadata.Language.Iso;
				return String.IsNullOrEmpty(isoCode) ? DefaultLanguageIsoCode : isoCode;
			}
		}

		///
		/// The name of the publication
		///
		public abstract string Name { get; }
		#endregion

		///
		/// (Temporary) path of the unzipped contents of the DBL bundle
		///
		protected string PathToUnzippedDirectory { get { return m_pathToUnzippedDirectory; } }

		#region Private methods
		private TM LoadMetadata()
		{
			const string filename = "metadata.xml";
			string metadataPath = Path.Combine(m_pathToUnzippedDirectory, filename);

			if (!File.Exists(metadataPath))
			{
				bool sourceBundle = filename.Contains("source") || Directory.Exists(Path.Combine(m_pathToUnzippedDirectory, "gather"));
				if (sourceBundle)
				{
					throw new ApplicationException(
						string.Format(LocalizationManager.GetString("DblBundle.SourceReleaseBundle",
							"This bundle appears to be a source bundle. Only Text Release Bundles are currently supported."), filename) +
						Environment.NewLine + m_pathToZippedBundle);

				}
				throw new ApplicationException(
					string.Format(LocalizationManager.GetString("DblBundle.FileMissingFromBundle",
						"Required {0} file not found. File is not a valid Text Release Bundle:"), filename) +
					Environment.NewLine + m_pathToZippedBundle);
			}

			Exception exception;
			var dblMetadata = DblMetadataBase<TL>.Load<TM>(metadataPath, out exception);
			if (exception != null)
			{
				Exception metadataBaseDeserializationError;
				DblMetadata metadata = XmlSerializationHelper.DeserializeFromFile<DblMetadata>(metadataPath,
					out metadataBaseDeserializationError);
				if (metadataBaseDeserializationError != null)
				{
					throw new ApplicationException(
						LocalizationManager.GetString("DblBundle.MetadataInvalid",
							"Unable to read metadata. File is not a valid Text Release Bundle:") +
						Environment.NewLine + m_pathToZippedBundle, metadataBaseDeserializationError);
				}

				throw new ApplicationException(
					String.Format(LocalizationManager.GetString("DblBundle.MetadataInvalidVersion",
						"Unable to read metadata. Type: {0}. Version: {1}. File is not a valid Text Release Bundle:"),
						metadata.Type, metadata.TypeVersion) +
					Environment.NewLine + m_pathToZippedBundle);
			}

			if (!dblMetadata.IsTextReleaseBundle)
			{
				throw new ApplicationException(
					String.Format(LocalizationManager.GetString("DblBundle.NotTextReleaseBundle",
						"This metadata in this bundle indicates that it is of type \"{0}\". Only Text Release Bundles are currently supported."),
						dblMetadata.Type));
			}

			return dblMetadata;
		}
		#endregion

		#region IDisposable Members
		///
		/// Dispose method for this class.
		///
		public void Dispose()
		{
			if (m_pathToUnzippedDirectory != null && Directory.Exists(m_pathToUnzippedDirectory))
			{
				try
				{
					Directory.Delete(m_pathToUnzippedDirectory, true);
				}
				catch (Exception e)
				{
					ErrorReport.ReportNonFatalExceptionWithMessage(e,
						string.Format("Failed to clean up temporary folder where bundle was unzipped: {0}.", m_pathToUnzippedDirectory));
				}
				m_pathToUnzippedDirectory = null;
			}
		}
		#endregion
	}
}


text:
I needed to backup all the database data for one of my current projects and thought to create a task for that would be a good idea. I do like to have things as simpler as possible, so didn't want any gem or third party software in charge of this task. It's quite simple

```
namespace :db do  desc "Backup database to AWS-S3"
  task :backup => [:environment] do
    root_folder = '/tmp/'
    s3_folder = 'db_backups'
    backup_filename = "#{Time.now.strftime('%Y%m%d%H%M%S')}_backup_db"

    `pg_dump mydatabase > #{root_folder}#{backup_filename}`
    `gzip -9 #{root_folder}#{backup_filename}`

    bucket_name = ENV['S3_BUCKET']
    Aws.config.update({
      region: 'eu-west-1',
      credentials: Aws::Credentials.new(ENV['AWS_ACCESS_KEY_ID'], ENV['AWS_SECRET_ACCESS_KEY'])
    })
    s3 = Aws::S3::Resource.new

    s3.bucket(bucket_name).object("#{s3_folder}/#{backup_filename}.gz").upload_file("#{root_folder}#{backup_filename}.gz")
    `rm -f #{root_folder}#{backup_filename}.gz`
  end
end
```

For get this script working, the current user should have the proper rights to access to the database schema "mydatabase" and some environment variables created, such as S3_BUCKET, AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY.

This will upload the compressed dump file to the folder "db_backups" within the bucket configured in S3_BUCKET.

Then, you just need to create a cron to run the task whenever you want:

```
crontab -e
```

Add the following line
```
00 15,23 * * * /bin/bash -l -c 'THE_ROOT_TO_THE_BIN/rake -f THE_ROOT_TO_THE_RAKEFILE/Rakefile db:backup' >> LOGS_FOLDER/crontab.log
```

This will create a backup of your database twice a day, at 3pm and 23pm, and upload them to your S3 bucket


text:
namespace cbor {
class Value;
}

namespace device {

namespace pin {
struct EmptyResponse;
}

// https://drafts.fidoalliance.org/fido-2/latest/fido-client-to-authenticator-protocol-v2.0-wd-20190409.html#authenticatorCredentialManagement

enum class CredentialManagementRequestKey : uint8_t {
  kSubCommand = 0x01,
  kSubCommandParams = 0x02,
  kPinProtocol = 0x03,
  kPinAuth = 0x04,
};

enum class CredentialManagementRequestParamKey : uint8_t {
  kRPIDHash = 0x01,
  kCredentialID = 0x02,
};

enum class CredentialManagementResponseKey : uint8_t {
  kExistingResidentCredentialsCount = 0x01,
  kMaxPossibleRemainingResidentCredentialsCount = 0x02,
  kRP = 0x03,
  kRPIDHash = 0x04,
  kTotalRPs = 0x05,
  kUser = 0x06,
  kCredentialID = 0x07,
  kPublicKey = 0x08,
  kTotalCredentials = 0x09,
  kCredProtect = 0x0a,
};

enum class CredentialManagementSubCommand : uint8_t {
  kGetCredsMetadata = 0x01,
  kEnumerateRPsBegin = 0x02,
  kEnumerateRPsGetNextRP = 0x03,
  kEnumerateCredentialsBegin = 0x04,
  kEnumerateCredentialsGetNextCredential = 0x05,
  kDeleteCredential = 0x06,
};

// CredentialManagementPreviewRequestAdapter wraps any credential management
// request struct in order to replace the authenticatorCredentialManagement
// command byte returned by the static EncodeAsCBOR() method (0x0a) with its
// vendor-specific preview equivalent (0x41).
template <class T>
class CredentialManagementPreviewRequestAdapter {
 public:
  static std::pair<CtapRequestCommand, base::Optional<cbor::Value>>
  EncodeAsCBOR(const CredentialManagementPreviewRequestAdapter<T>& request) {
    auto result = T::EncodeAsCBOR(request.wrapped_request_);
    DCHECK_EQ(result.first,
              CtapRequestCommand::kAuthenticatorCredentialManagement);
    result.first =
        CtapRequestCommand::kAuthenticatorCredentialManagementPreview;
    return result;
  }

  CredentialManagementPreviewRequestAdapter(T request)
      : wrapped_request_(std::move(request)) {}

 private:
  T wrapped_request_;
};

// CredentialManagementRequest is an authenticatorCredentialManagement(0x0a)
// CTAP2 request. Instances can be obtained via one of the subcommand-specific
// static factory methods.
struct CredentialManagementRequest {
  static std::pair<CtapRequestCommand, base::Optional<cbor::Value>>
  EncodeAsCBOR(const CredentialManagementRequest&);

  enum Version {
    kDefault,
    kPreview,
  };

  static CredentialManagementRequest ForGetCredsMetadata(
      Version version,
      base::span<const uint8_t> pin_token);
  static CredentialManagementRequest ForEnumerateRPsBegin(
      Version version,
      base::span<const uint8_t> pin_token);
  static CredentialManagementRequest ForEnumerateRPsGetNext(Version version);
  static CredentialManagementRequest ForEnumerateCredentialsBegin(
      Version version,
      base::span<const uint8_t> pin_token,
      std::array<uint8_t, kRpIdHashLength> rp_id_hash);
  static CredentialManagementRequest ForEnumerateCredentialsGetNext(
      Version version);
  static CredentialManagementRequest ForDeleteCredential(
      Version version,
      base::span<const uint8_t> pin_token,
      const PublicKeyCredentialDescriptor& credential_id);

  CredentialManagementRequest(CredentialManagementRequest&&);
  CredentialManagementRequest& operator=(CredentialManagementRequest&&);
  ~CredentialManagementRequest();

  Version version;
  CredentialManagementSubCommand subcommand;
  base::Optional<cbor::Value::MapValue> params;
  base::Optional<std::array<uint8_t, 16>> pin_auth;

 private:
  CredentialManagementRequest() = delete;
  CredentialManagementRequest(Version version,
                              CredentialManagementSubCommand subcommand,
                              base::Optional<cbor::Value::MapValue> params,
                              base::Optional<std::array<uint8_t, 16>> pin_auth);
  CredentialManagementRequest(const CredentialManagementRequest&) = delete;
  CredentialManagementRequest& operator=(const CredentialManagementRequest&) =
      delete;
};

struct CredentialsMetadataResponse {
  static base::Optional<CredentialsMetadataResponse> Parse(
      const base::Optional<cbor::Value>& cbor_response);

  size_t num_existing_credentials;
  size_t num_estimated_remaining_credentials;

 private:
  CredentialsMetadataResponse() = default;
};

struct EnumerateRPsResponse {
  static base::Optional<EnumerateRPsResponse> Parse(
      bool expect_rp_count,
      const base::Optional<cbor::Value>& cbor_response);

  // StringFixupPredicate indicates which fields of an EnumerateRPsResponse may
  // contain truncated UTF-8 strings. See
  // |Ctap2DeviceOperation::CBORPathPredicate|.
  static bool StringFixupPredicate(const std::vector<const cbor::Value*>& path);

  EnumerateRPsResponse(EnumerateRPsResponse&&);
  EnumerateRPsResponse& operator=(EnumerateRPsResponse&&);
  ~EnumerateRPsResponse();

  base::Optional<PublicKeyCredentialRpEntity> rp;
  base::Optional<std::array<uint8_t, kRpIdHashLength>> rp_id_hash;
  size_t rp_count;

 private:
  EnumerateRPsResponse(
      base::Optional<PublicKeyCredentialRpEntity> rp,
      base::Optional<std::array<uint8_t, kRpIdHashLength>> rp_id_hash,
      size_t rp_count);
  EnumerateRPsResponse(const EnumerateRPsResponse&) = delete;
  EnumerateRPsResponse& operator=(const EnumerateRPsResponse&) = delete;
};

struct EnumerateCredentialsResponse {
  static base::Optional<EnumerateCredentialsResponse> Parse(
      bool expect_credential_count,
      const base::Optional<cbor::Value>& cbor_response);

  // StringFixupPredicate indicates which fields of an
  // EnumerateCredentialsResponse may contain truncated UTF-8 strings. See
  // |Ctap2DeviceOperation::CBORPathPredicate|.
  static bool StringFixupPredicate(const std::vector<const cbor::Value*>& path);

  EnumerateCredentialsResponse(EnumerateCredentialsResponse&&);
  EnumerateCredentialsResponse& operator=(EnumerateCredentialsResponse&&);
  ~EnumerateCredentialsResponse();

  PublicKeyCredentialUserEntity user;
  PublicKeyCredentialDescriptor credential_id;
  // For convenience, also return the serialized |credential_id| so that the UI
  // doesn't have to do CBOR serialization. (It only cares about the opaque byte
  // string.)
  std::vector<uint8_t> credential_id_cbor_bytes;
  size_t credential_count;

 private:
  EnumerateCredentialsResponse(PublicKeyCredentialUserEntity user,
                               PublicKeyCredentialDescriptor credential_id,
                               size_t credential_count);
  EnumerateCredentialsResponse(const EnumerateCredentialsResponse&) = delete;
  EnumerateCredentialsResponse& operator=(EnumerateCredentialsResponse&) =
      delete;
};

struct COMPONENT_EXPORT(DEVICE_FIDO) AggregatedEnumerateCredentialsResponse {
  AggregatedEnumerateCredentialsResponse(PublicKeyCredentialRpEntity rp);
  AggregatedEnumerateCredentialsResponse(
      AggregatedEnumerateCredentialsResponse&&);
  AggregatedEnumerateCredentialsResponse& operator=(
      AggregatedEnumerateCredentialsResponse&&);
  ~AggregatedEnumerateCredentialsResponse();

  PublicKeyCredentialRpEntity rp;
  std::vector<EnumerateCredentialsResponse> credentials;

 private:
  AggregatedEnumerateCredentialsResponse(
      const AggregatedEnumerateCredentialsResponse&) = delete;
};

using DeleteCredentialResponse = pin::EmptyResponse;

std::pair<CtapRequestCommand, base::Optional<cbor::Value>>
AsCTAPRequestValuePair(const CredentialManagementRequest&);

}  // namespace device

#endif  // DEVICE_FIDO_CREDENTIAL_MANAGEMENT_H_


text:
package york.com.retrofit2rxjavademo.utils;

import android.content.Context;
import android.net.ConnectivityManager;
import android.net.NetworkInfo;
import android.telephony.TelephonyManager;

import java.io.IOException;
import java.net.HttpURLConnection;
import java.net.InetAddress;
import java.net.NetworkInterface;
import java.net.SocketException;
import java.net.URL;
import java.util.Enumeration;

public class NetworkUtil {

    public static int NET_CNNT_BAIDU_OK = 1; // NetworkAvailable
    public static int NET_CNNT_BAIDU_TIMEOUT = 2; // no NetworkAvailable
    public static int NET_NOT_PREPARE = 3; // Net no ready
    public static int NET_ERROR = 4; //net error
    private static int TIMEOUT = 3000; // TIMEOUT

    /**
     * check NetworkAvailable
     * @param context
     * @return
     */
    public static boolean isNetworkAvailable(Context context) {
        ConnectivityManager manager = (ConnectivityManager) context.getApplicationContext().getSystemService(
                Context.CONNECTIVITY_SERVICE);
        if (null == manager)
            return false;
        NetworkInfo info = manager.getActiveNetworkInfo();
        if (null == info || !info.isAvailable())
            return false;
        return true;
    }

    /**
     * 得到ip地址
     *
     * @return
     */
    public static String getLocalIpAddress() {
        String ret = "";
        try {
            for (Enumeration<NetworkInterface> en = NetworkInterface.getNetworkInterfaces(); en.hasMoreElements();) {
                NetworkInterface intf = en.nextElement();
                for (Enumeration<InetAddress> enumIpAddr = intf.getInetAddresses(); enumIpAddr.hasMoreElements();) {
                    InetAddress inetAddress = enumIpAddr.nextElement();
                    if (!inetAddress.isLoopbackAddress()) {
                        ret = inetAddress.getHostAddress().toString();
                    }
                }
            }
        } catch (SocketException ex) {
            ex.printStackTrace();
        }
        return ret;
    }

    /**
     * 返回当前网络状态
     *
     * @param context
     * @return
     */
    public static int getNetState(Context context) {
        try {
            ConnectivityManager connectivity = (ConnectivityManager) context
                    .getSystemService(Context.CONNECTIVITY_SERVICE);
            if (connectivity != null) {
                NetworkInfo networkinfo = connectivity.getActiveNetworkInfo();
                if (networkinfo != null) {
                    if (networkinfo.isAvailable() && networkinfo.isConnected()) {
                        if (!connectionNetwork())
                            return NET_CNNT_BAIDU_TIMEOUT;
                        else
                            return NET_CNNT_BAIDU_OK;
                    } else {
                        return NET_NOT_PREPARE;
                    }
                }
            }
        } catch (Exception e) {
            e.printStackTrace();
        }
        return NET_ERROR;
    }

    /**
     *ping "http://www.baidu.com"
     * @return
     */
    static private boolean connectionNetwork() {
        boolean result = false;
        HttpURLConnection httpUrl = null;
        try {
            httpUrl = (HttpURLConnection) new URL("http://www.baidu.com")
                    .openConnection();
            httpUrl.setConnectTimeout(TIMEOUT);
            httpUrl.connect();
            result = true;
        } catch (IOException e) {
        } finally {
            if (null != httpUrl) {
                httpUrl.disconnect();
            }
            httpUrl = null;
        }
        return result;
    }

    /**
     * check is3G
     * @param context
     * @return boolean
     */
    public static boolean is3G(Context context) {
        ConnectivityManager connectivityManager = (ConnectivityManager) context
                .getSystemService(Context.CONNECTIVITY_SERVICE);
        NetworkInfo activeNetInfo = connectivityManager.getActiveNetworkInfo();
        if (activeNetInfo != null
                && activeNetInfo.getType() == ConnectivityManager.TYPE_MOBILE) {
            return true;
        }
        return false;
    }

    /**
     * isWifi
     * @param context
     * @return boolean
     */
    public static boolean isWifi(Context context) {
        ConnectivityManager connectivityManager = (ConnectivityManager) context
                .getSystemService(Context.CONNECTIVITY_SERVICE);
        NetworkInfo activeNetInfo = connectivityManager.getActiveNetworkInfo();
        if (activeNetInfo != null
                && activeNetInfo.getType() == ConnectivityManager.TYPE_WIFI) {
            return true;
        }
        return false;
    }

    /**
     * is2G
     * @param context
     * @return boolean
     */
    public static boolean is2G(Context context) {
        ConnectivityManager connectivityManager = (ConnectivityManager) context
                .getSystemService(Context.CONNECTIVITY_SERVICE);
        NetworkInfo activeNetInfo = connectivityManager.getActiveNetworkInfo();
        if (activeNetInfo != null
                && (activeNetInfo.getSubtype() == TelephonyManager.NETWORK_TYPE_EDGE
                || activeNetInfo.getSubtype() == TelephonyManager.NETWORK_TYPE_GPRS || activeNetInfo
                .getSubtype() == TelephonyManager.NETWORK_TYPE_CDMA)) {
            return true;
        }
        return false;
    }

    /**
     *  is wifi on
     */
    public static boolean isWifiEnabled(Context context) {
        ConnectivityManager mgrConn = (ConnectivityManager) context
                .getSystemService(Context.CONNECTIVITY_SERVICE);
        TelephonyManager mgrTel = (TelephonyManager) context
                .getSystemService(Context.TELEPHONY_SERVICE);
        return ((mgrConn.getActiveNetworkInfo() != null && mgrConn
                .getActiveNetworkInfo().getState() == NetworkInfo.State.CONNECTED) || mgrTel
                .getNetworkType() == TelephonyManager.NETWORK_TYPE_UMTS);
    }

}


text:
static int const timeOutTimeInterval = 10;

typedef void(^CheckSuccess)(id object);

@interface DDMsgServer(PrivateAPI)

- (void)n_receiveLoginMsgServerNotification:(NSNotification*)notification;
- (void)n_receiveLoginLoginServerNotification:(NSNotification*)notification;

@end

@implementation DDMsgServer
{
    CheckSuccess _success;
    Failure _failure;

    BOOL _connecting;
    NSUInteger _connectTimes;
}
- (id)init
{
    self = [super init];
    if (self)
    {
        _connecting = NO;
        _connectTimes = 0;
//        [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(n_receiveLoginMsgServerNotification:) name:notificationLoginMsgServerSuccess object:nil];
    }
    return self;
}

-(void)checkUserID:(NSString*)userID Pwd:(NSString *)password token:(NSString*)token success:(void(^)(id object))success failure:(void(^)(id object))failure
{

    if (!_connecting)
    {

        NSNumber* clientType = @(17);
        NSString *clientVersion = [NSString stringWithFormat:@"MAC/%@-%@",[[[NSBundle mainBundle] infoDictionary] objectForKey:@"CFBundleShortVersionString"],[[[NSBundle mainBundle] infoDictionary] objectForKey:@"CFBundleVersion"]];
        NSArray* parameter = @[userID,password,clientVersion,clientType];

        LoginAPI* api = [[LoginAPI alloc] init];
        [api requestWithObject:parameter Completion:^(id response, NSError *error) {
            if (!error)
            {
                if (response)
                {
                    NSString *resultString =response[@"resultString"];
                    if (resultString == nil) {
                         success(response);
                    }
                }else{
                    failure(error);
                }

            }
            else
            {
                DDLog(@"error:%@",[error domain]);
                failure(error);
            }
        }];
    }
}

@end


text:
<!DOCTYPE html>
<html>
<body marginwidth=0 marginheight=0>

<iframe width=500 height=100 src="resources/013-helper.html"></iframe>
<object width=500 height=100 type="text/html" data="resources/013-helper.html"></object>


text:
category: Components
type: Other
cols: 1
title: LocaleProvider
---

`LocaleProvider` provides a uniform localization support for built-in text of components.

## Usage

`LocaleProvider` takes use of [context](https://facebook.github.io/react/docs/context.html), a feature of React, to accomplish global effectiveness by wrapping the app only once.

```jsx
import enUS from 'antd/lib/locale-provider/en_US';

...

return <LocaleProvider locale={enUS}><App /></LocaleProvider>;
```

### Add a language

We supply an English locale package. Other language users can create a locale package based on [en_US](https://github.com/ant-design/ant-design/blob/26b1f37392a278285aec6c573b99c6feea09e218/components/locale-provider/en_US.js) and send us a pull request.

### Other localization needs

This component aims for localization of the built-in text, if you want to support other documents, we recommend using [react-intl](https://github.com/yahoo/react-intl), refer to [Intl demo 1](http://github.com/ant-design/intl-example) and [Intl demo 2](http://yiminghe.me/learning-react/examples/react-intl.html?locale=en-US).

## API

Property | Description | Type | Default
-----|-----|-----|------
locale | language package setting, you can find the packages in this path: `antd/lib/locale-provider/` | Object | -


text:
from .base import BaseModel
from rf.utils.io import get_session

class Upload(BaseModel):
    URL_PATH = '/api/uploads/'

    def __init__(self, uploadStatus, fileType, uploadType, files,
                 datasource, metadata, visibility, id=None, createdAt=None,
                 createdBy=None, modifiedAt=None, owner=None,
                 projectId=None, layerId=None, keepInSourceBucket=None):
        self.id = id
        self.createdAt = createdAt
        self.createdBy = createdBy
        self.modifiedAt = modifiedAt
        self.owner = owner
        self.uploadStatus = uploadStatus
        self.fileType = fileType
        self.uploadType = uploadType
        self.files = files
        self.datasource = datasource
        self.metadata = metadata
        self.visibility = visibility
        self.projectId = projectId
        self.layerId = layerId
        self.keepInSourceBucket = keepInSourceBucket

    def to_dict(self):
        return dict(
            id=self.id,
            createdAt=self.createdAt,
            createdBy=self.createdBy,
            modifiedAt=self.modifiedAt,
            uploadStatus=self.uploadStatus,
            fileType=self.fileType,
            uploadType=self.uploadType,
            files=self.files,
            datasource=self.datasource,
            metadata=self.metadata,
            visibility=self.visibility,
            owner=self.owner,
            projectId=self.projectId,
            layerId=self.layerId,
            keepInSourceBucket=self.keepInSourceBucket
        )

    def update_upload_status(self, status):
        self.uploadStatus = status
        return self.update()

    @classmethod
    def from_dict(cls, d):
        return cls(
            d.get('uploadStatus'),
            d.get('fileType'),
            d.get('uploadType'),
            d.get('files'),
            d.get('datasource'),
            d.get('metadata'),
            d.get('visibility'),
            id=d.get('id'),
            createdAt=d.get('createdAt'),
            createdBy=d.get('createdBy'),
            modifiedAt=d.get('modifiedAt'),
            owner=d.get('owner'),
            projectId=d.get('projectId'),
            layerId=d.get('layerId'),
            keepInSourceBucket=d.get('keepInSourceBucket')
        )

    @classmethod
    def get_importable_uploads(cls):
        url = '{HOST}{URL_PATH}'.format(HOST=cls.HOST, URL_PATH=cls.URL_PATH)
        session = get_session()
        response = session.get(url, params={'uploadStatus': 'uploaded'})
        response.raise_for_status()

        parsed = response.json()
        ids = [rec['id'] for rec in parsed['results']]
        page = 0
        while parsed['hasNext']:
            page += 1
            parsed = session.get(url, params={'uploadStatus': 'uploaded', 'page': page}).json()
            ids += [rec['id'] for rec in parsed['results']]
        return ids


text:
describe 'BarExitButton' do
  describe '初期化' do
    before do
      @button = BarExitButton.create_with_square_size(25)
    end
    it 'should not be a valid button' do
      @button.should.not.be.nil
      @button.should.be.kind_of UIButton
    end

    it 'should have an accessibilityLabel' do
      @button.accessibilityLabel.should == 'exit'
    end
  end
end


text:
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:background="@android:color/transparent">

    <ImageView
        android:id="@+id/picker_photo_grid_item_img"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_gravity="center"
        android:contentDescription="@null"
        android:scaleType="centerCrop"/>

    <RelativeLayout
        android:id="@+id/picker_photo_grid_item_select_hotpot"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_gravity="bottom|right">

		<ImageView
	        android:id="@+id/picker_photo_grid_item_select"
	        android:layout_width="wrap_content"
	        android:layout_height="wrap_content"
	        android:layout_alignParentRight="true"
	        android:layout_alignParentBottom="true"
	        android:contentDescription="@null"
	        android:layout_margin="5dp"/>

    </RelativeLayout>

</FrameLayout>


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

  <title>build (Bundler::Index)</title>
  <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
  <link rel="stylesheet" href="../../.././rdoc-style.css" type="text/css" media="screen" />

# File lib/bundler/index.rb, line 5
    def self.build
      i = new
      yield i
      i
    end