From 92ba728e00a5d5650026f0e3d53fd010ee0a5872 Mon Sep 17 00:00:00 2001 From: Erik Rose Date: Tue, 3 Feb 2015 00:19:39 -0500 Subject: Change textual occurrences of "blessed" to "blessings". Also divide a few import stanzas into sections conformant with PEP 8. --- bin/editor.py | 4 ++- bin/keymatrix.py | 3 +- bin/on_resize.py | 6 ++-- bin/progress_bar.py | 7 ++-- bin/tprint.py | 4 ++- bin/worms.py | 7 ++-- blessed/__init__.py | 4 +-- blessed/_binterms.py | 4 +-- blessed/formatters.py | 2 +- blessed/keyboard.py | 2 +- blessed/sequences.py | 12 +++---- blessed/tests/accessories.py | 4 +-- blessed/tests/test_core.py | 58 +++++++++++++++--------------- blessed/tests/test_formatters.py | 66 ++++++++++++++++++++--------------- blessed/tests/test_keyboard.py | 20 +++++------ blessed/tests/test_length_sequence.py | 6 ++-- blessed/tests/test_sequences.py | 20 +++++------ docs/Makefile | 8 ++--- docs/conf.py | 14 ++++---- docs/index.rst | 20 +++++------ docs/make.bat | 4 +-- setup.py | 8 ++--- tox.ini | 2 +- 23 files changed, 151 insertions(+), 134 deletions(-) diff --git a/bin/editor.py b/bin/editor.py index 4dff2b7..dc8cde2 100755 --- a/bin/editor.py +++ b/bin/editor.py @@ -9,7 +9,9 @@ from __future__ import division, print_function import collections import functools -from blessed import Terminal + +from blessings import Terminal + echo = lambda text: ( functools.partial(print, end='', flush=True)(text)) diff --git a/bin/keymatrix.py b/bin/keymatrix.py index daaad99..f4e99f6 100755 --- a/bin/keymatrix.py +++ b/bin/keymatrix.py @@ -1,8 +1,9 @@ #!/usr/bin/env python from __future__ import division -from blessed import Terminal import sys +from blessings import Terminal + def main(): """ diff --git a/bin/on_resize.py b/bin/on_resize.py index 2481d05..4140748 100755 --- a/bin/on_resize.py +++ b/bin/on_resize.py @@ -1,6 +1,6 @@ #!/usr/bin/env python """ -This is an example application for the 'blessed' Terminal library for python. +This is an example application for the 'blessings' Terminal library for python. Window size changes are caught by the 'on_resize' function using a traditional signal handler. Meanwhile, blocking keyboard input is displayed to stdout. @@ -8,7 +8,9 @@ If a resize event is discovered, an empty string is returned by term.keystroke() when interruptable is False, as it is here. """ import signal -from blessed import Terminal + +from blessings import Terminal + term = Terminal() diff --git a/bin/progress_bar.py b/bin/progress_bar.py index 4fd4ca0..5257e95 100755 --- a/bin/progress_bar.py +++ b/bin/progress_bar.py @@ -1,17 +1,18 @@ #!/usr/bin/env python """ -This is an example application for the 'blessed' Terminal library for python. +This is an example application for the 'blessings' Terminal library for python. This isn't a real progress bar, just a sample "animated prompt" of sorts that demonstrates the separate move_x() and move_y() functions, made mainly to test the `hpa' compatibility for 'screen' terminal type which -fails to provide one, but blessed recognizes that it actually does, and +fails to provide one, but blessings recognizes that it actually does, and provides a proxy. """ from __future__ import print_function -from blessed import Terminal import sys +from blessings import Terminal + def main(): term = Terminal() diff --git a/bin/tprint.py b/bin/tprint.py index e85f580..c00c486 100755 --- a/bin/tprint.py +++ b/bin/tprint.py @@ -1,7 +1,9 @@ #!/usr/bin/env python import argparse -from blessed import Terminal + +from blessings import Terminal + parser = argparse.ArgumentParser( description='displays argument as specified style') diff --git a/bin/worms.py b/bin/worms.py index 4941679..be46d3d 100755 --- a/bin/worms.py +++ b/bin/worms.py @@ -1,15 +1,16 @@ #!/usr/bin/env python """ -This is an example application for the 'blessed' Terminal library for python. +This is an example application for the 'blessings' Terminal library for python. It is also an experiment in functional programming. """ from __future__ import division, print_function from collections import namedtuple -from random import randrange from functools import partial -from blessed import Terminal +from random import randrange + +from blessings import Terminal # python 2/3 compatibility, provide 'echo' function as an diff --git a/blessed/__init__.py b/blessed/__init__.py index 481468f..3622d0e 100644 --- a/blessed/__init__.py +++ b/blessed/__init__.py @@ -1,13 +1,13 @@ """ A thin, practical wrapper around terminal capabilities in Python -http://pypi.python.org/pypi/blessed +http://pypi.python.org/pypi/blessings """ import platform as _platform if ('3', '0', '0') <= _platform.python_version_tuple() < ('3', '2', '2+'): # Good till 3.2.10 # Python 3.x < 3.2.3 has a bug in which tparm() erroneously takes a string. - raise ImportError('Blessed needs Python 3.2.3 or greater for Python 3 ' + raise ImportError('Blessings needs Python 3.2.3 or greater for Python 3 ' 'support due to http://bugs.python.org/issue10570.') diff --git a/blessed/_binterms.py b/blessed/_binterms.py index 84f58fe..6c93ee0 100644 --- a/blessed/_binterms.py +++ b/blessed/_binterms.py @@ -1,6 +1,6 @@ -""" Exports a list of binary terminals blessed is not able to cope with. """ +""" Exports a list of binary terminals blessings is not able to cope with. """ #: This list of terminals is manually managed, it describes all of the terminals -#: that blessed cannot measure the sequence length for; they contain +#: that blessings cannot measure the sequence length for; they contain #: binary-packed capabilities instead of numerics, so it is not possible to #: build regular expressions in the way that sequences.py does. #: diff --git a/blessed/formatters.py b/blessed/formatters.py index e77adcd..54f090c 100644 --- a/blessed/formatters.py +++ b/blessed/formatters.py @@ -86,7 +86,7 @@ class ParameterizingProxyString(text_type): For example:: - >>> from blessed import Terminal + >>> from blessings import Terminal >>> term = Terminal('screen') >>> hpa = ParameterizingString(term.hpa, term.normal, 'hpa') >>> hpa(9) diff --git a/blessed/keyboard.py b/blessed/keyboard.py index d701a16..280606d 100644 --- a/blessed/keyboard.py +++ b/blessed/keyboard.py @@ -139,7 +139,7 @@ def get_keyboard_sequences(term): """get_keyboard_sequences(T) -> (OrderedDict) Initialize and return a keyboard map and sequence lookup table, - (sequence, constant) from blessed Terminal instance ``term``, + (sequence, constant) from blessings Terminal instance ``term``, where ``sequence`` is a multibyte input sequence, such as u'\x1b[D', and ``constant`` is a constant, such as term.KEY_LEFT. The return value is an OrderedDict instance, with their keys sorted longest-first. diff --git a/blessed/sequences.py b/blessed/sequences.py index 9353da8..80649c3 100644 --- a/blessed/sequences.py +++ b/blessed/sequences.py @@ -1,5 +1,5 @@ # encoding: utf-8 -" This sub-module provides 'sequence awareness' for blessed." +" This sub-module provides 'sequence awareness' for blessings." __author__ = 'Jeff Quast ' __license__ = 'MIT' @@ -21,7 +21,7 @@ from ._binterms import binary_terminals as _BINTERM_UNSUPPORTED import wcwidth # https://github.com/jquast/wcwidth _BINTERM_UNSUPPORTED_MSG = ( - u"Terminal kind {0!r} contains binary-packed capabilities, blessed " + u"Terminal kind {0!r} contains binary-packed capabilities, blessings " u"is likely to fail to measure the length of its sequences.") if sys.version_info[0] == 3: @@ -491,8 +491,8 @@ class Sequence(text_type): as half or full-width characters. For example: - >>> from blessed import Terminal - >>> from blessed.sequences import Sequence + >>> from blessings import Terminal + >>> from blessings.sequences import Sequence >>> term = Terminal() >>> Sequence(term.clear + term.red(u'コンニチハ')).length() 5 @@ -543,8 +543,8 @@ class Sequence(text_type): those last-most characters are destroyed. All other sequences are simply removed. An example, - >>> from blessed import Terminal - >>> from blessed.sequences import Sequence + >>> from blessings import Terminal + >>> from blessings.sequences import Sequence >>> term = Terminal() >>> Sequence(term.clear + term.red(u'test')).strip_seqs() u'test' diff --git a/blessed/tests/accessories.py b/blessed/tests/accessories.py index f7e2a42..8cb3f5b 100644 --- a/blessed/tests/accessories.py +++ b/blessed/tests/accessories.py @@ -15,7 +15,7 @@ import pty import os # local -from blessed import Terminal +from blessings import Terminal # 3rd import pytest @@ -31,7 +31,7 @@ RECV_SEMAPHORE = b'SEMAPHORE\r\n' all_xterms_params = ['xterm', 'xterm-256color'] many_lines_params = [30, 100] many_columns_params = [1, 10] -from blessed._binterms import binary_terminals +from blessings._binterms import binary_terminals default_all_terms = ['screen', 'vt220', 'rxvt', 'cons25', 'linux', 'ansi'] if os.environ.get('TEST_ALLTERMS'): try: diff --git a/blessed/tests/test_core.py b/blessed/tests/test_core.py index befcea3..ce1e838 100644 --- a/blessed/tests/test_core.py +++ b/blessed/tests/test_core.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -"Core blessed Terminal() tests." +"Core blessings Terminal() tests." # std try: @@ -29,8 +29,8 @@ import pytest def test_export_only_Terminal(): "Ensure only Terminal instance is exported for import * statements." - import blessed - assert blessed.__all__ == ('Terminal',) + import blessings + assert blessings.__all__ == ('Terminal',) def test_null_location(all_terms): @@ -246,23 +246,23 @@ def test_setupterm_invalid_has_no_styling(): reason='PyPy freezes') def test_missing_ordereddict_uses_module(monkeypatch): "ordereddict module is imported when without collections.OrderedDict." - import blessed.keyboard + import blessings.keyboard if hasattr(collections, 'OrderedDict'): monkeypatch.delattr('collections.OrderedDict') try: - imp.reload(blessed.keyboard) + imp.reload(blessings.keyboard) except ImportError as err: assert err.args[0] in ("No module named ordereddict", # py2 "No module named 'ordereddict'") # py3 sys.modules['ordereddict'] = mock.Mock() sys.modules['ordereddict'].OrderedDict = -1 - imp.reload(blessed.keyboard) - assert blessed.keyboard.OrderedDict == -1 + imp.reload(blessings.keyboard) + assert blessings.keyboard.OrderedDict == -1 del sys.modules['ordereddict'] monkeypatch.undo() - imp.reload(blessed.keyboard) + imp.reload(blessings.keyboard) else: assert platform.python_version_tuple() < ('2', '7') # reached by py2.6 @@ -271,51 +271,51 @@ def test_missing_ordereddict_uses_module(monkeypatch): reason='PyPy freezes') def test_python3_2_raises_exception(monkeypatch): "Test python version 3.0 through 3.2 raises an exception." - import blessed + import blessings monkeypatch.setattr('platform.python_version_tuple', lambda: ('3', '2', '2')) try: - imp.reload(blessed) + imp.reload(blessings) except ImportError as err: assert err.args[0] == ( - 'Blessed needs Python 3.2.3 or greater for Python 3 ' + 'Blessings needs Python 3.2.3 or greater for Python 3 ' 'support due to http://bugs.python.org/issue10570.') monkeypatch.undo() - imp.reload(blessed) + imp.reload(blessings) else: assert False, 'Exception should have been raised' def test_IOUnsupportedOperation_dummy(monkeypatch): "Ensure dummy exception is used when io is without UnsupportedOperation." - import blessed.terminal + import blessings.terminal import io if hasattr(io, 'UnsupportedOperation'): monkeypatch.delattr('io.UnsupportedOperation') - imp.reload(blessed.terminal) - assert blessed.terminal.IOUnsupportedOperation.__doc__.startswith( + imp.reload(blessings.terminal) + assert blessings.terminal.IOUnsupportedOperation.__doc__.startswith( "A dummy exception to take the place of") monkeypatch.undo() - imp.reload(blessed.terminal) + imp.reload(blessings.terminal) def test_without_dunder(): "Ensure dunder does not remain in module (py2x InterruptedError test." - import blessed.terminal - assert '_' not in dir(blessed.terminal) + import blessings.terminal + assert '_' not in dir(blessings.terminal) def test_IOUnsupportedOperation(): "Ensure stream that throws IOUnsupportedOperation results in non-tty." @as_subprocess def child(): - import blessed.terminal + import blessings.terminal def side_effect(): - raise blessed.terminal.IOUnsupportedOperation + raise blessings.terminal.IOUnsupportedOperation mock_stream = mock.Mock() mock_stream.fileno = side_effect @@ -431,17 +431,17 @@ def test_win32_missing_tty_modules(monkeypatch): else: __builtins__['__import__'] = __import__ try: - import blessed.terminal - imp.reload(blessed.terminal) + import blessings.terminal + imp.reload(blessings.terminal) except UserWarning: err = sys.exc_info()[1] - assert err.args[0] == blessed.terminal.msg_nosupport + assert err.args[0] == blessings.terminal.msg_nosupport warnings.filterwarnings("ignore", category=UserWarning) - import blessed.terminal - imp.reload(blessed.terminal) - assert blessed.terminal.HAS_TTY is False - term = blessed.terminal.Terminal('ansi') + import blessings.terminal + imp.reload(blessings.terminal) + assert blessings.terminal.HAS_TTY is False + term = blessings.terminal.Terminal('ansi') assert term.height == 24 assert term.width == 80 @@ -451,7 +451,7 @@ def test_win32_missing_tty_modules(monkeypatch): else: __builtins__['__import__'] = original_import warnings.resetwarnings() - import blessed.terminal - imp.reload(blessed.terminal) + import blessings.terminal + imp.reload(blessings.terminal) child() diff --git a/blessed/tests/test_formatters.py b/blessed/tests/test_formatters.py index b2e5f0c..3184140 100644 --- a/blessed/tests/test_formatters.py +++ b/blessed/tests/test_formatters.py @@ -6,7 +6,7 @@ import mock def test_parameterizing_string_args_unspecified(monkeypatch): """Test default args of formatters.ParameterizingString.""" - from blessed.formatters import ParameterizingString, FormattingString + from blessings.formatters import ParameterizingString, FormattingString # first argument to tparm() is the sequence name, returned as-is; # subsequent arguments are usually Integers. tparm = lambda *args: u'~'.join( @@ -38,7 +38,7 @@ def test_parameterizing_string_args_unspecified(monkeypatch): def test_parameterizing_string_args(monkeypatch): """Test basic formatters.ParameterizingString.""" - from blessed.formatters import ParameterizingString, FormattingString + from blessings.formatters import ParameterizingString, FormattingString # first argument to tparm() is the sequence name, returned as-is; # subsequent arguments are usually Integers. @@ -71,7 +71,7 @@ def test_parameterizing_string_args(monkeypatch): def test_parameterizing_string_type_error(monkeypatch): """Test formatters.ParameterizingString raising TypeError""" - from blessed.formatters import ParameterizingString + from blessings.formatters import ParameterizingString def tparm_raises_TypeError(*args): raise TypeError('custom_err') @@ -107,7 +107,7 @@ def test_parameterizing_string_type_error(monkeypatch): def test_formattingstring(monkeypatch): """Test formatters.FormattingString""" - from blessed.formatters import (FormattingString) + from blessings.formatters import FormattingString # given, with arg pstr = FormattingString(u'attr', u'norm') @@ -124,7 +124,7 @@ def test_formattingstring(monkeypatch): def test_nullcallablestring(monkeypatch): """Test formatters.NullCallableString""" - from blessed.formatters import (NullCallableString) + from blessings.formatters import (NullCallableString) # given, with arg pstr = NullCallableString() @@ -141,7 +141,7 @@ def test_nullcallablestring(monkeypatch): def test_split_compound(): """Test formatters.split_compound.""" - from blessed.formatters import split_compound + from blessings.formatters import split_compound assert split_compound(u'') == [u''] assert split_compound(u'a_b_c') == [u'a', u'b', u'c'] @@ -152,7 +152,7 @@ def test_split_compound(): def test_resolve_capability(monkeypatch): """Test formatters.resolve_capability and term sugaring """ - from blessed.formatters import resolve_capability + from blessings.formatters import resolve_capability # given, always returns a b'seq' tigetstr = lambda attr: ('seq-%s' % (attr,)).encode('latin1') @@ -183,9 +183,9 @@ def test_resolve_capability(monkeypatch): def test_resolve_color(monkeypatch): """Test formatters.resolve_color.""" - from blessed.formatters import (resolve_color, - FormattingString, - NullCallableString) + from blessings.formatters import (resolve_color, + FormattingString, + NullCallableString) color_cap = lambda digit: 'seq-%s' % (digit,) monkeypatch.setattr(curses, 'COLOR_RED', 1984) @@ -227,28 +227,30 @@ def test_resolve_color(monkeypatch): def test_resolve_attribute_as_color(monkeypatch): """ Test simple resolve_attribte() given color name. """ - import blessed - from blessed.formatters import resolve_attribute + import blessings + from blessings.formatters import resolve_attribute resolve_color = lambda term, digit: 'seq-%s' % (digit,) COLORS = set(['COLORX', 'COLORY']) COMPOUNDABLES = set(['JOINT', 'COMPOUND']) - monkeypatch.setattr(blessed.formatters, 'resolve_color', resolve_color) - monkeypatch.setattr(blessed.formatters, 'COLORS', COLORS) - monkeypatch.setattr(blessed.formatters, 'COMPOUNDABLES', COMPOUNDABLES) + monkeypatch.setattr(blessings.formatters, 'resolve_color', resolve_color) + monkeypatch.setattr(blessings.formatters, 'COLORS', COLORS) + monkeypatch.setattr(blessings.formatters, 'COMPOUNDABLES', COMPOUNDABLES) term = mock.Mock() assert resolve_attribute(term, 'COLORX') == u'seq-COLORX' def test_resolve_attribute_as_compoundable(monkeypatch): """ Test simple resolve_attribte() given a compoundable. """ - import blessed - from blessed.formatters import resolve_attribute, FormattingString + import blessings + from blessings.formatters import resolve_attribute, FormattingString resolve_cap = lambda term, digit: 'seq-%s' % (digit,) COMPOUNDABLES = set(['JOINT', 'COMPOUND']) - monkeypatch.setattr(blessed.formatters, 'resolve_capability', resolve_cap) - monkeypatch.setattr(blessed.formatters, 'COMPOUNDABLES', COMPOUNDABLES) + monkeypatch.setattr(blessings.formatters, + 'resolve_capability', + resolve_cap) + monkeypatch.setattr(blessings.formatters, 'COMPOUNDABLES', COMPOUNDABLES) term = mock.Mock() term.normal = 'seq-normal' @@ -260,12 +262,16 @@ def test_resolve_attribute_as_compoundable(monkeypatch): def test_resolve_attribute_non_compoundables(monkeypatch): """ Test recursive compounding of resolve_attribute(). """ - import blessed - from blessed.formatters import resolve_attribute, ParameterizingString + import blessings + from blessings.formatters import resolve_attribute, ParameterizingString uncompoundables = lambda attr: ['split', 'compound'] resolve_cap = lambda term, digit: 'seq-%s' % (digit,) - monkeypatch.setattr(blessed.formatters, 'split_compound', uncompoundables) - monkeypatch.setattr(blessed.formatters, 'resolve_capability', resolve_cap) + monkeypatch.setattr(blessings.formatters, + 'split_compound', + uncompoundables) + monkeypatch.setattr(blessings.formatters, + 'resolve_capability', + resolve_cap) tparm = lambda *args: u'~'.join( arg.decode('latin1') if not num else '%s' % (arg,) for num, arg in enumerate(args)).encode('latin1') @@ -286,12 +292,14 @@ def test_resolve_attribute_non_compoundables(monkeypatch): def test_resolve_attribute_recursive_compoundables(monkeypatch): """ Test recursive compounding of resolve_attribute(). """ - import blessed - from blessed.formatters import resolve_attribute, FormattingString + import blessings + from blessings.formatters import resolve_attribute, FormattingString # patch, resolve_cap = lambda term, digit: 'seq-%s' % (digit,) - monkeypatch.setattr(blessed.formatters, 'resolve_capability', resolve_cap) + monkeypatch.setattr(blessings.formatters, + 'resolve_capability', + resolve_cap) tparm = lambda *args: u'~'.join( arg.decode('latin1') if not num else '%s' % (arg,) for num, arg in enumerate(args)).encode('latin1') @@ -316,7 +324,7 @@ def test_resolve_attribute_recursive_compoundables(monkeypatch): def test_pickled_parameterizing_string(monkeypatch): """Test pickle-ability of a formatters.ParameterizingString.""" - from blessed.formatters import ParameterizingString, FormattingString + from blessings.formatters import ParameterizingString, FormattingString # simply send()/recv() over multiprocessing Pipe, a simple # pickle.loads(dumps(...)) did not reproduce this issue, @@ -356,7 +364,7 @@ def test_tparm_returns_null(monkeypatch): """ Test 'tparm() returned NULL' is caught (win32 PDCurses systems). """ # on win32, any calls to tparm raises curses.error with message, # "tparm() returned NULL", function PyCurses_tparm of _cursesmodule.c - from blessed.formatters import ParameterizingString, NullCallableString + from blessings.formatters import ParameterizingString, NullCallableString def tparm(*args): raise curses.error("tparm() returned NULL") @@ -376,7 +384,7 @@ def test_tparm_other_exception(monkeypatch): """ Test 'tparm() returned NULL' is caught (win32 PDCurses systems). """ # on win32, any calls to tparm raises curses.error with message, # "tparm() returned NULL", function PyCurses_tparm of _cursesmodule.c - from blessed.formatters import ParameterizingString, NullCallableString + from blessings.formatters import ParameterizingString, NullCallableString def tparm(*args): raise curses.error("unexpected error in tparm()") diff --git a/blessed/tests/test_keyboard.py b/blessed/tests/test_keyboard.py index 4ea806e..393b248 100644 --- a/blessed/tests/test_keyboard.py +++ b/blessed/tests/test_keyboard.py @@ -633,7 +633,7 @@ def test_esc_delay_keystroke_input_timout_0(): def test_keystroke_default_args(): "Test keyboard.Keystroke constructor with default arguments." - from blessed.keyboard import Keystroke + from blessings.keyboard import Keystroke ks = Keystroke() assert ks._name is None assert ks.name == ks._name @@ -647,7 +647,7 @@ def test_keystroke_default_args(): def test_a_keystroke(): "Test keyboard.Keystroke constructor with set arguments." - from blessed.keyboard import Keystroke + from blessings.keyboard import Keystroke ks = Keystroke(ucs=u'x', code=1, name=u'the X') assert ks._name is u'the X' assert ks.name == ks._name @@ -660,7 +660,7 @@ def test_a_keystroke(): def test_get_keyboard_codes(): "Test all values returned by get_keyboard_codes are from curses." - from blessed.keyboard import ( + from blessings.keyboard import ( get_keyboard_codes, CURSES_KEYCODE_OVERRIDE_MIXIN, ) @@ -675,7 +675,7 @@ def test_get_keyboard_codes(): def test_alternative_left_right(): "Test _alternative_left_right behavior for space/backspace." - from blessed.keyboard import _alternative_left_right + from blessings.keyboard import _alternative_left_right term = mock.Mock() term._cuf1 = u'' term._cub1 = u'' @@ -692,7 +692,7 @@ def test_alternative_left_right(): def test_cuf1_and_cub1_as_RIGHT_LEFT(all_terms): "Test that cuf1 and cub1 are assigned KEY_RIGHT and KEY_LEFT." - from blessed.keyboard import get_keyboard_sequences + from blessings.keyboard import get_keyboard_sequences @as_subprocess def child(kind): @@ -728,7 +728,7 @@ def test_get_keyboard_sequences_sort_order(xterms): def test_get_keyboard_sequence(monkeypatch): "Test keyboard.get_keyboard_sequence. " import curses.has_key - import blessed.keyboard + import blessings.keyboard (KEY_SMALL, KEY_LARGE, KEY_MIXIN) = range(3) (CAP_SMALL, CAP_LARGE) = 'cap-small cap-large'.split() @@ -749,7 +749,7 @@ def test_get_keyboard_sequence(monkeypatch): (KEY_LARGE, CAP_LARGE,)))) # patch global sequence mix-in - monkeypatch.setattr(blessed.keyboard, + monkeypatch.setattr(blessings.keyboard, 'DEFAULT_SEQUENCE_MIXIN', ( (SEQ_MIXIN.decode('latin1'), KEY_MIXIN),)) @@ -757,7 +757,7 @@ def test_get_keyboard_sequence(monkeypatch): term = mock.Mock() term._cuf1 = SEQ_ALT_CUF1.decode('latin1') term._cub1 = SEQ_ALT_CUB1.decode('latin1') - keymap = blessed.keyboard.get_keyboard_sequences(term) + keymap = blessings.keyboard.get_keyboard_sequences(term) assert list(keymap.items()) == [ (SEQ_LARGE.decode('latin1'), KEY_LARGE), @@ -769,7 +769,7 @@ def test_get_keyboard_sequence(monkeypatch): def test_resolve_sequence(): "Test resolve_sequence for order-dependent mapping." - from blessed.keyboard import resolve_sequence, OrderedDict + from blessings.keyboard import resolve_sequence, OrderedDict mapper = OrderedDict(((u'SEQ1', 1), (u'SEQ2', 2), # takes precedence over LONGSEQ, first-match @@ -841,7 +841,7 @@ def test_keypad_mixins_and_aliases(): @as_subprocess def child(kind): term = TestTerminal(kind=kind, force_styling=True) - from blessed.keyboard import resolve_sequence + from blessings.keyboard import resolve_sequence resolve = functools.partial(resolve_sequence, mapper=term._keymap, diff --git a/blessed/tests/test_length_sequence.py b/blessed/tests/test_length_sequence.py index 88096dc..0eac165 100644 --- a/blessed/tests/test_length_sequence.py +++ b/blessed/tests/test_length_sequence.py @@ -41,7 +41,7 @@ def test_length_ansiart(): @as_subprocess def child(): import codecs - from blessed.sequences import Sequence + from blessings.sequences import Sequence term = TestTerminal(kind='xterm-256color') # this 'ansi' art contributed by xzip!impure for another project, # unlike most CP-437 DOS ansi art, this is actually utf-8 encoded. @@ -276,7 +276,7 @@ def test_sequence_is_movement_false(all_terms): """Test parser about sequences that do not move the cursor.""" @as_subprocess def child_mnemonics_wontmove(kind): - from blessed.sequences import measure_length + from blessings.sequences import measure_length t = TestTerminal(kind=kind) assert (0 == measure_length(u'', t)) # not even a mbs @@ -313,7 +313,7 @@ def test_sequence_is_movement_true(all_terms): """Test parsers about sequences that move the cursor.""" @as_subprocess def child_mnemonics_willmove(kind): - from blessed.sequences import measure_length + from blessings.sequences import measure_length t = TestTerminal(kind=kind) # movements assert (len(t.move(98, 76)) == diff --git a/blessed/tests/test_sequences.py b/blessed/tests/test_sequences.py index b15426c..f42a52c 100644 --- a/blessed/tests/test_sequences.py +++ b/blessed/tests/test_sequences.py @@ -94,8 +94,8 @@ def test_stream_attr(): reason="travis-ci does not have binary-packed terminals.") def test_emit_warnings_about_binpacked(): """Test known binary-packed terminals (kermit, avatar) emit a warning.""" - from blessed.sequences import _BINTERM_UNSUPPORTED_MSG - from blessed._binterms import binary_terminals + from blessings.sequences import _BINTERM_UNSUPPORTED_MSG + from blessings._binterms import binary_terminals @as_subprocess def child(kind): @@ -122,9 +122,9 @@ def test_emit_warnings_about_binpacked(): def test_unit_binpacked_unittest(): """Unit Test known binary-packed terminals emit a warning (travis-safe).""" import warnings - from blessed._binterms import binary_terminals - from blessed.sequences import (_BINTERM_UNSUPPORTED_MSG, - init_sequence_patterns) + from blessings._binterms import binary_terminals + from blessings.sequences import (_BINTERM_UNSUPPORTED_MSG, + init_sequence_patterns) warnings.filterwarnings("error", category=UserWarning) term = mock.Mock() term.kind = binary_terminals[random.randrange(len(binary_terminals))] @@ -141,7 +141,7 @@ def test_unit_binpacked_unittest(): def test_merge_sequences(): """Test sequences are filtered and ordered longest-first.""" - from blessed.sequences import _merge_sequences + from blessings.sequences import _merge_sequences input_list = [u'a', u'aa', u'aaa', u''] output_expected = [u'aaa', u'aa', u'a'] assert (_merge_sequences(input_list) == output_expected) @@ -495,7 +495,7 @@ def test_null_callable_string(all_terms): def test_bnc_parameter_emits_warning(): """A fake capability without target digits emits a warning.""" import warnings - from blessed.sequences import _build_numeric_capability + from blessings.sequences import _build_numeric_capability # given, warnings.filterwarnings("error", category=UserWarning) @@ -517,7 +517,7 @@ def test_bnc_parameter_emits_warning(): def test_bna_parameter_emits_warning(): """A fake capability without any digits emits a warning.""" import warnings - from blessed.sequences import _build_any_numeric_capability + from blessings.sequences import _build_any_numeric_capability # given, warnings.filterwarnings("error", category=UserWarning) @@ -540,8 +540,8 @@ def test_padd(): """ Test terminal.padd(seq). """ @as_subprocess def child(): - from blessed.sequences import Sequence - from blessed import Terminal + from blessings.sequences import Sequence + from blessings import Terminal term = Terminal('xterm-256color') assert Sequence('xyz\b', term).padd() == u'xy' assert Sequence('xxxx\x1b[3Dzz', term).padd() == u'xzz' diff --git a/docs/Makefile b/docs/Makefile index 47febae..c1d668a 100644 --- a/docs/Makefile +++ b/docs/Makefile @@ -72,17 +72,17 @@ qthelp: @echo @echo "Build finished; now you can run "qcollectiongenerator" with the" \ ".qhcp project file in $(BUILDDIR)/qthelp, like this:" - @echo "# qcollectiongenerator $(BUILDDIR)/qthelp/blessed.qhcp" + @echo "# qcollectiongenerator $(BUILDDIR)/qthelp/blessings.qhcp" @echo "To view the help file:" - @echo "# assistant -collectionFile $(BUILDDIR)/qthelp/blessed.qhc" + @echo "# assistant -collectionFile $(BUILDDIR)/qthelp/blessings.qhc" devhelp: $(SPHINXBUILD) -b devhelp $(ALLSPHINXOPTS) $(BUILDDIR)/devhelp @echo @echo "Build finished." @echo "To view the help file:" - @echo "# mkdir -p $$HOME/.local/share/devhelp/blessed" - @echo "# ln -s $(BUILDDIR)/devhelp $$HOME/.local/share/devhelp/blessed" + @echo "# mkdir -p $$HOME/.local/share/devhelp/blessings" + @echo "# ln -s $(BUILDDIR)/devhelp $$HOME/.local/share/devhelp/blessings" @echo "# devhelp" epub: diff --git a/docs/conf.py b/docs/conf.py index 6975d7f..7361600 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- # -# blessed documentation build configuration file, created by +# blessings documentation build configuration file, created by # sphinx-quickstart on Thu Mar 31 13:40:27 2011. # # This file is execfile()d with the current directory set to its @@ -20,7 +20,7 @@ import os here = os.path.dirname(__file__) sys.path.insert(0, os.path.abspath(os.path.join(here, '..'))) -import blessed +import blessings # -- General configuration ---------------------------------------------------- @@ -45,7 +45,7 @@ source_suffix = '.rst' master_doc = 'index' # General information about the project. -project = u'Blessed' +project = u'Blessings' copyright = u'2014 Jeff Quast, 2011 Erik Rose' # The version info for the project you're documenting, acts as replacement for @@ -171,7 +171,7 @@ html_static_path = [] # html_file_suffix = None # Output file base name for HTML help builder. -htmlhelp_basename = 'blesseddoc' +htmlhelp_basename = 'blessingsdoc' # -- Options for LaTeX output ------------------------------------------------- @@ -186,7 +186,7 @@ htmlhelp_basename = 'blesseddoc' # (source start file, target name, title, author, documentclass # [howto/manual]). latex_documents = [ - ('index', 'blessed.tex', u'Blessed Documentation', + ('index', 'blessings.tex', u'Blessings Documentation', u'Jeff Quast', 'manual'), ] @@ -219,10 +219,10 @@ latex_documents = [ # One entry per manual page. List of tuples # (source start file, name, description, authors, manual section). man_pages = [ - ('index', 'Blessed', u'Blessed Documentation', + ('index', 'Blessings', u'Blessings Documentation', [u'Jeff Quast'], 1) ] autodoc_member_order = 'bysource' -del blessed # imported but unused +del blessings # imported but unused diff --git a/docs/index.rst b/docs/index.rst index 0383b3a..41da922 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -1,20 +1,20 @@ -===================== -Blessed API Reference -===================== +======================= +Blessings API Reference +======================= Read The Readme First ===================== -This is the API documentation for the Blessed terminal library. +This is the API documentation for the Blessings terminal library. -Because Blessed uses quite a bit of dynamism, you should +Because Blessings uses quite a bit of dynamism, you should `read the readme first`_ for a general guide and overview. However, if you're looking for the documentation of the internal classes, their methods, and related functions that make up the internals, you're in the right place. -.. _`read the readme first`: http://pypi.python.org/pypi/blessed +.. _`read the readme first`: http://pypi.python.org/pypi/blessings API Documentation ================= @@ -24,27 +24,27 @@ Internal modules are as follows. terminal module (primary) ------------------------- -.. automodule:: blessed.terminal +.. automodule:: blessings.terminal :members: :undoc-members: formatters module ----------------- -.. automodule:: blessed.formatters +.. automodule:: blessings.formatters :members: :undoc-members: keyboard module --------------- -.. automodule:: blessed.keyboard +.. automodule:: blessings.keyboard :members: :undoc-members: sequences module ---------------- -.. automodule:: blessed.sequences +.. automodule:: blessings.sequences :members: :undoc-members: diff --git a/docs/make.bat b/docs/make.bat index 21ff37b..c24653f 100644 --- a/docs/make.bat +++ b/docs/make.bat @@ -95,9 +95,9 @@ if "%1" == "qthelp" ( echo. echo.Build finished; now you can run "qcollectiongenerator" with the ^ .qhcp project file in %BUILDDIR%/qthelp, like this: - echo.^> qcollectiongenerator %BUILDDIR%\qthelp\blessed.qhcp + echo.^> qcollectiongenerator %BUILDDIR%\qthelp\blessings.qhcp echo.To view the help file: - echo.^> assistant -collectionFile %BUILDDIR%\qthelp\blessed.ghc + echo.^> assistant -collectionFile %BUILDDIR%\qthelp\blessings.ghc goto end ) diff --git a/setup.py b/setup.py index 489ebed..c473cda 100755 --- a/setup.py +++ b/setup.py @@ -37,17 +37,17 @@ def main(): extra['install_requires'].extend(['ordereddict>=1.1']) setuptools.setup( - name='blessed', + name='blessings', version='1.9.5', description="A feature-filled fork of Erik Rose's blessings project", long_description=open(os.path.join(here, 'README.rst')).read(), author='Jeff Quast', author_email='contact@jeffquast.com', license='MIT', - packages=['blessed', 'blessed.tests'], - url='https://github.com/jquast/blessed', + packages=['blessings', 'blessings.tests'], + url='https://github.com/erikrose/blessings', include_package_data=True, - test_suite='blessed.tests', + test_suite='blessings.tests', classifiers=[ 'Intended Audience :: Developers', 'Natural Language :: English', diff --git a/tox.ini b/tox.ini index 5c93fca..ff8b2b6 100644 --- a/tox.ini +++ b/tox.ini @@ -20,7 +20,7 @@ deps = pytest-flakes commands = {envbindir}/py.test \ --strict --pep8 --flakes \ --junit-xml=results.{envname}.xml --verbose \ - --cov blessed blessed/tests --cov-report=term-missing \ + --cov blessings blessings/tests --cov-report=term-missing \ {posargs} /bin/mv {toxinidir}/.coverage {toxinidir}/.coverage.{envname} -- cgit v1.2.1