Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Conversation

@sourcery-ai
Copy link

@sourcery-ai sourcery-ai bot commented Apr 21, 2022

Branch simples 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 simples branch, then run:

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

Help us improve this pull request!

@sourcery-ai sourcery-ai bot requested a review from edson-github April 21, 2022 12:58
Comment on lines -101 to +104
pontos=[self._transformar_em_ponto(a) for a in self._passaros+self._obstaculos+self._porcos]

return pontos
return [
self._transformar_em_ponto(a)
for a in self._passaros + self._obstaculos + self._porcos
]
Copy link
Author

Choose a reason for hiding this comment

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

Function Fase.calcular_pontos refactored with the following changes:

if s == sys.stdin:
return True
return False
return any(s == sys.stdin for s in i)
Copy link
Author

Choose a reason for hiding this comment

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

Function ouvir_teclado_fn refactored with the following changes:

  • Use any() instead of for loop (use-any)

Comment on lines -29 to +26
if eh_windows:
ouvir_teclado = msvcrt.kbhit
else:
ouvir_teclado = ouvir_teclado_fn

ouvir_teclado = msvcrt.kbhit if eh_windows else ouvir_teclado_fn
Copy link
Author

Choose a reason for hiding this comment

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

Lines 29-33 refactored with the following changes:

Comment on lines -57 to +50
entrada = ouvir_teclado()
if entrada:
if entrada := ouvir_teclado():
Copy link
Author

Choose a reason for hiding this comment

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

Function _jogar refactored with the following changes:

Comment on lines -82 to +90
rebobina(delta_t, fase, passo / velocidade_rebobina, tempo_final,
'Rebobinando %s vezes mais rápido!' % velocidade_rebobina)
rebobina(
delta_t,
fase,
passo / velocidade_rebobina,
tempo_final,
f'Rebobinando {velocidade_rebobina} vezes mais rápido!',
)

velocidade_replay = 1
_animar(delta_t, fase, passo / velocidade_replay, tempo, 'Replay %s vezes mais rápido!' % velocidade_replay)
_animar(
delta_t,
fase,
passo / velocidade_replay,
tempo,
f'Replay {velocidade_replay} vezes mais rápido!',
)

Copy link
Author

Choose a reason for hiding this comment

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

Function animar refactored with the following changes:

Comment on lines -18 to +21
for i in range(5):
for _ in range(5):
fase.adicionar_passaro(PassaroVermelho(30, 30))
# Adicionar Pássaros Amarelos
for i in range(30):
for _ in range(30):
Copy link
Author

Choose a reason for hiding this comment

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

Lines 18-21 refactored with the following changes:

Comment on lines -188 to +200
self.assertEqual(x_esperado, round(x_calculado), 'valor real de x = %s' % x_calculado)
self.assertEqual(y_esperado, round(y_calculado), 'valor real de y = %s' % y_calculado)
self.assertEqual(status_esperado, passaro.status, '(x = %s, y = %s)' % (x_calculado, y_calculado))
self.assertEqual(
x_esperado, round(x_calculado), f'valor real de x = {x_calculado}'
)

self.assertEqual(
y_esperado, round(y_calculado), f'valor real de y = {y_calculado}'
)

self.assertEqual(
status_esperado,
passaro.status,
f'(x = {x_calculado}, y = {y_calculado})',
)
Copy link
Author

Choose a reason for hiding this comment

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

Function PassaroBaseTests.assert_passaro_posicao refactored with the following changes:

Comment on lines -26 to +27
porcos = [Porco(1, 1) for i in range(2)] # criando 2 porcos
passaros = [PassaroAmarelo(1, 1) for i in range(2)] # criando 2 pássaros
porcos = [Porco(1, 1) for _ in range(2)]
passaros = [PassaroAmarelo(1, 1) for _ in range(2)]
Copy link
Author

Choose a reason for hiding this comment

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

Function FaseTestes.teste_acabou_com_porcos_e_passaros refactored with the following changes:

This removes the following comments ( why? ):

# criando 2 porcos
# criando 2 pássaros

Comment on lines -51 to +52
porcos = [Porco(1, 1) for i in range(2)]
passaros = [PassaroAmarelo(1, 1) for i in range(2)]
porcos = [Porco(1, 1) for _ in range(2)]
passaros = [PassaroAmarelo(1, 1) for _ in range(2)]
Copy link
Author

Choose a reason for hiding this comment

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

Function FaseTestes.teste_status refactored with the following changes:

Comment on lines -126 to +192
expected = set([Ponto(3, 3, 'A'), Ponto(3, 3, 'A'), Ponto(31, 10, 'O'), Ponto(78, 1, '@'),
Ponto(70, 1, '@'), Ponto(3, 3, 'V')])
expected = {
Ponto(3, 3, 'A'),
Ponto(3, 3, 'A'),
Ponto(31, 10, 'O'),
Ponto(78, 1, '@'),
Ponto(70, 1, '@'),
Ponto(3, 3, 'V'),
}

self.assertSetEqual(expected, set(fase_exemplo.calcular_pontos(0)))

fase_exemplo.lancar(45, 1)

# i variando de 1 até 2.9
for i in range(100, 300, 1):
for i in range(100, 300):
fase_exemplo.calcular_pontos(i / 100)

fase_exemplo.lancar(63, 3)

# i variando de 3 até 3.9
for i in range(300, 400, 1):
for i in range(300, 400):
fase_exemplo.calcular_pontos(i / 100)

fase_exemplo.lancar(23, 4)

expected = set([Ponto(32, 11, 'v'), Ponto(17, 25, 'A'), Ponto(3, 3, 'A'), Ponto(31, 10, ' '), Ponto(78, 1, '@'),
Ponto(70, 1, '@')])
expected = {
Ponto(32, 11, 'v'),
Ponto(17, 25, 'A'),
Ponto(3, 3, 'A'),
Ponto(31, 10, ' '),
Ponto(78, 1, '@'),
Ponto(70, 1, '@'),
}


self.assertSetEqual(expected, set(fase_exemplo.calcular_pontos(4)))

# i variando de 4 até 6.9
for i in range(400, 700, 1):
for i in range(400, 700):
fase_exemplo.calcular_pontos(i / 100)

expected = set(
[Ponto(32, 11, 'v'), Ponto(57, 30, 'A'), Ponto(70, 2, 'a'), Ponto(31, 10, ' '), Ponto(78, 1, '@'),
Ponto(70, 1, '+')])
expected = {
Ponto(32, 11, 'v'),
Ponto(57, 30, 'A'),
Ponto(70, 2, 'a'),
Ponto(31, 10, ' '),
Ponto(78, 1, '@'),
Ponto(70, 1, '+'),
}


self.assertSetEqual(expected, set(fase_exemplo.calcular_pontos(7)))

# i variando de 7 até 8.49
for i in range(700, 849, 1):
for i in range(700, 849):
fase_exemplo.calcular_pontos(i / 100)
print(fase_exemplo.calcular_pontos(8.5))

expected = set([Ponto(32, 11, 'v'), Ponto(77, 0, 'a'), Ponto(70, 2, 'a'), Ponto(31, 10, ' '), Ponto(78, 1, '+'),
Ponto(70, 1, '+')])
expected = {
Ponto(32, 11, 'v'),
Ponto(77, 0, 'a'),
Ponto(70, 2, 'a'),
Ponto(31, 10, ' '),
Ponto(78, 1, '+'),
Ponto(70, 1, '+'),
}

Copy link
Author

Choose a reason for hiding this comment

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

Function FaseTestes.teste_calcular_pontos 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.

1 participant

Morty Proxy This is a proxified and sanitized view of the page, visit original site.