From 1eb8a29914ca714d48db81ef6c0cf351ec17ebb8 Mon Sep 17 00:00:00 2001 From: Lukas Juhrich <lukasjuhrich@wh2.tu-dresden.de> Date: Sun, 24 Jul 2016 04:51:56 +0200 Subject: [PATCH] Add a docstring to `guess_namespace` --- mwclient/listing.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/mwclient/listing.py b/mwclient/listing.py index 94a4464..7cb581e 100644 --- a/mwclient/listing.py +++ b/mwclient/listing.py @@ -254,6 +254,14 @@ class PageList(GeneratorList): return cls(self.site, full_page_name, info) def guess_namespace(self, name): + """Guess the namespace from name + + If name starts with any of the site's namespaces' names or + default_namespaces, use that. Else, return zero. + + :param name: The pagename as a string (having `.startswith`) + :return: the id of the guessed namespace or zero. + """ for ns in self.site.namespaces: if ns == 0: continue -- GitLab