Skip to content

Commit 7bcc2f1

Browse files
committed
Use private constants
1 parent f38577a commit 7bcc2f1

1 file changed

Lines changed: 9 additions & 9 deletions

File tree

Lib/gzip.py

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,12 @@
1717

1818
READ, WRITE = 1, 2
1919

20-
COMPRESS_LEVEL_FAST = 1
21-
COMPRESS_LEVEL_TRADEOFF = 6
22-
COMPRESS_LEVEL_BEST = 9
20+
_COMPRESS_LEVEL_FAST = 1
21+
_COMPRESS_LEVEL_TRADEOFF = 6
22+
_COMPRESS_LEVEL_BEST = 9
2323

2424

25-
def open(filename, mode="rb", compresslevel=COMPRESS_LEVEL_BEST,
25+
def open(filename, mode="rb", compresslevel=_COMPRESS_LEVEL_BEST,
2626
encoding=None, errors=None, newline=None):
2727
"""Open a gzip-compressed file in binary or text mode.
2828
@@ -126,7 +126,7 @@ class GzipFile(_compression.BaseStream):
126126
myfileobj = None
127127

128128
def __init__(self, filename=None, mode=None,
129-
compresslevel=COMPRESS_LEVEL_BEST, fileobj=None, mtime=None):
129+
compresslevel=_COMPRESS_LEVEL_BEST, fileobj=None, mtime=None):
130130
"""Constructor for the GzipFile class.
131131
132132
At least one of fileobj and filename must be given a
@@ -520,7 +520,7 @@ def _rewind(self):
520520
super()._rewind()
521521
self._new_member = True
522522

523-
def compress(data, compresslevel=COMPRESS_LEVEL_BEST):
523+
def compress(data, compresslevel=_COMPRESS_LEVEL_BEST):
524524
"""Compress data in one shot and return the compressed string.
525525
Optional argument is the compression level, in range of 0-9.
526526
"""
@@ -551,11 +551,11 @@ def main():
551551
parser.add_argument("args", nargs="*", default=["-"], metavar='file')
552552
args = parser.parse_args()
553553

554-
compresslevel = COMPRESS_LEVEL_TRADEOFF
554+
compresslevel = _COMPRESS_LEVEL_TRADEOFF
555555
if args.fast:
556-
compresslevel = COMPRESS_LEVEL_FAST
556+
compresslevel = _COMPRESS_LEVEL_FAST
557557
elif args.best:
558-
compresslevel = COMPRESS_LEVEL_BEST
558+
compresslevel = _COMPRESS_LEVEL_BEST
559559

560560
for arg in args.args:
561561
if args.decompress:

0 commit comments

Comments
 (0)