Skip to content

Commit

Permalink
black formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
pnadolny13 committed Jul 27, 2023
1 parent 039171f commit 3421ac0
Showing 1 changed file with 21 additions and 7 deletions.
28 changes: 21 additions & 7 deletions hub_utils/meltano_util.py
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,10 @@ def _dedup_settings(reformatted_settings):
if name in reformatted_settings_2:
existing_setting = reformatted_settings_2.get(name)
existing_setting["description"] = ", ".join(
[existing_setting["description"], MeltanoUtil._clean_description(setting.get("description"))]
[
existing_setting["description"],
MeltanoUtil._clean_description(setting.get("description")),
]
)
else:
reformatted_settings_2[name] = setting
Expand Down Expand Up @@ -275,7 +278,7 @@ def _parse_sdk_about_settings(sdk_about_dict, enforce_desc=False):
description = MeltanoUtil._handle_description(
MeltanoUtil._clean_description(settings.get("description")),
name,
enforce_desc
enforce_desc,
)
setting_details = {
"name": name,
Expand Down Expand Up @@ -317,7 +320,9 @@ def _traverse_schema_properties(schema, field_sep="."):
reqs = value.get("required", [])
field = {
"name": full_name,
"description": MeltanoUtil._clean_description(subfield.get("description")),
"description": MeltanoUtil._clean_description(
subfield.get("description")
),
"default": subfield.get("default"),
"type": subfield.get("type"),
"title": subfield.get("title"),
Expand All @@ -336,7 +341,9 @@ def _traverse_schema_properties(schema, field_sep="."):
fields.append(
{
"name": key,
"description": MeltanoUtil._clean_description(value.get("description")),
"description": MeltanoUtil._clean_description(
value.get("description")
),
"default": value.get("default"),
"type": value.get("type"),
"title": value.get("title"),
Expand Down Expand Up @@ -378,7 +385,9 @@ def _split_sentence_endings(word_list):
desc_list_clean = []
for word in word_list:
if len(word.split(".")) > 1:
if not any(keyword in word for keyword in ("http", "ssh", "ssl", "e.g.")):
if not any(
keyword in word for keyword in ("http", "ssh", "ssl", "e.g.")
):
desc_list_clean.extend(word.replace(".", ". ").split())
continue
desc_list_clean.append(word)
Expand All @@ -398,12 +407,17 @@ def _capitalize(cleaned_sentence):
for elem in capital_list:
sentence_list = elem.split()
last_elem = MeltanoUtil._last_element(clean_capital_list)
if sentence_list[0][0].isupper() or sentence_list[0][0] == "'" or last_elem.endswith('e.g') or last_elem.endswith('i.e'):
if (
sentence_list[0][0].isupper()
or sentence_list[0][0] == "'"
or last_elem.endswith("e.g")
or last_elem.endswith("i.e")
):
clean_capital_list.append(" ".join(sentence_list))
else:
sentence_list[0] = sentence_list[0].capitalize()
clean_capital_list.append(" ".join(sentence_list))

return ". ".join(clean_capital_list)

@staticmethod
Expand Down

0 comments on commit 3421ac0

Please sign in to comment.