commit 07c75fa254926b2e14ef91d8edc9e8e20170ce81 Author: Damian Johnson atagar@torproject.org Date: Sun Oct 28 13:48:04 2012 -0700
Spelling corrections
Spell checked all of the stem/* files and the test utilites. Quite a few mistakes... --- docs/api.rst | 2 +- stem/control.py | 44 +++++++++++++++--------------- stem/descriptor/__init__.py | 8 +++--- stem/descriptor/export.py | 2 +- stem/descriptor/extrainfo_descriptor.py | 6 ++-- stem/descriptor/networkstatus.py | 8 +++--- stem/descriptor/reader.py | 2 +- stem/descriptor/router_status_entry.py | 10 +++--- stem/descriptor/server_descriptor.py | 10 +++--- stem/exit_policy.py | 24 ++++++++-------- stem/prereq.py | 4 +- stem/response/__init__.py | 2 +- stem/response/getinfo.py | 2 +- stem/socket.py | 4 +- stem/util/conf.py | 4 +- stem/util/connection.py | 6 ++-- stem/util/log.py | 6 ++-- stem/util/proc.py | 2 +- stem/util/system.py | 4 +- stem/version.py | 10 +++--- test/check_whitespace.py | 2 +- test/mocking.py | 14 +++++----- test/output.py | 4 +- test/prompt.py | 2 +- test/runner.py | 12 ++++---- 25 files changed, 97 insertions(+), 97 deletions(-)
diff --git a/docs/api.rst b/docs/api.rst index e149c81..938a10b 100644 --- a/docs/api.rst +++ b/docs/api.rst @@ -15,7 +15,7 @@ Controller * **Types**
* `stem.exit_policy <api/exit_policy.html>`_ - Relay policy for the destinations it will or won't allow traffic to. - * `stem.version <api/version.html>`_ - Tor versions that can be compared to determine Tor's capablilites. + * `stem.version <api/version.html>`_ - Tor versions that can be compared to determine Tor's capabilities.
Descriptors ----------- diff --git a/stem/control.py b/stem/control.py index b87048d..af5c8ee 100644 --- a/stem/control.py +++ b/stem/control.py @@ -182,8 +182,8 @@ class BaseController(object): # message. # # - This is a leftover response for a msg() call. We can't tell who an - # exception was airmarked for, so we only know that this was the case - # if it's a ControlMessage. This should not be possable and indicates + # exception was earmarked for, so we only know that this was the case + # if it's a ControlMessage. This should not be possible and indicates # a stem bug. This deserves a NOTICE level log message since it # indicates that one of our callers didn't get their reply.
@@ -227,7 +227,7 @@ class BaseController(object):
def is_alive(self): """ - Checks if our socket is currently connected. This is a passthrough for our + Checks if our socket is currently connected. This is a pass-through for our socket's :func:`~stem.socket.ControlSocket.is_alive` method.
:returns: **bool** that's **True** if we're shut down and **False** otherwise @@ -237,7 +237,7 @@ class BaseController(object):
def connect(self): """ - Reconnects our control socket. This is a passthrough for our socket's + Reconnects our control socket. This is a pass-through for our socket's :func:`~stem.socket.ControlSocket.connect` method.
:raises: :class:`stem.socket.SocketError` if unable to make a socket @@ -247,7 +247,7 @@ class BaseController(object):
def close(self): """ - Closes our socket connection. This is a passthrough for our socket's + Closes our socket connection. This is a pass-through for our socket's :func:`~stem.socket.ControlSocket.close` method. """
@@ -274,14 +274,14 @@ class BaseController(object):
The state is a value from stem.socket.State, functions **must** allow for new values in this field. The timestamp is a float for the unix time when - the change occured. + the change occurred.
This class only provides **State.INIT** and **State.CLOSED** notifications. Subclasses may provide others.
If spawn is **True** then the callback is notified via a new daemon thread. If **False** then the notice is under our locks, within the thread where - the change occured. In general this isn't advised, especially if your + the change occurred. In general this isn't advised, especially if your callback could block for a while.
:param function callback: function to be notified when our state changes @@ -298,7 +298,7 @@ class BaseController(object):
:param function callback: function to be removed from our listeners
- :returns: **bool** that's **True** if we removed one or more occurances of + :returns: **bool** that's **True** if we removed one or more occurrences of the callback, **False** otherwise """
@@ -353,19 +353,19 @@ class BaseController(object):
def _notify_status_listeners(self, state, expect_alive = None): """ - Informs our status listeners that a state change occured. + Informs our status listeners that a state change occurred.
States imply that our socket is either alive or not, which may not hold - true when multiple events occure in quick succession. For instance, a + true when multiple events occur in quick succession. For instance, a sighup could cause two events (**State.RESET** for the sighup and - **State.CLOSE** if it causes tor to crash). However, there's no guarentee - of the order in which they occure, and it would be bad if listeners got the + **State.CLOSE** if it causes tor to crash). However, there's no guarantee + of the order in which they occur, and it would be bad if listeners got the **State.RESET** last, implying that we were alive.
If set, the expect_alive flag will discard our event if it conflicts with our current :func:`~stem.control.BaseController.is_alive` state.
- :param stem.socket.State state: state change that has occured + :param stem.socket.State state: state change that has occurred :param bool expect_alive: discard event if it conflicts with our :func:`~stem.control.BaseController.is_alive` state """ @@ -373,7 +373,7 @@ class BaseController(object): # Any changes to our is_alive() state happen under the send lock, so we # need to have it to ensure it doesn't change beneath us.
- # TODO: when we drop python 2.5 compatability we can simplify this + # TODO: when we drop python 2.5 compatibility we can simplify this with self._socket._get_send_lock(): with self._status_listeners_lock: change_timestamp = time.time() @@ -398,8 +398,8 @@ class BaseController(object): them if we're restarted. """
- # In theory concurrent calls could result in multple start() calls on a - # single thread, which would cause an unexpeceted exception. Best be safe. + # In theory concurrent calls could result in multiple start() calls on a + # single thread, which would cause an unexpected exception. Best be safe.
with self._socket._get_send_lock(): if not self._reader_thread or not self._reader_thread.isAlive(): @@ -507,7 +507,7 @@ class Controller(BaseController): self._is_caching_enabled = enable_caching self._request_cache = {}
- # number of sequental 'GETINFO ip-to-country/*' lookups that have failed + # number of sequential 'GETINFO ip-to-country/*' lookups that have failed self._geoip_failure_count = 0 self.enabled_features = []
@@ -621,7 +621,7 @@ class Controller(BaseController): if key in CACHEABLE_GETINFO_PARAMS: self._request_cache["getinfo.%s" % key] = value elif key.startswith('ip-to-country/'): - # both cacheable and means that we should reset the geoip failure count + # both cache-able and means that we should reset the geoip failure count self._request_cache["getinfo.%s" % key] = value self._geoip_failure_count = -1
@@ -635,7 +635,7 @@ class Controller(BaseController): # bump geoip failure count if... # * we're caching results # * this was soley a geoip lookup - # * we've never had a successful geoip lookup (faiure count isn't -1) + # * we've never had a successful geoip lookup (failure count isn't -1)
is_geoip_request = len(params) == 1 and list(params)[0].startswith('ip-to-country/')
@@ -707,7 +707,7 @@ class Controller(BaseController): """
# TODO: We should iterate over the descriptors as they're read from the - # socket rather than reading the whole thing into memeory. + # socket rather than reading the whole thing into memory.
desc_content = self.get_info("desc/all-recent")
@@ -770,7 +770,7 @@ class Controller(BaseController): def authenticate(self, *args, **kwargs): """ A convenience method to authenticate the controller. This is just a - passthrough to :func:`stem.connection.authenticate`. + pass-through to :func:`stem.connection.authenticate`. """
import stem.connection @@ -1002,7 +1002,7 @@ class Controller(BaseController): })
The params can optionally be a list a key/value tuples, though the only - reason this type of arguement would be useful is for hidden service + reason this type of argument would be useful is for hidden service configuration (those options are order dependent).
:param dict,list params: mapping of configuration options to the values diff --git a/stem/descriptor/__init__.py b/stem/descriptor/__init__.py index edf4009..ff3d59f 100644 --- a/stem/descriptor/__init__.py +++ b/stem/descriptor/__init__.py @@ -74,7 +74,7 @@ def parse_file(path, descriptor_file): # by an annotation on their first line... # https://trac.torproject.org/5651
- # Cached descriptor handling. These contain mulitple descriptors per file. + # Cached descriptor handling. These contain multiple descriptors per file.
filename, file_parser = os.path.basename(path), None
@@ -268,7 +268,7 @@ def _get_descriptor_components(raw_contents, validate, extra_keywords = ()): followed by an optional value. Lines can also be followed by a signature block.
- To get a sublisting with just certain keywords use extra_keywords. This can + To get a sub-listing with just certain keywords use extra_keywords. This can be useful if we care about their relative ordering with respect to each other. For instance, we care about the ordering of 'accept' and 'reject' entries because this influences the resulting exit policy, but for everything @@ -293,7 +293,7 @@ def _get_descriptor_components(raw_contents, validate, extra_keywords = ()): while remaining_lines: line = remaining_lines.pop(0)
- # V2 network status documents explicitely can contain blank lines... + # V2 network status documents explicitly can contain blank lines... # # "Implementations MAY insert blank lines for clarity between sections; # these blank lines are ignored." @@ -303,7 +303,7 @@ def _get_descriptor_components(raw_contents, validate, extra_keywords = ()):
if not line: continue
- # Some lines have an 'opt ' for backward compatability. They should be + # Some lines have an 'opt ' for backward compatibility. They should be # ignored. This prefix is being removed in... # https://trac.torproject.org/projects/tor/ticket/5124
diff --git a/stem/descriptor/export.py b/stem/descriptor/export.py index 3b71455..9785421 100644 --- a/stem/descriptor/export.py +++ b/stem/descriptor/export.py @@ -21,7 +21,7 @@ def export_csv(descriptors, included_fields = (), excluded_fields = (), header = """ Provides a newline separated CSV for one or more descriptors. If simply provided with descriptors then the CSV contains all of its attributes, - labelled with a header row. Either 'included_fields' or 'excluded_fields' can + labeled with a header row. Either 'included_fields' or 'excluded_fields' can be used for more granular control over its attributes and the order.
:param Descriptor,list descriptors: either a diff --git a/stem/descriptor/extrainfo_descriptor.py b/stem/descriptor/extrainfo_descriptor.py index 026b59b..2bf76e3 100644 --- a/stem/descriptor/extrainfo_descriptor.py +++ b/stem/descriptor/extrainfo_descriptor.py @@ -34,7 +34,7 @@ Extra-info descriptors are available from a few sources... DirStats - known stats for ExtraInfoDescriptor's dir_*_direct_dl and dir_*_tunneled_dl |- COMPLETE - requests that completed successfully |- TIMEOUT - requests that didn't complete within a ten minute timeout - |- RUNNING - requests still in procress when measurement's taken + |- RUNNING - requests still in process when measurement's taken |- MIN - smallest rate at which a descriptor was downloaded in B/s |- MAX - largest rate at which a descriptor was downloaded in B/s |- D1-4 and D6-9 - rate of the slowest x/10 download rates in B/s @@ -184,7 +184,7 @@ class ExtraInfoDescriptor(stem.descriptor.Descriptor): :var datetime published: ***** time in GMT when this descriptor was made :var str geoip_db_digest: sha1 of geoIP database file :var dict transport: ***** mapping of transport methods to their (address, - port, args) tuple, these usually appeear on bridges in which case all of + port, args) tuple, these usually appear on bridges in which case all of those are **None**
**Bi-directional connection usage:** @@ -399,7 +399,7 @@ class ExtraInfoDescriptor(stem.descriptor.Descriptor): :param dict entries: descriptor contents to be applied :param bool validate: checks the validity of descriptor content if True
- :raises: **ValueError** if an error occures in validation + :raises: **ValueError** if an error occurs in validation """
for keyword, values in entries.items(): diff --git a/stem/descriptor/networkstatus.py b/stem/descriptor/networkstatus.py index a3eed1f..893129b 100644 --- a/stem/descriptor/networkstatus.py +++ b/stem/descriptor/networkstatus.py @@ -168,7 +168,7 @@ BANDWIDTH_WEIGHT_ENTRIES = ( def parse_file(document_file, validate = True, is_microdescriptor = False, document_version = 3): """ Parses a network status and iterates over the RouterStatusEntry in it. The - document that these instances reference have an empty 'rotuers' attribute to + document that these instances reference have an empty 'routers' attribute to allow for limited memory usage.
:param file document_file: file with network status document content @@ -366,7 +366,7 @@ class NetworkStatusDocumentV2(NetworkStatusDocument): self.published = datetime.datetime.strptime(value, "%Y-%m-%d %H:%M:%S") except ValueError: if validate: - raise ValueError("Versino 2 network status document's 'published' time wasn't parseable: %s" % value) + raise ValueError("Version 2 network status document's 'published' time wasn't parseable: %s" % value) elif keyword == "dir-options": self.options = value.split() elif keyword == "directory-signature": @@ -727,7 +727,7 @@ class _DocumentFooter(object):
content = document_file.read() if validate and content and not header.meets_consensus_method(9): - raise ValueError("Network status document's footer should only apepar in consensus-method 9 or later") + raise ValueError("Network status document's footer should only appear in consensus-method 9 or later") elif not content and not header.meets_consensus_method(9): return # footer is optional and there's nothing to parse
@@ -798,7 +798,7 @@ def _check_for_missing_and_disallowed_fields(header, entries, fields): :param list fields: expected field attributes (either **HEADER_STATUS_DOCUMENT_FIELDS** or **FOOTER_STATUS_DOCUMENT_FIELDS**)
- :raises: **ValueError** if we're missing mandatory fields or have fiels we shouldn't + :raises: **ValueError** if we're missing mandatory fields or have fields we shouldn't """
missing_fields, disallowed_fields = [], [] diff --git a/stem/descriptor/reader.py b/stem/descriptor/reader.py index de525d1..c03b996 100644 --- a/stem/descriptor/reader.py +++ b/stem/descriptor/reader.py @@ -134,7 +134,7 @@ class UnrecognizedType(FileSkipped):
class ReadFailed(FileSkipped): """ - An IOError occured while trying to read the file. + An IOError occurred while trying to read the file.
:param IOError exception: issue that arose when reading the file, **None** if this arose due to the file not being present diff --git a/stem/descriptor/router_status_entry.py b/stem/descriptor/router_status_entry.py index dfa26fe..321b7c0 100644 --- a/stem/descriptor/router_status_entry.py +++ b/stem/descriptor/router_status_entry.py @@ -249,14 +249,14 @@ class RouterStatusEntryV3(RouterStatusEntry): :var str digest: ***** router's digest
:var int bandwidth: bandwidth claimed by the relay (in kb/s) - :var int measured: bandwith measured to be available by the relay + :var int measured: bandwidth measured to be available by the relay :var list unrecognized_bandwidth_entries: ***** bandwidth weighting information that isn't yet recognized
:var stem.exit_policy.MicrodescriptorExitPolicy exit_policy: router's exit policy
:var list microdescriptor_hashes: tuples of two values, the list of consensus - methods for generting a set of digests and the 'algorithm => digest' mappings + methods for generating a set of digests and the 'algorithm => digest' mappings
***** attribute is either required when we're parsed with validation or has a default value, others are left as **None** if undefined @@ -317,7 +317,7 @@ class RouterStatusEntryMicroV3(RouterStatusEntry): flavored network status document.
:var int bandwidth: bandwidth claimed by the relay (in kb/s) - :var int measured: bandwith measured to be available by the relay + :var int measured: bandwidth measured to be available by the relay :var list unrecognized_bandwidth_entries: ***** bandwidth weighting information that isn't yet recognized
@@ -566,8 +566,8 @@ def _decode_fingerprint(identity, validate): raise ValueError("Unable to decode identity string '%s'" % identity)
for char in identity_decoded: - # Individual characters are either standard ascii or hex encoded, and each - # represent two hex digits. For instnace... + # Individual characters are either standard ASCII or hex encoded, and each + # represent two hex digits. For instance... # # >>> ord('\n') # 10 diff --git a/stem/descriptor/server_descriptor.py b/stem/descriptor/server_descriptor.py index 80df7bc..f8cdb00 100644 --- a/stem/descriptor/server_descriptor.py +++ b/stem/descriptor/server_descriptor.py @@ -313,7 +313,7 @@ class ServerDescriptor(stem.descriptor.Descriptor): :param dict entries: descriptor contents to be applied :param bool validate: checks the validity of descriptor content if **True**
- :raises: **ValueError** if an error occures in validation + :raises: **ValueError** if an error occurs in validation """
for keyword, values in entries.items(): @@ -381,7 +381,7 @@ class ServerDescriptor(stem.descriptor.Descriptor): # platform Tor 0.2.2.35 (git-73ff13ab3cc9570d) on Linux x86_64 # # There's no guarantee that we'll be able to pick these out the - # version, but might as well try to save our caller the effot. + # version, but might as well try to save our caller the effort.
platform_match = re.match("^Tor (\S*).* on (.*)$", self.platform)
@@ -411,7 +411,7 @@ class ServerDescriptor(stem.descriptor.Descriptor): raise ValueError("Fingerprint line should have groupings of four hex digits: %s" % value)
if not stem.util.tor_tools.is_valid_fingerprint(fingerprint): - raise ValueError("Tor relay fingerprints consist of fourty hex digits: %s" % value) + raise ValueError("Tor relay fingerprints consist of forty hex digits: %s" % value)
self.fingerprint = fingerprint elif keyword == "hibernating": @@ -439,7 +439,7 @@ class ServerDescriptor(stem.descriptor.Descriptor): else: self.hidden_service_dir = ["2"] elif keyword == "uptime": - # We need to be tolerant of negative uptimes to accomidate a past tor + # We need to be tolerant of negative uptimes to accommodate a past tor # bug... # # Changes in version 0.1.2.7-alpha - 2007-02-06 @@ -448,7 +448,7 @@ class ServerDescriptor(stem.descriptor.Descriptor): # buckets go absurdly negative. # # After parsing all of the attributes we'll double check that negative - # uptimes only occured prior to this fix. + # uptimes only occurred prior to this fix.
try: self.uptime = int(value) diff --git a/stem/exit_policy.py b/stem/exit_policy.py index dc50c6e..f228786 100644 --- a/stem/exit_policy.py +++ b/stem/exit_policy.py @@ -1,6 +1,6 @@ """ Representation of tor exit policies. These can be easily used to check if -exiting to a destination is permissable or not. For instance... +exiting to a destination is permissible or not. For instance...
::
@@ -63,7 +63,7 @@ AddressType = stem.util.enum.Enum(("WILDCARD", "Wildcard"), ("IPv4", "IPv4"), (" # That said, I'm not sure if this is entirely desirable since for most use # cases we *want* the caller to have an immutable ExitPolicy (since it # reflects something they... well, can't modify). However, I can think of -# some use cases where we might want to construct custom policies. Mabye make +# some use cases where we might want to construct custom policies. Maybe make # it a CustomExitPolicyRule subclass?
class ExitPolicy(object): @@ -148,7 +148,7 @@ class ExitPolicy(object): """ Provides a short description of our policy chain, similar to a microdescriptor. This excludes entries that don't cover all IP - addresses, and is either whitelist or blacklist policy based on + addresses, and is either white-list or blacklist policy based on the final entry. For instance...
:: @@ -165,7 +165,7 @@ class ExitPolicy(object): """
if self._summary_representation is None: - # determines if we're a whitelist or blacklist + # determines if we're a white-list or blacklist is_whitelist = not self._is_allowed_default
for rule in self._rules: @@ -173,8 +173,8 @@ class ExitPolicy(object): is_whitelist = not rule.is_accept break
- # Iterates over the policys and adds the the ports we'll return (ie, - # allows if a whitelist and rejects if a blacklist). Regardless of a + # Iterates over the policies and adds the the ports we'll return (ie, + # allows if a white-list and rejects if a blacklist). Regardless of a # port's allow/reject policy, all further entries with that port are # ignored since policies respect the first matching policy.
@@ -187,7 +187,7 @@ class ExitPolicy(object): for port in xrange(rule.min_port, rule.max_port + 1): if port in skip_ports: continue
- # if accept + whitelist or reject + blacklist then add + # if accept + white-list or reject + blacklist then add if rule.is_accept == is_whitelist: display_ports.append(port)
@@ -244,7 +244,7 @@ class MicrodescriptorExitPolicy(ExitPolicy): ::
accept 80,443 # only accepts common http ports - reject 1-1024 # only accepts non-privilaged ports + reject 1-1024 # only accepts non-privileged ports
Since these policies are a subset of the exit policy information (lacking IP ranges) clients can only use them to guess if a relay will accept traffic or @@ -334,7 +334,7 @@ class ExitPolicyRule(object): https://gitweb.torproject.org/torspec.git/blob/HEAD:/dir-spec.txt`_ as an "exitpattern". Note that while these are similar to tor's man page entry for ExitPolicies, it's not the exact same. An exitpattern is better defined and - scricter in what it'll accept. For instance, ports are not optional and it + stricter in what it'll accept. For instance, ports are not optional and it does not contain the 'private' alias.
This should be treated as an immutable object. @@ -435,7 +435,7 @@ class ExitPolicyRule(object): :raises: **ValueError** if provided with a malformed address or port """
- # validate our input and check if the argumement doens't match our address type + # validate our input and check if the argument doesn't match our address type if address != None: if stem.util.connection.is_valid_ip_address(address): if self.address_type == AddressType.IPv6: return False @@ -490,7 +490,7 @@ class ExitPolicyRule(object): label += "[%s]" % self.address
# Including our mask label as follows... - # - exclde our mask if it doesn't do anything + # - exclude our mask if it doesn't do anything # - use our masked bit count if we can # - use the mask itself otherwise
@@ -607,7 +607,7 @@ class ExitPolicyRule(object): # Our string representation encompasses our effective policy. Technically # this isn't quite right since our rule attribute may differ (ie, "accept # 0.0.0.0/0" == "accept 0.0.0.0/0.0.0.0" will be True), but these - # policies are effectively equivilant. + # policies are effectively equivalent.
return str(self) == str(other) else: diff --git a/stem/prereq.py b/stem/prereq.py index e443078..3e899dd 100644 --- a/stem/prereq.py +++ b/stem/prereq.py @@ -8,7 +8,7 @@ series). Other requirements for complete functionality are...
* rsa module
- * validating descriptor signagure integrity + * validating descriptor signature integrity
::
@@ -70,7 +70,7 @@ def is_rsa_available(): IS_RSA_AVAILABLE = False
msg = "Unable to import the rsa module. Because of this we'll be unable to verify descriptor signature integrity." - log.log_once("stem.prereq.is_rsa_availabe", log.INFO, msg) + log.log_once("stem.prereq.is_rsa_available", log.INFO, msg)
return IS_RSA_AVAILABLE
diff --git a/stem/response/__init__.py b/stem/response/__init__.py index 5c9b889..bd73f85 100644 --- a/stem/response/__init__.py +++ b/stem/response/__init__.py @@ -471,7 +471,7 @@ class SingleLineResponse(ControlMessage): content = self.content()
if len(content) > 1: - raise stem.socket.ProtocolError("Received multiline response") + raise stem.socket.ProtocolError("Received multi-line response") elif len(content) == 0: raise stem.socket.ProtocolError("Received empty response") else: diff --git a/stem/response/getinfo.py b/stem/response/getinfo.py index 24aeb84..ddedc34 100644 --- a/stem/response/getinfo.py +++ b/stem/response/getinfo.py @@ -47,7 +47,7 @@ class GetInfoResponse(stem.response.ControlMessage):
if "\n" in value: if not value.startswith("\n"): - raise stem.socket.ProtocolError("GETINFO response contained a multiline value that didn't start with a newline:\n%s" % self) + raise stem.socket.ProtocolError("GETINFO response contained a multi-line value that didn't start with a newline:\n%s" % self)
value = value[1:]
diff --git a/stem/socket.py b/stem/socket.py index 58dc5e2..2b13466 100644 --- a/stem/socket.py +++ b/stem/socket.py @@ -174,7 +174,7 @@ class ControlSocket(object): self._socket_file = self._socket.makefile() self._is_alive = True
- # It's possable for this to have a transient failure... + # It's possible for this to have a transient failure... # SocketError: [Errno 4] Interrupted system call # # It's safe to retry, so give it another try if it fails. @@ -359,7 +359,7 @@ class ControlSocketFile(ControlSocket): def send_message(control_file, message, raw = False): """ Sends a message to the control socket, adding the expected formatting for - single verses multiline messages. Neither message type should contain an + single verses multi-line messages. Neither message type should contain an ending newline (if so it'll be treated as a multi-line message with a blank line at the end). If the message doesn't contain a newline then it's sent as... diff --git a/stem/util/conf.py b/stem/util/conf.py index 7bf157a..9c15973 100644 --- a/stem/util/conf.py +++ b/stem/util/conf.py @@ -124,7 +124,7 @@ Alternatively you can get a read-only dictionary that stays in sync with the |- save - writes the current configuration to a file |- clear - empties our loaded configuration contents |- synchronize - replaces mappings in a dictionary with the config's values - |- add_listener - notifies the given listener when an update occures + |- add_listener - notifies the given listener when an update occurs |- clear_listeners - removes any attached listeners |- keys - provides keys in the loaded configuration |- set - sets the given key/value pair @@ -355,7 +355,7 @@ class Config(object): elif not self._path: raise ValueError("Unable to save configuration: no path provided")
- # TODO: when we drop python 2.5 compatability we can simplify this + # TODO: when we drop python 2.5 compatibility we can simplify this with self._contents_lock: with open(self._path, 'w') as output_file: for entry_key in sorted(self.keys()): diff --git a/stem/util/connection.py b/stem/util/connection.py index 104ad5c..a5afc2b 100644 --- a/stem/util/connection.py +++ b/stem/util/connection.py @@ -91,7 +91,7 @@ def is_valid_port(entry, allow_zero = False): Checks if a string or int is a valid port number.
:param list,str,int entry: string, integer or list to be checked - :param bool allow_zero: accept port number of zero (reserved by defintion) + :param bool allow_zero: accept port number of zero (reserved by definition)
:returns: **True** if input is an integer and within the valid port range, **False** otherwise """ @@ -190,7 +190,7 @@ def get_masked_bits(mask): if not is_valid_ip_address(mask): raise ValueError("'%s' is an invalid subnet mask" % mask)
- # converts octets to binary representatino + # converts octets to binary representation mask_bin = get_address_binary(mask) mask_match = re.match("^(1*)(0*)$", mask_bin)
@@ -239,7 +239,7 @@ def get_address_binary(address): """ Provides the binary value for an IPv4 or IPv6 address.
- :returns: **str** with the binary prepresentation of this address + :returns: **str** with the binary representation of this address
:raises: **ValueError** if address is neither an IPv4 nor IPv6 address """ diff --git a/stem/util/log.py b/stem/util/log.py index b9dd988..fbb8fdc 100644 --- a/stem/util/log.py +++ b/stem/util/log.py @@ -2,8 +2,8 @@ Functions to aid library logging. Default logging is usually NOTICE and above, runlevels being used as follows...
-* **ERROR** - critical issue occured, the user needs to be notified -* **WARN** - non-critical issue occured that the user should be aware of +* **ERROR** - critical issue occurred, the user needs to be notified +* **WARN** - non-critical issue occurred that the user should be aware of * **NOTICE** - information that is helpful to the user * **INFO** - high level library activity * **DEBUG** - low level library activity @@ -96,7 +96,7 @@ def logging_level(runlevel):
def escape(message): """ - Escapes specific sequences for logging (newlines, tabs, carrage returns). + Escapes specific sequences for logging (newlines, tabs, carriage returns).
:param str message: string to be escaped
diff --git a/stem/util/proc.py b/stem/util/proc.py index 5315167..084caf2 100644 --- a/stem/util/proc.py +++ b/stem/util/proc.py @@ -124,7 +124,7 @@ def get_cwd(pid):
:param int pid: process id of the process to be queried
- :returns: **str** with the path of the workign direcctory for the process + :returns: **str** with the path of the working directory for the process
:raises: **IOError** if it can't be determined """ diff --git a/stem/util/system.py b/stem/util/system.py index 6c2be06..85c8faf 100644 --- a/stem/util/system.py +++ b/stem/util/system.py @@ -10,7 +10,7 @@ best-effort, providing **None** if the lookup fails. is_windows - checks if we're running on windows is_mac - checks if we're running on a mac is_bsd - checks if we're running on the bsd family of operating systems - is_available - determines if a command is availabe on this system + is_available - determines if a command is available on this system is_running - determines if a given process is running get_pid_by_name - gets the pid for a process by the given name get_pid_by_port - gets the pid for a process listening to a given port @@ -511,7 +511,7 @@ def get_bsd_jail_id(pid):
def expand_path(path, cwd = None): """ - Provides an absolute path, expanding tildas with the user's home and + Provides an absolute path, expanding tildes with the user's home and appending a current working directory if the path was relative. This is unix-specific and paths never have an ending slash.
diff --git a/stem/version.py b/stem/version.py index 42ef062..8a792b3 100644 --- a/stem/version.py +++ b/stem/version.py @@ -135,7 +135,7 @@ class Version(object): be compared to either a :class:`~stem.version.Version` or :class:`~stem.version.VersionRequirements`.
- :param requirements: requrirements to be checked for + :param requirements: requirements to be checked for """
if isinstance(requirements, Version): @@ -196,7 +196,7 @@ class VersionRequirements(object): """ Adds a constraint that we're greater than the given version.
- :param stem.version.Version verison: version we're checking against + :param stem.version.Version version: version we're checking against :param bool inclusive: if comparison is inclusive or not """
@@ -209,7 +209,7 @@ class VersionRequirements(object): """ Adds a constraint that we're less than the given version.
- :param stem.version.Version verison: version we're checking against + :param stem.version.Version version: version we're checking against :param bool inclusive: if comparison is inclusive or not """
@@ -222,8 +222,8 @@ class VersionRequirements(object): """ Adds constraint that we're within the range from one version to another.
- :param stem.version.Version from_verison: beginning of the comparison range - :param stem.version.Version to_verison: end of the comparison range + :param stem.version.Version from_version: beginning of the comparison range + :param stem.version.Version to_version: end of the comparison range :param bool from_inclusive: if comparison is inclusive with the starting version :param bool to_inclusive: if comparison is inclusive with the ending version """ diff --git a/test/check_whitespace.py b/test/check_whitespace.py index d30f99a..314230f 100644 --- a/test/check_whitespace.py +++ b/test/check_whitespace.py @@ -8,7 +8,7 @@ which are... * no trailing whitespace unless the line is empty, in which case it should have the same indentation as the surrounding code
-This also checks for 2.5 compatability issues (yea, they're not whitespace but +This also checks for 2.5 compatibility issues (yea, they're not whitespace but it's so much easier to do here...):
* checks that anything using the 'with' keyword has... diff --git a/test/mocking.py b/test/mocking.py index 4cfe91a..66d3017 100644 --- a/test/mocking.py +++ b/test/mocking.py @@ -10,8 +10,8 @@ calling :func:`test.mocking.revert_mocking`. revert_mocking - reverts any changes made by the mock function get_real_function - provides the non-mocked version of a function get_all_combinations - provides all combinations of attributes - support_with - makes object be compatable for use via the 'with' keyword - get_object - get an abitrary mock object of any class + support_with - makes object be compatible for use via the 'with' keyword + get_object - get an arbitrary mock object of any class
Mocking Functions no_op - does nothing @@ -252,8 +252,8 @@ def mock(target, mock_call, target_module=None):
The target_module only needs to be set if the results of 'inspect.getmodule(target)' doesn't match the module that we want to mock - (for instance, the 'os' module provies the platform module that it wraps like - 'postix', which won't work). + (for instance, the 'os' module provides the platform module that it wraps + like 'postix', which won't work).
:param function target: function to be mocked :param functor mock_call: mocking to replace the function with @@ -282,7 +282,7 @@ def mock(target, mock_call, target_module=None):
def mock_method(target_class, method_name, mock_call): """ - Mocks the given class method in a similar fasion as what mock() does for + Mocks the given class method in a similar fashion as what mock() does for functions.
:param class target_class: class with the method we want to mock @@ -426,10 +426,10 @@ def get_message(content, reformat = True): the following changes unless 'reformat' is false...
* ensures the content ends with a newline - * newlines are replaced with a carrage return and newline pair + * newlines are replaced with a carriage return and newline pair
:param str content: base content for the controller message - :param str reformat: modifies content to be more accomidateing to being parsed + :param str reformat: modifies content to be more accommodating to being parsed
:returns: stem.socket.ControlMessage instance """ diff --git a/test/output.py b/test/output.py index 084a79a..001c6a5 100644 --- a/test/output.py +++ b/test/output.py @@ -71,7 +71,7 @@ def print_config(test_config):
def apply_filters(testing_output, *filters): """ - Gets the tests results, possably processed through a series of filters. The + Gets the tests results, possibly processed through a series of filters. The filters are applied in order, each getting the output of the previous.
A filter's input arguments should be the line's (type, content) and the @@ -115,7 +115,7 @@ def colorize(line_type, line_content): def strip_module(line_type, line_content): """ Removes the module name from testing output. This information tends to be - repetative, and redundant with the headers. + repetitive, and redundant with the headers. """
m = re.match(".*( (.*?)).*", line_content) diff --git a/test/prompt.py b/test/prompt.py index fad9d4e..91ad6d3 100644 --- a/test/prompt.py +++ b/test/prompt.py @@ -68,7 +68,7 @@ def is_running(): """ Checks if we're likely running a tor instance spawned by this module. This is simply a check if our custom control port is in use, so it can be confused by - other applications (not likely, but possable). + other applications (not likely, but possible).
:returns: True if the control port is used, False otherwise """ diff --git a/test/runner.py b/test/runner.py index a372c42..acf346e 100644 --- a/test/runner.py +++ b/test/runner.py @@ -100,7 +100,7 @@ class RunnerStopped(Exception): "Raised when we try to use a Runner that doesn't have an active tor instance"
class TorInaccessable(Exception): - "Raised when information is needed from tor but the instance we have is inaccessable" + "Raised when information is needed from tor but the instance we have is inaccessible"
def skip(test_case, message): """ @@ -209,7 +209,7 @@ def get_runner(): class _MockChrootFile(object): """ Wrapper around a file object that strips given content from readline() - responses. This is used to simulate a chroot setup by removing the restign + responses. This is used to simulate a chroot setup by removing the prefix directory from the paths we report. """
@@ -335,7 +335,7 @@ class Runner(object): if self._test_dir and CONFIG["integ.test_directory"] == "": shutil.rmtree(self._test_dir, ignore_errors = True)
- # reverts any mockin of stem.socket.recv_message + # reverts any mocking of stem.socket.recv_message if self._original_recv_message: stem.socket.recv_message = self._original_recv_message self._original_recv_message = None @@ -382,7 +382,7 @@ class Runner(object): a lot of adverse side effects (`ticket https://trac.torproject.org/projects/tor/ticket/3313`_).
- :returns: True if debugger attachment is allowd, False otherwise + :returns: True if debugger attachment is allowed, False otherwise """
# If we're running a tor version where ptrace is disabled and we didn't @@ -407,7 +407,7 @@ class Runner(object):
:param str resource: file within our test directory to provide the path for
- :returns: str with our test direcectory's absolute path or that of a file within it + :returns: str with our test directory's absolute path or that of a file within it
:raises: :class:`test.runner.RunnerStopped` if we aren't running """ @@ -596,7 +596,7 @@ class Runner(object):
# Makes a directory for the control socket if needed. As of, at least, Tor # 0.2.3.10 it checks during startup that the directory a control socket - # resides in is only accessable by the tor user (and refuses to finish + # resides in is only accessible by the tor user (and refuses to finish # starting if it isn't).
if Torrc.SOCKET in self._custom_opts: