|
1 | 1 | """Objects representing MediaWiki families."""
|
2 | 2 | #
|
3 |
| -# (C) Pywikibot team, 2004-2023 |
| 3 | +# (C) Pywikibot team, 2004-2024 |
4 | 4 | #
|
5 | 5 | # Distributed under the terms of the MIT license.
|
6 | 6 | #
|
@@ -97,98 +97,117 @@ def instance(cls):
|
97 | 97 | #: Not open for edits; stewards can still edit.
|
98 | 98 | closed_wikis: list[str] = []
|
99 | 99 |
|
100 |
| - #: Completely removed sites |
| 100 | + #: Completely removed sites. |
101 | 101 | removed_wikis: list[str] = []
|
102 | 102 |
|
103 | 103 | code_aliases: dict[str, str] = {}
|
104 | 104 | """Code mappings which are only an alias, and there is no 'old' wiki.
|
105 |
| -
|
106 | 105 | For all except 'nl_nds', subdomains do exist as a redirect, but that
|
107 | 106 | should not be relied upon.
|
108 | 107 | """
|
109 | 108 |
|
110 | 109 | langs: dict[str, str] = {}
|
111 | 110 |
|
112 |
| - # A list of category redirect template names in different languages |
| 111 | + #: A list of category redirect template names in different languages. |
113 | 112 | category_redirect_templates: dict[str, Sequence[str]] = {
|
114 | 113 | '_default': []
|
115 | 114 | }
|
116 | 115 |
|
117 |
| - # A list of disambiguation template names in different languages |
| 116 | + #: A list of disambiguation template names in different languages. |
118 | 117 | disambiguationTemplates: dict[str, Sequence[str]] = {
|
119 | 118 | '_default': []
|
120 | 119 | }
|
121 | 120 |
|
122 |
| - # A dict of tuples for different sites with names of templates |
123 |
| - # that indicate an edit should be avoided |
124 | 121 | edit_restricted_templates: dict[str, tuple[str, ...]] = {}
|
| 122 | + """A dict of tuples for different sites with names of templates that |
| 123 | + indicate an edit should be avoided. |
| 124 | + """ |
125 | 125 |
|
126 |
| - # A dict of tuples for different sites with names of archive |
127 |
| - # templates that indicate an edit of non-archive bots |
128 |
| - # should be avoided |
129 | 126 | archived_page_templates: dict[str, tuple[str, ...]] = {}
|
| 127 | + """A dict of tuples for different sites with names of archive |
| 128 | + templates that indicate an edit of non-archive bots should be |
| 129 | + avoided. |
| 130 | + """ |
130 | 131 |
|
131 |
| - # A set of projects that share cross-project sessions. |
| 132 | + #: A set of projects that share cross-project sessions. |
132 | 133 | cross_projects: set[str] = set()
|
133 | 134 |
|
134 |
| - # A list with the name for cross-project cookies. |
135 |
| - # default for wikimedia centralAuth extensions. |
| 135 | + #: A list with the name for cross-project cookies, default for |
| 136 | + #: wikimedia centralAuth extensions. |
136 | 137 | cross_projects_cookies = ['centralauth_Session',
|
137 | 138 | 'centralauth_Token',
|
138 | 139 | 'centralauth_User']
|
139 | 140 | cross_projects_cookie_username = 'centralauth_User'
|
140 | 141 |
|
141 |
| - # A list with the name in the cross-language flag permissions |
| 142 | + #: A list with the name in the cross-language flag permissions. |
142 | 143 | cross_allowed: list[str] = []
|
143 | 144 |
|
144 |
| - # A dict with the name of the category containing disambiguation |
145 |
| - # pages for the various languages. Only one category per language, |
146 |
| - # and without the namespace, so add things like: |
147 |
| - # 'en': "Disambiguation" |
148 | 145 | disambcatname: dict[str, str] = {}
|
| 146 | + """A dict with the name of the category containing disambiguation |
| 147 | + pages for the various languages. Only one category per language, and |
| 148 | + without the namespace, so add things like: |
| 149 | +
|
| 150 | + 'en': "Disambiguation" |
| 151 | + """ |
149 | 152 |
|
150 |
| - # attop is a list of languages that prefer to have the interwiki |
151 |
| - # links at the top of the page. |
152 | 153 | interwiki_attop: list[str] = []
|
153 |
| - # on_one_line is a list of languages that want the interwiki links |
154 |
| - # one-after-another on a single line |
| 154 | + """attop is a list of languages that prefer to have the interwiki |
| 155 | + links at the top of the page. |
| 156 | + """ |
| 157 | + |
155 | 158 | interwiki_on_one_line: list[str] = []
|
156 |
| - # String used as separator between interwiki links and the text |
| 159 | + """on_one_line is a list of languages that want the interwiki links |
| 160 | + one-after-another on a single line |
| 161 | + """ |
| 162 | + |
| 163 | + #: String used as separator between interwiki links and the text. |
157 | 164 | interwiki_text_separator = '\n\n'
|
158 | 165 |
|
159 | 166 | # Similar for category
|
160 | 167 | category_attop: list[str] = []
|
161 |
| - # on_one_line is a list of languages that want the category links |
162 |
| - # one-after-another on a single line |
| 168 | + """attop is a list of categories that prefer to have the category |
| 169 | + links at the top of the page. |
| 170 | + """ |
| 171 | + |
163 | 172 | category_on_one_line: list[str] = []
|
164 |
| - # String used as separator between category links and the text |
| 173 | + """on_one_line is a list of languages that want the category links |
| 174 | + one-after-another on a single line. |
| 175 | + """ |
| 176 | + |
| 177 | + #: String used as separator between category links and the text |
165 | 178 | category_text_separator = '\n\n'
|
166 |
| - # When both at the bottom should categories come after interwikilinks? |
167 |
| - # TODO: T86284 Needed on Wikia sites, as it uses the CategorySelect |
168 |
| - # extension which puts categories last on all sites. TO BE DEPRECATED! |
| 179 | + |
169 | 180 | categories_last: list[str] = []
|
| 181 | + """When both at the bottom should categories come after |
| 182 | + interwikilinks? |
| 183 | +
|
| 184 | + TODO: :phab:`T86284` Needed on Wikia sites, as it uses the |
| 185 | + CategorySelect extension which puts categories last on all sites. |
| 186 | + TO BE DEPRECATED! |
| 187 | + """ |
170 | 188 |
|
171 |
| - # Which languages have a special order for putting interlanguage |
172 |
| - # links, and what order is it? If a language is not in |
173 |
| - # interwiki_putfirst, alphabetical order on language code is used. |
174 |
| - # For languages that are in interwiki_putfirst, interwiki_putfirst |
175 |
| - # is checked first, and languages are put in the order given there. |
176 |
| - # All other languages are put after those, in code-alphabetical |
177 |
| - # order. |
178 | 189 | interwiki_putfirst: dict[str, str] = {}
|
| 190 | + """Which languages have a special order for putting interlanguage |
| 191 | + links, and what order is it? If a language is not in |
| 192 | + interwiki_putfirst, alphabetical order on language code is used. For |
| 193 | + languages that are in interwiki_putfirst, interwiki_putfirst is |
| 194 | + checked first, and languages are put in the order given there. All |
| 195 | + other languages are put after those, in code-alphabetical order. |
| 196 | + """ |
179 | 197 |
|
180 |
| - # Some families, e. g. commons and meta, are not multilingual and |
181 |
| - # forward interlanguage links to another family (wikipedia). |
182 |
| - # These families can set this variable to the name of the target |
183 |
| - # family. |
184 | 198 | interwiki_forward: str | None = None
|
| 199 | + """Some families, e. g. commons and meta, are not multilingual and |
| 200 | + forward interlanguage links to another family (wikipedia). These |
| 201 | + families can set this variable to the name of the target family. |
| 202 | + """ |
185 | 203 |
|
186 |
| - # Language codes of the largest wikis. They should be roughly sorted |
187 |
| - # by size. |
188 | 204 | languages_by_size: list[str] = []
|
| 205 | + """Language codes of the largest wikis. They should be roughly |
| 206 | + sorted by size. |
| 207 | + """ |
189 | 208 |
|
190 |
| - # Some languages belong to a group where the possibility is high that |
191 |
| - # equivalent articles have identical titles among the group. |
| 209 | + #: Some languages belong to a group where the possibility is high |
| 210 | + #: that equivalent articles have identical titles among the group. |
192 | 211 | language_groups = {
|
193 | 212 | # languages using the Arabic script
|
194 | 213 | 'arab': [
|
@@ -248,37 +267,48 @@ def instance(cls):
|
248 | 267 | ],
|
249 | 268 | }
|
250 | 269 |
|
251 |
| - # LDAP domain if your wiki uses LDAP authentication, |
252 |
| - # https://www.mediawiki.org/wiki/Extension:LDAPAuthentication2 |
253 | 270 | ldapDomain = ()
|
| 271 | + """LDAP domain if your wiki uses LDAP authentication. |
| 272 | +
|
| 273 | + .. seealso:: https://www.mediawiki.org/wiki/Extension:LDAPAuthentication2 |
| 274 | + """ |
254 | 275 |
|
255 |
| - # Allows crossnamespace interwiki linking. |
256 |
| - # Lists the possible crossnamespaces combinations |
257 |
| - # keys are originating NS |
258 |
| - # values are dicts where: |
259 |
| - # keys are the originating langcode, or _default |
260 |
| - # values are dicts where: |
261 |
| - # keys are the languages that can be linked to from the lang+ns, or |
262 |
| - # '_default'; values are a list of namespace numbers |
263 | 276 | crossnamespace: CrossnamespaceType = collections.defaultdict(dict)
|
264 |
| - ## |
265 |
| - # Examples : |
266 |
| - # |
267 |
| - # Allowing linking to pt' 102 NS from any other lang' 0 NS is |
268 |
| - # |
269 |
| - # crossnamespace[0] = { |
270 |
| - # '_default': { 'pt': [102]} |
271 |
| - # } |
272 |
| - # |
273 |
| - # While allowing linking from pt' 102 NS to any other lang' = NS is |
274 |
| - # |
275 |
| - # crossnamespace[102] = { |
276 |
| - # 'pt': { '_default': [0]} |
277 |
| - # } |
278 |
| - |
279 |
| - # Some wiki farms have UrlShortener extension enabled only on the main |
280 |
| - # site. This value can specify this last one with (lang, family) tuple. |
| 277 | + """Allows crossnamespace interwiki linking. |
| 278 | +
|
| 279 | + Lists the possible crossnamespaces combinations; keys are |
| 280 | + originating namespace; values are dicts where keys are the |
| 281 | + originating langcode, or ``_default`` and values are dicts where |
| 282 | + keys are the languages that can be linked to from the lang+ns, or |
| 283 | + ``_default``; values are a list of namespace numbers. |
| 284 | +
|
| 285 | + **Examples:** |
| 286 | +
|
| 287 | + Allowing linking *to* ``pt`` 102 namespace from any other lang 0 |
| 288 | + namepace is: |
| 289 | +
|
| 290 | + .. code-block:: Python |
| 291 | +
|
| 292 | + crossnamespace[0] = { |
| 293 | + '_default': { 'pt': [102]} |
| 294 | + } |
| 295 | +
|
| 296 | + While allowing linking *from* ``pt`` 102 namespace to any other |
| 297 | + lang 0 namespace is |
| 298 | +
|
| 299 | + .. code-block:: Python |
| 300 | +
|
| 301 | + crossnamespace[102] = { |
| 302 | + 'pt': { '_default': [0]} |
| 303 | + } |
| 304 | +
|
| 305 | + """ |
| 306 | + |
281 | 307 | shared_urlshortner_wiki: tuple[str, str] | None = None
|
| 308 | + """Some wiki farms have UrlShortener extension enabled only on |
| 309 | + the main site. This value can specify this last one with |
| 310 | + ``(lang, family)`` tuple. |
| 311 | + """ |
282 | 312 |
|
283 | 313 | title_delimiter_and_aliases = ' _'
|
284 | 314 | """Titles usually are delimited by a space and the alias is replaced
|
|
0 commit comments