"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "httpie/output/lexers/metadata.py" between
httpie-3.0.0.tar.gz and httpie-3.0.1.tar.gz

About: HTTPie is a command line HTTP client, a user-friendly cURL replacement, with the goal to make CLI interaction with web services as human-friendly as possible.

metadata.py  (httpie-3.0.0):metadata.py  (httpie-3.0.1)
import pygments import pygments
from httpie.models import ELAPSED_TIME_LABEL
from httpie.output.lexers.common import precise from httpie.output.lexers.common import precise
SPEED_TOKENS = { SPEED_TOKENS = {
0.45: pygments.token.Number.SPEED.FAST, 0.45: pygments.token.Number.SPEED.FAST,
1.00: pygments.token.Number.SPEED.AVG, 1.00: pygments.token.Number.SPEED.AVG,
2.50: pygments.token.Number.SPEED.SLOW, 2.50: pygments.token.Number.SPEED.SLOW,
} }
def speed_based_token(lexer, match, ctx): def speed_based_token(lexer, match, ctx):
try: try:
skipping to change at line 35 skipping to change at line 37
pygments.token.Number pygments.token.Number
) )
yield match.start(), response_type, match.group() yield match.start(), response_type, match.group()
class MetadataLexer(pygments.lexer.RegexLexer): class MetadataLexer(pygments.lexer.RegexLexer):
"""Simple HTTPie metadata lexer.""" """Simple HTTPie metadata lexer."""
tokens = { tokens = {
'root': [ 'root': [
( (
r'(Elapsed time)( *)(:)( *)(\d+\.\d+)(s)', pygments.lexer.bygrou ps( fr'({ELAPSED_TIME_LABEL})( *)(:)( *)(\d+\.\d+)(s)', pygments.lex er.bygroups(
pygments.token.Name.Decorator, # Name pygments.token.Name.Decorator, # Name
pygments.token.Text, pygments.token.Text,
pygments.token.Operator, # Colon pygments.token.Operator, # Colon
pygments.token.Text, pygments.token.Text,
speed_based_token, speed_based_token,
pygments.token.Name.Builtin # Value pygments.token.Name.Builtin # Value
) )
), ),
# Generic item # Generic item
( (
 End of changes. 2 change blocks. 
1 lines changed or deleted 3 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)