Improving coding style

This commit is contained in:
Denis-Cosmin Nutiu 2017-05-27 21:30:50 +03:00
parent 632397ba7b
commit 7e6ea787bd
5 changed files with 6 additions and 8 deletions

View file

@ -14,7 +14,7 @@
You should have received a copy of the GNU General Public License You should have received a copy of the GNU General Public License
along with scoreboard-benchmark . If not, see <http://www.gnu.org/licenses/>. along with scoreboard-benchmark . If not, see <http://www.gnu.org/licenses/>.
This the configuration file for the GUnicorn server. This the configuration file for the GUnicorn server.
""" """
import multiprocessing import multiprocessing

View file

@ -26,7 +26,6 @@ def to_zero_count(page_no):
""" """
Will subtract 1 from the argument it gets, converting it to an int. Will subtract 1 from the argument it gets, converting it to an int.
If the conversion fails or the argument it's negatives it returns zero instead. If the conversion fails or the argument it's negatives it returns zero instead.
>>> to_zero_count(3) >>> to_zero_count(3)
2 2
>>> to_zero_count('a') >>> to_zero_count('a')
@ -61,7 +60,7 @@ def get_env_variable(variable, fallback):
Returns: Returns:
On success is returns the variable's value from the environment, on failure it returns the On success is returns the variable's value from the environment, on failure it returns the
value provided by fallback value provided by fallback
>>> get_env_variable('HOMES', 'fallback') >>> get_env_variable('HOMES', 'fallback')
'fallback' 'fallback'

View file

@ -24,7 +24,7 @@
<td>{{ item.gpu | truncate(50) }}</td> <td>{{ item.gpu | truncate(50) }}</td>
<td>{{ item.cpu | truncate(50) }}</td> <td>{{ item.cpu | truncate(50) }}</td>
<td>{{ item.score }}</td> <td>{{ item.score }}</td>
<td><a href="{{ url_for('scoreboard.result', id=item.id) }}" target="_blank">See more</a></td> <td><a href="{{ url_for('scoreboard.result', rid=item.id) }}" target="_blank">See more</a></td>
</tr> </tr>
{% endfor %} {% endfor %}
</tbody> </tbody>

View file

@ -83,13 +83,13 @@ def result_post():
@utilities.cache.cached(timeout=60*5) @utilities.cache.cached(timeout=60*5)
@scoreboard.route("/result/<id>", methods=['GET']) @scoreboard.route("/result/<rid>", methods=['GET'])
def result(id): def result(rid):
""" """
Fetches an entry from the database and displays it in a view. Fetches an entry from the database and displays it in a view.
The entry is retrieved from the database and the ID is a primary key for the entry. The entry is retrieved from the database and the ID is a primary key for the entry.
""" """
entry_name = Result.query.filter_by(id=id).first() entry_name = Result.query.filter_by(id=rid).first()
if entry_name: if entry_name:
progress_bar_data = dict() progress_bar_data = dict()
progress_bar_data['value'] = utilities.get_progress_bar_score(entry_name.score) progress_bar_data['value'] = utilities.get_progress_bar_score(entry_name.score)

View file

@ -55,7 +55,6 @@ class UtilitiesTestCase(unittest.TestCase):
self.assertEqual(9, r) self.assertEqual(9, r)
def test_get_environment_variable(self): def test_get_environment_variable(self):
import os
self.assertEqual(ut.get_env_variable("TESTING", "false"), 'false') self.assertEqual(ut.get_env_variable("TESTING", "false"), 'false')
os.environ['TESTING'] = 'True' os.environ['TESTING'] = 'True'
self.assertEqual(ut.get_env_variable("TESTING", "false"), 'True') self.assertEqual(ut.get_env_variable("TESTING", "false"), 'True')