Skip to content

Commit

Permalink
Remove all linting exceptions
Browse files Browse the repository at this point in the history
This resulted in me having to remove all trailing commas
from single line tuples. Although I prefer this style
for consistency reasons, following community standards
is prioritized.
  • Loading branch information
JakobGM committed May 23, 2018
1 parent fc0a080 commit b2330f1
Show file tree
Hide file tree
Showing 11 changed files with 24 additions and 28 deletions.
4 changes: 2 additions & 2 deletions astrality/actions.py
Original file line number Diff line number Diff line change
Expand Up @@ -552,7 +552,7 @@ def __init__(self, *args, **kwargs) -> None:
non_templates_action = self._options.get('non_templates', 'symlink')
self.ignore_non_templates = non_templates_action.lower() == 'ignore'

if non_templates_action.lower() not in ('copy', 'symlink', 'ignore',):
if non_templates_action.lower() not in ('copy', 'symlink', 'ignore'):
logger = logging.getLogger(__name__)
logger.error(
f'Invalid stow non_templates parameter:'
Expand Down Expand Up @@ -920,7 +920,7 @@ def run(
if result:
# Run action is not null object, so we can return results
command, stdout = result
results += ((command, stdout,),)
results += ((command, stdout),)

return results

Expand Down
2 changes: 1 addition & 1 deletion astrality/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ def user_configuration(
)

# Insert default global settings that are not specified
for section_name in ('astrality', 'modules',):
for section_name in ('astrality', 'modules'):
section_content = config.get(section_name, {})
config[section_name] = ASTRALITY_DEFAULT_GLOBAL_SETTINGS[section_name].copy() # type: ignore # noqa
config[section_name].update(section_content) # type: ignore
Expand Down
2 changes: 1 addition & 1 deletion astrality/context.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ def __init__(
self._dict = {}
self._max_key: Real = float(-inf)

if isinstance(content, (dict, Context,)):
if isinstance(content, (dict, Context)):
self.update(content)
elif isinstance(content, Path):
if content.is_file():
Expand Down
6 changes: 3 additions & 3 deletions astrality/event_listener.py
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ class Daylight(Solar):

type_ = 'daylight'

events = ('day', 'night',)
events = ('day', 'night')
default_event_listener_config = {
'type': 'daylight',
'longitude': 0,
Expand Down Expand Up @@ -294,7 +294,7 @@ def time_until_next_event(self) -> timedelta:
(datetime.now() - self.initialization_time) % self.timedelta


WorkDay = namedtuple('WorkDay', ('start', 'end',))
WorkDay = namedtuple('WorkDay', ('start', 'end'))


class TimeOfDay(EventListener):
Expand All @@ -305,7 +305,7 @@ class TimeOfDay(EventListener):
events are referring to worktime.
"""

events = ('on', 'off',)
events = ('on', 'off')
default_event_listener_config = {
'type': 'time_of_day',
'monday': '09:00-17:00',
Expand Down
4 changes: 2 additions & 2 deletions astrality/module.py
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,7 @@ def get_action_block(
assert name == 'on_modified'
return self.action_blocks[name][path] # type: ignore
else:
assert name in ('on_setup', 'on_startup', 'on_event', 'on_exit',)
assert name in ('on_setup', 'on_startup', 'on_event', 'on_exit')
return self.action_blocks[name] # type: ignore

def execute(
Expand Down Expand Up @@ -653,7 +653,7 @@ def execute(
:module: Specific module to be executed. If not provided, then all
managed modules will be executed.
"""
assert block in ('on_setup', 'on_startup', 'on_event', 'on_exit',)
assert block in ('on_setup', 'on_startup', 'on_event', 'on_exit')

modules: Iterable[Module]
if isinstance(module, Module):
Expand Down
2 changes: 1 addition & 1 deletion astrality/tests/actions/test_run_action.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ def test_that_dry_run_is_respected(tmpdir, caplog):
result = run_action.execute(dry_run=True)

# Command to be run and empty string should be returned
assert result == ('touch touched.tmp', '',)
assert result == ('touch touched.tmp', '')

# Command to be run should be logged
assert 'SKIPPED: ' in caplog.record_tuples[0][2]
Expand Down
8 changes: 4 additions & 4 deletions astrality/tests/module/test_external_modules.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,13 +48,13 @@ def temp_test_files(test_config_directory):
touch_target = module_dir / 'touched.tmp'
watch_touch_target = module_dir / 'watch_touched.tmp'

for file in (compile_target, touch_target, watch_touch_target,):
for file in (compile_target, touch_target, watch_touch_target):
if file.is_file():
os.remove(file)

yield compile_target, touch_target, watch_touch_target, watched_file

for file in (compile_target, touch_target, watch_touch_target,):
for file in (compile_target, touch_target, watch_touch_target):
if file.is_file():
os.remove(file)

Expand All @@ -81,7 +81,7 @@ def test_correct_relative_paths_used_in_external_module(
) = temp_test_files

# Sanity check before testing
for file in (compile_target, touch_target, watch_touch_target,):
for file in (compile_target, touch_target, watch_touch_target):
assert not file.is_file()

# Finish task and see if context import, compilation, and run has been
Expand Down Expand Up @@ -112,7 +112,7 @@ def test_that_external_module_contexts_are_imported_correctly(
application_config = {
'modules': {
'modules_directory': 'test_modules',
'enabled_modules': [{'name': 'module_with_context::*', }],
'enabled_modules': [{'name': 'module_with_context::*'}],
},
}

Expand Down
12 changes: 6 additions & 6 deletions astrality/tests/module/test_module.py
Original file line number Diff line number Diff line change
Expand Up @@ -781,10 +781,10 @@ def test_trigger_event_module_action(test_config_directory):
block='on_startup',
))
assert results == (
('echo startup', 'startup',),
('echo on_event', 'on_event',),
('echo exit', 'exit',),
('echo modified.templateA', 'modified.templateA',),
('echo startup', 'startup'),
('echo on_event', 'on_event'),
('echo exit', 'exit'),
('echo modified.templateA', 'modified.templateA'),
)

# Check that all context section imports are available in startup block
Expand Down Expand Up @@ -844,7 +844,7 @@ def test_not_using_list_when_specifiying_trigger_action(conf_path):
block='on_startup',
)
assert result == (
('echo on_event', 'on_event',),
('echo on_event', 'on_event'),
)


Expand Down Expand Up @@ -934,4 +934,4 @@ def test_defining_on_startup_block_at_root_indentation(caplog):
module_directory=Path('/'),
)
assert module.execute(action='run', block='on_startup') \
== (('echo overwritten', 'overwritten',),)
== (('echo overwritten', 'overwritten'),)
2 changes: 1 addition & 1 deletion astrality/tests/module/test_setup_block.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ def test_that_module_block_is_persisted():
SetupActionBlock,
)
assert module.execute(action='run', block='on_setup') == (
('echo first time!', 'first time!',),
('echo first time!', 'first time!'),
)

# After creating this module again, the run action should not be performed.
Expand Down
6 changes: 3 additions & 3 deletions astrality/tests/test_context.py
Original file line number Diff line number Diff line change
Expand Up @@ -112,9 +112,9 @@ def test_items(self):
config['font'] = 'Comic Sans'
config['5'] = '8'
assert list(config.items()) == [
('4', 'test',),
('font', 'Comic Sans',),
('5', '8',),
('4', 'test'),
('font', 'Comic Sans'),
('5', '8'),
]

def test_keys(self):
Expand Down
4 changes: 0 additions & 4 deletions setup.cfg
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
[pycodestyle]
ignore = E704, C819

[flake8]
max-line-length = 80
ignore = C819, E211, E704

[yapf]
based_on_style = pep8
Expand Down

0 comments on commit b2330f1

Please sign in to comment.