14.2.4. crate_anon.common.constants

crate_anon/common/constants.py


Copyright (C) 2015, University of Cambridge, Department of Psychiatry. Created by Rudolf Cardinal (rnc1001@cam.ac.uk).

This file is part of CRATE.

CRATE is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

CRATE is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with CRATE. If not, see <https://www.gnu.org/licenses/>.


Constants used throughout CRATE.

class crate_anon.common.constants.CrateCommand[source]

Top-level commands within CRATE, recorded here to ensure consistency. However, see also crate/installer/installer.py, which duplicates some (because the full Python environment is not then available).

class crate_anon.common.constants.CratePath[source]

Directories within the CRATE Python package.

class crate_anon.common.constants.DockerConstants[source]

Constants for the Docker environment.

class crate_anon.common.constants.EnvVar[source]

Environment variable names.

class crate_anon.common.constants.HelpUrl[source]

Makes help URLs, for an approximation to context-sensitive help within the web site.

Note that in Django’s template syntax,

{{ HelpUrl.main }}

gets translated to

HelpUrl.main()

i.e. further brackets are unnecessary (and an error). See:

… “If a variable resolves to a callable, the template system will call it with no arguments and use its result instead of the callable.”

static make_url(location: str, language: str = 'en', version: str = 'latest') str[source]

Make a CRATE help URL.

Parameters
  • location – location within docs

  • language – language (default en)

  • version – version (default latest)

crate_anon.common.constants.mebibytes(mb: int) int[source]

Takes a parameter in mebibytes (1024^2 bytes) and returns the number of bytes.