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

Fix deprecated import (Sourcery refactored) #67

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions pure_pagination/paginator.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import collections
from collections.abc import Iterable

from django.core.paginator import InvalidPage, EmptyPage, PageNotAnInteger
from django.conf import settings
Expand Down Expand Up @@ -102,7 +102,7 @@ def wrapper(self, *args, **kwargs):
if isinstance(result, int):
querystring = self._other_page_querystring(result)
return PageRepresentation(result, querystring)
elif isinstance(result, collections.Iterable):
elif isinstance(result, Iterable):
new_result = []
for number in result:
if isinstance(number, int):
Expand All @@ -129,7 +129,7 @@ def __init__(self, object_list, number, paginator):
self.number = PageRepresentation(number, self._other_page_querystring(number))

def __repr__(self):
return '<Page %s of %s>' % (self.number, self.paginator.num_pages)
return f'<Page {self.number} of {self.paginator.num_pages}>'
Copy link
Author

Choose a reason for hiding this comment

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

Function Page.__repr__ refactored with the following changes:


def has_next(self):
return self.number < self.paginator.num_pages
Expand Down Expand Up @@ -206,7 +206,7 @@ def _other_page_querystring(self, page_number):
return self.base_queryset.urlencode()

# raise Warning("You must supply Paginator() with the request object for a proper querystring.")
return 'page=%s' % page_number
return f'page={page_number}'
Copy link
Author

Choose a reason for hiding this comment

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

Function Page._other_page_querystring refactored with the following changes:


def render(self):
return render_to_string('pure_pagination/pagination.html', {
Expand Down
10 changes: 5 additions & 5 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@
url='https://github.com/jamespacileo/django-pure-pagination/',
author='James Pacileo',
author_email='[email protected]',
description='''django-pure-pagination provides advanced pagination features
and is fully compatible with existing code based on Django's
core
pagination module. (aka no need to rewrite code!)''',
description=('django-pure-pagination provides advanced pagination features'
' and is fully compatible with existing code based on Django\'s'
' core'
' pagination module. (aka no need to rewrite code!)'),
long_description=README,
license='BSD',
packages=find_packages(),
Expand All @@ -39,4 +39,4 @@
'Topic :: Internet :: WWW/HTTP :: WSGI',
'Topic :: Software Development :: Libraries :: Python Modules',
],
)
)