Skip to content

Commit 47d9bdb

Browse files
h-jooCapirca Team
authored andcommitted
Automated Code Change
PiperOrigin-RevId: 941568242
1 parent 9caa02f commit 47d9bdb

23 files changed

Lines changed: 53 additions & 53 deletions

capirca/aclgen.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ def SkipLines(text, skip_line_func=False):
143143
"""
144144
if not skip_line_func:
145145
return text
146-
return [x for x in text if not skip_line_func(x)]
146+
return [x for x in text if not skip_line_func(x)] # pyrefly: ignore[not-callable]
147147

148148

149149
def RenderFile(base_directory: str, input_file: pathlib.Path,

capirca/lib/arista_tp.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -217,7 +217,7 @@ def __str__(self):
217217

218218
term_block.append([
219219
TERM_INDENT,
220-
"match %s %s" % (self.term.name, family_keywords["addr_fam"]), False
220+
"match %s %s" % (self.term.name, family_keywords["addr_fam"]), False # pyrefly: ignore[unsupported-operation]
221221
])
222222

223223
term_af = self.AF_MAP.get(self.term_type)

capirca/lib/aruba.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ def __str__(self):
153153
str_tok.append(dst_addr_token)
154154

155155
str_tok.append(dst_port)
156-
str_tok.append(self._ACTIONS.get(self.term.action[0]))
156+
str_tok.append(self._ACTIONS.get(self.term.action[0])) # pyrefly: ignore[bad-argument-type]
157157
ret_str.append(' '.join(t for t in str_tok if t))
158158

159159
self.netdestinations = netdestinations

capirca/lib/cisco.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -766,7 +766,7 @@ def __init__(self, term, af=4, proto_int=True, enable_dsmo=False,
766766
self.text_af = 'inet'
767767
else:
768768
self.text_af = 'inet6'
769-
self.ALLOWED_PROTO_STRINGS.extend([self.PROTO_MAP.get(x)
769+
self.ALLOWED_PROTO_STRINGS.extend([self.PROTO_MAP.get(x) # pyrefly: ignore[bad-argument-type]
770770
for x in self.ALWAYS_PROTO_NUM])
771771

772772
def __str__(self):
@@ -978,7 +978,7 @@ def __str__(self):
978978
ret_str.extend(
979979
self._TermletToStr(
980980
sequence,
981-
action,
981+
action, # pyrefly: ignore[unbound-name]
982982
self._FormatProto(proto, self.af),
983983
saddr,
984984
self._FormatPort(sport, proto),

capirca/lib/ciscoasa.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -198,7 +198,7 @@ def __str__(self):
198198

199199
return '\n'.join(ret_str)
200200

201-
def _TermletToStr(self, filter_name, action, proto, saddr, sport, daddr,
201+
def _TermletToStr(self, filter_name, action, proto, saddr, sport, daddr, # pyrefly: ignore[bad-override]
202202
dport, icmp_type, option):
203203
"""Take the various compenents and turn them into a cisco acl line.
204204

capirca/lib/fortigate.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -334,7 +334,7 @@ def add_address_to_fw_addrgrps(
334334

335335
if address_exclude_v6:
336336
raise FortiGateValueError(
337-
'Exclude IPv6 address is unsupported: {}'.join([f'{x.with_prefix_len}' for x in address_exclude_v6]))
337+
'Exclude IPv6 address is unsupported: {}'.join([f'{x.with_prefix_len}' for x in address_exclude_v6])) # pyrefly: ignore[missing-attribute]
338338

339339
addr_names = []
340340
if address_v4 or address_exclude_v4:

capirca/lib/gce.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -581,7 +581,7 @@ def _TranslatePolicy(self, pol, exp_info):
581581
'Attribute count (%d) for %s exceeded the maximum (%d)' %
582582
(total_attribute_count, filter_name, max_attribute_count))
583583
self.gce_policies.append(rules)
584-
logging.info('Total rule count of policy %s is: %d', filter_name,
584+
logging.info('Total rule count of policy %s is: %d', filter_name, # pyrefly: ignore[unbound-name]
585585
total_rule_count)
586586
logging.info('Total attribute count of policy %s is: %d', filter_name,
587587
total_attribute_count)

capirca/lib/gce_vpc_tf.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -599,7 +599,7 @@ def _TranslatePolicy(self, pol, exp_info):
599599
(total_attribute_count, filter_name, max_attribute_count))
600600
self.terraform_resources['google_compute_firewall'].append(rules)
601601
priority_counter += len(rules)
602-
logging.info('Total rule count of policy %s is: %d', filter_name,
602+
logging.info('Total rule count of policy %s is: %d', filter_name, # pyrefly: ignore[unbound-name]
603603
total_rule_count)
604604
logging.info('Total attribute count of policy %s is: %d', filter_name,
605605
total_attribute_count)

capirca/lib/gcp_hf.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -298,11 +298,11 @@ def ConvertToDict(self, priority_index):
298298
for daddr_chunk in destination_address_chunks:
299299
rule = copy.deepcopy(term_dict)
300300
if self.api_version == 'ga':
301-
rule['match'][dest_ip_range] = [
301+
rule['match'][dest_ip_range] = [ # pyrefly: ignore[unsupported-operation]
302302
daddr.with_prefixlen for daddr in daddr_chunk
303303
]
304304
else:
305-
rule['match']['config'][dest_ip_range] = [
305+
rule['match']['config'][dest_ip_range] = [ # pyrefly: ignore[bad-index]
306306
daddr.with_prefixlen for daddr in daddr_chunk
307307
]
308308
rule['priority'] = priority_index
@@ -345,11 +345,11 @@ def ConvertToDict(self, priority_index):
345345
for saddr_chunk in source_address_chunks:
346346
rule = copy.deepcopy(term_dict)
347347
if self.api_version == 'ga':
348-
rule['match'][src_ip_range] = [
348+
rule['match'][src_ip_range] = [ # pyrefly: ignore[unsupported-operation]
349349
saddr.with_prefixlen for saddr in saddr_chunk
350350
]
351351
else:
352-
rule['match']['config'][src_ip_range] = [
352+
rule['match']['config'][src_ip_range] = [ # pyrefly: ignore[bad-index]
353353
saddr.with_prefixlen for saddr in saddr_chunk
354354
]
355355
rule['priority'] = priority_index
@@ -511,7 +511,7 @@ def _TranslatePolicy(self, pol, exp_info):
511511

512512
# If compute api_version is beta, set type to FIREWALL
513513
if api_version == 'beta':
514-
policy['type'] = 'FIREWALL'
514+
policy['type'] = 'FIREWALL' # pyrefly: ignore[unsupported-operation]
515515

516516
# Handle mixed for each indvidual term as inet and inet6.
517517
# inet/inet6 are treated the same.
@@ -571,7 +571,7 @@ def _TranslatePolicy(self, pol, exp_info):
571571
raise ExceededCostError(
572572
'Policy cost (%d) for %s reached the '
573573
'maximum (%d)' %
574-
(total_cost, policy[display_name], policies_max_cost))
574+
(total_cost, policy[display_name], policies_max_cost)) # pyrefly: ignore[unbound-name]
575575

576576
self.policies.append(policy)
577577

@@ -581,7 +581,7 @@ def _TranslatePolicy(self, pol, exp_info):
581581

582582
if total_cost > 0:
583583
logging.info('Policy %s quota cost: %d',
584-
policy[display_name], total_cost)
584+
policy[display_name], total_cost) # pyrefly: ignore[unbound-name]
585585

586586

587587
def GetRuleTupleCount(dict_term: Dict[str, Any], api_version):

capirca/lib/juniper.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -269,12 +269,12 @@ def __str__(self, term_type_table=None):
269269
elif opt.startswith('established'):
270270
if self.term.protocol == ['tcp']:
271271
if 'tcp-established;' not in from_str:
272-
from_str.append(family_keywords['tcp-est'] + ';')
272+
from_str.append(family_keywords['tcp-est'] + ';') # pyrefly: ignore[unsupported-operation]
273273

274274
# if tcp-established specified, but more than just tcp is included
275275
# in the protocols, raise an error
276276
elif opt.startswith('tcp-established'):
277-
flag = family_keywords['tcp-est'] + ';'
277+
flag = family_keywords['tcp-est'] + ';' # pyrefly: ignore[unsupported-operation]
278278
if self.term.protocol == ['tcp']:
279279
if flag not in from_str:
280280
from_str.append(flag)
@@ -347,7 +347,7 @@ def __str__(self, term_type_table=None):
347347
address = summarizer.Summarize(address)
348348

349349
if address:
350-
config.Append('%s {' % family_keywords['addr'])
350+
config.Append('%s {' % family_keywords['addr']) # pyrefly: ignore[unsupported-operation]
351351
for addr in address:
352352
for comment in self._Comment(addr):
353353
config.Append('%s' % comment)
@@ -373,7 +373,7 @@ def __str__(self, term_type_table=None):
373373
src_addr, src_addr_ex = self._MinimizePrefixes(src_addr, src_addr_ex)
374374

375375
if src_addr:
376-
config.Append('%s {' % family_keywords['saddr'])
376+
config.Append('%s {' % family_keywords['saddr']) # pyrefly: ignore[unsupported-operation]
377377
for addr in src_addr:
378378
for comment in self._Comment(addr):
379379
config.Append('%s' % comment)
@@ -407,7 +407,7 @@ def __str__(self, term_type_table=None):
407407
dst_addr, dst_addr_ex = self._MinimizePrefixes(dst_addr, dst_addr_ex)
408408

409409
if dst_addr:
410-
config.Append('%s {' % family_keywords['daddr'])
410+
config.Append('%s {' % family_keywords['daddr']) # pyrefly: ignore[unsupported-operation]
411411
for addr in dst_addr:
412412
for comment in self._Comment(addr):
413413
config.Append('%s' % comment)
@@ -507,7 +507,7 @@ def __str__(self, term_type_table=None):
507507
if 'icmpv6' in self.term.protocol:
508508
loc = self.term.protocol.index('icmpv6')
509509
self.term.protocol[loc] = 'icmp6'
510-
config.Append(family_keywords['protocol'] + ' ' +
510+
config.Append(family_keywords['protocol'] + ' ' + # pyrefly: ignore[unsupported-operation]
511511
self._Group(self.term.protocol))
512512

513513
# protocol
@@ -516,7 +516,7 @@ def __str__(self, term_type_table=None):
516516
if 'icmpv6' in self.term.protocol_except:
517517
loc = self.term.protocol_except.index('icmpv6')
518518
self.term.protocol_except[loc] = 'icmp6'
519-
config.Append(family_keywords['protocol-except'] + ' ' +
519+
config.Append(family_keywords['protocol-except'] + ' ' + # pyrefly: ignore[unsupported-operation]
520520
self._Group(self.term.protocol_except))
521521

522522
if self.term.traffic_type:
@@ -686,7 +686,7 @@ def __str__(self, term_type_table=None):
686686
# If there is a routing-instance defined, skip reject/accept/etc actions.
687687
if not self.term.routing_instance:
688688
for action in self.term.action:
689-
config.Append(self.ACTIONS.get(action) + ';')
689+
config.Append(self.ACTIONS.get(action) + ';') # pyrefly: ignore[unsupported-operation]
690690

691691
# DSCP SET
692692
if self.term.dscp_set:

0 commit comments

Comments
 (0)