From a95fe2d310085abe2b4ee726d31af7f922f82d71 Mon Sep 17 00:00:00 2001 From: Kevin Steves Date: Fri, 13 Jan 2023 12:49:57 -0800 Subject: [PATCH] pycodestyle --- bin/panxapi.py | 19 ++++++++++--------- lib/pan/commit.py | 6 +++--- lib/pan/xapi.py | 4 ++-- 3 files changed, 15 insertions(+), 14 deletions(-) diff --git a/bin/panxapi.py b/bin/panxapi.py index 007fad9..2d1ff52 100755 --- a/bin/panxapi.py +++ b/bin/panxapi.py @@ -70,7 +70,8 @@ def main(): try: xapi = pan.xapi.PanXapi(timeout=options['timeout'], - tag=None if not options['tag'] else options['tag'], + tag=None if not options['tag'] + else options['tag'], use_http=options['use_http'], use_get=options['use_get'], api_username=options['api_username'], @@ -164,7 +165,7 @@ def main(): action = 'dynamic-update' kwargs = { 'cmd': options['cmd'], - } + } if options['ad_hoc'] is not None: extra_qs_used = True kwargs['extra_qs'] = options['ad_hoc'] @@ -279,7 +280,7 @@ def main(): kwargs = { 'cmd': options['op'], 'cmd_xml': options['cmd_xml'], - } + } if options['ad_hoc'] is not None: extra_qs_used = True kwargs['extra_qs'] = options['ad_hoc'] @@ -327,7 +328,7 @@ def main(): 'sync': options['sync'], 'interval': options['interval'], 'timeout': options['job_timeout'], - } + } if options['ad_hoc'] is not None: extra_qs_used = True kwargs['extra_qs'] = options['ad_hoc'] @@ -432,7 +433,7 @@ def parse_opts(): 'element': None, 'cmd': None, 'timeout': None, - } + } valid_where = ['after', 'before', 'top', 'bottom'] @@ -483,14 +484,14 @@ def parse_opts(): options['force'] = True elif opt == '--partial': if arg: - l = get_parts(arg) - [options['partial'].append(s) for s in l] + x = get_parts(arg) + [options['partial'].append(s) for s in x] elif opt == '--sync': options['sync'] = True elif opt == '--vsys': if arg: - l = get_vsys(arg) - [options['vsys'].append(s) for s in l] + x = get_vsys(arg) + [options['vsys'].append(s) for s in x] elif opt == '-A': options['commit_all'] = True options['cmd'] = get_element(arg) diff --git a/lib/pan/commit.py b/lib/pan/commit.py index 00ca3f8..52d1c6b 100644 --- a/lib/pan/commit.py +++ b/lib/pan/commit.py @@ -25,7 +25,7 @@ 'shared-object-excluded', 'no-vsys', 'vsys', - ]) +]) _part_xml = { 'device-and-network-excluded': @@ -38,7 +38,7 @@ '', 'vsys': '%s', - } +} def valid_part(part): @@ -94,7 +94,7 @@ def vsys(self, vsys): part = 'vsys' self.partial.add(part) - if type(vsys) == type(''): + if isinstance(vsys, str): vsys = [vsys] for name in vsys: self._vsys.add(name) diff --git a/lib/pan/xapi.py b/lib/pan/xapi.py index 4ed8cf4..2af7997 100644 --- a/lib/pan/xapi.py +++ b/lib/pan/xapi.py @@ -502,7 +502,7 @@ def __api_request(self, query): kwargs = { 'url': request, - } + } # see PEP 476; urlopen() has context if self.ssl_context is None: @@ -587,7 +587,7 @@ def keygen(self, extra_qs=None): 'type': 'keygen', 'user': self.api_username, 'password': self.api_password, - } + } if self.serial is not None: query['target'] = self.serial if extra_qs is not None: