Skip to content

Commit

Permalink
Rename a variable to avoid spurious pylint failure
Browse files Browse the repository at this point in the history
pylint flagged `graph` (used earlier in a function) as a redefinition
of a name from outer scope. This happens because the block under the
`if __name__ == "__main__"` check is technically in module scope.
Therefore, at analysis-time, there is a module-scoped variable named
`graph` and we "need" to avoid redefinition.

This could be tucked into a `def _main()` to "hide" the name from
module scope, but a rename is equally simple to dodge the
overly-aggressive pylint check.
  • Loading branch information
sirosen committed Jul 19, 2023
1 parent da13b48 commit 9a9f41a
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/globus_sdk/experimental/scope_parser/parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -260,9 +260,9 @@ def parse_scope_graph(scopes: str) -> ScopeGraph:
if __name__ == "__main__":
import sys

graph = parse_scope_graph(sys.argv[1])
parsed_graph = parse_scope_graph(sys.argv[1])
print(
"top level scopes:",
", ".join([name for name, _optional in graph.top_level_scopes]),
", ".join([name for name, _optional in parsed_graph.top_level_scopes]),
)
print(graph)
print(parsed_graph)

0 comments on commit 9a9f41a

Please sign in to comment.