Metadata-Version: 2.4
Name: flati
Version: 0.2.0
Summary: Flatten nested iterable object (Pure-Python)
Home-page: https://github.com/ikegami-yukino/flati
Author: Yukino Ikegami
Author-email: yknikgm@gmail.com
License: MIT License
Keywords: flatten,generator,pure-python
Platform: POSIX
Platform: Windows
Platform: Unix
Platform: MacOS
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Developers
Classifier: Intended Audience :: Information Technology
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: MacOS
Classifier: Operating System :: Microsoft
Classifier: Operating System :: POSIX
Classifier: Programming Language :: Python :: 2.7
Classifier: Programming Language :: Python :: 3.4
Classifier: Programming Language :: Python :: 3.5
Classifier: Programming Language :: Python :: 3.6
Classifier: Programming Language :: Python :: 3.7
Classifier: Programming Language :: Python :: 3.8
Classifier: Programming Language :: Python :: 3.8
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
License-File: LICENSE
Dynamic: author
Dynamic: author-email
Dynamic: classifier
Dynamic: description
Dynamic: home-page
Dynamic: keywords
Dynamic: license
Dynamic: license-file
Dynamic: platform
Dynamic: summary

flati
==========
|pyversion| |version| |license|

Flatten nested iterable object (Pure-Python implementation)

Japanese document is available: https://qiita.com/yukinoi/items/9570c76034c28bdae0a8

Installation
==============

::

 $ pip install flati


Usage
============

.. code:: python

  import flati

  iterable = [(1, 2, 3), (4, (5, 6))]
  list(flati.flatten(iterable))
  # => [1, 2, 3, 4, 5, 6]

  # flati.flatten() returns a generator
  import types
  isinstance(flati.flatten(iterable), types.GeneratorType)
  # => True

  # If you want to avoid flattening specific type, then use "ignore" parameter
  iterable = [('abc'), ('def', ('g', 'hi'))]
  list(flati.flatten(iterable, ignore=str))
  # => ['abc', 'def', 'g', 'hi']

Tips
------
If you want to flatten numpy.ndarray, I recommend using following methods:

* numpy.ravel()
* ndarray.reshape(-1)
* ndarray.flatten()  # This method is a bit slow because it makes a copy

Contribution
=============
Contributions are welcome.

See https://github.com/ikegami-yukino/flati/blob/master/CONTRIBUTING.md


.. |pyversion| image:: https://img.shields.io/pypi/pyversions/flati.svg

.. |version| image:: https://img.shields.io/pypi/v/flati.svg
    :target: http://pypi.python.org/pypi/flati/
    :alt: latest version

.. |license| image:: https://img.shields.io/pypi/l/flati.svg
    :target: http://pypi.python.org/pypi/flati/
    :alt: license


CHANGES
=======

0.2.0 (2025-08-02)
------------------

- Add stub files according to PEP 561
- Support Python 3.9, 3.10, 3.11, 3.12, 3.13

0.1.2 (2019-12-31)
------------------

- Support Python 3.8

0.1.1 (2019-1-28)
------------------

- Support Python 2.7

0.1 (2019-1-27)
------------------

- First release
