mirror of
https://github.com/LazoCoder/Pokemon-Terminal
synced 2024-11-21 19:33:08 +00:00
Flake8 fix and formatting
This commit is contained in:
parent
13eb258488
commit
6bbb14c905
10 changed files with 27 additions and 17 deletions
3
.gitignore
vendored
3
.gitignore
vendored
|
@ -150,4 +150,7 @@ fabric.properties
|
|||
# .idea/misc.xml
|
||||
# *.ipr
|
||||
|
||||
# VSCode
|
||||
.vscode/
|
||||
|
||||
# End of https://www.gitignore.io/api/osx,python,pycharm
|
||||
|
|
|
@ -18,7 +18,8 @@ class ITerm(TerminalAdapterInterface):
|
|||
return os.environ.get("ITERM_PROFILE")
|
||||
|
||||
def __run_osascript(self, stream):
|
||||
p = subprocess.Popen(['osascript'], stdout=subprocess.PIPE, stdin=subprocess.PIPE)
|
||||
p = subprocess.Popen(['osascript'], stdout=subprocess.PIPE,
|
||||
stdin=subprocess.PIPE)
|
||||
p.stdin.write(stream)
|
||||
p.communicate()
|
||||
p.stdin.close()
|
||||
|
|
|
@ -151,7 +151,8 @@ def main(argv):
|
|||
action='store_true')
|
||||
either.add_argument(
|
||||
'id',
|
||||
help='Specify the desired pokemon ID or the exact (case insensitive) name',
|
||||
help='Specify the wanted pokemon ID or the exact (case insensitive)' +
|
||||
' name',
|
||||
nargs='?',
|
||||
default=0, const=0)
|
||||
options = parser.parse_args(argv)
|
||||
|
@ -212,7 +213,7 @@ def main(argv):
|
|||
|
||||
if is_slideshow and options.id <= 0 and size > 1:
|
||||
if options.slideshow <= 0:
|
||||
print("Time has to be greater then 0. (You can use decimals, e.g.: 0.1)")
|
||||
print("Time has to be greater then 0. You can use decimal values.")
|
||||
return
|
||||
target_func = scripter.change_wallpaper if options.wallpaper else \
|
||||
scripter.change_terminal
|
||||
|
|
|
@ -15,7 +15,8 @@ end tell"""
|
|||
|
||||
|
||||
def __run_osascript(stream):
|
||||
p = subprocess.Popen(['osascript'], stdout=subprocess.PIPE, stdin=subprocess.PIPE)
|
||||
p = subprocess.Popen(['osascript'], stdout=subprocess.PIPE,
|
||||
stdin=subprocess.PIPE)
|
||||
p.stdin.write(stream)
|
||||
p.communicate()
|
||||
p.stdin.close()
|
||||
|
@ -24,7 +25,8 @@ def __run_osascript(stream):
|
|||
def __linux_create_wallpaper_script(image_file_path):
|
||||
# If its gnome... aka GDMSESSION=gnome-xorg, etc.
|
||||
if "gnome" in os.environ.get("GDMSESSION"):
|
||||
fmt = 'gsettings set org.gnome.desktop.background picture-uri "file://{}"'
|
||||
fmt = 'gsettings set org.gnome.desktop.background ' +\
|
||||
'picture-uri "file://{}"'
|
||||
return fmt.format(image_file_path)
|
||||
# elif condition of KDE...
|
||||
else:
|
||||
|
|
4
setup.py
4
setup.py
|
@ -1,6 +1,4 @@
|
|||
#/usr/bin/env python3
|
||||
|
||||
|
||||
#!/usr/bin/env python3
|
||||
import os
|
||||
from setuptools import setup, find_packages
|
||||
|
||||
|
|
|
@ -2,8 +2,8 @@
|
|||
|
||||
# To run the tests, use: python3 -m pytest --capture=sys
|
||||
|
||||
#from pokemonterminal.database import Database
|
||||
#from tests.test_utils import expected_len
|
||||
from pokemonterminal.database import Database
|
||||
from tests.test_utils import expected_len
|
||||
|
||||
|
||||
def broken_test_extra_length(region_name='extra'):
|
||||
|
|
|
@ -137,7 +137,8 @@ def _test_region(region_name):
|
|||
# extra_count = extra_counts.get(region_name, 0)
|
||||
assert len(pokemon_list) == end - start + 1 # + extra_count
|
||||
# make sure that all pokemon.id == '---' or are in the ID range
|
||||
assert all([start <= int(p.get_id()) <= end for p in pokemon_list if p.get_id() != '---'])
|
||||
assert all([start <= int(p.get_id()) <= end for p in pokemon_list
|
||||
if p.get_id() != '---'])
|
||||
|
||||
|
||||
def test_regions_two():
|
||||
|
|
|
@ -21,7 +21,8 @@ def compare_pokemon(a, b):
|
|||
|
||||
|
||||
def test_len():
|
||||
assert len(Database()) == len(load_all_pokemon()) == MAX_ID + expected_len('extra')
|
||||
assert len(Database()) == len(load_all_pokemon()) \
|
||||
== MAX_ID + expected_len('extra')
|
||||
|
||||
|
||||
def test_lists():
|
||||
|
|
|
@ -66,7 +66,8 @@ def test_region(capsys):
|
|||
# matrix test of first pokemon name and last pokemon name from all regions
|
||||
for name, region_info in region_dict.items():
|
||||
filtered = [p for p in Filter.POKEMON_LIST
|
||||
if regFilter.matches(p, name) and noExtras.matches(p, None)]
|
||||
if regFilter.matches(p, name)
|
||||
and noExtras.matches(p, None)]
|
||||
assert len(filtered) == region_info.size
|
||||
assert random.choice(filtered).get_region() == name
|
||||
assert filtered[0].get_id() == ('%03d' % (region_info.start))
|
||||
|
|
|
@ -41,13 +41,15 @@ def test_database_single_arg(arg):
|
|||
elif arg == "get_random":
|
||||
print(db.get_random())
|
||||
else:
|
||||
print("No such public method '" + arg + "' with zero parameters exists in the Database class.")
|
||||
print("No such public method '" + arg + "' with zero parameters " +
|
||||
"exists in the Database class.")
|
||||
|
||||
|
||||
def test_database_double_arg(arg):
|
||||
# Test the database where there are two command line parameters.
|
||||
# The first parameter is the name of the method to test.
|
||||
# The second parameter is the input parameter for the method that is being test.
|
||||
# The second parameter is the input parameter for the method
|
||||
# that is being tested.
|
||||
arg1 = arg[1].lower()
|
||||
arg2 = arg[2].lower()
|
||||
db = Database()
|
||||
|
@ -68,9 +70,9 @@ def test_database_double_arg(arg):
|
|||
elif arg1 == "names_with_infix":
|
||||
print_items(db.names_with_infix(arg2))
|
||||
elif arg1 == "get_light":
|
||||
print_items(db.get_light(threshold=int(arg2)/10, all_pkmn=True))
|
||||
print_items(db.get_light(threshold=int(arg2) / 10, all_pkmn=True))
|
||||
elif arg1 == "get_dark":
|
||||
print_items(db.get_dark(threshold=int(arg2)/10, all_pkmn=True))
|
||||
print_items(db.get_dark(threshold=int(arg2) / 10, all_pkmn=True))
|
||||
else:
|
||||
print("No such public method '" + arg + "' with two parameters"
|
||||
" exists in the Database class.")
|
||||
|
|
Loading…
Reference in a new issue