diff options
author | Ilya Etingof <etingof@gmail.com> | 2019-02-10 16:38:35 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-02-10 16:38:35 +0100 |
commit | 588b9b902d191d8010cb6b247fcb07887d59542c (patch) | |
tree | 419b01d2598e91331db784ac3a6675324aba8c24 /pysnmp/smi/compiler.py | |
parent | 9664858b145140a4fbb2a22b633c1ab41c2555bd (diff) | |
download | pysnmp-git-588b9b902d191d8010cb6b247fcb07887d59542c.tar.gz |
Uppercase global constants (#238)
This is a massive patch essentially upper-casing global/class attributes
that mean to be constants.
Some previously exposed constants have been preserved for compatibility
reasons (notably, in `hlapi`), though the rest might break user code relying
on pysnmp 4.
Diffstat (limited to 'pysnmp/smi/compiler.py')
-rw-r--r-- | pysnmp/smi/compiler.py | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/pysnmp/smi/compiler.py b/pysnmp/smi/compiler.py index 08e38811..231685f8 100644 --- a/pysnmp/smi/compiler.py +++ b/pysnmp/smi/compiler.py @@ -7,15 +7,15 @@ import os import sys -defaultSources = ['file:///usr/share/snmp/mibs', 'file:///usr/share/mibs'] +DEFAULT_SOURCES = ['file:///usr/share/snmp/mibs', 'file:///usr/share/mibs'] if sys.platform[:3] == 'win': - defaultDest = os.path.join(os.path.expanduser("~"), + DEFAULT_DEST = os.path.join(os.path.expanduser("~"), 'PySNMP Configuration', 'mibs') else: - defaultDest = os.path.join(os.path.expanduser("~"), '.pysnmp', 'mibs') + DEFAULT_DEST = os.path.join(os.path.expanduser("~"), '.pysnmp', 'mibs') -defaultBorrowers = [] +DEFAULT_BORROWERS = [] try: from pysmi.reader.url import getReadersFromUrls @@ -50,16 +50,16 @@ else: compiler = MibCompiler(parserFactory(**smiV1Relaxed)(), PySnmpCodeGen(), - PyFileWriter(kwargs.get('destination') or defaultDest)) + PyFileWriter(kwargs.get('destination') or DEFAULT_DEST)) - compiler.addSources(*getReadersFromUrls(*kwargs.get('sources') or defaultSources)) + compiler.addSources(*getReadersFromUrls(*kwargs.get('sources') or DEFAULT_SOURCES)) compiler.addSearchers(StubSearcher(*baseMibs)) compiler.addSearchers(*[PyPackageSearcher(x.fullPath()) for x in mibBuilder.getMibSources()]) compiler.addBorrowers(*[PyFileBorrower(x, genTexts=mibBuilder.loadTexts) for x in - getReadersFromUrls(*kwargs.get('borrowers') or defaultBorrowers, + getReadersFromUrls(*kwargs.get('borrowers') or DEFAULT_BORROWERS, lowcaseMatching=False)]) mibBuilder.setMibCompiler( - compiler, kwargs.get('destination') or defaultDest + compiler, kwargs.get('destination') or DEFAULT_DEST ) |