1. 03 Ara, 2017 1 kayıt (commit)
    • R. David Murray's avatar
      bpo-27240 Rewrite the email header folding algorithm. (#3488) · 85d5c18c
      R. David Murray yazdı
      The original algorithm tried to delegate the folding to the tokens so
      that those tokens whose folding rules differed could specify the
      differences.  However, this resulted in a lot of duplicated code because
      most of the rules were the same.
      
      The new algorithm moves all folding logic into a set of functions
      external to the token classes, but puts the information about which
      tokens can be folded in which ways on the tokens...with the exception of
      mime-parameters, which are a special case (which was not even
      implemented in the old folder).
      
      This algorithm can still probably be improved and hopefully simplified
      somewhat.
      
      Note that some of the test expectations are changed.  I believe the
      changes are toward more desirable and consistent behavior: in general
      when (re) folding a line the canonical version of the tokens is
      generated, rather than preserving errors or extra whitespace.
      85d5c18c
  2. 18 May, 2017 1 kayıt (commit)
    • Jon Dufresne's avatar
      bpo-30296 Remove unnecessary tuples, lists, sets, and dicts (#1489) · 3972628d
      Jon Dufresne yazdı
      * Replaced list(<generator expression>) with list comprehension
      * Replaced dict(<generator expression>) with dict comprehension
      * Replaced set(<list literal>) with set literal
      * Replaced builtin func(<list comprehension>) with func(<generator
        expression>) when supported (e.g. any(), all(), tuple(), min(), &
        max())
      3972628d
  3. 17 Nis, 2016 1 kayıt (commit)
  4. 10 Şub, 2016 1 kayıt (commit)
  5. 17 Eki, 2014 1 kayıt (commit)
    • R David Murray's avatar
      #21991: make headerregistry params property MappingProxyType. · 685b3495
      R David Murray yazdı
      It is unlikely anyone is using the fact that the dictionary returned
      by the 'params' attribute was previously writable, but even if someone
      is the API is provisional so this kind of change is acceptable (and
      needed, to get the API "right" before it becomes official).
      
      Patch by Stéphane Wirtel.
      685b3495
  6. 25 Tem, 2014 1 kayıt (commit)
  7. 24 Haz, 2012 1 kayıt (commit)
    • R David Murray's avatar
      #15160: Extend the new email parser to handle MIME headers. · 97f43c01
      R David Murray yazdı
      This code passes all the same tests that the existing RFC mime header
      parser passes, plus a bunch of additional ones.
      
      There are a couple of commented out tests where there are issues with the
      folding.  The folding doesn't normally get invoked for headers parsed from
      source, and the cases are marginal anyway (headers with invalid binary data)
      so I'm not worried about them, but will fix them after the beta.
      
      There are things that can be done to make this API even more convenient, but I
      think this is a solid foundation worth having.  And the parser is a full RFC
      parser, so it handles cases that the current parser doesn't.  (There are also
      probably cases where it fails when the current parser doesn't, but I haven't
      found them yet ;)
      
      Oh, yeah, and there are some really ugly bits in the parser for handling some
      'postel' cases that are unfortunately common.
      
      I hope/plan to to eventually refactor a lot of the code in the parser which
      should reduce the line count...but there is no escaping the fact that the
      error recovery is welter of special cases.
      97f43c01
  8. 27 May, 2012 1 kayıt (commit)
    • R David Murray's avatar
      Make headerregistry fully part of the provisional api. · ea976689
      R David Murray yazdı
      When I made the checkin of the provisional email policy, I knew that
      Address and Group needed to be made accessible from somewhere.  The more
      I looked at it, though, the more it became clear that since this is a
      provisional API anyway, there's no good reason to hide headerregistry as
      a private API.  It was designed to ultimately be part of the public API,
      and so it should be part of the provisional API.
      
      This patch fully documents the headerregistry API, and deletes the
      abbreviated version of those docs I had added to the provisional policy
      docs.
      ea976689
  9. 25 May, 2012 1 kayıt (commit)
    • R David Murray's avatar
      #12586: add provisional email policy with new header parsing and folding. · 0b6f6c82
      R David Murray yazdı
      When the new policies are used (and only when the new policies are explicitly
      used) headers turn into objects that have attributes based on their parsed
      values, and can be set using objects that encapsulate the values, as well as
      set directly from unicode strings.  The folding algorithm then takes care of
      encoding unicode where needed, and folding according to the highest level
      syntactic objects.
      
      With this patch only date and time headers are parsed as anything other than
      unstructured, but that is all the helper methods in the existing API handle.
      I do plan to add more parsers, and complete the set specified in the RFC
      before the package becomes stable.
      0b6f6c82