Skip to content

Commit f71248c

Browse files
author
Roberto Rosario
committed
Add keyword arguments open and delete
Applies to function and mehtods (storage, compressed files). Signed-off-by: Roberto Rosario <[email protected]>
1 parent 48f099a commit f71248c

File tree

46 files changed

+135
-122
lines changed

Some content is hidden

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

46 files changed

+135
-122
lines changed

HISTORY.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,8 @@
4545
- Remove the fragment "(object):" from all base class declarations.
4646
- Remove settings ``DOCUMENTS_DISABLE_BASE_IMAGE_CACHE`` and
4747
``DOCUMENTS_DISABLE_TRANSFORMED_IMAGE_CACHE``.
48+
- Add keyword arguments to all the ``open()`` and ``delete()`` methods
49+
and functions.
4850

4951
3.4.9 (2020-05-26)
5052
==================

contrib/scripts/code_statistics.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77

88
def print_views_summary(module_filename):
9-
with open(module_filename) as file_object:
9+
with open(file=module_filename) as file_object:
1010
print(' module:', module_filename)
1111
count_class_based_views = 0
1212
count_function_based_views = 0
@@ -23,7 +23,7 @@ def print_views_summary(module_filename):
2323

2424

2525
def print_tests_summary(module_filename):
26-
with open(module_filename) as file_object:
26+
with open(file=module_filename) as file_object:
2727
print(' module:', module_filename)
2828
count_tests = 0
2929
for line in file_object:

contrib/scripts/generate_setup.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ def generate_commit_timestamp():
4848
def get_requirements(base_directory, filename):
4949
result = []
5050

51-
with open(os.path.join(base_directory, filename)) as file_object:
51+
with open(file=os.path.join(base_directory, filename)) as file_object:
5252
for line in file_object:
5353
if line.startswith('-r'):
5454
line = line.split('\n')[0][3:]
@@ -72,16 +72,16 @@ def get_requirements(base_directory, filename):
7272
base_directory=BASE_DIR, filename=REQUIREMENTS_FILE
7373
)
7474

75-
with open(SETUP_TEMPLATE) as file_object:
75+
with open(file=SETUP_TEMPLATE) as file_object:
7676
template = file_object.read()
7777
result = Template(template).render(
7878
context=Context({'requirements': requirements})
7979
)
8080

81-
with open('setup.py', 'w') as file_object:
81+
with open(file='setup.py', mode='w') as file_object:
8282
file_object.write(result)
8383

84-
with open(MAYAN_TEMPLATE) as file_object:
84+
with open(file=MAYAN_TEMPLATE) as file_object:
8585
template = file_object.read()
8686

8787
# Ignore local version if any
@@ -102,5 +102,5 @@ def get_requirements(base_directory, filename):
102102
)
103103
)
104104

105-
with open(os.path.join(BASE_DIR, 'mayan', '__init__.py'), 'w') as file_object:
105+
with open(file=os.path.join(BASE_DIR, 'mayan', '__init__.py'), mode='w') as file_object:
106106
file_object.write(result)

docs/chapters/rest_api.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ Upload a new document:
6363

6464
.. code-block:: python
6565

66-
with open('test_document.pdf', mode='rb') as file_object:
66+
with open(file='test_document.pdf', mode='rb') as file_object:
6767
requests.post('http://127.0.0.1:8000/api/documents/', auth=('username', 'password'), files={'file': file_object}, data={'document_type': 1}).json()
6868

6969
{u'description': u'',

docs/utils.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88
def load_env_file(filename='../config.env'):
99
result = {}
10-
with open(filename) as file_object:
10+
with open(file=filename) as file_object:
1111
for line in file_object:
1212
if not line.startswith('#'):
1313
key, value = line.strip().split('=')

mayan/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
__title__ = 'Mayan EDMS'
22
__version__ = '3.5a1'
33
__build__ = 0x030407
4-
__build_string__ = 'v3.4.7_Tue Apr 28 17:14:27 2020 -0400'
4+
__build_string__ = 'v3.4.9-26-g48f099a168_Tue Jun 2 00:59:10 2020 -0400'
55
__django_version__ = '2.2'
66
__author__ = 'Roberto Rosario'
77
__author_email__ = '[email protected]'

mayan/apps/cabinets/tests/test_wizard_steps.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616

1717
class CabinetDocumentUploadTestMixin:
1818
def _request_upload_interactive_document_create_view(self):
19-
with open(TEST_SMALL_DOCUMENT_PATH, mode='rb') as file_object:
19+
with open(file=TEST_SMALL_DOCUMENT_PATH, mode='rb') as file_object:
2020
return self.post(
2121
viewname='sources:document_upload_interactive', kwargs={
2222
'source_id': self.test_source.pk

mayan/apps/checkouts/tests/test_models.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ def test_blocking_new_versions(self):
8888
NewVersionBlock.objects.block(document=self.test_document)
8989

9090
with self.assertRaises(expected_exception=NewDocumentVersionNotAllowed):
91-
with open(TEST_SMALL_DOCUMENT_PATH, mode='rb') as file_object:
91+
with open(file=TEST_SMALL_DOCUMENT_PATH, mode='rb') as file_object:
9292
self.test_document.new_version(file_object=file_object)
9393

9494
def test_unblocking(self):
@@ -120,5 +120,5 @@ def test_version_creation_blocking(self):
120120
self._check_out_test_document()
121121

122122
with self.assertRaises(expected_exception=NewDocumentVersionNotAllowed):
123-
with open(TEST_SMALL_DOCUMENT_PATH, mode='rb') as file_object:
123+
with open(file=TEST_SMALL_DOCUMENT_PATH, mode='rb') as file_object:
124124
self.test_document.new_version(file_object=file_object)

mayan/apps/common/compressed_files.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -209,7 +209,7 @@ def write(self, filename=None):
209209
self.string_buffer.seek(0)
210210

211211
if filename:
212-
with open(filename, 'w') as file_object:
212+
with open(file=filename, mode='w') as file_object:
213213
file_object.write(self.string_buffer.read())
214214
else:
215215
return self.string_buffer

mayan/apps/common/forms.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -204,7 +204,7 @@ def __init__(self, *args, **kwargs):
204204
file_path = os.path.join(
205205
settings.BASE_DIR, os.sep.join(self.DIRECTORY), self.FILENAME
206206
)
207-
with open(file_path) as file_object:
207+
with open(file=file_path) as file_object:
208208
self.fields['text'].initial = file_object.read()
209209

210210

0 commit comments

Comments
 (0)