You've already forked httpie-cli
mirror of
https://github.com/httpie/cli.git
synced 2025-08-10 22:42:05 +02:00
Cleanup
This commit is contained in:
@@ -132,10 +132,3 @@ class RequestType(enum.Enum):
|
|||||||
FORM = enum.auto()
|
FORM = enum.auto()
|
||||||
MULTIPART = enum.auto()
|
MULTIPART = enum.auto()
|
||||||
JSON = enum.auto()
|
JSON = enum.auto()
|
||||||
|
|
||||||
|
|
||||||
EMPTY_STRING = ''
|
|
||||||
OPEN_BRACKET = '['
|
|
||||||
CLOSE_BRACKET = ']'
|
|
||||||
BACKSLASH = '\\'
|
|
||||||
HIGHLIGHTER = '^'
|
|
||||||
|
@@ -9,8 +9,14 @@ from typing import (
|
|||||||
Type,
|
Type,
|
||||||
Union,
|
Union,
|
||||||
)
|
)
|
||||||
from httpie.cli.dicts import NestedJSONArray
|
from .dicts import NestedJSONArray
|
||||||
from httpie.cli.constants import EMPTY_STRING, OPEN_BRACKET, CLOSE_BRACKET, BACKSLASH, HIGHLIGHTER
|
|
||||||
|
|
||||||
|
EMPTY_STRING = ''
|
||||||
|
HIGHLIGHTER = '^'
|
||||||
|
OPEN_BRACKET = '['
|
||||||
|
CLOSE_BRACKET = ']'
|
||||||
|
BACKSLASH = '\\'
|
||||||
|
|
||||||
|
|
||||||
class HTTPieSyntaxError(ValueError):
|
class HTTPieSyntaxError(ValueError):
|
||||||
@@ -31,7 +37,7 @@ class HTTPieSyntaxError(ValueError):
|
|||||||
if self.token is not None:
|
if self.token is not None:
|
||||||
lines.append(self.source)
|
lines.append(self.source)
|
||||||
lines.append(
|
lines.append(
|
||||||
' ' * (self.token.start)
|
' ' * self.token.start
|
||||||
+ HIGHLIGHTER * (self.token.end - self.token.start)
|
+ HIGHLIGHTER * (self.token.end - self.token.start)
|
||||||
)
|
)
|
||||||
return '\n'.join(lines)
|
return '\n'.join(lines)
|
||||||
@@ -51,9 +57,15 @@ class TokenKind(Enum):
|
|||||||
return 'a ' + self.name.lower()
|
return 'a ' + self.name.lower()
|
||||||
|
|
||||||
|
|
||||||
OPERATORS = {OPEN_BRACKET: TokenKind.LEFT_BRACKET, CLOSE_BRACKET: TokenKind.RIGHT_BRACKET}
|
OPERATORS = {
|
||||||
|
OPEN_BRACKET: TokenKind.LEFT_BRACKET,
|
||||||
|
CLOSE_BRACKET: TokenKind.RIGHT_BRACKET,
|
||||||
|
}
|
||||||
SPECIAL_CHARS = OPERATORS.keys() | {BACKSLASH}
|
SPECIAL_CHARS = OPERATORS.keys() | {BACKSLASH}
|
||||||
LITERAL_TOKENS = [TokenKind.TEXT, TokenKind.NUMBER]
|
LITERAL_TOKENS = [
|
||||||
|
TokenKind.TEXT,
|
||||||
|
TokenKind.NUMBER,
|
||||||
|
]
|
||||||
|
|
||||||
|
|
||||||
class Token(NamedTuple):
|
class Token(NamedTuple):
|
||||||
|
@@ -13,7 +13,8 @@ import urllib3
|
|||||||
from . import __version__
|
from . import __version__
|
||||||
from .adapters import HTTPieHTTPAdapter
|
from .adapters import HTTPieHTTPAdapter
|
||||||
from .context import Environment
|
from .context import Environment
|
||||||
from .cli.constants import EMPTY_STRING, HTTP_OPTIONS
|
from .cli.constants import HTTP_OPTIONS
|
||||||
|
from .cli.nested_json import EMPTY_STRING
|
||||||
from .cli.dicts import HTTPHeadersDict, NestedJSONArray
|
from .cli.dicts import HTTPHeadersDict, NestedJSONArray
|
||||||
from .encoding import UTF8
|
from .encoding import UTF8
|
||||||
from .models import RequestsMessage
|
from .models import RequestsMessage
|
||||||
|
Reference in New Issue
Block a user