Skip to content

Dead code line using lstrip() without assignment #442

Open
@christophebedard

Description

@christophebedard

I found a line that doesn't do anything:

self.__expanded_node_name.lstrip('/')

However, self.__expanded_node_name is later used in a call to prefix_namespace(():

self.__final_node_name = prefix_namespace(
self.__expanded_node_namespace, self.__expanded_node_name)

And, according to prefix_namespace(), there's definitely a difference between self.__expanded_node_name with and without a leading / :

combined_ns = prefix_namespace('my_ns', 'original_ns')
assert combined_ns == 'my_ns/original_ns'
combined_ns = prefix_namespace('/my_ns', 'original_ns')
assert combined_ns == '/my_ns/original_ns'
combined_ns = prefix_namespace('my_ns', '/original_ns')
assert combined_ns == '/original_ns'

I guess at this point it works fine, in which case the line could just be removed.

Metadata

Metadata

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions