Skip to content

Commit 63c9cb6

Browse files
AreadrillJoão Mota
andauthored
Fixing overly long lines (#42)
* Fixing overly long lines * Fix additional lint issues Co-authored-by: João Mota <[email protected]>
1 parent 2835559 commit 63c9cb6

File tree

4 files changed

+34
-10
lines changed

4 files changed

+34
-10
lines changed

setup.py

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@
1212
from os.path import splitext
1313
from setuptools import setup
1414

15+
changelog_url = 'https://github.com/ZigRazor/PyStateMachine/blob/master/CHANGELOG.md'
16+
1517

1618
def read(*names, **kwargs):
1719
with io.open(
@@ -27,7 +29,10 @@ def read(*names, **kwargs):
2729
license='GNU GENERAL PUBLIC LICENSE',
2830
description='PyStateMachine Package',
2931
long_description='%s\n%s' % (
30-
re.compile('^.. start-badges.*^.. end-badges', re.M | re.S).sub('', read('README.md')),
32+
re.compile(
33+
'^.. start-badges.*^.. end-badges',
34+
re.M | re.S
35+
).sub('', read('README.md')),
3136
re.sub(':[a-z]+:`~?(.*?)`', r'``\1``', read('CHANGELOG.md'))
3237
),
3338
author='ZigRazor',
@@ -40,7 +45,8 @@ def read(*names, **kwargs):
4045
include_package_data=True,
4146
zip_safe=False,
4247
classifiers=[
43-
# complete classifier list: http://pypi.python.org/pypi?%3Aaction=list_classifiers
48+
# complete classifier list:
49+
# http://pypi.python.org/pypi?%3Aaction=list_classifiers
4450
'Development Status :: 5 - Production/Stable',
4551
'Intended Audience :: Developers',
4652
'License :: OSI Approved :: GNU GENERAL PUBLIC LICENSE',
@@ -61,7 +67,7 @@ def read(*names, **kwargs):
6167
'Topic :: Utilities',
6268
],
6369
project_urls={
64-
'Changelog': 'https://github.com/ZigRazor/PyStateMachine/blob/master/CHANGELOG.md',
70+
'Changelog': changelog_url,
6571
'Issue Tracker': 'https://github.com/ZigRazor/PyStateMachine/issues',
6672
},
6773
keywords=[
@@ -86,4 +92,4 @@ def read(*names, **kwargs):
8692
'nameless = nameless.cli:main',
8793
]
8894
},
89-
)
95+
)

src/Event.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,14 @@
55
class Event:
66
"""Construct an Event class"""
77

8-
def __init__(self, name: str, to_state: str, pre_conditions: Conditions, post_conditions: Conditions, pre_actions: Actions, post_actions: Actions):
8+
def __init__(
9+
self, name: str,
10+
to_state: str,
11+
pre_conditions: Conditions,
12+
post_conditions: Conditions,
13+
pre_actions: Actions,
14+
post_actions: Actions
15+
):
916
"""Initialize Event Class"""
1017
self.name = name
1118
self.to_state = to_state

src/ReadStateMachine.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,13 @@ def ReadStateMachineFile(xml_file: str):
110110
post_actions = Actions(post_action_elements)
111111

112112
events[event_name] = Event(
113-
event_name, to_state, pre_conditions, post_conditions, pre_actions, post_actions)
113+
event_name,
114+
to_state,
115+
pre_conditions,
116+
post_conditions,
117+
pre_actions,
118+
post_actions
119+
)
114120
# print(event.to_string())
115121
elif state_child.tag == "Name":
116122
# print("Name element = ", state_child.text)

src/StateMachine.py

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,8 @@ class StateMachine:
1010
xml_file (str): The name of the xml that defines the state machine.
1111
states (list): list of possible states of the machine.
1212
current_state (str): the current state of the machine.
13-
context (dict): dictionary that contains the imported module at runtime for state machine operations.
13+
context (dict): dictionary that contains the imported module
14+
at runtime for state machine operations.
1415
saved_state (list): list of variables for restore state in case of rollback.
1516
"""
1617
def __init__(self, xml_file: str):
@@ -25,8 +26,11 @@ def __init__(self, xml_file: str):
2526
self.current_state = ""
2627
self.context = {}
2728
self.saved_state = None
28-
logging.basicConfig(filename=xml_file.split(sep=".xml")[
29-
0] + '.log', format='%(asctime)s - %(levelname)s - %(message)s', level=logging.DEBUG)
29+
logging.basicConfig(
30+
filename=xml_file.split(sep=".xml")[0] + '.log',
31+
format='%(asctime)s - %(levelname)s - %(message)s',
32+
level=logging.DEBUG
33+
)
3034

3135
def __CheckConditions(self, conditions):
3236
"""
@@ -35,7 +39,8 @@ def __CheckConditions(self, conditions):
3539
Parameters:
3640
conditions (list): List of condition to check.
3741
Returns:
38-
all_conditions_satisfied: a boolean that indicates if all conditions are satisfied
42+
all_conditions_satisfied:
43+
a boolean that indicates if all conditions are satisfied
3944
"""
4045
all_conditions_satisfied = True
4146
if conditions is not None:

0 commit comments

Comments
 (0)