[Git][NTPsec/ntpsec][master] Remove 15 instances of make_wrapper(), none where ever used.
Gary E. Miller
gitlab at mg.gitlab.com
Thu Sep 28 17:33:03 UTC 2017
Gary E. Miller pushed to branch master at NTPsec / ntpsec
Commits:
f076d070 by Gary E. Miller at 2017-09-28T10:31:17-07:00
Remove 15 instances of make_wrapper(), none where ever used.
How much other dead code is in here?
- - - - -
7 changed files:
- contrib/make-leap-seconds.py
- ntpclients/ntpq
- ntpclients/ntpwait
- pylib/agentx.py
- pylib/packet.py
- tests/pylib/jigs.py
- tests/pylib/test_packet.py
Changes:
=====================================
contrib/make-leap-seconds.py
=====================================
--- a/contrib/make-leap-seconds.py
+++ b/contrib/make-leap-seconds.py
@@ -26,9 +26,6 @@ if str is bytes: # Python 2
def string_escape(s):
return s.decode('string_escape')
- def make_wrapper(fp):
- return fp
-
else: # Python 3
import io
@@ -56,16 +53,6 @@ else: # Python 3
# assumes that it will be called with a Python 3 'str' instance
return s.encode(master_encoding).decode('unicode_escape')
- def make_wrapper(fp):
- "Wrapper factory function to enforce master encoding"
- # This can be used to wrap normally binary streams for API
- # compatibility with functions that need a text stream in
- # Python 3; it ensures that the binary bytes are decoded using
- # the master encoding we use to turn bytes to Unicode in
- # polystr above
- # newline="\n" ensures that Python 3 won't mangle line breaks
- return io.TextIOWrapper(fp, encoding=master_encoding, newline="\n")
-
def make_std_wrapper(stream):
"Standard input/output wrapper factory function"
# This ensures that the encoding of standard output and standard
=====================================
ntpclients/ntpq
=====================================
--- a/ntpclients/ntpq
+++ b/ntpclients/ntpq
@@ -48,10 +48,7 @@ version = ntp.util.stdversion()
# - Use latin-1 encoding to transform binary data to/from Unicode when
# necessary for operations where Python 3 expects Unicode; the
# polystr and polybytes functions are used to do this so that
-# when running on Python 2, the byte string data is used unchanged;
-# also, the make_wrapper function constructs a text stream that can
-# wrap a file opened in binary mode for cases where a file object
-# that can be passed around from function to function is needed
+# when running on Python 2, the byte string data is used unchanged.
#
# - Construct custom stdin, stdout, and stderr streams when running
# on Python 3 that force latin-1 encoding, and wrap them around the
@@ -98,16 +95,6 @@ else: # Python 3
# assumes that it will be called with a Python 3 'str' instance
return s.encode(master_encoding).decode('unicode_escape')
- def make_wrapper(fp):
- "Wrapper factory function to enforce master encoding"
- # This can be used to wrap normally binary streams for API
- # compatibility with functions that need a text stream in
- # Python 3; it ensures that the binary bytes are decoded using
- # the master encoding we use to turn bytes to Unicode in
- # polystr above
- # newline="\n" ensures that Python 3 won't mangle line breaks
- return io.TextIOWrapper(fp, encoding=master_encoding, newline="\n")
-
def make_std_wrapper(stream):
"Standard input/output wrapper factory function"
# This ensures that the encoding of standard output and standard
=====================================
ntpclients/ntpwait
=====================================
--- a/ntpclients/ntpwait
+++ b/ntpclients/ntpwait
@@ -41,10 +41,7 @@ import ntp.util
# - Use latin-1 encoding to transform binary data to/from Unicode when
# necessary for operations where Python 3 expects Unicode; the
# polystr and polybytes functions are used to do this so that
-# when running on Python 2, the byte string data is used unchanged;
-# also, the make_wrapper function constructs a text stream that can
-# wrap a file opened in binary mode for cases where a file object
-# that can be passed around from function to function is needed
+# when running on Python 2, the byte string data is used unchanged.
#
# - Construct custom stdin, stdout, and stderr streams when running
# on Python 3 that force latin-1 encoding, and wrap them around the
@@ -63,9 +60,6 @@ if str is bytes: # Python 2
def string_escape(s):
return s.decode('string_escape')
- def make_wrapper(fp):
- return fp
-
else: # Python 3
import io
@@ -93,16 +87,6 @@ else: # Python 3
# assumes that it will be called with a Python 3 'str' instance
return s.encode(master_encoding).decode('unicode_escape')
- def make_wrapper(fp):
- "Wrapper factory function to enforce master encoding"
- # This can be used to wrap normally binary streams for API
- # compatibility with functions that need a text stream in
- # Python 3; it ensures that the binary bytes are decoded using
- # the master encoding we use to turn bytes to Unicode in
- # polystr above
- # newline="\n" ensures that Python 3 won't mangle line breaks
- return io.TextIOWrapper(fp, encoding=master_encoding, newline="\n")
-
def make_std_wrapper(stream):
"Standard input/output wrapper factory function"
# This ensures that the encoding of standard output and standard
=====================================
pylib/agentx.py
=====================================
--- a/pylib/agentx.py
+++ b/pylib/agentx.py
@@ -19,9 +19,6 @@ if str is bytes: # Python 2
def string_escape(s):
return s.decode('string_escape')
- def make_wrapper(fp):
- return fp
-
else: # Python 3
import io
@@ -63,16 +60,6 @@ else: # Python 3
# assumes that it will be called with a Python 3 'str' instance
return s.encode(master_encoding).decode('unicode_escape')
- def make_wrapper(fp):
- "Wrapper factory function to enforce master encoding"
- # This can be used to wrap normally binary streams for API
- # compatibility with functions that need a text stream in
- # Python 3; it ensures that the binary bytes are decoded using
- # the master encoding we use to turn bytes to Unicode in
- # polystr above
- # newline="\n" ensures that Python 3 won't mangle line breaks
- return io.TextIOWrapper(fp, encoding=master_encoding, newline="\n")
-
def make_std_wrapper(stream):
"Standard input/output wrapper factory function"
# This ensures that the encoding of standard output and standard
=====================================
pylib/packet.py
=====================================
--- a/pylib/packet.py
+++ b/pylib/packet.py
@@ -208,10 +208,7 @@ import ntp.util
# - Use latin-1 encoding to transform binary data to/from Unicode when
# necessary for operations where Python 3 expects Unicode; the
# polystr and polybytes functions are used to do this so that
-# when running on Python 2, the byte string data is used unchanged;
-# also, the make_wrapper function constructs a text stream that can
-# wrap a file opened in binary mode for cases where a file object
-# that can be passed around from function to function is needed
+# when running on Python 2, the byte string data is used unchanged.
#
# - Construct custom stdin, stdout, and stderr streams when running
# on Python 3 that force latin-1 encoding, and wrap them around the
@@ -277,16 +274,6 @@ else: # Python 3
# assumes that it will be called with a Python 3 'str' instance
return s.encode(master_encoding).decode('unicode_escape')
- def make_wrapper(fp):
- "Wrapper factory function to enforce master encoding"
- # This can be used to wrap normally binary streams for API
- # compatibility with functions that need a text stream in
- # Python 3; it ensures that the binary bytes are decoded using
- # the master encoding we use to turn bytes to Unicode in
- # polystr above
- # newline="\n" ensures that Python 3 won't mangle line breaks
- return io.TextIOWrapper(fp, encoding=master_encoding, newline="\n")
-
def make_std_wrapper(stream):
"Standard input/output wrapper factory function"
# This ensures that the encoding of standard output and standard
=====================================
tests/pylib/jigs.py
=====================================
--- a/tests/pylib/jigs.py
+++ b/tests/pylib/jigs.py
@@ -20,9 +20,6 @@ if str is bytes: # Python 2
def string_escape(s):
return s.decode('string_escape')
- def make_wrapper(fp):
- return fp
-
else: # Python 3
import io
@@ -64,16 +61,6 @@ else: # Python 3
# assumes that it will be called with a Python 3 'str' instance
return s.encode(master_encoding).decode('unicode_escape')
- def make_wrapper(fp):
- "Wrapper factory function to enforce master encoding"
- # This can be used to wrap normally binary streams for API
- # compatibility with functions that need a text stream in
- # Python 3; it ensures that the binary bytes are decoded using
- # the master encoding we use to turn bytes to Unicode in
- # polystr above
- # newline="\n" ensures that Python 3 won't mangle line breaks
- return io.TextIOWrapper(fp, encoding=master_encoding, newline="\n")
-
def make_std_wrapper(stream):
"Standard input/output wrapper factory function"
# This ensures that the encoding of standard output and standard
=====================================
tests/pylib/test_packet.py
=====================================
--- a/tests/pylib/test_packet.py
+++ b/tests/pylib/test_packet.py
@@ -31,9 +31,6 @@ if str is bytes: # Python 2
def string_escape(s):
return s.decode('string_escape')
- def make_wrapper(fp):
- return fp
-
else: # Python 3
import io
@@ -75,16 +72,6 @@ else: # Python 3
# assumes that it will be called with a Python 3 'str' instance
return s.encode(master_encoding).decode('unicode_escape')
- def make_wrapper(fp):
- "Wrapper factory function to enforce master encoding"
- # This can be used to wrap normally binary streams for API
- # compatibility with functions that need a text stream in
- # Python 3; it ensures that the binary bytes are decoded using
- # the master encoding we use to turn bytes to Unicode in
- # polystr above
- # newline="\n" ensures that Python 3 won't mangle line breaks
- return io.TextIOWrapper(fp, encoding=master_encoding, newline="\n")
-
def make_std_wrapper(stream):
"Standard input/output wrapper factory function"
# This ensures that the encoding of standard output and standard
View it on GitLab: https://gitlab.com/NTPsec/ntpsec/commit/f076d070f9501baace6591a22dcfef9c85b8b259
---
View it on GitLab: https://gitlab.com/NTPsec/ntpsec/commit/f076d070f9501baace6591a22dcfef9c85b8b259
You're receiving this email because of your account on gitlab.com.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.ntpsec.org/pipermail/vc/attachments/20170928/d1e9d768/attachment.html>
More information about the vc
mailing list