HomeSoftware Heritage

common/highlightjs: Turn some global variables into functions

Description

common/highlightjs: Turn some global variables into functions

The _hljs_languages* global variables content rely on reading a JSON file
located through Django static finders.

As a side effect, when the module is imported, the JSON file is located
then read.

When the DJANGO_SETTINGS_MODULE environment variable is not set, the
module import will fail as the JSON file could not be located.

So avoid to execute that JSON loading code when importing the module
by turning the global variables into functions.

The purpose is to avoid import errors when running sphinx autodoc.

Details

Provenance
anlambertAuthored on Apr 20 2021, 3:00 PM
anlambertPushed on Apr 21 2021, 11:26 AM
Differential Revision
D5563: common/highlightjs: Turn some global variables into functions
Parents
rDWAPPS4a6d884a7449: origin_save: Add docstring and some test scenarios
Branches
Unknown
Tags
Unknown
Build Status
Buildable 20897
Build 32427: test-and-buildJenkins console · Jenkins