-
Notifications
You must be signed in to change notification settings - Fork 68
Vladisla2000 sol #26
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Vladisla2000 sol #26
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -70,32 +70,29 @@ | |||||||||||||||||
|
|
||||||||||||||||||
|
|
||||||||||||||||||
| def capital_of_Idaho(): | ||||||||||||||||||
| # Your code here | ||||||||||||||||||
| pass | ||||||||||||||||||
| return STATES_CAPITALS['Idaho'] | ||||||||||||||||||
|
|
||||||||||||||||||
| def all_states(): | ||||||||||||||||||
| # Your code here | ||||||||||||||||||
| pass | ||||||||||||||||||
| return list(STATES_CAPITALS.keys()) | ||||||||||||||||||
|
|
||||||||||||||||||
| def all_capitals(): | ||||||||||||||||||
| # Your code here | ||||||||||||||||||
| pass | ||||||||||||||||||
| return list(STATES_CAPITALS.values()) | ||||||||||||||||||
|
|
||||||||||||||||||
| def states_capitals_string(): | ||||||||||||||||||
| # Your code here | ||||||||||||||||||
| pass | ||||||||||||||||||
|
|
||||||||||||||||||
|
|
||||||||||||||||||
| return ', '.join(f'{state} -> {capital}' for state, capital in sorted(STATES_CAPITALS.items())) | ||||||||||||||||||
|
|
||||||||||||||||||
| def get_state(capital): | ||||||||||||||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. E302: expected 2 blank lines, found 1 ❗❗ 3 similar findings have been found in this PR 🔎 Expand here to view all instances of this finding
Visit the Lift Web Console to find more details in your report. ℹ️ Expand to see all @sonatype-lift commandsYou can reply with the following commands. For example, reply with @sonatype-lift ignoreall to leave out all findings.
Note: When talking to LiftBot, you need to refresh the page to see its response. |
||||||||||||||||||
| pass | ||||||||||||||||||
|
|
||||||||||||||||||
| states = [state for state, cap in STATES_CAPITALS.items() if cap == capital] | ||||||||||||||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. E501: line too long (80 > 79 characters) ℹ️ Expand to see all @sonatype-lift commandsYou can reply with the following commands. For example, reply with @sonatype-lift ignoreall to leave out all findings.
Note: When talking to LiftBot, you need to refresh the page to see its response. |
||||||||||||||||||
| if not states: | ||||||||||||||||||
| raise KeyError("No state found for the given capital.") | ||||||||||||||||||
| if len(states) > 1: | ||||||||||||||||||
| raise ValueError("Multiple states have the same capital.") | ||||||||||||||||||
| return states[0] | ||||||||||||||||||
|
|
||||||||||||||||||
|
|
||||||||||||||||||
| def test_state_to_capital(): | ||||||||||||||||||
| assert 'Cheyenne' == STATES_CAPITALS['Wyoming'] | ||||||||||||||||||
|
|
||||||||||||||||||
|
|
||||||||||||||||||
| def test_state_to_capital_unknown(): | ||||||||||||||||||
| with pytest.raises(KeyError): | ||||||||||||||||||
| STATES_CAPITALS[''] | ||||||||||||||||||
|
|
@@ -104,14 +101,15 @@ def test_state_to_capital_unknown(): | |||||||||||||||||
| def test_capital_to_state(): | ||||||||||||||||||
| assert 'Wyoming' == get_state('Cheyenne') | ||||||||||||||||||
|
|
||||||||||||||||||
|
|
||||||||||||||||||
| def test_capital_to_state_unknown(): | ||||||||||||||||||
| with pytest.raises(KeyError): | ||||||||||||||||||
| get_state('') | ||||||||||||||||||
|
|
||||||||||||||||||
|
|
||||||||||||||||||
| #def main(): | ||||||||||||||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. E265: block comment should start with '# ' ℹ️ Expand to see all @sonatype-lift commandsYou can reply with the following commands. For example, reply with @sonatype-lift ignoreall to leave out all findings.
Note: When talking to LiftBot, you need to refresh the page to see its response. |
||||||||||||||||||
| # return pytest.main(__file__) | ||||||||||||||||||
|
|
||||||||||||||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. W293: blank line contains whitespace ℹ️ Expand to see all @sonatype-lift commandsYou can reply with the following commands. For example, reply with @sonatype-lift ignoreall to leave out all findings.
Note: When talking to LiftBot, you need to refresh the page to see its response. |
||||||||||||||||||
| def main(): | ||||||||||||||||||
| return pytest.main(__file__) | ||||||||||||||||||
| return pytest.main([__file__]) | ||||||||||||||||||
|
|
||||||||||||||||||
|
|
||||||||||||||||||
| if __name__ == '__main__': | ||||||||||||||||||
|
|
||||||||||||||||||
| Original file line number | Diff line number | Diff line change | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|
| @@ -1,26 +1,15 @@ | ||||||||||
| """With this string: | ||||||||||
| 'monty pythons flying circus' | ||||||||||
| Create a function that returns a sorted string with no duplicate characters | ||||||||||
| (keep any whitespace): | ||||||||||
| Example: ' cfghilmnoprstuy' | ||||||||||
| Create a function that returns the words in reverse order: | ||||||||||
| Example: ['circus', 'flying', 'pythons', 'monty'] | ||||||||||
| Create a function that returns a list of 4 character strings: | ||||||||||
| Example: ['mont', 'y py', 'thon', 's fl', 'ying', ' cir', 'cus'] | ||||||||||
| ### git comment | ||||||||||
| """ | ||||||||||
| import pytest | ||||||||||
|
|
||||||||||
| def no_duplicates(a_string): | ||||||||||
| pass | ||||||||||
| return ''.join(sorted(set(a_string))) | ||||||||||
|
|
||||||||||
|
|
||||||||||
| def reversed_words(a_string): | ||||||||||
| pass | ||||||||||
| return a_string.split()[::-1] | ||||||||||
|
|
||||||||||
|
|
||||||||||
| def four_char_strings(a_string): | ||||||||||
| pass | ||||||||||
| return [a_string[i:i+4] for i in range(0, len(a_string), 4)] | ||||||||||
|
|
||||||||||
|
|
||||||||||
| def test_no_duplicates(): | ||||||||||
|
|
@@ -39,9 +28,9 @@ def test_four_char_strings(): | |||||||||
|
|
||||||||||
|
|
||||||||||
| def main(): | ||||||||||
| return pytest.main(__file__) | ||||||||||
| return pytest.main([__file__]) | ||||||||||
|
|
||||||||||
|
|
||||||||||
| if __name__ == '__main__': | ||||||||||
| main() | ||||||||||
|
|
||||||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. W391: blank line at end of file ℹ️ Expand to see all @sonatype-lift commandsYou can reply with the following commands. For example, reply with @sonatype-lift ignoreall to leave out all findings.
Note: When talking to LiftBot, you need to refresh the page to see its response. |
||||||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
E501: line too long (99 > 79 characters)
ℹ️ Expand to see all @sonatype-lift commands
You can reply with the following commands. For example, reply with @sonatype-lift ignoreall to leave out all findings.
@sonatype-lift ignore@sonatype-lift ignoreall@sonatype-lift exclude <file|issue|path|tool>file|issue|path|toolfrom Lift findings by updating your config.toml fileNote: When talking to LiftBot, you need to refresh the page to see its response.
Click here to add LiftBot to another repo.