Skip to content

Commit

Permalink
Merge pull request #66 from lokal-profil/0.5
Browse files Browse the repository at this point in the history
PR for the 0.5 release of WikidataStuff 

---

This introduces no new functionality but drops all previously deprecated packages,  modules, classes, functions and arguments.

If upgrading from a pre-0.4 release you are strongly recommended too **first upgrade to 0.4 ** and then clear out any deprecation warnings.

Note that the package name is now `wikidatastuff`.
  • Loading branch information
lokal-profil authored Feb 17, 2019
2 parents 7b013a0 + aba0d41 commit 13f9941
Show file tree
Hide file tree
Showing 17 changed files with 3 additions and 276 deletions.
2 changes: 1 addition & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ verbosity=3
with-coverage=1
cover-erase=1
cover-inclusive=1
cover-package=wikidataStuff,wikidatastuff
cover-package=wikidatastuff
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

setup(
name='wikidataStuff',
packages=['wikidatastuff', 'wikidataStuff'],
packages=['wikidatastuff'],
install_requires=[
'pywikibot==3.0-dev',
'requests',
Expand Down
25 changes: 0 additions & 25 deletions tests/test_helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
listify,
sig_fig_error,
fill_cache_wdqs,
fill_cache,
convert_language_dict_to_json
)

Expand Down Expand Up @@ -224,30 +223,6 @@ def test_fill_cache_wdqs_queryoverride_trigger_error(self):
self.mock_output.assert_not_called()


class TestFillCache(unittest.TestCase):

"""Test fill_cache()."""

def setUp(self):
patcher = mock.patch('wikidatastuff.helpers.fill_cache_wdqs')
self.mock_fill_cache_wdqs = patcher.start()
self.mock_fill_cache_wdqs.return_value = 'fill_cache_wdqs return value'
self.addCleanup(patcher.stop)
patcher = mock.patch('wikidatastuff.helpers.pywikibot.warning')
self.warning = patcher.start()
self.addCleanup(patcher.stop)

def test_fill_cache_redirects_and_warns(self):
expected = 'fill_cache_wdqs return value'
result = fill_cache('P123', 'override', 'max_age')
self.mock_fill_cache_wdqs.assert_called_once_with(
'P123', queryoverride='override')
self.warning.assert_called_once_with(
'fill_cache is deprecated since < 0.4. '
'Use fill_cache_wdqs instead.')
self.assertEqual(result, expected)


class TestGetUnitQ(unittest.TestCase):

"""Test get_unit_q()."""
Expand Down
3 changes: 1 addition & 2 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ commands = flake8

[flake8]
filename =
wikidataStuff/*.py
wikidatastuff/*.py
tests/*.py
ignore = E501
Expand All @@ -25,5 +24,5 @@ deps = pydocstyle
commands = pydocstyle

[pydocstyle]
match-dir = wikidata(S|s)tuff
match-dir = wikidatastuff
match = (?![test_|__init__|user\-config]).*\.py
10 changes: 0 additions & 10 deletions wikidataStuff/PreviewItem.py

This file was deleted.

10 changes: 0 additions & 10 deletions wikidataStuff/WdqToWdqs.py

This file was deleted.

10 changes: 0 additions & 10 deletions wikidataStuff/WikidataStringSearch.py

This file was deleted.

13 changes: 0 additions & 13 deletions wikidataStuff/WikidataStuff.py

This file was deleted.

Empty file removed wikidataStuff/__init__.py
Empty file.
36 changes: 0 additions & 36 deletions wikidataStuff/deprecator.py

This file was deleted.

10 changes: 0 additions & 10 deletions wikidataStuff/helpers.py

This file was deleted.

10 changes: 0 additions & 10 deletions wikidataStuff/wdqsLookup.py

This file was deleted.

29 changes: 0 additions & 29 deletions wikidatastuff/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@

import pywikibot
from pywikibot import pagegenerators
from pywikibot.tools import deprecated, deprecated_args

START_P = 'P580' # start date
END_P = 'P582' # end date
Expand Down Expand Up @@ -64,13 +63,6 @@ def load_json_file(filename, force_path=None):
return json.load(f)


def fill_cache(pid, queryoverride=None, cache_max_age=0):
"""DEPRECATED. Cannot use @deprecated due to differing args."""
pywikibot.warning(
'fill_cache is deprecated since < 0.4. Use fill_cache_wdqs instead.')
return fill_cache_wdqs(pid, queryoverride=queryoverride)


# @todo: Move to wdqs since import here is cyclical?
# @todo: skip going via WdqToWdqs?
def fill_cache_wdqs(pid, queryoverride=None, no_strip=False):
Expand Down Expand Up @@ -112,12 +104,6 @@ def fill_cache_wdqs(pid, queryoverride=None, no_strip=False):
return result


@deprecated('today_as_wbtime', since='0.4')
def today_as_WbTime():
"""DEPRECATED."""
return today_as_wbtime()


def today_as_wbtime():
"""
Get todays date as a WbTime object.
Expand All @@ -132,12 +118,6 @@ def today_as_wbtime():
return date


@deprecated('iso_to_wbtime', since='0.4')
def iso_to_WbTime(date):
"""DEPRECATED."""
return iso_to_wbtime(date)


def iso_to_wbtime(date):
"""
Convert ISO date string into WbTime object.
Expand Down Expand Up @@ -180,14 +160,6 @@ def iso_to_wbtime(date):
raise pywikibot.Error('An invalid ISO-date string received: ' % date)


@deprecated('wikidatastuff.statement.add_start_end_qualifiers', since='0.4')
@deprecated_args(startVal='start_val', endVal='end_val', since='<0.4')
def add_start_end_qualifiers(statement, start_val, end_val):
"""DEPRECATED."""
from wikidatastuff.statement import add_start_end_qualifiers as aseq_new
return aseq_new(statement, start_val, end_val)


def match_name(name, typ, wd, limit=75):
"""
Check if there is an item matching the name.
Expand Down Expand Up @@ -407,7 +379,6 @@ def reorder_names(name):
return None


@deprecated_args(fileExts='file_exts', since='0.4')
def find_files(path, file_exts, subdir=True):
"""
Identify all files with a given extension in a given directory.
Expand Down
3 changes: 0 additions & 3 deletions wikidatastuff/qualifier.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@
from __future__ import unicode_literals
from builtins import object

from pywikibot.tools import deprecated_args


class Qualifier(object):
"""
Expand All @@ -22,7 +20,6 @@ class Qualifier(object):
retire in favor of pywikibot.Claim
"""

@deprecated_args(P='prop', since='0.4')
def __init__(self, prop, itis):
"""
Make a correctly formatted qualifier object for claims.
Expand Down
11 changes: 0 additions & 11 deletions wikidatastuff/statement.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
from builtins import object

import pywikibot
from pywikibot.tools import deprecated, deprecated_args

import wikidatastuff.helpers as helpers
from wikidatastuff.reference import Reference
Expand Down Expand Up @@ -40,11 +39,6 @@ def __init__(self, itis, special=False):
self.special = special
self.force = False

@deprecated('add_qualifier', since='0.4')
def addQualifier(self, qual, force=False):
"""DEPRECATED. Use add_qualifier()."""
return self.add_qualifier(qual, force)

def add_qualifier(self, qual, force=False):
"""
Add qualifier to the statement if not None or already present.
Expand Down Expand Up @@ -98,11 +92,6 @@ def add_reference(self, ref):

return self

@deprecated('is_none', since='0.4')
def isNone(self):
"""DEPRECATED. Use is_none()."""
return self.is_none()

def is_none(self):
"""Test if Statement was created with itis=None."""
return self.itis is None
Expand Down
11 changes: 0 additions & 11 deletions wikidatastuff/wikidata_string_search.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
import pymysql

from pywikibot import output
from pywikibot.tools import deprecated

import wikidatastuff.helpers as helpers

Expand Down Expand Up @@ -52,11 +51,6 @@ def close_connection(self):
"""Close database connection."""
self.conn.close()

@deprecated('test_input', since='0.4')
def testInput(self, text, language=None, term_type=None, entities=None):
"""DEPRECATED. Use test_input()."""
return self.test_input(text, language, term_type, entities)

def test_input(self, text, language=None, term_type=None, entities=None):
"""
Test that the user input is valid.
Expand Down Expand Up @@ -117,11 +111,6 @@ def search(self, text, language='sv', term_type=None):
entities=None,
term_type=term_type)

@deprecated('search_in_entities', since='0.4')
def searchInEntities(self, text, entities, language='sv', term_type=None):
"""DEPRECATED. Use search_in_entities()."""
return self.search_in_entities(text, entities, language, term_type)

def search_in_entities(self, text, entities, language='sv',
term_type=None):
"""
Expand Down
Loading

0 comments on commit 13f9941

Please sign in to comment.