Address W504 linting rule

PEP 8 recommends not breaking lines immediately after operators.

Change-Id: Ic80fc9469257ac8382daa2435be28299a03b1ab9
This commit is contained in:
Jeremy Stanley 2025-04-03 17:03:09 +00:00
parent 5e3bc54373
commit 3178bac6f8
3 changed files with 12 additions and 12 deletions

View File

@ -1,6 +1,5 @@
[flake8]
exclude=.venv,.git,.nox,.tox,dist,doc,*lib/python*,*egg,build
# E123, E125 and W503 are invalid per PEP-8; OpenStack's H rules don't apply
# TODO: drop W504 once the scripts are adjusted to suit it
ignore = E123,E125,H,W503,W504
ignore = E123,E125,H,W503
show-source = True

View File

@ -66,8 +66,9 @@ publishing changes to online meeting schedules.
# parse arguments:
args = parser.parse_args()
if ((args.index_template and not args.index_output) or
(args.index_output and not args.index_template)):
if (
(args.index_template and not args.index_output)
or (args.index_output and not args.index_template)):
parser.error("You need to provide both -t and "
"-w if you want to output an index.")
if args.ical_dir and (args.calname or args.caldescription):

View File

@ -129,8 +129,8 @@ class Schedule(object):
# deal with meetings that start on day1 and end on day2.
self.meeting_start = datetime.datetime.combine(DATES[self.day],
self.time.time())
self.meeting_end = (self.meeting_start +
datetime.timedelta(minutes=self.duration))
self.meeting_end = (self.meeting_start
+ datetime.timedelta(minutes=self.duration))
if self.day == 'Sunday' and self.meeting_end.strftime("%a") == 'Mon':
self.meeting_start = self.meeting_start - ONE_WEEK
self.meeting_end = self.meeting_end - ONE_WEEK
@ -174,10 +174,10 @@ class Schedule(object):
# NOTE(tonyb): .meeting_start also includes the day of the week. So no
# need to check .day explictly
return ((self.irc == other.irc) and
((self.meeting_start < other.meeting_end) and
(other.meeting_start < self.meeting_end)) and
_non_weekly_conflict_detection(self, other))
return ((self.irc == other.irc)
and ((self.meeting_start < other.meeting_end)
and (other.meeting_start < self.meeting_end))
and _non_weekly_conflict_detection(self, other))
class Meeting(object):
@ -272,8 +272,8 @@ def load_meetings(yaml_source):
if os.path.splitext(f)[1] == '.yaml':
yaml_file = os.path.join(root, f)
meetings.append(Meeting.fromfile(yaml_file))
elif (os.path.isfile(yaml_source) and
os.path.splitext(yaml_source)[1] == '.yaml'):
elif (os.path.isfile(yaml_source)
and os.path.splitext(yaml_source)[1] == '.yaml'):
meetings.append(Meeting.fromfile(yaml_source))
elif isinstance(yaml_source, str):
return [Meeting.fromstring(yaml_source)]