semvec/pypi-packages huggingface dataset:
templetize 2014.09.21
Templetize is a script to convert a file or a directory (recursively) to a template for codegen. It is bundled with a simple code generator module to expand these templates.
License: BSD
Keywords: templating code generator

Templetize is a script to convert a file or a directory (recursively)
to a template for codegen and writes it to stdout.

Codegen uses a single jinja2 template from a given file or string and
the data you provide to the code generator to recreate the previously
templetized file structure (maybe renaming parts of it).

See the jinja2 documentation for the template syntax.

---

Code generator reads and evaluates templates generated with templetize
and creates the directories and files according to the templates
instructions.

Bevore operating the template will be parsed thru jinja2.

See the jinja2 documentation for the template syntax.

Code generator special directives start with "@@@" and extend to the
end of the line. There are 3 different commands. An example:

@@@ dir dir/to/be/generated/

@@@ file dir/to/be/generated/with-a-file-{{inside}}.txt

This is the content {{inside}} of the file. The word inside will be
replaced by jinja2. So if you set 'inside': 'to-generate', you will get
a file called `dir/to/be/generated/with-a-file-to-generate.txt` with
the content `This is the content to-generate of the file. [...]`

@@@ binary another/dir/image.png

IyEvdXNyL2Jpbi9lbnYgcHl0aG9uCiMgLSotIGNvZGluZzogdXRmLTggLSotCgppbXB==

Code generator will not throw exceptions but just ignore already
existing files. They won't be overwritten. A message is printed to
stderr.
demiurge 0.2
Scraping micro-framework based on pyquery.
License: BSD
Keywords: scraping pyquery framework scraper web data extraction

demiurge
========

PyQuery-based scraping micro-framework.
Supports Python 2.x and 3.x.

Documentation: http://demiurge.readthedocs.org


Installing demiurge
-------------------

    $ pip install demiurge


Quick start
-----------

Define items to be scraped using a declarative (Django-inspired) syntax:

    >>> import demiurge
    >>> class TorrentDetails(demiurge.Item):
    ...     label = demiurge.TextField(selector='strong')
    ...     value = demiurge.TextField()
    ...     def clean_value(self, value):
    ...         unlabel = value[value.find(':') + 1:]
    ...         return unlabel.strip()
    ...     class Meta:
    ...         selector = 'div#specifications p'
    ... 
    >>> class Torrent(demiurge.Item):
    ...     url = demiurge.AttributeValueField(
    ...         selector='td:eq(2) a:eq(1)', attr='href')
    ...     name = demiurge.TextField(selector='td:eq(2) a:eq(2)')
    ...     size = demiurge.TextField(selector='td:eq(3)')
    ...     details = demiurge.RelatedItem(
    ...         TorrentDetails, selector='td:eq(2) a:eq(2)', attr='href')
    ...     class Meta:
    ...         selector = 'table.maintable:gt(0) tr:gt(0)'
    ...         base_url = 'http://www.mininova.org'
    ... 
    >>> 
    >>> t = Torrent.one('/search/ubuntu/seeds')
    >>> t.name
    'Ubuntu 7.10 Desktop Live CD'
    >>> t.size
    u'695.81\xa0MB'
    >>> t.url
    '/get/1053846'
    >>> t.html
    u'<td>19\xa0Dec\xa007</td><td><a href="/cat/7">Software</a></td><td>...'
    >>> results = Torrent.all('/search/ubuntu/seeds')
    >>> len(results)
    116
    >>> for t in results[:3]:
    ...     print t.name, t.size
    ...
    Ubuntu 7.10 Desktop Live CD 695.81 MB
    Super Ubuntu 2008.09 - VMware image 871.95 MB
    Portable Ubuntu 9.10 for Windows 559.78 MB
    ...
    >>> t = Torrent.one('/search/ubuntu/seeds')
    >>> for detail in t.details:
    ...     print detail.label, detail.value
    ... 
    Category: Software > GNU/Linux
    Total size: 695.81 megabyte
    Added: 2467 days ago by Distribution
    Share ratio: 17 seeds, 2 leechers
    Last updated: 35 minutes ago
    Downloads: 29,085


See documentation for details: http://demiurge.readthedocs.org


Why *demiurge*?
---------------

Plato, as the speaker Timaeus, refers to the Demiurge frequently in the Socratic
dialogue Timaeus, c. 360 BC. The main character refers to the Demiurge as the
entity who "fashioned and shaped" the material world. Timaeus describes the
Demiurge as unreservedly benevolent, and hence desirous of a world as good as
possible. The world remains imperfect, however, because the Demiurge created
the world out of a chaotic, indeterminate non-being.

http://en.wikipedia.org/wiki/Demiurge