Skip to content

Commit

Permalink
Fix linting
Browse files Browse the repository at this point in the history
  • Loading branch information
V1NAY8 committed Mar 31, 2022
1 parent ba97ee4 commit ed80b7f
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 1 deletion eland/ndframe.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,10 +57,10 @@
class NDFrame(ABC):
def __init__(
self,
es_index_pattern: str,
es_client: Optional[
Union[str, List[str], Tuple[str, ...], "Elasticsearch"]
] = None,
es_index_pattern: Optional[str] = None,
columns: Optional[List[str]] = None,
es_index_field: Optional[str] = None,
_query_compiler: Optional[QueryCompiler] = None,
Expand Down
8 changes: 4 additions & 4 deletions eland/operations.py
Original file line number Diff line number Diff line change
Expand Up @@ -416,7 +416,7 @@ def _metric_aggs(
fields=fields,
es_aggs=es_aggs,
pd_aggs=pd_aggs,
response=response,
response=response, # type: ignore
numeric_only=numeric_only,
is_dataframe_agg=is_dataframe_agg,
percentiles=percentiles,
Expand Down Expand Up @@ -453,7 +453,7 @@ def _terms_aggs(
body.terms_aggs(field, func, field, es_size=es_size)

response = query_compiler._client.search(
index=query_compiler._index_pattern, size=0, body=body.to_search_body()
index=query_compiler._index_pattern, size=0, **body.to_search_body()
)

results = {}
Expand Down Expand Up @@ -499,7 +499,7 @@ def _hist_aggs(
body.hist_aggs(field, field, min_aggs[field], max_aggs[field], num_bins)

response = query_compiler._client.search(
index=query_compiler._index_pattern, size=0, body=body.to_search_body()
index=query_compiler._index_pattern, size=0, **body.to_search_body()
)
# results are like
# "aggregations" : {
Expand Down Expand Up @@ -1040,7 +1040,7 @@ def bucket_generator(
res = query_compiler._client.search(
index=query_compiler._index_pattern,
size=0,
body=body.to_search_body(),
**body.to_search_body(),
)

# Pagination Logic
Expand Down
4 changes: 2 additions & 2 deletions eland/query.py
Original file line number Diff line number Diff line change
Expand Up @@ -322,11 +322,11 @@ def to_search_body(self) -> Dict[str, Any]:
body["query"] = self._query.build()
return body

def to_count_body(self) -> Optional[Dict[str, Any]]:
def to_count_body(self) -> Dict[str, Any]:
if len(self._aggs) > 0:
warnings.warn(f"Requesting count for agg query {self}")
if self._query.empty():
return None
return {}
else:
return {"query": self._query.build()}

Expand Down
4 changes: 2 additions & 2 deletions eland/query_compiler.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,18 +77,18 @@ class QueryCompiler:

def __init__(
self,
index_pattern: str,
client: Optional[
Union[str, List[str], Tuple[str, ...], "Elasticsearch"]
] = None,
index_pattern: Optional[str] = None,
display_names: Optional[List[str]] = None,
index_field: Optional[str] = None,
to_copy: Optional["QueryCompiler"] = None,
) -> None:
# Implement copy as we don't deep copy the client
if to_copy is not None:
self._client: "Elasticsearch" = to_copy._client
self._index_pattern: Optional[str] = to_copy._index_pattern
self._index_pattern: str = to_copy._index_pattern
self._index: "Index" = Index(self, to_copy._index.es_index_field)
self._operations: "Operations" = copy.deepcopy(to_copy._operations)
self._mappings: FieldMappings = copy.deepcopy(to_copy._mappings)
Expand Down

0 comments on commit ed80b7f

Please sign in to comment.