Skip to content

Conversation

sourcery-ai[bot]
Copy link

@sourcery-ai sourcery-ai bot commented Sep 7, 2023

Branch master refactored by Sourcery.

If you're happy with these changes, merge this Pull Request using the Squash and merge strategy.

See our documentation here.

Run Sourcery locally

Reduce the feedback loop during development by using the Sourcery editor plugin:

Review changes via command line

To manually merge these changes, make sure you're on the master branch, then run:

git fetch origin sourcery/master
git merge --ff-only FETCH_HEAD
git reset HEAD^

Help us improve this pull request!

@sourcery-ai sourcery-ai bot requested a review from alastairherd September 7, 2023 08:53
Comment on lines -125 to +135
for elem in slide_dict:
if type(slide_dict[elem]) != list:
if slide_dict[elem].startswith("song") or slide_dict[elem].startswith("psalm"):
song_list.append(elem)
elif slide_dict[elem].startswith("catechism"):
catechism_list.append(elem)
elif type(slide_dict[elem]) == list:
for elem, value in slide_dict.items():
if type(value) == list:
if "reading" in slide_dict[elem][0]:
reading_list.append(elem)
elif slide_dict[elem][0] not in ['call_to_worship'] and slide_dict[elem][0] not in ['prayers']:
elif slide_dict[elem][0] not in ['call_to_worship', 'prayers']:
component_list.append(elem)

elif slide_dict[elem].startswith("song") or slide_dict[elem].startswith("psalm"):
song_list.append(elem)
elif slide_dict[elem].startswith("catechism"):
catechism_list.append(elem)
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lines 125-134 refactored with the following changes:

Comment on lines -211 to +229
params = {
'q': passage,
'include-headings': False,
'include-footnotes': False,
'include-verse-numbers': True,
'include-short-copyright': False,
'include-passage-references': False
}

headers = {
'Authorization': 'Token %s' % API_KEY
}

response = requests.get(API_URL, params=params, headers=headers)

passages = response.json()['passages']

result = passages[0].strip()
result = super_verse(result)
result = replace_text(result)

if passages:
return (result,passage)
else:
return 'Error: Passage not found'
params = {
'q': passage,
'include-headings': False,
'include-footnotes': False,
'include-verse-numbers': True,
'include-short-copyright': False,
'include-passage-references': False
}

headers = {'Authorization': f'Token {API_KEY}'}

response = requests.get(API_URL, params=params, headers=headers)

passages = response.json()['passages']

result = passages[0].strip()
result = super_verse(result)
result = replace_text(result)

return (result, passage) if passages else 'Error: Passage not found'
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Function get_esv_text refactored with the following changes:

Comment on lines -360 to +361
match = re.search(r"^(Psalm )?(\d{1,3})(:(([1-9]\d{0,2})-([1-9]\d{0,2})))?(\s\(([a-zA-Z])\))?(\s\((\d{0,2})\))?$", psalm_name)

if match:
if match := re.search(
r"^(Psalm )?(\d{1,3})(:(([1-9]\d{0,2})-([1-9]\d{0,2})))?(\s\(([a-zA-Z])\))?(\s\((\d{0,2})\))?$",
psalm_name,
):
if match.group(2):
psalm = match.group(2)
if match.group(7):
version = match.group(8)
else:
version = "a"
if match.group(9):
section = match.group(10)
else:
section = None
version = match.group(8) if match.group(7) else "a"
section = match.group(10) if match.group(9) else None
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Function psalm_getter refactored with the following changes:

Comment on lines -522 to +511
slide = prs.slides.add_slide(slide_layout)
return slide
return prs.slides.add_slide(slide_layout)
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Function slide_maker refactored with the following changes:

Comment on lines -63 to +82
params = {
'q': passage,
'include-headings': False,
'include-footnotes': False,
'include-verse-numbers': True,
'include-short-copyright': False,
'include-passage-references': False
}

headers = {
'Authorization': 'Token %s' % API_KEY
}

response = requests.get(API_URL, params=params, headers=headers)

passages = response.json()['passages']
params = {
'q': passage,
'include-headings': False,
'include-footnotes': False,
'include-verse-numbers': True,
'include-short-copyright': False,
'include-passage-references': False
}

result = passages[0].strip()
result = super_verse(result)
result = replace_text(result)

if passages:
return (result,passage)
else:
return 'Error: Passage not found'
headers = {'Authorization': f'Token {API_KEY}'}

response = requests.get(API_URL, params=params, headers=headers)

passages = response.json()['passages']

result = passages[0].strip()
result = super_verse(result)
result = replace_text(result)

return (result, passage) if passages else 'Error: Passage not found'
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Function get_esv_text refactored with the following changes:

Comment on lines -212 to +214
match = re.search(r"^(Psalm )?(\d{1,3})(:(([1-9]\d{0,2})-([1-9]\d{0,2})))?(\s\(([a-zA-Z])\))?(\s\((\d{0,2})\))?$", psalm_name)

if match:
if match := re.search(
r"^(Psalm )?(\d{1,3})(:(([1-9]\d{0,2})-([1-9]\d{0,2})))?(\s\(([a-zA-Z])\))?(\s\((\d{0,2})\))?$",
psalm_name,
):
if match.group(2):
psalm = match.group(2)
if match.group(7):
version = match.group(8)
else:
version = "a"
if match.group(9):
section = match.group(10)
else:
section = None
version = match.group(8) if match.group(7) else "a"
section = match.group(10) if match.group(9) else None
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Function psalm_getter refactored with the following changes:

slide_layout = prs.slide_layouts[layout_type]
slide = prs.slides.add_slide(slide_layout)
return slide
return prs.slides.add_slide(slide_layout)
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Function slide_maker refactored with the following changes:

Comment on lines -109 to +119
for elem in slide_dict:
if type(slide_dict[elem]) != list:
if slide_dict[elem].startswith("song") or slide_dict[elem].startswith("psalm"):
song_list.append(elem)
elif slide_dict[elem].startswith("catechism"):
catechism_list.append(elem)
elif type(slide_dict[elem]) == list:
for elem, value in slide_dict.items():
if type(value) == list:
if "reading" in slide_dict[elem][0]:
reading_list.append(elem)
elif slide_dict[elem][0] not in ['call_to_worship'] and slide_dict[elem][0] not in ['prayers']:
elif slide_dict[elem][0] not in ['call_to_worship', 'prayers']:
component_list.append(elem)

elif slide_dict[elem].startswith("song") or slide_dict[elem].startswith("psalm"):
song_list.append(elem)
elif slide_dict[elem].startswith("catechism"):
catechism_list.append(elem)
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lines 109-118 refactored with the following changes:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

0 participants