Skip to content

Commit

Permalink
Fixed linting errors.
Browse files Browse the repository at this point in the history
  • Loading branch information
patdaburu committed Jul 27, 2019
1 parent f0a218c commit c14d405
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 40 deletions.
3 changes: 2 additions & 1 deletion elastalk/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,9 @@
from pathlib import Path
import uuid
from typing import Iterable, Dict, Set
import toml
from dataclasses import dataclass, field
import toml


#: the module logger
__logger__: logging.Logger = logging.getLogger(__name__)
Expand Down
34 changes: 0 additions & 34 deletions elastalk/index.py

This file was deleted.

12 changes: 7 additions & 5 deletions elastalk/search.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,12 @@
from typing import Any, Iterable, Mapping, Tuple
import uuid

ID_FIELD = '_id' #: the standard name of the ID field


def extract_hit(
hit: Mapping[str, Any],
includes: Tuple[str] = ('_id',), # TODO: _id should be a constant
includes: Tuple[str] = (ID_FIELD,),
source: str = '_source'
) -> Mapping[str, Any]:
"""
Expand All @@ -29,19 +31,19 @@ def extract_hit(
doc = {
**{
k: hit.get(k) for k in includes
},
},
**hit.get(source)
}
# If the document ID is included...
if '_id' in doc:
if ID_FIELD in doc:
# ...convert it to a UUID.
doc['_id'] = uuid.UUID(doc.get('_id'))
doc[ID_FIELD] = uuid.UUID(doc.get(ID_FIELD))
return doc


def extract_hits(
result: Mapping[str, Any],
includes: Tuple[str] = ('_id',), # TODO: _id should be a constant
includes: Tuple[str] = (ID_FIELD,),
source: str = '_source'
) -> Iterable[Mapping[str, Any]]:
"""
Expand Down

0 comments on commit c14d405

Please sign in to comment.