-
Notifications
You must be signed in to change notification settings - Fork 68
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
first try #25
base: master
Are you sure you want to change the base?
first try #25
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,27 +70,47 @@ | |||||||||
|
||||||||||
|
||||||||||
def capital_of_Idaho(): | ||||||||||
# Your code here | ||||||||||
capital = 'Boise' | ||||||||||
for i in STATES_CAPITALS: | ||||||||||
if STATES_CAPITALS[i] == capital: | ||||||||||
print('Q1:', STATES_CAPITALS[i]) | ||||||||||
pass | ||||||||||
|
||||||||||
def all_states(): | ||||||||||
# Your code here | ||||||||||
state = list(STATES_CAPITALS.keys()) | ||||||||||
print('Q2:', state) | ||||||||||
pass | ||||||||||
|
||||||||||
def all_capitals(): | ||||||||||
# Your code here | ||||||||||
capitals = list(STATES_CAPITALS.values()) | ||||||||||
print('Q3:', capitals) | ||||||||||
pass | ||||||||||
|
||||||||||
|
||||||||||
def states_capitals_string(): | ||||||||||
# Your code here | ||||||||||
list = [] | ||||||||||
for state, capital in STATES_CAPITALS.items(): | ||||||||||
list.append(state) | ||||||||||
list.append('->') | ||||||||||
list.append(capital) | ||||||||||
list.append(',') | ||||||||||
string = ' '.join(list) | ||||||||||
print('Q4:', string) | ||||||||||
pass | ||||||||||
|
||||||||||
|
||||||||||
|
||||||||||
def get_state(capital): | ||||||||||
pass | ||||||||||
|
||||||||||
|
||||||||||
capital_input = capital | ||||||||||
state_input = '' | ||||||||||
flag = 0 | ||||||||||
for state, capital in STATES_CAPITALS.items(): | ||||||||||
if capital == capital_input: | ||||||||||
state_input += state + ' ' | ||||||||||
flag = 1 | ||||||||||
if flag == 0: | ||||||||||
raise KeyError("value exist") | ||||||||||
return state_input | ||||||||||
|
||||||||||
def test_state_to_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 ℹ️ 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. |
||||||||||
assert 'Cheyenne' == STATES_CAPITALS['Wyoming'] | ||||||||||
|
@@ -102,17 +122,17 @@ def test_state_to_capital_unknown(): | |||||||||
|
||||||||||
|
||||||||||
def test_capital_to_state(): | ||||||||||
assert 'Wyoming' == get_state('Cheyenne') | ||||||||||
assert 'Wyoming' == get_state('Cheyenne').strip() | ||||||||||
|
||||||||||
|
||||||||||
def test_capital_to_state_unknown(): | ||||||||||
with pytest.raises(KeyError): | ||||||||||
get_state('') | ||||||||||
|
||||||||||
|
||||||||||
def main(): | ||||||||||
return pytest.main(__file__) | ||||||||||
|
||||||||||
def main(): | ||||||||||
return pytest.main(["StateCap.py"]) | ||||||||||
|
||||||||||
if __name__ == '__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. E305: expected 2 blank lines after class or function definition, found 1 ℹ️ 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. |
||||||||||
sys.exit(main()) |
Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
@@ -1,3 +1,4 @@ | ||||||||||||||||||||||||||
|
||||||||||||||||||||||||||
"""With this string: | ||||||||||||||||||||||||||
'monty pythons flying circus' | ||||||||||||||||||||||||||
Create a function that returns a sorted string with no duplicate characters | ||||||||||||||||||||||||||
|
@@ -9,23 +10,51 @@ | |||||||||||||||||||||||||
Example: ['mont', 'y py', 'thon', 's fl', 'ying', ' cir', 'cus'] | ||||||||||||||||||||||||||
### git comment | ||||||||||||||||||||||||||
""" | ||||||||||||||||||||||||||
|
||||||||||||||||||||||||||
import pytest | ||||||||||||||||||||||||||
|
||||||||||||||||||||||||||
string='monty pythons flying circus' | ||||||||||||||||||||||||||
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. E225: missing whitespace around operator ❗❗ 2 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. |
||||||||||||||||||||||||||
|
||||||||||||||||||||||||||
def no_duplicates(a_string): | ||||||||||||||||||||||||||
sort='' | ||||||||||||||||||||||||||
for i in a_string: | ||||||||||||||||||||||||||
if i != ' ': | ||||||||||||||||||||||||||
if i not in sort: | ||||||||||||||||||||||||||
sort = sort + i | ||||||||||||||||||||||||||
yep = sorted(sort) | ||||||||||||||||||||||||||
string=''.join(yep) | ||||||||||||||||||||||||||
return string | ||||||||||||||||||||||||||
pass | ||||||||||||||||||||||||||
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. vulture-100: unreachable code after 'return' ❗❗ 2 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. |
||||||||||||||||||||||||||
|
||||||||||||||||||||||||||
|
||||||||||||||||||||||||||
def reversed_words(a_string): | ||||||||||||||||||||||||||
pass | ||||||||||||||||||||||||||
spl = a_string.split() | ||||||||||||||||||||||||||
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. E111: indentation is not a multiple of 4 ❗❗ 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. 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. E117: over-indented ℹ️ 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. |
||||||||||||||||||||||||||
reverse = spl[::-1] | ||||||||||||||||||||||||||
return reverse | ||||||||||||||||||||||||||
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. E111: indentation is not a multiple of 4 ℹ️ 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 | ||||||||||||||||||||||||||
|
||||||||||||||||||||||||||
|
||||||||||||||||||||||||||
def four_char_strings(a_string): | ||||||||||||||||||||||||||
pass | ||||||||||||||||||||||||||
j = 0 | ||||||||||||||||||||||||||
temp = '' | ||||||||||||||||||||||||||
new_string = [] | ||||||||||||||||||||||||||
print('Start:' + a_string) | ||||||||||||||||||||||||||
for i in a_string: | ||||||||||||||||||||||||||
temp = temp + i | ||||||||||||||||||||||||||
if j == 3: | ||||||||||||||||||||||||||
new_string.append(temp) | ||||||||||||||||||||||||||
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. E117: over-indented ℹ️ 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. |
||||||||||||||||||||||||||
temp = '' | ||||||||||||||||||||||||||
j = 0 | ||||||||||||||||||||||||||
else: | ||||||||||||||||||||||||||
j = j + 1 | ||||||||||||||||||||||||||
new_string.append(temp) | ||||||||||||||||||||||||||
return new_string | ||||||||||||||||||||||||||
|
||||||||||||||||||||||||||
pass | ||||||||||||||||||||||||||
|
||||||||||||||||||||||||||
def test_no_duplicates(): | ||||||||||||||||||||||||||
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 ℹ️ 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. |
||||||||||||||||||||||||||
s = 'monty pythons flying circus' | ||||||||||||||||||||||||||
assert no_duplicates(s) == ' cfghilmnoprstuy' | ||||||||||||||||||||||||||
assert no_duplicates(s) == 'cfghilmnoprstuy' | ||||||||||||||||||||||||||
|
||||||||||||||||||||||||||
|
||||||||||||||||||||||||||
def test_reversed_words(): | ||||||||||||||||||||||||||
|
@@ -38,10 +67,13 @@ def test_four_char_strings(): | |||||||||||||||||||||||||
assert four_char_strings(s) == ['mont', 'y py', 'thon', 's fl', 'ying', ' cir', 'cus'] | ||||||||||||||||||||||||||
|
||||||||||||||||||||||||||
|
||||||||||||||||||||||||||
|
||||||||||||||||||||||||||
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. E303: too many blank lines (3) ℹ️ 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__) | ||||||||||||||||||||||||||
|
||||||||||||||||||||||||||
return pytest.main(["strings.py"]) | ||||||||||||||||||||||||||
|
||||||||||||||||||||||||||
if __name__ == '__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. E305: expected 2 blank lines after class or function definition, found 1 ℹ️ 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. |
||||||||||||||||||||||||||
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.
E302: expected 2 blank lines, found 1
ℹ️ 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|tool
from 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.