Package doapfiend :: Module doaplib
[hide private]
[frames] | no frames]

Module doaplib

source code

Library for parsing, displaying, querying and serializing DOAP

Functions [hide private]
Project
load_graph(doap, format='xml')
Load a DOAP profile into a RDFAlchemy/rdflib graph
source code
string
get_by_pkg_index(index, project_name, proxy=None)
Get DOAP for a package index project name
source code
list
query_by_homepage(url)
Get list of URL's for DOAP given a project's homepage.
source code
 
print_doap(doap_xml, color=None, format='text', serializer=None, filename=None)
Print DOAP as text, xml, or n3 etc.
source code
function
get_serializer(format)
Return a serializer instance given its name
source code
 
get_plugin(method)
Return plugin object if `method` exists
source code
text
fetch_doap(url, proxy=None)
Fetch DOAP by its URL or filename
source code
Variables [hide private]
  XMLRPC_SERVER = <ServerProxy for doapspace.org/xmlrpc/>
Function Details [hide private]

load_graph(doap, format='xml')

source code 

Load a DOAP profile into a RDFAlchemy/rdflib graph

Supports any serialization format rdflib can parse (xml, n3, etc.)

Parameters:
  • doap (string) - DOAP
  • format (string) - Serialization format we're parsing
Returns: Project
a Project{rdfSubject}

get_by_pkg_index(index, project_name, proxy=None)

source code 

Get DOAP for a package index project name

Builtin indexes:

  • 'sf' SourceForge
  • 'fm' Freshmeat
  • 'py' Python Package Index

Note there can be other package indexes available by third party plugins.

Parameters:
  • index (string) - Package index two letter abbreviation
  • project_name (string) - project name
  • proxy (string) - Optional HTTP proxy URL
Returns: string
text of file retrieved

query_by_homepage(url)

source code 

Get list of URL's for DOAP given a project's homepage. The list can contain zero or multiple URLs.

The return format is: [(source, URL), (source, URL)...]

'source' is the two letter package index abbreviation or 'ex' for external. 'external' meaning the DOAP was spidered on the web. Possible package indexes:

Current indexes:

  • 'sf' SourceForge
  • 'fm' Freshmeat
  • 'py' Python Package Index
Parameters:
  • url (string) - URL of homepage of a project
Returns: list
A list of tuples containing URLs for DOAP found by homepage

print_doap(doap_xml, color=None, format='text', serializer=None, filename=None)

source code 

Print DOAP as text, xml, or n3 etc. or to stdout or a file A callable serializer object may be passed or a name of a serializer plugin.

Parameters:
  • doap_xml (string) - DOAP profile in RDF/XML
  • format (string) - Serialization syntax formatter name
  • serializer (callable) - Instance of a serializer
  • filename (string) - Optional filename to write to
Returns:
`serializer` or 1 if invalid serialization request

get_serializer(format)

source code 

Return a serializer instance given its name

Parameters:
  • format (string) - Name of serializer
Returns: function
Instance of a serializer

get_plugin(method)

source code 

Return plugin object if `method` exists

Parameters:
  • method (string) - name of plugin's method we're calling
Returns:
list of plugins with `method`

fetch_doap(url, proxy=None)

source code 

Fetch DOAP by its URL or filename

Parameters:
  • url (string) - URL of DOAP profile in RDF/XML serialization
Returns: text
DOAP