|
41 | 41 | # restructured at some point) |
42 | 42 | from .verify import VerifyError |
43 | 43 |
|
44 | | - # Set module-global boolean variables--these variables can also get their |
45 | | - # values from environment variables |
46 | | - GLOBALS = [ |
47 | | - # Variable name # Default |
48 | | - ('EXTENSION_NAME_CASE_SENSITIVE', False), |
49 | | - ('USE_MEMMAP', True), |
50 | | - ('ENABLE_RECORD_VALUED_KEYWORD_CARDS', True) |
51 | | - ] |
| 44 | + from ...config import ConfigurationItem |
| 45 | + |
| 46 | + # Set module-global boolean variables |
| 47 | + # TODO: Make it possible to set these variables via environment variables |
| 48 | + # again, once support for that is added to Astropy |
| 49 | + EXTENSION_NAME_CASE_SENSITIVE = ConfigurationItem( |
| 50 | + 'extension_name_case_sensitive', False, |
| 51 | + 'If True, extension names (i.e. the EXTNAME keyword) should be ' |
| 52 | + 'treated as case-sensitive.') |
| 53 | + |
| 54 | + USE_MEMMAP = ConfigurationItem( |
| 55 | + 'use_memmap', True, |
| 56 | + 'If True, use memory-mapped file access to read/write the data in ' |
| 57 | + 'FITS files. This generally provides better performance, especially ' |
| 58 | + 'for large files, but may affect performance in I/O-heavy ' |
| 59 | + 'applications.') |
| 60 | + |
| 61 | + ENABLE_RECORD_VALUED_KEYWORD_CARDS = ConfigurationItem( |
| 62 | + 'enabled_record_valued_keyword_cards', True, |
| 63 | + 'If True, enable support for record-valued keywords as described by ' |
| 64 | + 'FITS WCS Paper IV. Otherwise they are treated as normal keywords.') |
52 | 65 |
|
53 | | - for varname, default in GLOBALS: |
54 | | - try: |
55 | | - envvar = os.environ.get('ASTROPY_FITS_' + varname, default) |
56 | | - locals()[varname] = bool(int(envvar)) |
57 | | - except ValueError: |
58 | | - locals()[varname] = default |
59 | 66 |
|
60 | 67 | __all__ = (card.__all__ + column.__all__ + convenience.__all__ + |
61 | 68 | hdu.__all__ + |
62 | | - ['FITS_record', 'FITS_rec', 'GroupData', 'open', 'Section', |
63 | | - 'new_table', 'Header', 'VerifyError', |
64 | | - 'setExtensionNameCaseSensitive'] + [g[0] for g in GLOBALS]) |
| 69 | + ['FITS_record', 'FITS_rec', 'GroupData', 'open', 'Section', |
| 70 | + 'new_table', 'Header', 'VerifyError', |
| 71 | + 'EXTENSION_NAME_CASE_SENSITIVE', 'USE_MEMMAP', |
| 72 | + 'ENABLE_RECORD_VALUED_KEYWORD_CARDS']) |
0 commit comments