semvec/pypi-packages huggingface dataset:
flexible-data-parser 1.0
A configurable semi-structured data parser
License: MIT
Keywords: data parse

# flexible-data-parser

This module is designed to convert semi-structured text data into Python dicts (or lists) by interpreting an XML configuration file.

## Usage

    from fdp import FileParser

    p = FileParser("/path/to/config.xml")
    parsed_dict = p.parse("/path/to/target.txt")

## Theory

The parser walks through the target text file one line at a time, comparing the current line with the regexes defined in the config file. Matching capture groups are stored according to the specified keys in the config file.

The process supports loops (if there are multiple instances of a kind of data stored in a single file). For example, a text invoice might have several line items, each broken out into three lines; in the config file, you can define a Section for each line item, with a separate regex for each line of text.

## XML Configuration

A sample configuration file is included.

### Section

Defines how to populate a list or dict with data.

*Attributes:*

* `name` - Key to store the list or dict under in above section
* `key` - [Optional] If defined, this section will be a dict, and will use the value of the specified key from child dicts as the index

*Contains:*

* `<repeat-until>` - [Optional] Text node; regex that signals the end of any further repeats of this section
* `<section>` - [Optional] Defines how to populate a list or dict with data
* `<line>` - [Optional] Defines how to match and capture data from a line of text

### Line

Defines how to match and capture data from a line of text

*Attributes:*

* `ignore` - [Optional] Boolean; if true, wait for this line to appear in the file, but do not save any capture groups.
* `optional` - [Optional] Boolean; if true, this line can be skipped if a match is found for the next line. (By default, no line can be skipped, and the parser will continue reading the target file until the next matching line is found.)

*Contains:*

* `<regex>` - Specifies the regex the line must match. Any capture groups will be saved.
* `<fields>` - Contains `<field>` elements
  * `<field>` - Specifies the key in which to store the data from the capture group(s). Must be a number of `<field>` elements equal to the number of capture groups.
datapackage-pipelines-spss 0.0.4a0
{{ DESCRIPTION }}
License: MIT
Keywords: data

SPSS Plugin for datapackage-pipelines
=====================================

| |Travis|
| |Coveralls|
| |PyPi|
| |SemVer|
| |Gitter|

Install
-------

::

    # clone the repo and install it with pip

    git clone https://github.com/frictionlessdata/datapackage-pipelines-spss.git
    pip install -e .

Usage
-----

datapackage-pipelines-spss uses
`tableschema-spss <https://github.com/frictionlessdata/tableschema-spss-py>`__
to read SPSS .sav files and add tableschema descriptors to a
datapackage. You can use datapackage-pipelines-spss as a plugin for
`dpp <https://github.com/frictionlessdata/datapackage-pipelines#datapackage-pipelines>`__.
In the pipeline-spec.yaml it will look like this:

.. code:: yaml

      ...
      - run: spss.add_spss
        parameters:
          source: data/my-file.sav

This will add the file defined at ``source`` as a tabular resource to
the pipeline. ``source`` can be either a file path, or a url starting
with ``http`` or ``https``.

.. |Travis| image:: https://img.shields.io/travis/frictionlessdata/datapackage-pipelines-spss/master.svg
   :target: https://travis-ci.org/frictionlessdata/datapackage-pipelines-spss
.. |Coveralls| image:: http://img.shields.io/coveralls/frictionlessdata/datapackage-pipelines-spss/master.svg
   :target: https://coveralls.io/r/frictionlessdata/datapackage-pipelines-spss?branch=master
.. |PyPi| image:: https://img.shields.io/pypi/v/datapackage-pipelines-spss.svg
   :target: https://pypi.python.org/pypi/datapackage-pipelines-spss
.. |SemVer| image:: https://img.shields.io/badge/versions-SemVer-brightgreen.svg
   :target: http://semver.org/
.. |Gitter| image:: https://img.shields.io/gitter/room/frictionlessdata/chat.svg
   :target: https://gitter.im/frictionlessdata/chat
django-magic-cards 0.4.1
A Django app for the Oracle text of all Magic: the Gathering cards.
License: MIT
Keywords: django-magic-cards

==================
Django Magic Cards
==================

.. image:: https://badge.fury.io/py/django-magic-cards.svg
    :target: https://badge.fury.io/py/django-magic-cards

.. image:: https://travis-ci.org/pbaranay/django-magic-cards.svg?branch=master
    :target: https://travis-ci.org/pbaranay/django-magic-cards

.. image:: https://codecov.io/gh/pbaranay/django-magic-cards/branch/master/graph/badge.svg
    :target: https://codecov.io/gh/pbaranay/django-magic-cards

Django Magic Cards is a pluggable Django app for the Oracle text of all Magic: the Gathering cards.

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

The full documentation is at https://django-magic-cards.readthedocs.io.

Quickstart
----------

Install the package::

    pip install django-magic-cards

Add the app to your `INSTALLED_APPS`:

.. code-block:: python

    INSTALLED_APPS = (
        ...
        'magic_cards.apps.MagicCardsConfig',
        ...
    )

Add Django Magic Cards' tables to your the database::

    ./manage.py migrate magic_cards

Populate the card database::

    ./manage.py import_magic_cards

Acknowledgments
---------------

* MTGJSON_ for providing up-to-date card data.
* Cookiecutter_ and `cookiecutter-djangopackage`_ for providing the structure for this project.

.. _MTGJSON: http://mtgjson.com/
.. _Cookiecutter: https://github.com/audreyr/cookiecutter
.. _`cookiecutter-djangopackage`: https://github.com/pydanny/cookiecutter-djangopackage

Disclaimer
----------

The literal and graphical information presented in this software about Magic: the Gathering, including Oracle text and card images, is copyright Wizards of the Coast, LLC, a subsidiary of Hasbro, Inc. This project is not produced by, endorsed by, supported by, or affiliated with Wizards of the Coast.




History
-------

0.4.1 (2017-10-26)
++++++++++++++++++

* Improve Unicode handling on Python 2, allowing the Printings admin
  page to load properly (`#27`_).

.. _#27: https://github.com/pbaranay/django-magic-cards/issues/27

0.4.0 (2017-10-04)
++++++++++++++++++

* Update a `Card`'s data (text, loyalty, types, etc.) when a set is re-imported (`#23`_).

.. _#23: https://github.com/pbaranay/django-magic-cards/issues/23

0.3.0 (2017-09-28)
++++++++++++++++++

* Store planeswalkers' starting loyalty (`#19`_).
* Correctly populate flavor text.
* Fix issue that crashed re-importing a set without multiverse IDs.

.. _#19: https://github.com/pbaranay/django-magic-cards/issues/19

0.2.0 (2017-08-16)
++++++++++++++++++

* Speed up import function (`#9`_).
* Implement basic admin pages (`#7`_).

.. _#9: https://github.com/pbaranay/django-magic-cards/issues/9
.. _#7: https://github.com/pbaranay/django-magic-cards/issues/7

0.1.1 (2017-08-10)
++++++++++++++++++

* Increase maximum length of a `Card`'s `name` (`#2`_).

.. _#2: https://github.com/pbaranay/django-magic-cards/issues/2

0.1.0 (2017-08-08)
++++++++++++++++++

* First release on PyPI.