These are no longer necessary in a Python 3-only world.
Signed-off-by: Stephen Finucane <stephenfin@redhat.com>
Change-Id: Ia3eda6d451b673f3eafba1aa3ecd2e51b7038f1f
Everything is unicode in Python 3. No need for these anymore.
Signed-off-by: Stephen Finucane <stephenfin@redhat.com>
Change-Id: I722095c41c8e014b38bfbb16aaecae0023fcf3a8
debtcollector is one of the few remaining OpenStack libraries still
using six. Like the other libraries that have since removed it,
debtcollector no longer actually needs this since it only supports
Python 3. Remove the library.
Signed-off-by: Stephen Finucane <stephenfin@redhat.com>
Change-Id: Ia16572985a46afe39b53a199ebabb695cd05ae2d
inspect.getargspec was deprecated since Python 3.0 and
inspect.getfullargspec is its replacement with correct handling of
function annotations and keyword-only parameters[1].
[1] https://docs.python.org/3/library/inspect.html#inspect.getargspec
Change-Id: Ifc98b578c4cb6f917e1fc62177fd09ff4d25b6d4
Pbr is a very heavy package to depend on. It requires git-core, which is
16 MiB on my Fedora. We only use it to detect the version, which can be
done without pbr using a much lighter importlib_metadata.
Copied from https://review.opendev.org/c/openstack/osprofiler/+/739379
Change-Id: Ib10180732042bda254b058b94c9ff41f5c31c3cb
This repo has been using train tests and thus was missed by the bot to
update from ussuri to victoria, update manually.
See also the PTI in governance [1].
Fix pep8 failure in debtcollector/updating.py and remove six from the
file.
[1]: https://governance.openstack.org/tc/reference/project-testing-interface.html
Change-Id: I9d07da7c5729f7ed33cc25f27cf70a7a41d1214c
oslotest itself depends on debtcollector and debtcollector depends
on oslotest. That's a cycle dependency which makes bootstrapping the whole
module chain more difficult.
Instead of using oslotest, just use the standard unittest.TestCase class
as base to break the dependency cycle.
Change-Id: Idcbe727883fe2742d62d463bb9a195592aeaba09
Tests are added that show that several of the decorators, when
used on functions, lose the argspec. This causes the documentation
to be generated incorrectly since the args aren't shown for
decorated functions.
The tests show that some of the decorators work as expected.
Change-Id: Id024f5110082a88c30e71e991764320b3aed07aa
Specifying replace=True to renames.renamed_kwarg will substitute the
kwarg from the old to the new. This will allow for an argument to be
renamed and the positional argument still maintained in the case of a
direct rename.
Change-Id: Ibff3cc2bc3f35142f6415372f795890148898fa2
To augment the problems with @remove on classes, see
bug #1520397 and bug #1500851 introduce a class decorator
that is specifically made for removing existing
classes (and it appears to work correctly even
under inheritance).
Related-Bug: #1520397
Related-Bug: #1500851
Change-Id: I91adbdacc9fc77511d3f0bfb66d558269c49f885
We recently Fixed get_class_name() in Python 3 in
7ef6a8fbf98a5da61c40989cc63c0c2261dca98e, sync this
to debtcollector.
Change-Id: I9d4031faa72bc2d464cb130bf82873d47c259a43
For when a existing property (class property or
instance property) has been renamed it is quite
useful to be able to deprecate the old name/location
and let users that access that property know when
they read the property what the new location is.
This adds a new descriptor that emits such a
warning in a format that matches the rest of the
debtcollector functions/decorators/descriptors.
Change-Id: I9305ba512856e957c06996b637acb4a8c4fa5d04
Provide a helpful fixture that can be used
to disable warnings being output, for testing, or other
purporses.
Closes-Bug: #1503918
Change-Id: I2e1fd6f427ff6ee6d0b11b86ac2ff1b75dc0548c
This is useful for moving functions to newer names
or newer modules/locations and retaining the old function
so that the old function proxies to the new function and
emits a deprecation warning when it is called.
Also fixes how the 'get_callable_name' needs to filter
for none, as it appears that when ran under sphinx the
'__module__' attribute is set to none and this causes
issues when joining into a string.
Change-Id: I290f1b71c141c6647da1750aec348ea590a8d9bd
To make it possible for easy usage of the message generating
formats that debtcollector uses, allow users to call into a
helper function that can be used to deprecate arbitrary things.
Closes-Bug: 1478676
Change-Id: I4d5b8fe44150ce2d6d5418a9f4e13812e6b558ce
There are two reasons to remove oslo.utils:
* oslo.utils brings in a number of dependencies that are not required
by any debtcollector code paths. This is a concern for having
debtcollector be adopted by libraries that want to maintain minimal
external requirements.
* oslo.utils now has a dependency on debtcollector. While this doesn't
seem to cause any problems with pip it is a weird circular dependency
that is best to break.
Copy the required reflection methods from oslo.utils to debtcollector
and the associated tests and remove the oslo.utils dependency.
Change-Id: Id4d8f4f7466775d099ab1e82b38605e98e6d840d
Instead of always using 'DeprecationWarning' it can be useful
to allow for 'PendingDeprecationWarning' to be used instead (or
other category); so enable this category passing and usage
by providing yet another keyword argument (that when not provided
defaults to 'DeprecationWarning').
Change-Id: I6719afd44bae99da31d09d429f8aa9402af194fc
When a module will be removed in the future add a way
to emit a deprecation warning that this is occuring (with
the option to specify a replacement) for use-cases where
this is nice to provide.
Change-Id: Ibcb3657c8fa5d23494840d22de248938383415f5
It is quite often useful to deprecate a keyword argument
so that it can be either removed or replaced in the near
future; so a decorator that aids in this pattern can be
quite useful for others.
Change-Id: Ic57f93722b113c2aa900b2b92aa90174aadc7904
To be more consistent with the moved messages in that module
have function/method messages that are decoratored end in () and
have the thing being decorated name be in single quotes.
Change-Id: Ia3ba4c426d47bd36eb76f7f9df7144f5db821582
This commit adds a new decorator to mark a function/class as
deprecated in preparation for it's removal.
Change-Id: I4c3cf3ff9abdd7faefeae907a8b73608123fb09d
When an instance method has moved to a better location (for
whatever reason) it is nice to provide the old instance method
under the previous name for a deprecation cycle. To enable
this kind of pattern use/modify/extend the existing moved decorator
to not just work for properties but also work for instance methods.
Change-Id: Ie002d9255d9e5127011c5308c7f5ce16d0b44821
This adds the initial import (and adjustments to requirements
and code) that was initially targeted to land into oslo.utils
but now lands in this project from the following:
https://review.openstack.org/#/c/140119
This forms the basis of the debtcollector functionality (with
more to come as/when needed).
Change-Id: Icd62622a728525fab48ba4de7ee746d0add73b9b