-
Notifications
You must be signed in to change notification settings - Fork 412
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
DEP: Deprecate all data reading functionality via pandas-datareader (#97
) * DEP: Deprecate all functions using pandas-datareader * DOC: Update README with deprecation documentation * STY: Markdown style * STY: Markdown style again * REV: revert previous commit * STY: typo * STY: consistent naming convention * DEP: also deprecate any cacheing of data * DEP: forgot to deprecate additional funcs * REV: get_utc_timestamp should not be deprecated * ENH: add function to compute returns from prices * BUG: wrap import in try-except * MAINT: update deprecation warning * MAINT: move `simple_returns` func to `stats` module * MAINT: don't raise deprecation warning for _1_bday_ago * DOC: remove suggestions * TST: added test for simple_returns * MAINT: add simple_returns to init * TST: fixed simple_returns test * STY: use size, not shape * TST: tests passing * DOC: 1_bday_ago no longer deprecated
- Loading branch information
Showing
6 changed files
with
140 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
"""Utilities for marking deprecated functions.""" | ||
# Copyright 2018 Quantopian, Inc. | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
|
||
import warnings | ||
from functools import wraps | ||
|
||
|
||
def deprecated(msg=None, stacklevel=2): | ||
""" | ||
Used to mark a function as deprecated. | ||
Parameters | ||
---------- | ||
msg : str | ||
The message to display in the deprecation warning. | ||
stacklevel : int | ||
How far up the stack the warning needs to go, before | ||
showing the relevant calling lines. | ||
Usage | ||
----- | ||
@deprecated(msg='function_a is deprecated! Use function_b instead.') | ||
def function_a(*args, **kwargs): | ||
""" | ||
def deprecated_dec(fn): | ||
@wraps(fn) | ||
def wrapper(*args, **kwargs): | ||
warnings.warn( | ||
msg or "Function %s is deprecated." % fn.__name__, | ||
category=DeprecationWarning, | ||
stacklevel=stacklevel | ||
) | ||
return fn(*args, **kwargs) | ||
return wrapper | ||
return deprecated_dec |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters