diff --git a/src/resources/__init__.py b/src/resources/__init__.py new file mode 100644 index 0000000..1987b55 --- /dev/null +++ b/src/resources/__init__.py @@ -0,0 +1,17 @@ +""" + Author: Denis Nutiu + This file is part of scoreboard-benchmark. + + scoreboard-benchmark is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + scoreboard-benchmark is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with scoreboard-benchmark . If not, see . +""" \ No newline at end of file diff --git a/src/resources/utilities.py b/src/resources/utilities.py new file mode 100644 index 0000000..59ab02d --- /dev/null +++ b/src/resources/utilities.py @@ -0,0 +1,27 @@ +""" + Author: Denis Nutiu + This file is part of scoreboard-benchmark. + + scoreboard-benchmark is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + scoreboard-benchmark is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with scoreboard-benchmark . If not, see . +""" + + +def to_zero_count(page_no): + try: + page_no = int(page_no) - 1 + if page_no < 0: + page_no = 0 + except (TypeError, ValueError): # page_no is not an int + page_no = 0 + return page_no