Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replace lists created with list() with [] #1471

Merged
merged 2 commits into from
May 27, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Autocoders/Python/bin/codegen.py
Original file line number Diff line number Diff line change
Expand Up @@ -1145,7 +1145,7 @@ def generate_dependency_file(filename, target_file, subst_path, parser, the_type
# get list of dependency files from XML/header file list
file_list_tmp = list(parser.get_comp_type_file_header_dict().keys())
file_list = file_list_tmp
# file_list = list()
# file_list = []
# for f in file_list_tmp:
# file_list.append(f.replace("Ai.xml","Ac.hpp"))
else:
Expand Down
14 changes: 7 additions & 7 deletions Autocoders/Python/bin/tlm_packet_gen.py
Original file line number Diff line number Diff line change
Expand Up @@ -303,18 +303,18 @@ def gen_packet_file(self, xml_filename):
it.packet_list_namespace = list_namespace
it.max_size = max_size

packet_list_container = list()
packet_list_container = []

packetized_channel_list = list()
it.ignore_list = list()
id_list = list() # check for duplicates
ignore_name_list = list()
packetized_channel_list = []
it.ignore_list = []
id_list = [] # check for duplicates
ignore_name_list = []

size_dict = dict()

ht.num_packets = 0
total_packet_size = 0
levels = list()
levels = []
view_path = "./Views"
# find the topology import
for entry in element_tree.getroot():
Expand Down Expand Up @@ -354,7 +354,7 @@ def gen_packet_file(self, xml_filename):
else:
id_list.append(packet_id)

channel_list = list()
channel_list = []
for channel in entry:
channel_name = channel.attrib["name"]
if not channel_name in channel_size_dict:
Expand Down
2 changes: 1 addition & 1 deletion Autocoders/Python/src/fprime_ac/generators/ChannelBody.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ def __init__(self):
"""
Constructor.
"""
self.__visitor_list = list()
self.__visitor_list = []

def __call__(self, args):
"""
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ def __init__(self):
"""
Constructor.
"""
self.__visitor_list = list()
self.__visitor_list = []

def __call__(self, args):
"""
Expand Down
2 changes: 1 addition & 1 deletion Autocoders/Python/src/fprime_ac/generators/CommandBody.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ def __init__(self):
"""
Constructor.
"""
self.__visitor_list = list()
self.__visitor_list = []

def __call__(self, args):
"""
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ def __init__(self):
"""
Constructor.
"""
self.__visitor_list = list()
self.__visitor_list = []

def __call__(self, args):
"""
Expand Down
2 changes: 1 addition & 1 deletion Autocoders/Python/src/fprime_ac/generators/DictBody.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ def __init__(self):
"""
Constructor.
"""
self.__visitor_list = list()
self.__visitor_list = []

def __call__(self, args):
"""
Expand Down
2 changes: 1 addition & 1 deletion Autocoders/Python/src/fprime_ac/generators/DictHeader.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ def __init__(self):
"""
Constructor.
"""
self.__visitor_list = list()
self.__visitor_list = []

def __call__(self, args):
"""
Expand Down
2 changes: 1 addition & 1 deletion Autocoders/Python/src/fprime_ac/generators/DictStart.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ def __init__(self):
"""
Constructor.
"""
self.__visitor_list = list()
self.__visitor_list = []

def __call__(self, args):
"""
Expand Down
2 changes: 1 addition & 1 deletion Autocoders/Python/src/fprime_ac/generators/EventBody.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ def __init__(self):
"""
Constructor.
"""
self.__visitor_list = list()
self.__visitor_list = []

def __call__(self, args):
"""
Expand Down
2 changes: 1 addition & 1 deletion Autocoders/Python/src/fprime_ac/generators/EventHeader.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ def __init__(self):
"""
Constructor.
"""
self.__visitor_list = list()
self.__visitor_list = []

def __call__(self, args):
"""
Expand Down
2 changes: 1 addition & 1 deletion Autocoders/Python/src/fprime_ac/generators/FinishSource.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ def __init__(self):
"""
Constructor.
"""
self.__visitor_list = list()
self.__visitor_list = []

def __call__(self, args):
"""
Expand Down
2 changes: 1 addition & 1 deletion Autocoders/Python/src/fprime_ac/generators/GenFactory.py
Original file line number Diff line number Diff line change
Expand Up @@ -350,7 +350,7 @@ def _buildVisitorList(self):
"""
# Instance this list only once for all elements
if self.__visitor_list is None:
self.__visitor_list = list()
self.__visitor_list = []
#
# Insert each of the code producer visitors into the list of
# visitors. The visitor must be in the list of
Expand Down
2 changes: 1 addition & 1 deletion Autocoders/Python/src/fprime_ac/generators/HtmlDocPage.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ def __init__(self):
"""
Constructor.
"""
self.__visitor_list = list()
self.__visitor_list = []

def __call__(self, args):
"""
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ def __init__(self):
"""
Constructor.
"""
self.__visitor_list = list()
self.__visitor_list = []

def __call__(self, args):
"""
Expand Down
2 changes: 1 addition & 1 deletion Autocoders/Python/src/fprime_ac/generators/Includes1.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ def __init__(self):
"""
Constructor.
"""
self.__visitor_list = list()
self.__visitor_list = []

def __call__(self, args):
"""
Expand Down
2 changes: 1 addition & 1 deletion Autocoders/Python/src/fprime_ac/generators/Includes2.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ def __init__(self):
"""
Constructor.
"""
self.__visitor_list = list()
self.__visitor_list = []

def __call__(self, args):
"""
Expand Down
2 changes: 1 addition & 1 deletion Autocoders/Python/src/fprime_ac/generators/InitFiles.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ def __init__(self):
"""
Constructor.
"""
self.__visitor_list = list()
self.__visitor_list = []

def __call__(self, args):
"""
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ def __init__(self):
"""
Constructor.
"""
self.__visitor_list = list()
self.__visitor_list = []

def __call__(self, args, topology_model):
"""
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ def __init__(self):
"""
Constructor.
"""
self.__visitor_list = list()
self.__visitor_list = []

def __call__(self, args, topology_model):
"""
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ def __init__(self):
"""
Constructor.
"""
self.__visitor_list = list()
self.__visitor_list = []

def __call__(self, args, topology_model):
"""
Expand Down
2 changes: 1 addition & 1 deletion Autocoders/Python/src/fprime_ac/generators/MdDocPage.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ def __init__(self):
"""
Constructor.
"""
self.__visitor_list = list()
self.__visitor_list = []

def __call__(self, args):
"""
Expand Down
2 changes: 1 addition & 1 deletion Autocoders/Python/src/fprime_ac/generators/MdStartPage.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ def __init__(self):
"""
Constructor.
"""
self.__visitor_list = list()
self.__visitor_list = []

def __call__(self, args):
"""
Expand Down
2 changes: 1 addition & 1 deletion Autocoders/Python/src/fprime_ac/generators/Namespace.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ def __init__(self):
"""
Constructor.
"""
self.__visitor_list = list()
self.__visitor_list = []

def __call__(self, args):
"""
Expand Down
2 changes: 1 addition & 1 deletion Autocoders/Python/src/fprime_ac/generators/Private.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ def __init__(self):
"""
Constructor.
"""
self.__visitor_list = list()
self.__visitor_list = []

def __call__(self, args):
"""
Expand Down
2 changes: 1 addition & 1 deletion Autocoders/Python/src/fprime_ac/generators/Protected.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ def __init__(self):
"""
Constructor.
"""
self.__visitor_list = list()
self.__visitor_list = []

def __call__(self, args):
"""
Expand Down
2 changes: 1 addition & 1 deletion Autocoders/Python/src/fprime_ac/generators/Public.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ def __init__(self):
"""
Constructor.
"""
self.__visitor_list = list()
self.__visitor_list = []

def __call__(self, args):
"""
Expand Down
2 changes: 1 addition & 1 deletion Autocoders/Python/src/fprime_ac/generators/StartChannel.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ def __init__(self):
"""
Constructor.
"""
self.__visitor_list = list()
self.__visitor_list = []

def __call__(self, args):
"""
Expand Down
2 changes: 1 addition & 1 deletion Autocoders/Python/src/fprime_ac/generators/StartCommand.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ def __init__(self):
"""
Constructor.
"""
self.__visitor_list = list()
self.__visitor_list = []

def __call__(self, args):
"""
Expand Down
2 changes: 1 addition & 1 deletion Autocoders/Python/src/fprime_ac/generators/StartEvent.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ def __init__(self):
"""
Constructor.
"""
self.__visitor_list = list()
self.__visitor_list = []

def __call__(self, args):
"""
Expand Down
2 changes: 1 addition & 1 deletion Autocoders/Python/src/fprime_ac/generators/StartSource.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ def __init__(self):
"""
Constructor.
"""
self.__visitor_list = list()
self.__visitor_list = []

def __call__(self, args):
"""
Expand Down
28 changes: 14 additions & 14 deletions Autocoders/Python/src/fprime_ac/generators/formatters.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ def _strip_without_code(self, line_list):
the first @code is stripped off each line.
"""

new_line_list = list()
new_line_list = []

code_flag = False

Expand Down Expand Up @@ -140,7 +140,7 @@ def _wrapText(self, text, indent, prefix, width=70):
returned.
"""

out = list()
out = []

width = width - indent

Expand Down Expand Up @@ -720,7 +720,7 @@ def opcodeStemNameValidate(self, id, cmd_name_list):
@param cmd_name_list: list of command function names.
@return: TRUE if all command stem names are unique, else raise an exception.
"""
cmds = list()
cmds = []

for c in cmd_name_list:
cmds.append(self.opcodeStemName(id, c))
Expand Down Expand Up @@ -896,8 +896,8 @@ def simpleFuncDraw(self, name, args, proto=True, indent=0):
# one argument. A one argument function is built on one line. All
# other numbers of arguments will use multiple lines.

arg_list = list()
type_list = list()
arg_list = []
type_list = []

for arg in args:

Expand Down Expand Up @@ -977,9 +977,9 @@ def formatFunComment(self, name, args, proto=True, ident=0):

fname = name.strip()

arg_list = list()
type_list = list()
comment_list = list()
arg_list = []
type_list = []
comment_list = []

# Get the no argument case out of the way -- just add void argument.
if len(args) == 0:
Expand Down Expand Up @@ -1007,7 +1007,7 @@ def formatFunComment(self, name, args, proto=True, ident=0):

type_args_list = self.argStringAlign(type_list, arg_list, pad)

new_list = list()
new_list = []
for line in type_args_list[:-1]:
new_list.append(line + ",")
if proto == True:
Expand Down Expand Up @@ -1216,7 +1216,7 @@ def argStringAlign(self, type_list, arg_list, pad_spaces=4):
@return str_list: a list of strings with args aligned.
"""

str_list = list()
str_list = []

if len(type_list) > 0:

Expand Down Expand Up @@ -1261,9 +1261,9 @@ def argTypedefStringAlign(self, args):
@param args: list of tuple args from xml.
"""

type_list = list()
arg_list = list()
comment_list = list()
type_list = []
arg_list = []
comment_list = []

for arg in args:
# EGB pass by pointer: This is to allow pointers to be passed directly via IPC
Expand Down Expand Up @@ -1388,7 +1388,7 @@ def argFilter(self, module, args, name="foo"):
Changes the STRING to a U8 for use as U8 array.
Changes the SCLK to ModArgSclk struct type of U32, U16.
"""
new_args = list()
new_args = []
for arg in args:
id, type, comment, array_max, array_len, range_list, enum_type_list = arg[
0:7
Expand Down
Loading