Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
M
mwclient
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
WebU
shared
mwclient
Commits
1eb8a299
Commit
1eb8a299
authored
8 years ago
by
Lukas Juhrich
Committed by
Dan Michael O. Heggø
8 years ago
Browse files
Options
Downloads
Patches
Plain Diff
Add a docstring to `guess_namespace`
parent
8ab48a7e
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
mwclient/listing.py
+8
-0
8 additions, 0 deletions
mwclient/listing.py
with
8 additions
and
0 deletions
mwclient/listing.py
+
8
−
0
View file @
1eb8a299
...
...
@@ -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
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment