Skip to content

Commit

Permalink
fix configuration and tests
Browse files Browse the repository at this point in the history
  • Loading branch information
m29538 committed Jan 8, 2024
1 parent 086ab21 commit 7886284
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 11 deletions.
5 changes: 3 additions & 2 deletions docs/source/conf.py
Expand Up @@ -15,6 +15,7 @@

import os
import sys
from typing import Dict, List

# If extensions (or modules to document with autodoc) are in another directory,
# add these directories to sys.path here. If the directory is relative to the
Expand Down Expand Up @@ -88,7 +89,7 @@
# List of patterns, relative to source directory, that match files and
# directories to ignore when looking for source files.
# This patterns also effect to html_static_path and html_extra_path
exclude_patterns = []
exclude_patterns: List[str] = []

# The reST default role (used for this markup: `text`) to use for all
# documents.
Expand Down Expand Up @@ -224,7 +225,7 @@

# -- Options for LaTeX output ---------------------------------------------

latex_elements = {
latex_elements: Dict[str, str] = {
# The paper size ('letterpaper' or 'a4paper').
#'papersize': 'letterpaper',
# The font size ('10pt', '11pt' or '12pt').
Expand Down
11 changes: 7 additions & 4 deletions mediawiki/configuraton.py
Expand Up @@ -98,14 +98,17 @@ def lang(self) -> str:

@lang.setter
def lang(self, lang: str):
lang = lang.lower()
if self._lang == lang:
print(f"lang setter: {lang}")
t_lang = lang.lower()
print(f"t_lang setter: {t_lang}")
if self._lang == t_lang:
print("non-change")
return
url = self._api_url
tmp = url.replace(f"/{self._lang}.", f"/{lang}.")
tmp = url.replace(f"/{self._lang}.", f"/{t_lang}.")

self.api_url = tmp
self._lang = lang
self._lang = t_lang
self._clear_memoized - True

@property
Expand Down
5 changes: 3 additions & 2 deletions mediawiki/mediawiki.py
Expand Up @@ -78,7 +78,7 @@ def __init__(
url.format(lang=lang.lower())
self._config = Configuration(
lang=lang,
api_url=url.format(lang=lang),
api_url=url.format(lang=lang.lower()),
category_prefix=cat_prefix,
timeout=timeout,
proxies=proxies,
Expand Down Expand Up @@ -235,7 +235,8 @@ def language(self) -> str:
@language.setter
def language(self, lang: str):
"""Set the language to use; attempts to change the API URL"""
self._config.lang == lang
print(f"language setter: {lang}")
self._config.lang = lang
if self._config._clear_memoized:
self.clear_memoized()
self._config._clear_memoized = False
Expand Down
4 changes: 2 additions & 2 deletions scripts/generate_test_data.py
Expand Up @@ -269,12 +269,12 @@ def _post_response(self, params):

if PULL_ALL is True or PULL_CATEGORYTREE is True:
site.rate_limit = True
ct = site.categorytree(["Chess", "Ebola"], depth=None)
ct = site.categorytree(["Chess", "Ebola"], depth=None) # type: ignore
with open(CATTREE_FILE, "w") as fp:
json.dump(ct, fp, ensure_ascii=False, sort_keys=True)

try:
site.categorytree("Chess Ebola", depth=None)
site.categorytree("Chess Ebola", depth=None) # type: ignore
except Exception as ex:
responses[site.api_url]["missing_categorytree"] = str(ex)
site.rate_limit = False
Expand Down
2 changes: 1 addition & 1 deletion setup.py
@@ -1,3 +1,3 @@
from setuptools import setup
from setuptools import setup # type: ignore

setup()

0 comments on commit 7886284

Please sign in to comment.