Skip to content

Commit f1ddd65

Browse files
committed
clean code
1 parent ae12a2c commit f1ddd65

File tree

20 files changed

+178
-331
lines changed

20 files changed

+178
-331
lines changed

.moban.d/docs/source/conf.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
{% extends 'docs/source/conf.py.jj2' %}
22

33
{%block custom_doc_theme%}
4+
import os # noqa
5+
import sys # noqa
46
sys.path.append(os.path.abspath('_themes'))
57
html_theme_path = ['_themes']
68
html_theme = 'djangodocs'

.moban.d/setup.py

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -2,22 +2,22 @@
22
{%block extras %}
33
{%endblock %}
44
{%block additional_keywords%}
5-
'API',
6-
'Django'
5+
'API',
6+
'Django'
77
{%endblock%}
88

99
{%block additional_classifiers%}
10-
'Development Status :: 3 - Alpha',
11-
'Environment :: Web Environment',
12-
'Topic :: Internet :: WWW/HTTP',
13-
'Topic :: Software Development :: Libraries :: Python Modules',
14-
'Framework :: Django :: 1.7',
15-
'Framework :: Django :: 1.8',
16-
'Framework :: Django :: 1.9',
17-
'Programming Language :: Python :: 2',
18-
'Programming Language :: Python :: 2.7',
19-
'Programming Language :: Python :: 3',
20-
'Programming Language :: Python :: 3.3',
21-
'Programming Language :: Python :: 3.4',
22-
'Programming Language :: Python :: 3.5'
10+
'Development Status :: 3 - Alpha',
11+
'Environment :: Web Environment',
12+
'Topic :: Internet :: WWW/HTTP',
13+
'Topic :: Software Development :: Libraries :: Python Modules',
14+
'Framework :: Django :: 1.7',
15+
'Framework :: Django :: 1.8',
16+
'Framework :: Django :: 1.9',
17+
'Programming Language :: Python :: 2',
18+
'Programming Language :: Python :: 2.7',
19+
'Programming Language :: Python :: 3',
20+
'Programming Language :: Python :: 3.3',
21+
'Programming Language :: Python :: 3.4',
22+
'Programming Language :: Python :: 3.5'
2323
{%endblock%}

.travis.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,11 +24,11 @@ before_install:
2424
- if [[ -f min_requirements.txt && "$MINREQ" -eq 1 ]]; then
2525
mv min_requirements.txt requirements.txt ;
2626
fi
27-
- test ! -f rnd_requirements.txt || pip install --upgrade "setuptools" "pip==7.1"
27+
- pip install --upgrade "setuptools" "pip==7.1"
2828
- test ! -f rnd_requirements.txt || pip install --no-deps -r rnd_requirements.txt
2929
- test ! -f rnd_requirements.txt || pip install -r rnd_requirements.txt ;
3030
- pip install -r tests/requirements.txt
3131
script:
32-
make test
32+
- make test
3333
after_success:
3434
codecov

README.rst

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,11 @@ formats by providing a common programming interface.
2727
.. note::
2828
Here is a typical conversation between the developer and the user::
2929

30-
User: "I have uploaded an excel file as instructed, but your application says un-supported file format"
30+
User: "I have uploaded an excel file"
31+
"but your application says un-supported file format"
3132
Developer: "Did you upload an xlsx file or a csv file?"
32-
User: "Well, I am not sure. I saved the data using Microsoft Excel. Surely, it must be in an excel format."
33+
User: "Well, I am not sure. I saved the data using "
34+
"Microsoft Excel. Surely, it must be in an excel format."
3335

3436
The highlighted features are:
3537

@@ -90,6 +92,13 @@ Tested Django Versions
9092

9193
Installation
9294
================================================================================
95+
96+
Recently, pyexcel(0.2.2+) and its plugins(0.2.0+) started using newer version of setuptools. Please upgrade your setup tools before install latest pyexcel components:
97+
98+
.. code-block:: bash
99+
100+
$ pip install --upgrade setuptools
101+
93102
You can install it via pip:
94103

95104
.. code-block:: bash

django_excel/__init__.py

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ def save_to_database(self, model=None, initializer=None, mapdict=None,
3131
**keywords):
3232
"""
3333
Save data from a sheet to a nominated django model
34-
"""
34+
"""
3535
params = self.get_params(**keywords)
3636
if 'name_columns_by_row' not in params:
3737
params['name_columns_by_row'] = 0
@@ -50,7 +50,7 @@ def save_book_to_database(self, models=None, initializers=None,
5050
"""
5151
params = self.get_params(**keywords)
5252
params['dest_models'] = models
53-
params['dest_initializers']=initializers
53+
params['dest_initializers'] = initializers
5454
params['dest_mapdicts'] = mapdicts
5555
params['dest_batch_size'] = batch_size
5656
pe.save_book_as(**params)
@@ -65,7 +65,7 @@ class ExcelInMemoryUploadedFile(ExcelMixin, InMemoryUploadedFile):
6565

6666
class TemporaryUploadedExcelFile(ExcelMixin, TemporaryUploadedFile):
6767
"""
68-
Mix-in pyexcel-webio methods in TemporaryUploadedFile
68+
Mix-in pyexcel-webio methods in TemporaryUploadedFile
6969
"""
7070
pass
7171

@@ -115,14 +115,15 @@ def _make_response(content, content_type, status, file_name=None):
115115
"""
116116
response = HttpResponse(content, content_type=content_type, status=status)
117117
if file_name:
118-
response["Content-Disposition"] = "attachment; filename=%s" % (file_name)
118+
response["Content-Disposition"] = (
119+
"attachment; filename=%s" % (file_name))
119120
return response
120121

121122

122123
webio.ExcelResponse = _make_response
123124

124125

125-
from pyexcel_webio import (
126+
from pyexcel_webio import ( # noqa
126127
make_response,
127128
make_response_from_array,
128129
make_response_from_dict,
@@ -142,7 +143,8 @@ def make_response_from_a_table(model, file_type,
142143
:param status: same as :meth:`~django_excel.make_response`
143144
"""
144145
sheet = pe.get_sheet(model=model, **keywords)
145-
return make_response(sheet, file_type, status, file_name=file_name, **keywords)
146+
return make_response(sheet, file_type, status,
147+
file_name=file_name, **keywords)
146148

147149

148150
def make_response_from_tables(models, file_type,
@@ -157,4 +159,5 @@ def make_response_from_tables(models, file_type,
157159
:param status: same as :meth:`~django_excel.make_response`
158160
"""
159161
book = pe.get_book(models=models, **keywords)
160-
return make_response(book, file_type, status, file_name=file_name, **keywords)
162+
return make_response(book, file_type, status,
163+
file_name=file_name, **keywords)

0 commit comments

Comments
 (0)