Skip to content

Commit

Permalink
Feature/disambiguation non sorted (#126)
Browse files Browse the repository at this point in the history
* add unsorted options

* remove python 3.6 testing

* update changelog

* update changelog
  • Loading branch information
barrust committed Dec 17, 2022
1 parent 8a62371 commit 6f95028
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 2 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/python-package.yml
Expand Up @@ -11,7 +11,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ['3.6', '3.7', '3.8', '3.9', '3.10', '3.11']
python-version: ['3.7', '3.8', '3.9', '3.10', '3.11']

steps:
- uses: actions/checkout@v3
Expand Down
3 changes: 3 additions & 0 deletions .gitignore
Expand Up @@ -92,3 +92,6 @@ ENV/

# PyPi
.pypirc

# vscode
.vscode/
4 changes: 4 additions & 0 deletions CHANGELOG.md
@@ -1,5 +1,9 @@
# MediaWiki Changelog

## Future Release

* Add `unordered_options` to the `DisambiguationError` to attempt to get options in the order presented on the page; [issue #124](https://github.com/barrust/mediawiki/issues/124)

## Version 0.7.2

* Add `page_preview` property to simulate the page preview hover [PR #114](https://github.com/barrust/mediawiki/pull/114)
Expand Down
7 changes: 6 additions & 1 deletion mediawiki/exceptions.py
Expand Up @@ -3,7 +3,6 @@
"""
from .utilities import str_or_unicode


ODD_ERROR_MESSAGE = (
"This should not happen. If the MediaWiki site you are "
"querying is available, then please report this issue on "
Expand Down Expand Up @@ -128,6 +127,7 @@ class DisambiguationError(MediaWikiBaseException):

def __init__(self, title, may_refer_to, url, details=None):
self._title = title
self._unordered_options = may_refer_to
self._options = sorted(may_refer_to)
self._details = details
self._url = url
Expand All @@ -151,6 +151,11 @@ def options(self):
""" list: The list of possible page titles """
return self._options

@property
def unordered_options(self):
"""list: The list of possible page titles, un-sorted in an attempt to get them as they showup on the page"""
return self._unordered_options

@property
def details(self):
""" list: The details of the proposed non-disambigous pages """
Expand Down

0 comments on commit 6f95028

Please sign in to comment.