Skip to content

Commit 2ec9e24

Browse files
committed
Remove a bunch of unused local variables
1 parent e9b4c6a commit 2ec9e24

File tree

13 files changed

+7
-20
lines changed

13 files changed

+7
-20
lines changed

pygccxml/binary_parsers/parsers.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -430,7 +430,7 @@ def merge_information(global_ns, fname, runs_under_unittest=False):
430430
"""high level function - select the appropriate binary file parser and
431431
integrates the information from the file to the declarations tree. """
432432
ext = os.path.splitext(fname)[1]
433-
parser = None
433+
434434
if '.dll' == ext:
435435
parser = dll_file_parser_t(global_ns, fname)
436436
elif '.map' == ext:

pygccxml/binary_parsers/undname.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -253,7 +253,7 @@ def format_decl(self, decl, hint=None):
253253
could be mapped later to the blobs.
254254
The valid options are: "msvc" and "nm".
255255
"""
256-
name = None
256+
257257
if hint is None:
258258
if 'nt' == os.name:
259259
hint = 'msvc'

pygccxml/declarations/algorithm.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -286,7 +286,6 @@ def find_all_declarations(
286286
287287
"""
288288

289-
decls = []
290289
if recursive:
291290
decls = make_flatten(declarations)
292291
else:

pygccxml/declarations/class_declaration.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -475,7 +475,7 @@ def remove_declaration(self, decl):
475475
:param decl: declaration to be removed
476476
:type decl: :class:`declaration_t`
477477
"""
478-
container = None
478+
479479
access_type = self.find_out_member_access_type(decl)
480480
if access_type == ACCESS_TYPES.PUBLIC:
481481
container = self.public_members
@@ -497,7 +497,6 @@ def find_out_member_access_type(self, member):
497497
"""
498498
assert member.parent is self
499499
if not member.cache.access_type:
500-
access_type = None
501500
if member in self.public_members:
502501
access_type = ACCESS_TYPES.PUBLIC
503502
elif member in self.protected_members:

pygccxml/declarations/container_traits.py

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -215,12 +215,10 @@ def erase_hash_allocator(self, cls_name):
215215
if len(c_args) < 3:
216216
return
217217

218-
default_hash = None
219218
default_less = 'std::less'
220219
default_equal_to = 'std::equal_to'
221220
default_allocator = 'std::allocator'
222221

223-
tmpl = None
224222
if 3 == len(c_args):
225223
default_hash = 'hash_compare'
226224
tmpl = (
@@ -253,17 +251,13 @@ def erase_hashmap_compare_allocator(self, cls_name):
253251
cls_name = self.replace_basic_string(cls_name)
254252
c_name, c_args = templates.split(cls_name)
255253

256-
default_hash = None
257254
if self.unordered_maps_and_sets:
258255
default_less_or_hash = 'std::hash'
259256
else:
260257
default_less_or_hash = 'std::less'
261258
default_allocator = 'std::allocator'
262259
default_equal_to = 'std::equal_to'
263260

264-
tmpl = None
265-
key_type = None
266-
mapped_type = None
267261
if 2 < len(c_args):
268262
key_type = c_args[0]
269263
mapped_type = c_args[1]
@@ -394,7 +388,6 @@ def get_container_or_none(self, type_):
394388
utils.loggers.queries_engine.debug(
395389
"Container traits: cleaned up search %s" % type_)
396390

397-
cls_declaration = None
398391
if isinstance(type_, cpptypes.declarated_t):
399392
cls_declaration = type_traits.remove_alias(type_.declaration)
400393
elif isinstance(type_, class_declaration.class_t):

pygccxml/declarations/pattern_parser.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ def join(self, name, args, arg_separator=None):
129129
if None is arg_separator:
130130
arg_separator = ', '
131131
args = [_f for _f in args if _f]
132-
args_str = ''
132+
133133
if not args:
134134
args_str = ' '
135135
elif 1 == len(args):

pygccxml/declarations/type_traits.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -493,7 +493,6 @@ def is_base_and_derived(based, derived):
493493
assert isinstance(based, class_declaration.class_t)
494494
assert isinstance(derived, (class_declaration.class_t, tuple))
495495

496-
all_derived = None
497496
if isinstance(derived, class_declaration.class_t):
498497
all_derived = ([derived])
499498
else: # tuple

pygccxml/parser/declarations_cache.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,7 @@ def __init__(self, name):
170170
@staticmethod
171171
def __load(file_name):
172172
" Load pickled cache from file and return the object. "
173-
cache = None
173+
174174
if os.path.exists(file_name) and not os.path.isfile(file_name):
175175
raise RuntimeError(
176176
'Cache should be initialized with valid full file name')

pygccxml/parser/directory_cache.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -540,7 +540,7 @@ def _get_signature(self, entry):
540540
# return file modification date...
541541
try:
542542
return os.path.getmtime(entry.filename)
543-
except OSError as e:
543+
except OSError:
544544
return None
545545

546546
def _dump(self):

pygccxml/parser/project_reader.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -477,7 +477,6 @@ def _join_class_hierarchy(self, namespaces):
477477
if id(leaved_classes[key]) == id(class_):
478478
continue
479479
else:
480-
declarations = None
481480
if class_.parent:
482481
declarations = class_.parent.declarations
483482
else:

0 commit comments

Comments
 (0)