Fixed code smells 'Define a constant instead of duplicating this literal' reported by SonarQube.

This commit is contained in:
Akshay Joshi
2020-09-29 15:08:14 +05:30
parent c7c199210d
commit 1c70a43b91
22 changed files with 167 additions and 176 deletions

View File

@@ -785,6 +785,8 @@ class Filemanager(object):
Returns a JSON object containing information
about the given file.
"""
date_created = 'Date Created'
date_modified = 'Date Modified'
path = unquote(path)
if self.dir is None:
self.dir = ""
@@ -801,8 +803,8 @@ class Filemanager(object):
'Code': 0,
'Info': '',
'Properties': {
'Date Created': '',
'Date Modified': '',
date_created: '',
date_modified: '',
'Width': '',
'Height': '',
'Size': ''
@@ -819,8 +821,8 @@ class Filemanager(object):
'Code': 1,
'Info': '',
'Properties': {
'Date Created': '',
'Date Modified': '',
date_created: '',
date_modified: '',
'Width': '',
'Height': '',
'Size': ''
@@ -842,8 +844,8 @@ class Filemanager(object):
created = time.ctime(os.path.getctime(orig_path))
modified = time.ctime(os.path.getmtime(orig_path))
thefile['Properties']['Date Created'] = created
thefile['Properties']['Date Modified'] = modified
thefile['Properties'][date_created] = created
thefile['Properties'][date_modified] = modified
thefile['Properties']['Size'] = sizeof_fmt(getsize(orig_path))
return thefile