Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 14 additions & 16 deletions StateCap.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()))
Copy link

Choose a reason for hiding this comment

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

3% of developers fix this issue

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.

Command Usage
@sonatype-lift ignore Leave out the above finding from this PR
@sonatype-lift ignoreall Leave out all the existing findings from this PR
@sonatype-lift exclude <file|issue|path|tool> Exclude specified file|issue|path|tool from Lift findings by updating your config.toml file

Note: When talking to LiftBot, you need to refresh the page to see its response.
Click here to add LiftBot to another repo.


def get_state(capital):
Copy link

Choose a reason for hiding this comment

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

7% of developers fix this issue

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
File Path Line Number
StateCap.py 96
StateCap.py 104
StateCap.py 111

Visit the Lift Web Console to find more details in your report.


ℹ️ 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.

Command Usage
@sonatype-lift ignore Leave out the above finding from this PR
@sonatype-lift ignoreall Leave out all the existing findings from this PR
@sonatype-lift exclude <file|issue|path|tool> Exclude specified file|issue|path|tool from Lift findings by updating your config.toml file

Note: When talking to LiftBot, you need to refresh the page to see its response.
Click here to add LiftBot to another repo.

pass

states = [state for state, cap in STATES_CAPITALS.items() if cap == capital]
Copy link

Choose a reason for hiding this comment

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

3% of developers fix this issue

E501: line too long (80 > 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.

Command Usage
@sonatype-lift ignore Leave out the above finding from this PR
@sonatype-lift ignoreall Leave out all the existing findings from this PR
@sonatype-lift exclude <file|issue|path|tool> Exclude specified file|issue|path|tool from Lift findings by updating your config.toml file

Note: When talking to LiftBot, you need to refresh the page to see its response.
Click here to add LiftBot to another repo.

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['']
Expand All @@ -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():
Copy link

Choose a reason for hiding this comment

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

5% of developers fix this issue

E265: block comment should start with '# '


ℹ️ 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.

Command Usage
@sonatype-lift ignore Leave out the above finding from this PR
@sonatype-lift ignoreall Leave out all the existing findings from this PR
@sonatype-lift exclude <file|issue|path|tool> Exclude specified file|issue|path|tool from Lift findings by updating your config.toml file

Note: When talking to LiftBot, you need to refresh the page to see its response.
Click here to add LiftBot to another repo.

# return pytest.main(__file__)

Copy link

Choose a reason for hiding this comment

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

12% of developers fix this issue

W293: blank line contains whitespace


ℹ️ 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.

Command Usage
@sonatype-lift ignore Leave out the above finding from this PR
@sonatype-lift ignoreall Leave out all the existing findings from this PR
@sonatype-lift exclude <file|issue|path|tool> Exclude specified file|issue|path|tool from Lift findings by updating your config.toml file

Note: When talking to LiftBot, you need to refresh the page to see its response.
Click here to add LiftBot to another repo.

def main():
return pytest.main(__file__)
return pytest.main([__file__])


if __name__ == '__main__':
Expand Down
Binary file added __pycache__/StateCap.cpython-310-pytest-6.2.5.pyc
Binary file not shown.
Binary file added __pycache__/strings.cpython-310-pytest-6.2.5.pyc
Binary file not shown.
21 changes: 5 additions & 16 deletions strings.py
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():
Expand All @@ -39,9 +28,9 @@ def test_four_char_strings():


def main():
return pytest.main(__file__)
return pytest.main([__file__])


if __name__ == '__main__':
main()

Copy link

Choose a reason for hiding this comment

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

22% of developers fix this issue

W391: blank line at end of file


ℹ️ 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.

Command Usage
@sonatype-lift ignore Leave out the above finding from this PR
@sonatype-lift ignoreall Leave out all the existing findings from this PR
@sonatype-lift exclude <file|issue|path|tool> Exclude specified file|issue|path|tool from Lift findings by updating your config.toml file

Note: When talking to LiftBot, you need to refresh the page to see its response.
Click here to add LiftBot to another repo.