Skip to content

Commit

Permalink
Upgrade to elasticsearch client dependency to v8 (#210)
Browse files Browse the repository at this point in the history
Upgrade the dependency to version 8 from 7. The dependency is now on the lower level transport library (elastic_transport) instead of the high level library (elasticsearch-py) since Peek does not use high level DSL.

Resolves: #200
  • Loading branch information
ywangd authored Jan 24, 2024
1 parent c42f563 commit c50f1ff
Show file tree
Hide file tree
Showing 35 changed files with 414 additions and 370 deletions.
32 changes: 16 additions & 16 deletions peek/ast.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,52 +10,52 @@ def __init__(self):
self._consumers = []

def visit_es_api_call_node(self, node):
raise NotImplementedError()
raise NotImplementedError

def visit_func_call_node(self, node):
raise NotImplementedError()
raise NotImplementedError

def visit_let_node(self, node):
raise NotImplementedError()
raise NotImplementedError

def visit_shell_out_node(self, node):
raise NotImplementedError()
raise NotImplementedError

def visit_for_in_node(self, node):
raise NotImplementedError()
raise NotImplementedError

def visit_name_node(self, node):
raise NotImplementedError()
raise NotImplementedError

def visit_symbol_node(self, node):
raise NotImplementedError()
raise NotImplementedError

def visit_text_node(self, node):
raise NotImplementedError()
raise NotImplementedError

def visit_key_value_node(self, node):
raise NotImplementedError()
raise NotImplementedError

def visit_dict_node(self, node):
raise NotImplementedError()
raise NotImplementedError

def visit_array_node(self, node):
raise NotImplementedError()
raise NotImplementedError

def visit_string_node(self, node):
raise NotImplementedError()
raise NotImplementedError

def visit_number_node(self, node):
raise NotImplementedError()
raise NotImplementedError

def visit_bin_op_node(self, node):
raise NotImplementedError()
raise NotImplementedError

def visit_unary_op_node(self, node):
raise NotImplementedError()
raise NotImplementedError

def visit_group_node(self, node):
raise NotImplementedError()
raise NotImplementedError

def consume(self, *args, **kwargs):
if not self._consumers:
Expand Down
3 changes: 2 additions & 1 deletion peek/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,8 @@ def main():
parser.add_argument(
'--verify_certs', action='store_true', default=argparse.SUPPRESS, help='Verify server certificate'
)
parser.add_argument('--assert_hostname', action='store_true', default=argparse.SUPPRESS, help='Verify hostname')
parser.add_argument('--assert_hostname', default=argparse.SUPPRESS, help='Verify for the given hostname')
parser.add_argument('--assert_fingerprint', default=argparse.SUPPRESS, help='Verify for the given fingerprint')
parser.add_argument('--ca_certs', help='Location of CA certificates')
parser.add_argument('--client_cert', help='Location of client certificate')
parser.add_argument('--client_key', help='Location of client private key')
Expand Down
7 changes: 6 additions & 1 deletion peek/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,10 @@ def __getattr__(self, name):
return None


PeekToken = NamedTuple('PeekToken', [('index', int), ('ttype', _TokenType), ('value', str)])
class PeekToken(NamedTuple):
index: int
ttype: _TokenType
value: str


NONE_NS = AlwaysNoneNameSpace()
26 changes: 13 additions & 13 deletions peek/completer.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,29 +3,29 @@
import os
from typing import Iterable, List, Optional

from prompt_toolkit.completion import Completer, CompleteEvent, Completion, WordCompleter, FuzzyCompleter, PathCompleter
from prompt_toolkit.completion import CompleteEvent, Completer, Completion, FuzzyCompleter, PathCompleter, WordCompleter
from prompt_toolkit.contrib.completers import SystemCompleter
from prompt_toolkit.document import Document
from pygments.token import Error, Literal, String, Name
from pygments.token import Error, Literal, Name, String

from peek.common import PeekToken, HTTP_METHODS
from peek.common import HTTP_METHODS, PeekToken
from peek.completions import PayloadKeyCompletion
from peek.config import config_location
from peek.lexers import (
PeekLexer,
UrlPathLexer,
PathPart,
ParamName,
EOF,
Ampersand,
QuestionMark,
Slash,
HttpMethod,
DictKey,
FuncName,
HttpMethod,
ParamName,
PathPart,
PeekLexer,
QuestionMark,
ShellOut,
DictKey,
EOF,
Slash,
UrlPathLexer,
)
from peek.parser import PeekParser, ParserEvent, ParserEventType
from peek.parser import ParserEvent, ParserEventType, PeekParser

_logger = logging.getLogger(__name__)

Expand Down
6 changes: 3 additions & 3 deletions peek/completions.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import json
import logging
from typing import Tuple, Any
from typing import Any, Tuple

from prompt_toolkit.buffer import CompletionState
from prompt_toolkit.completion import Completion
Expand Down Expand Up @@ -106,5 +106,5 @@ def serialise_and_indent_json(data, current_indent):

def monkey_patch_completion_state():
if CompletionState.new_text_and_position != proxy_new_text_and_position:
setattr(CompletionState, 'original_new_text_and_position', CompletionState.new_text_and_position)
setattr(CompletionState, 'new_text_and_position', proxy_new_text_and_position)
CompletionState.original_new_text_and_position = CompletionState.new_text_and_position
CompletionState.new_text_and_position = proxy_new_text_and_position
2 changes: 1 addition & 1 deletion peek/config.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import logging
import os
import platform
from os.path import expanduser, dirname
from os.path import dirname, expanduser
from typing import Iterable

from configobj import ConfigObj
Expand Down
Loading

0 comments on commit c50f1ff

Please sign in to comment.