Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

changed syntax in cached_property for python >= 3.9.6 #119

Merged
merged 1 commit into from
May 24, 2023

Conversation

CodeBBQ
Copy link

@CodeBBQ CodeBBQ commented Mar 10, 2022

The syntax in cached_property changed at the version change from 1.0.x to 2.0.x in werkzeug package.

I, therefore, introduced a try-except block to use the newer attribute fget instead of func if an AttributeError occurs.

For running:

python -m unittest discover > ~/testresult.txt

s./Users/user/repositories/ads/ads/base.py:135: RuntimeWarning: No token found
  warnings.warn("No token found", RuntimeWarning)
........../Users/user/repositories/ads/ads/utils.py:33: UserWarning: You are lazy loading attributes via 'citation_count', and so are making multiple calls to the API. This will impact your overall rate limits.
  warnings.warn(
/Users/user/repositories/ads/ads/utils.py:33: UserWarning: You are lazy loading attributes via 'author', and so are making multiple calls to the API. This will impact your overall rate limits.
  warnings.warn(
/Users/user/repositories/ads/ads/utils.py:33: UserWarning: You are lazy loading attributes via 'volume', and so are making multiple calls to the API. This will impact your overall rate limits.
  warnings.warn(
/Users/user/repositories/ads/ads/utils.py:33: UserWarning: You are lazy loading attributes via 'metrics', and so are making multiple calls to the API. This will impact your overall rate limits.
  warnings.warn(
/Users/user/repositories/ads/ads/search.py:288: UserWarning: metrics should be queried with ads.MetricsQuery(); You willhit API ratelimits very quickly otherwise.
  warnings.warn("metrics should be queried with ads.MetricsQuery(); You will"
/Users/user/repositories/ads/ads/utils.py:33: UserWarning: You are lazy loading attributes via 'bibtex', and so are making multiple calls to the API. This will impact your overall rate limits.
  warnings.warn(
/Users/user/repositories/ads/ads/search.py:295: UserWarning: bibtex should be queried with ads.ExportQuery(); You will hit API ratelimits very quickly otherwise.
  warnings.warn("bibtex should be queried with ads.ExportQuery(); You will "
..../Users/user/repositories/ads/ads/utils.py:33: UserWarning: You are lazy loading attributes via 'aff', and so are making multiple calls to the API. This will impact your overall rate limits.
  warnings.warn(
../Users/user/repositories/ads/ads/utils.py:33: UserWarning: You are lazy loading attributes via 'pubdate', and so are making multiple calls to the API. This will impact your overall rate limits.
  warnings.warn(
/Users/user/repositories/ads/ads/utils.py:33: UserWarning: You are lazy loading attributes via 'read_count', and so are making multiple calls to the API. This will impact your overall rate limits.
  warnings.warn(
/Users/user/repositories/ads/ads/utils.py:33: UserWarning: You are lazy loading attributes via 'issue', and so are making multiple calls to the API. This will impact your overall rate limits.
  warnings.warn(
.../Users/user/repositories/ads/ads/utils.py:33: UserWarning: You are lazy loading attributes via 'first_author', and so are making multiple calls to the API. This will impact your overall rate limits.
  warnings.warn(
/Users/user/repositories/ads/ads/utils.py:33: UserWarning: You are lazy loading attributes via 'author', and so are making multiple calls to the API. This will impact your overall rate limits.
  warnings.warn(
/Users/user/repositories/ads/ads/utils.py:33: UserWarning: You are lazy loading attributes via 'year', and so are making multiple calls to the API. This will impact your overall rate limits.
  warnings.warn(
.........../Users/user/repositories/ads/ads/search.py:567: DeprecationWarning: ads.query will be deprectated. Use ads.SearchQuery in the future
  warnings.warn(
..
----------------------------------------------------------------------
Ran 34 tests in 0.176s

OK (skipped=1)

I do not know why the test does not find my token in ~/.ads/dev_key, but this works for regular use.

@rieder
Copy link

rieder commented Jun 1, 2022

would be good to see this fixed

@JohannesBuchner
Copy link
Contributor

I ran into this issue as well. I was about to submit a PR when I saw this PR, which is very similar or better than what I prepared. I would recommend merging it and making a new release on pypi, please @andycasey .

@andycasey andycasey merged commit 5f9f074 into andycasey:master May 24, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants