[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[tor-commits] [stem/master] Dropping stem.util.str_tools.join()



commit 4bf82dbc66809775af6ba28cf51b5236f715aa04
Author: Damian Johnson <atagar@xxxxxxxxxxxxxx>
Date:   Sat Nov 22 14:31:57 2014 -0800

    Dropping stem.util.str_tools.join()
    
    This helper on reflection is really specialized for arm's use case. It doesn't
    belong in Stem. Thankfully it wasn't part of any release yet so we can just
    drop it.
---
 docs/change_log.rst       |    1 -
 stem/descriptor/remote.py |    6 +++---
 stem/util/str_tools.py    |   39 ---------------------------------------
 test/unit/doctest.py      |    1 -
 4 files changed, 3 insertions(+), 44 deletions(-)

diff --git a/docs/change_log.rst b/docs/change_log.rst
index 8b9086b..e0e765b 100644
--- a/docs/change_log.rst
+++ b/docs/change_log.rst
@@ -64,7 +64,6 @@ The following are only available within Stem's `git repository
   * Added support for directories to :func:`stem.util.conf.Config.load`.
   * Changed :func:`stem.util.conf.uses_settings` to only provide a 'config' keyword arument if the decorated function would accept it.
   * Added :func:`stem.util.str_tools.crop`
-  * Added :func:`stem.util.str_tools.join`
   * Added :func:`stem.util.proc.file_descriptors_used`
   * Dropped the 'get_*' prefix from most function names. Old names will still work, but are a deprecated alias.
 
diff --git a/stem/descriptor/remote.py b/stem/descriptor/remote.py
index 02f09d2..0e912aa 100644
--- a/stem/descriptor/remote.py
+++ b/stem/descriptor/remote.py
@@ -645,6 +645,9 @@ class DirectoryAuthority(object):
      network. They in turn use this to construct their circuits and use the
      network.
 
+  .. versionchanged:: 1.3.0
+     Added the is_bandwidth_authority attribute.
+
   :var str nickname: nickname of the authority
   :var str address: IP address of the authority, presently they're all IPv4 but
     this may not always be the case
@@ -764,9 +767,6 @@ def get_authorities():
   The directory information hardcoded into Tor and occasionally changes, so the
   information this provides might not necessarily match your version of tor.
 
-  .. versionchanged:: 1.3.0
-     Added the is_bandwidth_authority attribute.
-
   :returns: dict of str nicknames to :class:`~stem.descriptor.remote.DirectoryAuthority` instances
   """
 
diff --git a/stem/util/str_tools.py b/stem/util/str_tools.py
index d669753..16681d5 100644
--- a/stem/util/str_tools.py
+++ b/stem/util/str_tools.py
@@ -13,7 +13,6 @@ Toolkit for various string activity.
 ::
 
   crop - shortens string to a given length
-  join - joins a series of strings up to a given length
 
   size_label - human readable label for a number of bytes
   time_label - human readable label for a number of seconds
@@ -258,44 +257,6 @@ def crop(msg, size, min_word_length = 4, min_crop = 0, ending = Ending.ELLIPSE,
   return (return_msg, remainder) if get_remainder else return_msg
 
 
-def join(entries, joiner = ' ', size = None):
-  """
-  Joins a series of strings similar to str.join(), but only up to a given size.
-  This returns an empty string if none of the entries will fit. For example...
-
-    >>> join(['This', 'is', 'a', 'looooong', 'message'], size = 18)
-    'This is a looooong'
-
-    >>> join(['This', 'is', 'a', 'looooong', 'message'], size = 17)
-    'This is a'
-
-    >>> join(['This', 'is', 'a', 'looooong', 'message'], size = 2)
-    ''
-
-  :param list entries: strings to be joined
-  :param str joiner: strings to join the entries with
-  :param int size: maximum length the result can be, there's no length
-    limitation if **None**
-
-  :returns: **str** of the joined entries up to the given length
-  """
-
-  if size is None:
-    return joiner.join(entries)
-
-  result = ''
-
-  for entry in entries:
-    new_result = joiner.join((result, entry)) if result else entry
-
-    if len(new_result) > size:
-      break
-    else:
-      result = new_result
-
-  return result
-
-
 def size_label(byte_count, decimal = 0, is_long = False, is_bytes = True):
   """
   Converts a number of bytes into a human readable label in its most
diff --git a/test/unit/doctest.py b/test/unit/doctest.py
index 090b273..e3e53d8 100644
--- a/test/unit/doctest.py
+++ b/test/unit/doctest.py
@@ -60,7 +60,6 @@ class TestDocumentation(unittest.TestCase):
         args['globs'] = {
           '_to_camel_case': stem.util.str_tools._to_camel_case,
           'crop': stem.util.str_tools.crop,
-          'join': stem.util.str_tools.join,
           'size_label': stem.util.str_tools.size_label,
           'time_label': stem.util.str_tools.time_label,
           'time_labels': stem.util.str_tools.time_labels,

_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits