Remove dead code from analyse_commons_dump

analyse_commons_dump started as a specific project (Trutat collection)
aiming to do lots of things (like writing LaTeX reports automatically).
This is not used anymore, and broken in many places.

Remove all this old stuff.
Move code out of outer scope to method

We had a bunch of code directly in the main scope,
under the __main__ directive. This is all sorts of evil.

Extract code to its own method make_edits_analysis, which is
called from a main() method, which is directly called from
the outer scope.

This is way cleaner.
Clean up in edits analysis

Remove dead code, fix style issues.
Change timestamp_to_date to use datetime

We used to use datetime.date to represent timestamps.
We need to use datetime.datetime to make more
powerful things (like comparisons, IIRC).
Fixup: Remove more useless code
Revamp XML parsing method

The previously used data struture was way too simple,
effectively losing a lot of information.
We want to use a more powerful and flexible data structure.

We settle for a dictionary like this:
{ ID => { title => 'Some title'
	  revisions => [ revision1, revision2, etc. ]
	}
}
where revision is a tuple (timestamp, username, wikitext)
Add class DumpMediaCollection

We add a class DumpMediaCollection, which inherits from dict,
and serve as wrapper around the dump parsed from the XML.

This will allow to manipulate the collection more easily,
by adding methods or implementing caching for example.

Add method init_from_xml_dump which updates the media collection
with the contents parsed from a XML dump.

Note that the MediaCollection could be initialized through
another way, like API queries for example, and is not specifically
tied to the concept of an XML dump.
Add classes CommonsPage and CommonsRevision

Representing these two concepts as objects will make
them easier to manipulate.

Edit the XML parsing method to use them.
The data structure is now as follows:
{page_id: { CommonsPage(title: "Some title"git
                        revisions: [CommonsRevision, ...]
          }
}
Add method to retrieve the latest revision of a page

We are often interested in the latest revision of a Page,
because it shows its current contents.

Add method to access this latest revision. It trivially returns
the last revision of the list of revisions, assuming that the list
is ordered - which is the case so far with the XML initialisation.

But this abstraction method also makes sense because we might want
to add other ways to retrieve the latest revision (eg through the API).
Use list comprehension in get_categories_from_text

Use list comprehension instead of map() method
in method get_categories_from_text.
Add method to get categories for a CommonsRevision

Add to class CommonsRevision a method to retrieve categories.

This merely calls get_categories_from_text on the revision wikitext.
Add methods to retrieve Valued Images

As a program leader, I want to know which files in a
media collection are valued images.

Add two method:
- a predicate to CommonsRevision, which returns whether the file
  is a valued image or not (using regexes on the wikitext)

- a method to MediaCollection, which loops through the latest revision
  of each file and returns a list of the valued images

This is mainly meant as a proof of concept of the awesomeness of this program.

(the regex to detect valued images may not cover all possible cases)
Get the state of a collection at any given time

"As a program leader with an interest in media collections,
I want to be able to restore the state of a
given media collection at any point of time
in order to perform retroactive analysis."

This implements the above user-story.
The method get_state takes as parameter
a date (as a datetime object) and returns a
MediaCollection in the state it was at the time.
This means it only contains the revisions before
the target date, and therefore the files not yet
uploaded at the time are not part of it.

As we get back a MediaCollection, we can then use
all the power of this object for analysis.

Closes #2.
Get the initial state of a collection.

The initial state is the collection of all the files
at their first revision. It is useful to make diffs with it,
in order to measure the editing activty on Wikimedia Commons.

Note that since state methods return MediaCollections,
it is possible to compose them, to get the initial state of
a collection as it existed at some point in time
(before subsequent uploads).
Remove deprecated unit tests