Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 087c982

Browse files
committed
Lots of cleanup and prep work for Python 3.7-3.10 Django 2.1+
1 parent aa448bd commit 087c982

File tree

101 files changed

+946
-749
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

101 files changed

+946
-749
lines changed

.coveragerc

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
[run]
2+
branch = True
3+
omit =
4+
*/migrations/*
5+
6+
[report]
7+
fail_under = 70
8+
omit =
9+
*/migrations/*
10+
*/test*

.gitignore

Lines changed: 105 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,107 @@
1-
*.pyc
2-
*.pyo
1+
# Created by .ignore support plugin (hsz.mobi)
2+
### Python template
3+
# Byte-compiled / optimized / DLL files
4+
__pycache__/
5+
*.py[cod]
6+
*$py.class
7+
# C extensions
8+
*.so
9+
10+
# Distribution / packaging
11+
.Python
12+
build/
13+
develop-eggs/
14+
dist/
15+
downloads/
16+
eggs/
17+
.eggs/
18+
lib/
19+
lib64/
20+
parts/
21+
sdist/
22+
var/
23+
wheels/
24+
*.egg-info/
25+
.installed.cfg
26+
*.egg
27+
MANIFEST
28+
29+
# PyInstaller
30+
# Usually these files are written by a python script from a template
31+
# before PyInstaller builds the exe, so as to inject date/other infos into it.
32+
*.manifest
33+
*.spec
34+
35+
# Installer logs
36+
pip-log.txt
37+
pip-delete-this-directory.txt
38+
39+
# Unit test / coverage reports
40+
htmlcov/
41+
.tox/
42+
.coverage
43+
.coverage.*
44+
.cache
45+
nosetests.xml
46+
coverage.xml
47+
*.cover
48+
.hypothesis/
49+
.pytest_cache/
50+
51+
# Translations
52+
*.mo
53+
*.pot
54+
55+
# Django stuff:
356
*.log
4-
.DS_Store
5-
Thumbs.db
6-
*.orig
7-
dist
8-
build
9-
django_datatable_view.egg-info
10-
.tm_properties
11-
.python-version
57+
local_settings.py
1258
db.sqlite3
13-
appengine
14-
docs/_build
15-
.idea
16-
.venv/
59+
60+
# Flask stuff:
61+
instance/
62+
.webassets-cache
63+
64+
# Scrapy stuff:
65+
.scrapy
66+
67+
# Sphinx documentation
68+
docs/_build/
69+
70+
# PyBuilder
71+
target/
72+
73+
# Jupyter Notebook
74+
.ipynb_checkpoints
75+
76+
# pyenv
77+
.python-version
78+
79+
# celery beat schedule file
80+
celerybeat-schedule
81+
82+
# SageMath parsed files
83+
*.sage.py
84+
85+
# Environments
86+
.env
87+
.venv
88+
env/
89+
venv/
90+
ENV/
91+
env.bak/
92+
venv.bak/
93+
94+
# Spyder project settings
95+
.spyderproject
96+
.spyproject
97+
98+
# Rope project settings
99+
.ropeproject
100+
101+
# mkdocs documentation
102+
/site
103+
104+
# mypy
105+
.mypy_cache/
106+
107+
.DS_Store

.pre-commit-config.yaml

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
repos:
2+
- repo: git://github.com/pre-commit/pre-commit-hooks
3+
rev: v1.4.0
4+
hooks:
5+
- id: check-added-large-files
6+
args: ['--maxkb=500']
7+
- id: check-byte-order-marker
8+
- id: check-case-conflict
9+
- id: check-merge-conflict
10+
- id: check-symlinks
11+
- id: detect-private-key
12+
- id: flake8
13+
files: datatableview
14+
exclude: tests/*
15+
args: ['--config=tox.ini']
16+
- id: fix-encoding-pragma
17+
- id: end-of-file-fixer
18+
exclude: .idea/*
19+
- id: trailing-whitespace
20+
exclude: .idea/*
21+
- id: mixed-line-ending
22+
exclude: .idea/*
23+
- id: double-quote-string-fixer
24+
exclude: .idea/*
25+
- id: check-json
26+
files: .gitignore
27+
- repo: https://github.com/pre-commit/mirrors-isort
28+
rev: v4.3.16 # Use the revision sha / tag you want to point at
29+
hooks:
30+
- id: isort
31+
files: datatableview
32+
args: ['--recursive', '--diff']

.travis.yml

Lines changed: 27 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,30 @@
1-
sudo: false
1+
dist: xenial
2+
23
language: python
4+
5+
sudo: false
6+
7+
git:
8+
depth: 1
9+
quiet: true
10+
11+
cache: pip
12+
313
python:
4-
- "2.7"
5-
- "3.4"
6-
- "3.5"
7-
- "3.6"
8-
# - "3.7"
9-
env:
10-
- DJANGO=1.11.16
11-
- DJANGO=2.0.9
12-
- DJANGO=2.1.2
14+
- "3.7"
15+
- "3.8"
16+
- "3.9"
17+
- "3.10-dev"
18+
1319
install:
14-
- pip install -q Django==$DJANGO
15-
# - pip install pep8
16-
# - pip install pyflakes
17-
- pip install -q -e .
18-
# before_script:
19-
# - "pep8 --exclude=migrations --ignore=E501,E225 datatableview"
20-
# - pyflakes datatableview
21-
script:
22-
- python datatableview/tests/example_project/manage.py test
23-
24-
matrix:
25-
exclude:
26-
- python: "2.7"
27-
env: DJANGO=2.0.9
28-
- python: "2.7"
29-
env: DJANGO=2.1.2
30-
- python: "3.4"
31-
env: DJANGO=2.1.2
20+
- 'pip install tox-travis pyyaml python-coveralls'
21+
22+
script: tox
23+
24+
notifications:
25+
slack:
26+
rooms:
27+
- pivotalenergy:SvNSkVaLVlZeu82utL37wSvy#travis
28+
29+
after_success:
30+
- coveralls

CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -337,7 +337,7 @@ class MyDatatableView(DatatableView):
337337
def get_json_response_object(self, object_list, *args, **kwargs):
338338
data = super(MyDatatableView, self).get_json_response_object(object_list, *args, **kwargs)
339339

340-
# Keep customizations JSON-compatible! :)
340+
# Keep customizations JSON-compatible! :)
341341
data.update({
342342
'special_arg': self.kwargs['special_arg'],
343343
})

LICENSE.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -199,4 +199,4 @@
199199
distributed under the License is distributed on an "AS IS" BASIS,
200200
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
201201
See the License for the specific language governing permissions and
202-
limitations under the License.
202+
limitations under the License.

datatableview/__init__.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,12 @@
77

88
__name__ = 'datatableview'
99
__author__ = 'Autumn Valenta'
10-
__version_info__ = (0, 9, 0)
10+
__version_info__ = (1, 0, 0)
1111
__version__ = '.'.join(map(str, __version_info__))
1212
__date__ = '2013/11/14 2:00:00 PM'
1313
__credits__ = ['Autumn Valenta', 'Steven Klass']
1414
__license__ = 'See the file LICENSE.txt for licensing information.'
15+
16+
__all__ = ['Datatable', 'ValuesDatatable', 'LegacyDatatable', 'Column', 'TextColumn',
17+
'DateColumn', 'DateTimeColumn', 'BooleanColumn', 'IntegerColumn', 'FloatColumn',
18+
'DisplayColumn', 'CompoundColumn', 'CheckBoxSelectColumn', 'SkipRecord']

datatableview/cache.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
# -*- coding: utf-8 -*-
12
import inspect
23
import hashlib
34
import logging
@@ -42,11 +43,11 @@ class cache_types(object):
4243

4344
cache = caches[CACHE_BACKEND]
4445

45-
4646
hash_slice = None
4747
if CACHE_KEY_HASH:
4848
hash_slice = slice(None, CACHE_KEY_HASH_LENGTH)
4949

50+
5051
def _hash_key_component(s):
5152
return hashlib.sha1(s.encode('utf-8')).hexdigest()[hash_slice]
5253

@@ -93,7 +94,7 @@ def get_cache_key(datatable_class, view=None, user=None, **kwargs):
9394
kwargs_id = _hash_key_component(kwargs_id)
9495
cache_key += '__kwargs_%s' % (kwargs_id,)
9596

96-
log.debug("Cache key derived for %r: %r (from kwargs %r)", datatable_class, cache_key, values)
97+
log.debug('Cache key derived for %r: %r (from kwargs %r)', datatable_class, cache_key, values)
9798

9899
return cache_key
99100

@@ -102,12 +103,12 @@ def get_cached_data(datatable, **kwargs):
102103
""" Returns the cached object list under the appropriate key, or None if not set. """
103104
cache_key = '%s%s' % (CACHE_PREFIX, datatable.get_cache_key(**kwargs))
104105
data = cache.get(cache_key)
105-
log.debug("Reading data from cache at %r: %r", cache_key, data)
106+
log.debug('Reading data from cache at %r: %r', cache_key, data)
106107
return data
107108

108109

109110
def cache_data(datatable, data, **kwargs):
110111
""" Stores the object list in the cache under the appropriate key. """
111112
cache_key = '%s%s' % (CACHE_PREFIX, datatable.get_cache_key(**kwargs))
112-
log.debug("Setting data to cache at %r: %r", cache_key, data)
113+
log.debug('Setting data to cache at %r: %r', cache_key, data)
113114
cache.set(cache_key, data)

0 commit comments

Comments
 (0)