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

Prevent clashing of function names in different modules #41

Merged
merged 2 commits into from
Jun 2, 2020

Conversation

Uxio0
Copy link
Contributor

@Uxio0 Uxio0 commented Jun 1, 2020

Fixes #15

Hi @peterbe,

First of all I would like to thank you for your awesome library.

I found some problem using it in a project not so small, that some modules can have same function name and it's very tedious to set prefix all the time.

What do you think of the solution I propose using __module__ (I know the tests are not passing)? I think that would fix a lot of cases, even if some would still remain (for example, objects with the same function name or inherited in the same module)

Kind regards and thank you for your work

@peterbe
Copy link
Owner

peterbe commented Jun 1, 2020

Try using __qualname__ instead of name and see if that works.

If I remember correctly, it was brought up here: #15
But that the time, django-cache-memoize had to still support Python 2. Those days are gone.

@Uxio0
Copy link
Contributor Author

Uxio0 commented Jun 1, 2020

Try using __qualname__ instead of name and see if that works.

If I remember correctly, it was brought up here: #15
But that the time, django-cache-memoize had to still support Python 2. Those days are gone.

Nice, I haven't read that issue and I thought Python2.7 support was required. Even better.

I have changed that and fixed the tests.

@peterbe
Copy link
Owner

peterbe commented Jun 1, 2020

Seems you just have a linting error.
Oh, and you don't need to rebase your PRs.

@codecov
Copy link

codecov bot commented Jun 2, 2020

Codecov Report

Merging #41 into master will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@            Coverage Diff            @@
##            master       #41   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files            1         1           
  Lines           41        41           
=========================================
  Hits            41        41           
Impacted Files Coverage Δ
src/cache_memoize/__init__.py 100.00% <ø> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 829a58a...306fd07. Read the comment docs.

@Uxio0
Copy link
Contributor Author

Uxio0 commented Jun 2, 2020

Should be fixed now

Copy link
Owner

@peterbe peterbe left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@peterbe peterbe merged commit e83222e into peterbe:master Jun 2, 2020
@peterbe
Copy link
Owner

peterbe commented Jun 2, 2020

Should be in 0.1.7 now https://pypi.org/project/django-cache-memoize/0.1.7/

@Uxio0
Copy link
Contributor Author

Uxio0 commented Jun 2, 2020

Awesome, thanks @peterbe ! 👏

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.

Use func.__qualname__ instead of func.__name__
2 participants