/mandos/trunk

To get this branch, use:
bzr branch http://bzr.recompile.se/loggerhead/mandos/trunk

« back to all changes in this revision

Viewing changes to mandos

  • Committer: Teddy Hogeborn
  • Date: 2015-05-31 16:13:39 UTC
  • Revision ID: teddy@recompile.se-20150531161339-igb3l0ip3c10ejpz
mandos-ctl: Generate better messages in exceptions.

mandos (rfc3339_duration_to_delta): Remove dead code.  Adjust white
                                    space.
mandos-ctl (rfc3339_duration_to_delta): Do minor formatting and
                                        whitespace adjustments, and
                                        Generate better message in
                                        exception.
(string_to_delta): Adjust quote character in doc string.

Show diffs side-by-side

added added

removed removed

Lines of Context:
2182
2182
    # avoid excessive use of external libraries.
2183
2183
    
2184
2184
    # New type for defining tokens, syntax, and semantics all-in-one
2185
 
    Token = collections.namedtuple("Token",
2186
 
                                   ("regexp", # To match token; if
2187
 
                                              # "value" is not None,
2188
 
                                              # must have a "group"
2189
 
                                              # containing digits
2190
 
                                    "value",  # datetime.timedelta or
2191
 
                                              # None
2192
 
                                    "followers")) # Tokens valid after
2193
 
                                                  # this token
2194
2185
    Token = collections.namedtuple("Token", (
2195
2186
        "regexp",  # To match token; if "value" is not None, must have
2196
2187
                   # a "group" containing digits
2231
2222
    # Define starting values
2232
2223
    value = datetime.timedelta() # Value so far
2233
2224
    found_token = None
2234
 
    followers = frozenset((token_duration,)) # Following valid tokens
 
2225
    followers = frozenset((token_duration, )) # Following valid tokens
2235
2226
    s = duration                # String left to parse
2236
2227
    # Loop until end token is found
2237
2228
    while found_token is not token_end: