Lib

iso

Functionality to gather information about iso-639-3 codes from sil.org.

clld.lib.iso.get(path)[source]

Retrieve a resource from the sil site and return it’s representation.

clld.lib.iso.get_documentation(code)[source]

Scrape information about a iso 639-3 code from the documentation page.

clld.lib.iso.get_tab(name)[source]

Generator for entries in a tab file specified by name.

clld.lib.iso.get_taburls()[source]

Retrieve the current (date-stamped) file names for download files from sil.

rdf

This module provides functionality for handling our data as rdf.

class clld.lib.rdf.ClldGraph(*args, **kw)[source]

Augmented rdflib.Graph.

Augment the standard rdflib.Graph by making sure our standard ns prefixes are always bound.

class clld.lib.rdf.Notation(name, extension, mimetype, uri)
extension

Alias for field number 1

mimetype

Alias for field number 2

name

Alias for field number 0

uri

Alias for field number 3

clld.lib.rdf.expand_prefix(p)[source]

Expand default prefixes if possible.

Parameters:p – a qualified name in prefix:localname notation or a URL.
Returns:a string URL or a URIRef
clld.lib.rdf.properties_as_xml_snippet(subject, props)[source]

Serialize props of subject as RDF-XML snippet.

clld.lib.rdf.url_for_qname(qname)[source]

Expand qname to full URL respecting our default prefixes.

bibtex

Functionality to handle bibligraphical data in the BibTeX format.

class clld.lib.bibtex.Database(records)[source]

Represents a bibtex databases, i.e. a container class for Record instances.

classmethod from_file(bibFile, encoding=u'utf8', lowercase=False)[source]

Create bibtex database from a bib-file.

@param bibFile: path of the bibtex-database-file to be read.

keymap

Map bibtex record ids to list index.

class clld.lib.bibtex.EntryType[source]

Bibtext entry types.

article
An article from a journal or magazine. Required fields: author, title, journal, year Optional fields: volume, number, pages, month, note, key
book
A book with an explicit publisher. Required fields: author/editor, title, publisher, year Optional fields: volume/number, series, address, edition, month, note, key
booklet
A work that is printed and bound, but without a named publisher or sponsoring institution. Required fields: title Optional fields: author, howpublished, address, month, year, note, key
conference
The same as inproceedings, included for Scribe compatibility.
inbook
A part of a book, usually untitled. May be a chapter (or section or whatever) and/or a range of pages. Required fields: author/editor, title, chapter/pages, publisher, year Optional fields: volume/number, series, type, address, edition, month, note, key
incollection
A part of a book having its own title. Required fields: author, title, booktitle, publisher, year Optional fields: editor, volume/number, series, type, chapter, pages, address, edition, month, note, key
inproceedings
An article in a conference proceedings. Required fields: author, title, booktitle, year Optional fields: editor, volume/number, series, pages, address, month, organization, publisher, note, key
manual
Technical documentation. Required fields: title Optional fields: author, organization, address, edition, month, year, note, key
mastersthesis
A Master’s thesis. Required fields: author, title, school, year Optional fields: type, address, month, note, key
misc
For use when nothing else fits. Required fields: none Optional fields: author, title, howpublished, month, year, note, key
phdthesis
A Ph.D. thesis. Required fields: author, title, school, year Optional fields: type, address, month, note, key
proceedings
The proceedings of a conference. Required fields: title, year Optional fields: editor, volume/number, series, address, month, publisher, organization, note, key
techreport
A report published by a school or other institution, usually numbered within a series. Required fields: author, title, institution, year Optional fields: type, number, address, month, note, key
unpublished
A document having an author and title, but not formally published. Required fields: author, title, note Optional fields: month, year, key
class clld.lib.bibtex.Record(genre, id_, *args, **kw)[source]

A BibTeX record is an ordered dict with two special properties - id and genre.

To overcome the limitation of single values per field in BibTeX, we allow fields, i.e. values of the dict to be iterables of strings as well. Note that to support this use case comprehensively, various methods of retrieving values will behave differently. I.e. values will be

  • joined to a string in __getitem__,
  • retrievable as assigned with get (i.e. only use get if you know how a value was assigned),
  • retrievable as list with getall

Note

Unknown genres are converted to “misc”.

getall(key)[source]

Get list of all values for key.

Returns:list of strings representing the values of the record for field ‘key’.
clld.lib.bibtex.u_unescape(s)[source]

Unencode Unicode escape sequences.

Match all 3-5-digit sequences with unicode character replace all ‘?[u....]’ with corresponding unicode

There are some decimal/octal mismatches in unicode encodings in bibtex

clld.lib.bibtex.unescape(string)[source]

Transform latex escape sequences of type `e into unicode.

Parameters:string – six.text_type or six.binary_type (which will be decoded using latex+latin1)
Returns:six.text_type

coins

Functionality to create Coins, i.e. context objects in spans.

class clld.lib.coins.ContextObject(sid, mtx, *data)[source]

A Context Object which knows how to render it’s metadata as HTML span tags.

fmpxml

Functionality to retrieve data from a FileMaker server.

We use the FileMaker Custom Web Publishing with XML protocol.

class clld.lib.fmpxml.Client(host, db, user, password, limit=1000, cache=None, verbose=True)[source]

Client for FileMaker’s ‘Custom Web Publishing with XML’ feature.

get(what)[source]

Retrieve data from the server.

Parameters:what – Name of the layout from which to retrieve data.
Returns:list of dict representing the data of the layout.
class clld.lib.fmpxml.Result(content)[source]

Represents a filemaker pro xml result.

clld.lib.fmpxml.normalize_markup(s)[source]

normalize markup in filemaker data.