[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
[tor-commits] [stem/master] Rename gzip enum
commit db72d0480f0cc118018033d8f8e9d81a47c7d85a
Author: Damian Johnson <atagar@xxxxxxxxxxxxxx>
Date: Mon Dec 25 13:30:16 2017 -0800
Rename gzip enum
The compression name is gzip, 'gz' is just its file extension.
---
stem/descriptor/collector.py | 6 +++---
test/integ/descriptor/collector.py | 2 +-
test/unit/descriptor/collector.py | 2 +-
3 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/stem/descriptor/collector.py b/stem/descriptor/collector.py
index 4af35827..72ecfc30 100644
--- a/stem/descriptor/collector.py
+++ b/stem/descriptor/collector.py
@@ -66,15 +66,15 @@ import stem.prereq
import stem.util.enum
import stem.util.str_tools
-Compression = stem.util.enum.Enum('NONE', 'BZ2', 'GZ', 'XZ')
+Compression = stem.util.enum.Enum('NONE', 'GZIP', 'BZ2', 'XZ')
COLLECTOR_URL = 'https://collector.torproject.org/'
REFRESH_INDEX_RATE = 3600 # get new index if cached copy is an hour old
COMPRESSION_SUFFIX = {
Compression.NONE: '',
+ Compression.GZIP: '.gz',
Compression.BZ2: '.bz2',
- Compression.GZ: '.gz',
Compression.XZ: '.xz',
}
@@ -144,7 +144,7 @@ class CollecTor(object):
# TODO: add compression and retry support
- if self.compression == Compression.GZ:
+ if self.compression == Compression.GZIP:
if stem.prereq.is_python_3():
response = gzip.decompress(response)
else:
diff --git a/test/integ/descriptor/collector.py b/test/integ/descriptor/collector.py
index d79197c2..edb0d2e6 100644
--- a/test/integ/descriptor/collector.py
+++ b/test/integ/descriptor/collector.py
@@ -18,7 +18,7 @@ class TestCollector(unittest.TestCase):
@test.require.only_run_once
@test.require.online
def test_index_gzip(self):
- self._test_index(Compression.GZ)
+ self._test_index(Compression.GZIP)
@test.require.only_run_once
@test.require.online
diff --git a/test/unit/descriptor/collector.py b/test/unit/descriptor/collector.py
index 5dc12164..ce7f0f3c 100644
--- a/test/unit/descriptor/collector.py
+++ b/test/unit/descriptor/collector.py
@@ -11,6 +11,6 @@ class TestCollector(unittest.TestCase):
def test_url(self):
self.assertEqual('https://collector.torproject.org/index/index.json', url('index'))
self.assertEqual('https://collector.torproject.org/index/index.json', url('index', compression = Compression.NONE))
- self.assertEqual('https://collector.torproject.org/index/index.json.gz', url('index', compression = Compression.GZ))
+ self.assertEqual('https://collector.torproject.org/index/index.json.gz', url('index', compression = Compression.GZIP))
self.assertEqual('https://collector.torproject.org/index/index.json.bz2', url('index', compression = Compression.BZ2))
self.assertEqual('https://collector.torproject.org/index/index.json.xz', url('index', compression = Compression.XZ))
_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits