1. 20 Oct, 2019 1 commit
  2. 21 Apr, 2019 3 commits
  3. 13 Aug, 2018 2 commits
    • Charles Ferguson's avatar
      Add better handling for unicode. · 64a84cf2
      Charles Ferguson authored
      The unicode handling was not great in the Python 2.7 uses of the
      styled strings. I've updated the string joins to be given more
      control over the encoding.
      The handling of rendition is now tested properly too.
    • Charles Ferguson's avatar
      Fix for inefficient renderer processing. · de338e6b
      Charles Ferguson authored
      The renderer would join together all the elements it was returning,
      but the caller expected them to be separated into a list. The result
      was that when caller tried to process the elements in an enumeration,
      it stepped over all the characters in the returned rendition, rather
      than the parts that had been constructed.
  4. 28 Jul, 2018 4 commits
    • Charles Ferguson's avatar
      Lint: Address issues and broken Formatter code. · 07d97458
      Charles Ferguson authored
      There were a few formatting issues, and shadowed symbols, but more
      importantly, the formatter code was just very wrong. Now fixed, but
      clearly not being tested yet.
    • Charles Ferguson's avatar
      Implement find, index, partition and their reverse counterparts. · 5ee5a4c9
      Charles Ferguson authored
      The search operations are all now implemented - only for the case
      where the strings are simple. There are however, no tests for these
      because I've been lazy. I should add some soon, I guess.
      Also __contains__ is now implemented as well, as this is an identical
      operation to the find.
      And rsplit has been created from the split code, and should work,
      but again has not been tested.
    • Charles Ferguson's avatar
      Add optimisations for the simple cases of bare strings. · c6a4fb21
      Charles Ferguson authored
      Strings which do not contain nested styling are a lot simpler to
      handle than those that contain other styles. As a result, we can
      handle them in a more efficient manner by just calling down to
      the string operations and then wrapping the result in a styled
      string (if necessary).
    • Charles Ferguson's avatar
      Add zfill; introduce some optimisations and fixes. · c192b1c7
      Charles Ferguson authored
      The zfill function, which is rjust with a default parameter fill='0',
      is now implemented, and has some simple tests.
      There are now some optimisations for the item fetching code which is
      used for indexed access, resulting in slightly faster operations on
      simple strings. These changes also highlighted a couple of bugs which
      were addressed.
  5. 27 Jul, 2018 1 commit
    • Charles Ferguson's avatar
      Implement split and its tests. · e403106c
      Charles Ferguson authored
      The split function is easy enough to implement, falling back on the
      base string implementation to provide a fast way of recognising the
      split points. The tests for this have been created only for simple
      unformatted strings, and the need to add more tests for upcoming
      functions means that I've renumbered the main test class 30s to 40s.
  6. 26 Jul, 2018 1 commit
  7. 23 Jul, 2018 1 commit
  8. 21 Jul, 2018 4 commits
  9. 19 Jul, 2018 1 commit
    • Charles Ferguson's avatar
      Made the 'endswith' call generic enough to be used with 'startswith' · 180781b8
      Charles Ferguson authored
      The 'endswith' and the 'startswith' calls have very similar code -
      they just compare a truncated string with an comparison string. As
      they are so simple, both can be implemented by the same code with
      a small callback function for the truncateion.
      Tests now exist for these 'startswith' calls as well.
  10. 15 Jul, 2018 1 commit
    • Charles Ferguson's avatar
      Implement endswith tuple comparisons. · d0f47e8d
      Charles Ferguson authored
      The tuple comparisons used by endswith are a 'or' list of alternatives
      that we wish to match with the string. This matches the behaviour of
      the regular endswith string operation. However, we still do not
      implement the offset points, nor does startswith gain this functionality
      as yet.
  11. 14 Jul, 2018 1 commit
  12. 13 Jul, 2018 1 commit
    • Charles Ferguson's avatar
      Add more re.sub tests; fix bug with named captures. · 0e4f459f
      Charles Ferguson authored
      re.sub tests are now present for group numbers and names, and from
      that there is a small fix for named captures not being referenced
      properly - the group_start and group_end values would not be
      calculated, resulting in a failure in the replacement code.
  13. 09 Jul, 2018 1 commit
    • Charles Ferguson's avatar
      Add support for upper(), lower() and capitalize(). · 9b9ef553
      Charles Ferguson authored
      The upper and lower functions are supported as a transformation of
      a copy of the string. This could actually be performed on the string
      with other transformations, but for now we leave it as it stands.
      The capitalisation, in capitalize(), is a upper() of the first
      character, followed by the rest of the string. It is quite simple
      in that regard.
  14. 23 Jun, 2018 3 commits
    • Charles Ferguson's avatar
      Docs: Small fix to formatting. · 380ffdff
      Charles Ferguson authored
      Tiny fix which should let the docs build work now.
    • Charles Ferguson's avatar
      Fix for re_sub giving the wrong style for substitutions. · 3d8976cf
      Charles Ferguson authored
      The re_sub function is a bit of a mish-mash in that it can extend
      the styling of some strings, and replaces the style with the related
      style in others. This isn't ideal but it tries to keep to the most
      common usage. The code now checks the behaviour of these
      replacements, even with escapes, which may show what we're trying
      to do.
    • Charles Ferguson's avatar
      Lint: Address some small lint issues, and a bug fix for re_sub. · b25aefd3
      Charles Ferguson authored
      The re_sub function used a matching application function but the
      parameter passed to it was not actually used - another variable
      value was instead used, which was only valid in some cases. This
      was found by lint.
      The other lint issues were 'relative-import', which can be annotated
      as disabled.
  15. 05 Jun, 2018 1 commit
    • Charles Ferguson's avatar
      Fix for indexing problem with ranges of characters and empty strings. · 8fb3ead0
      Charles Ferguson authored
      When a range was requested for an empty string, it would return a
      failure, despite actually being valid with regular strings. The
      raised exception has been updated so that it only occurs for character
      indexes, not range indexes.
      Tests have been added for this in the case it was found in (rstrip of
      a formatted string that is empty), and in the indexing code in general.
      The simplify operation has been updated so that an empty nested string
      is omitted from the styled string - they have no value as they cannot
      be appended to at the time that the simplify call is made. And that fixes
      one of the tests that was failing to compare the strings as equal.
  16. 07 May, 2018 1 commit
  17. 19 Apr, 2018 1 commit
  18. 31 Mar, 2018 12 commits
    • Charles Ferguson's avatar
      Added all the CI scripts. · da04893d
      Charles Ferguson authored
    • Charles Ferguson's avatar
      Fixed up the CI. · 4b19c665
      Charles Ferguson authored
    • Charles Ferguson's avatar
      Reorganise the property rendering in StyledStrings. · dcda67eb
      Charles Ferguson authored
      There's a new 'properties_delta' function in the StyledStrings, so
      that we can process the whole state more easily. This was found to
      be necessary to make the longtraceback work sensibly.
    • Charles Ferguson's avatar
      StyledString regex tests, simplification fixes, __ne__ fix. · f284b20e
      Charles Ferguson authored
      The regular expressions for substitution are now tested to some
      degree, but are not comprehensive by any means. The tests cover
      many of the cases that we believe will crop up, and should at least
      give us a useful set of regression checks.
      Regular expressions, as part of the processing, involve a lot more
      operations on strings and substrings, which has highlighted a lot
      of simplification problems which were caused by the lack of
      consistency in their operation. The simplification should now be
      a lot more robust, although we still do not strip out the empty
      strings that might turn up in the output. This has not been a
      problem as yet, but may need more checking in the future.
      There was a real world failure with the operation of the formatter
      which was shown up in tests with longtraceback, but didn't turn up
      in the functional tests themselves. This was caused by an early
      stringification of the format string, which produced extra text
      that we did not want. A new class has been added to hold this form
      of test for regression testing, and I should introduce better
      tests that check for this early stringification at some later
      Apparently prior to python 3.4, __ne__ was not the inverse of
      __eq__. So we now have an implementation that is just an inverse
      so that those earlier python versions are happier.
    • Charles Ferguson's avatar
      Add regular expression 'sub' function for StyledString. · da6e59e7
      Charles Ferguson authored
      The 'sub' function for regular expressions is patched to support
      processing of the StyledString, through the substitution of the
      parts of the string. Though the process is a little involved, it
      does appear to be successful.
      No tests are currently present.
    • Charles Ferguson's avatar
      Simplify wildcard matching of StyledString rules. · 83ac8ea5
      Charles Ferguson authored
      The wild card matching is now performed in a single block, rather
      than being repeated. This should make it easier to maintain and
      less error prone.
    • Charles Ferguson's avatar
      Fix for incorrect prefix rule matches on StyledString. · 3c60963f
      Charles Ferguson authored
      Rule matches were incorrectly matching prefixes, rather than the
      explict component - a rule for '.string would match 'strings' in
      the style. This has now been fixed and the tests updated.
      The templates for the 'expansions' are now extended to support
      both the property and the value as templates, and a wildcard match
      added to catch any other cases that might otherwise fall through.
    • Charles Ferguson's avatar
      Add startswith to StyledString. · 72fa46d3
      Charles Ferguson authored
      The StyledString now has 'startswith' checks so that we can see when
      the string starts with a known sequence.
    • Charles Ferguson's avatar
      Add some test for StyledString Formatter base functionality. · d2b4e699
      Charles Ferguson authored
      Some of the simpler, non-StyledString related tests are run to make
      sure that we've not broken the expectations of being able to use
      the format function.
    • Charles Ferguson's avatar
      Implement the [lr]?strip methods and tests for StyledString. · 5a8652b3
      Charles Ferguson authored
      The StyledString now has tests for the new strip methods which should
      allow the formatter to work when there are some combinations that
      result in the string output being pre-formatted as a StyledString
      on exit from _format_field.
      Plus they'll be useful if we want to strip strings.
    • Charles Ferguson's avatar
      Apply fixes and disablements for pylint. · 6eb3110e
      Charles Ferguson authored
      There are a lot of disabled pylint messages to ensure that the code
      is clean - almost entirely because pylint gets confused by the use
      of protected methods between classes of the same type in the binary
      operations, and the subclassed test Renditions.
      However, it did spot a typo in the __name__ of one usage, and the
      lstrip and rstrip functions not being implemented in the StyledString
      could be a problem in some cases. The latter is not yet fixed, and
      will be addressed in the next change.
    • Charles Ferguson's avatar
      Add lots of formatter tests for StyledString. · c7542445
      Charles Ferguson authored
      The StyledString is now tested in a lot of ways - it's still got a
      lot of uncovered possible configurations, as the formatter can do
      a lot of different things. The majority of the cases are now covered
      I believe, and more can be added as and when they are found to be