Skip to content

Commit fda168b

Browse files
committed
CLN: renames for clarity
* use uppercase for constants * ...
1 parent 9ca60ba commit fda168b

File tree

2 files changed

+25
-23
lines changed

2 files changed

+25
-23
lines changed

larray_editor/editor.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,8 @@
3232
import larray as la
3333

3434
from larray_editor.traceback_tools import StackSummary
35-
from larray_editor.utils import (_, create_action, show_figure, ima, commonpath, dependencies,
36-
get_versions, get_documentation_url, urls, RecentlyUsedList)
35+
from larray_editor.utils import (_, create_action, show_figure, ima, commonpath, DEPENDENCIES,
36+
get_versions, get_documentation_url, URLS, RecentlyUsedList)
3737
from larray_editor.arraywidget import ArrayEditorWidget
3838
from larray_editor.commands import EditSessionArrayCommand, EditCurrentArrayCommand
3939

@@ -236,11 +236,11 @@ def _report_issue(*args, **kwargs):
236236
* Python {python} on {system} {bitness:d}bits
237237
"""
238238
issue_template += f"* {package} {{{package}}}\n"
239-
for dep in dependencies[package]:
239+
for dep in DEPENDENCIES[package]:
240240
issue_template += f"* {dep} {{{dep}}}\n"
241241
issue_template = issue_template.format(**versions)
242242

243-
url = QUrl(urls[f'new_issue_{package}'])
243+
url = QUrl(URLS[f'new_issue_{package}'])
244244
from qtpy.QtCore import QUrlQuery
245245
query = QUrlQuery()
246246
query.addQueryItem("body", quote(issue_template))
@@ -250,15 +250,15 @@ def _report_issue(*args, **kwargs):
250250
return _report_issue
251251

252252
def open_users_group(self):
253-
QDesktopServices.openUrl(QUrl(urls['users_group']))
253+
QDesktopServices.openUrl(QUrl(URLS['users_group']))
254254

255255
def open_announce_group(self):
256-
QDesktopServices.openUrl(QUrl(urls['announce_group']))
256+
QDesktopServices.openUrl(QUrl(URLS['announce_group']))
257257

258258
def about(self):
259259
"""About Editor"""
260260
kwargs = get_versions('editor')
261-
kwargs.update(urls)
261+
kwargs.update(URLS)
262262
message = """\
263263
<p><b>LArray Editor</b> {editor}
264264
<br>The Graphical User Interface for LArray
@@ -269,7 +269,7 @@ def about(self):
269269
<ul>
270270
<li>Python {python} on {system} {bitness:d}bits</li>
271271
"""
272-
for dep in dependencies['editor']:
272+
for dep in DEPENDENCIES['editor']:
273273
message += f"<li>{dep} {kwargs[dep]}</li>\n"
274274
message += "</ul>"
275275
QMessageBox.about(self, _("About LArray Editor"), message.format(**kwargs))

larray_editor/utils.py

Lines changed: 17 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -32,18 +32,18 @@
3232
logger = logging.getLogger("editor")
3333

3434

35-
core_dependencies = ['numpy', 'pandas', 'matplotlib', 'pytables', 'xlwings', 'xlsxwriter', 'xlrd', 'openpyxl']
36-
editor_dependencies = ['larray', 'larray_eurostat', 'qt'] + core_dependencies
37-
eurostat_dependencies = ['larray']
38-
dependencies = {'editor': editor_dependencies, 'larray': core_dependencies, 'larray_eurostat': eurostat_dependencies}
35+
CORE_DEPENDENCIES = ['matplotlib', 'numpy', 'openpyxl', 'pandas', 'pytables', 'xlsxwriter', 'xlrd', 'xlwings']
36+
EDITOR_DEPENDENCIES = ['larray', 'larray_eurostat', 'qt'] + CORE_DEPENDENCIES
37+
EUROSTAT_DEPENDENCIES = ['larray']
38+
DEPENDENCIES = {'editor': EDITOR_DEPENDENCIES, 'larray': CORE_DEPENDENCIES, 'larray_eurostat': EUROSTAT_DEPENDENCIES}
3939

4040

41-
doc = "http://larray.readthedocs.io/en/{version}"
42-
urls = {"fpb": "http://www.plan.be/index.php?lang=en",
41+
DOC = "http://larray.readthedocs.io/en/{version}"
42+
URLS = {"fpb": "http://www.plan.be/index.php?lang=en",
4343
"GPL3": "https://www.gnu.org/licenses/gpl-3.0.html",
44-
"doc_index": f"{doc}/index.html",
45-
"doc_tutorial": f"{doc}/tutorial.html",
46-
"doc_api": f"{doc}/api.html",
44+
"doc_index": f"{DOC}/index.html",
45+
"doc_tutorial": f"{DOC}/tutorial.html",
46+
"doc_api": f"{DOC}/api.html",
4747
"new_issue_editor": "https://github.com/larray-project/larray-editor/issues/new",
4848
"new_issue_larray": "https://github.com/larray-project/larray/issues/new",
4949
"new_issue_larray_eurostat": "https://github.com/larray-project/larray_eurostat/issues/new",
@@ -74,19 +74,21 @@ def get_module_version(module_name):
7474

7575

7676
def get_versions(package):
77-
"""Get version information of dependencies of a package"""
77+
"""Get version information of dependencies of one of our packages
78+
`package` can be one of 'editor', 'larray' or 'larray_eurostat'
79+
"""
7880
import platform
79-
modules = {'editor': 'larray_editor', 'qt': 'qtpy.QtCore', 'pytables': 'tables'}
81+
module_with_version = {'editor': 'larray_editor', 'qt': 'qtpy.QtCore', 'pytables': 'tables'}
8082

8183
versions = {
8284
'system': platform.system() if sys.platform != 'darwin' else 'Darwin',
8385
'python': platform.python_version(),
8486
'bitness': 64 if sys.maxsize > 2**32 else 32,
8587
}
8688

87-
versions[package] = get_module_version(modules.get(package, package))
88-
for dep in dependencies[package]:
89-
versions[dep] = get_module_version(modules.get(dep, dep))
89+
versions[package] = get_module_version(module_with_version.get(package, package))
90+
for dep in DEPENDENCIES[package]:
91+
versions[dep] = get_module_version(module_with_version.get(dep, dep))
9092

9193
return versions
9294

@@ -95,7 +97,7 @@ def get_documentation_url(key):
9597
version = get_module_version('larray')
9698
if version == 'N/A':
9799
version = 'stable'
98-
return urls[key].format(version=version)
100+
return URLS[key].format(version=version)
99101

100102

101103
# Note: string and unicode data types will be formatted with '%s' (see below)

0 commit comments

Comments
 (0)