Skip to content

Commit

Permalink
Fix lint
Browse files Browse the repository at this point in the history
  • Loading branch information
rexruan committed Mar 18, 2024
1 parent 3969ff3 commit 0bfbe12
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 6 deletions.
4 changes: 2 additions & 2 deletions server/lib/fetch_features.py
Original file line number Diff line number Diff line change
Expand Up @@ -145,8 +145,8 @@ def get_features_for_items(
"scalar": [feature_data.get("scalar")]
}
for feature_name, feature_data in _aspect_dict.items():
feature_data["mean"] = mean(value for value in feature_data["mean"] if value != "")
feature_data["median"] = median(value for value in feature_data["median"] if value != "")
feature_data["mean"] = mean([value for value in feature_data["mean"] if value != ""])
feature_data["median"] = median([value for value in feature_data["median"] if value != ""])
feature_data["scalar"] = r2(sum(value for value in feature_data["scalar"] if value))

aspect_data.append({
Expand Down
1 change: 1 addition & 0 deletions server/lib/fetch_lengths.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@

def fetch_lengths(category: str, tagset: str, data: Dict[str, Any], db: Session) -> Dict[str, Any]:
language = data["lang"]
# breakpoint()
texts = [text for text in get_texts(db, language, category=category) if text.parsed]
type_dict, pos_dict = get_type_and_pos_dicts(category=category, tagset=tagset, texts=texts)

Expand Down
6 changes: 3 additions & 3 deletions server/lib/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@

def get_texts(db: Session, language: str, category: Optional[str] = None) -> List[Text]:

texts = db.query(Text).filter(Text.language == language).filter(Text.activated is True)
texts = db.query(Text).filter(Text.language == language).filter(Text.activated == True) # pylint: disable=singleton-comparison

if category == "norm":
return [text for text in texts.filter(Text.normalized is True)] # pylint: disable=unnecessary-comprehension
return [text for text in texts.filter(Text.normalized == True)] # pylint: disable=unnecessary-comprehension, singleton-comparison
if category == "lemma":
return [text for text in texts.filter(Text.tagged is True)] # pylint: disable=unnecessary-comprehension
return [text for text in texts.filter(Text.tagged == True)] # pylint: disable=unnecessary-comprehension, singleton-comparison

return [text for text in texts] # pylint: disable=unnecessary-comprehension

Expand Down
2 changes: 1 addition & 1 deletion swegram_main/version.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
"""version module"""

VERSION = "2.1.3"
VERSION = "2.1.4"

0 comments on commit 0bfbe12

Please sign in to comment.