Skip to content

Commit

Permalink
Remove deprecationWarnings on import pyalex and remove Venues
Browse files Browse the repository at this point in the history
  • Loading branch information
J535D165 committed Aug 19, 2024
1 parent 9673ee1 commit 51dba82
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 40 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ Works()["W2741809807"]["open_access"]
{'is_oa': True, 'oa_status': 'gold', 'oa_url': 'https://doi.org/10.7717/peerj.4375'}
```

The previous works also for Authors, Venues, Institutions, Concepts and Topics
The previous works also for Authors, Sources, Institutions, Concepts and Topics

```python
Authors()["A2887243803"]
Expand Down
4 changes: 0 additions & 4 deletions pyalex/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,6 @@
from pyalex.api import Subfields
from pyalex.api import Topic
from pyalex.api import Topics
from pyalex.api import Venue
from pyalex.api import Venues
from pyalex.api import Work
from pyalex.api import Works
from pyalex.api import autocomplete
Expand All @@ -46,8 +44,6 @@
"Funders",
"Publishers",
"Publisher",
"Venues",
"Venue",
"Institutions",
"Institution",
"Concepts",
Expand Down
49 changes: 15 additions & 34 deletions pyalex/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -483,46 +483,27 @@ def __getitem__(self, key):
)


def Venue(*args, **kwargs): # deprecated
# warn about deprecation
warnings.warn(
"Venue is deprecated. Use Sources instead.",
DeprecationWarning,
stacklevel=2,
)

return Source(*args, **kwargs)


def Venues(*args, **kwargs): # deprecated
# warn about deprecation
warnings.warn(
"Venues is deprecated. Use Sources instead.",
DeprecationWarning,
stacklevel=2,
)

return Sources(*args, **kwargs)


class Concept(OpenAlexEntity):
# warn about deprecation
warnings.warn(
"Concept is deprecated by OpenAlex and replaced by topics.",
DeprecationWarning,
stacklevel=2,
)
def __init__(self, *args, **kwargs):
warnings.warn(
"Concept is deprecated by OpenAlex and replaced by topics.",
DeprecationWarning,
stacklevel=2,
)
super().__init__(*args, **kwargs)


class Concepts(BaseOpenAlex):
# warn about deprecation
warnings.warn(
"Concepts is deprecated by OpenAlex and replaced by topics.",
DeprecationWarning,
stacklevel=2,
)
resource_class = Concept

def __init__(self, *args, **kwargs):
warnings.warn(
"Concepts is deprecated by OpenAlex and replaced by topics.",
DeprecationWarning,
stacklevel=2,
)
super().__init__(*args, **kwargs)


def autocomplete(s):
"""autocomplete with any type of entity"""
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -41,4 +41,4 @@ force-single-line = true

[tool.pytest.ini_options]
pythonpath = ["."]
addopts = "-v"
addopts = "-v -W error"

0 comments on commit 51dba82

Please sign in to comment.