Skip to content

Commit 11ced90

Browse files
committed
lint
1 parent e8cdba4 commit 11ced90

File tree

2 files changed

+10
-3
lines changed

2 files changed

+10
-3
lines changed

easybuild/os_hook.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
class OSProxy(types.ModuleType):
99
"""Proxy module to intercept os attribute access."""
1010
overrides = {}
11+
1112
def __init__(self, real_os):
1213
super().__init__("os")
1314
self._real_os = real_os
@@ -23,6 +24,7 @@ def __dir__(self):
2324
def register_override(cls, name, value):
2425
cls.overrides[name] = value
2526

27+
2628
class OSFinder(importlib.abc.MetaPathFinder):
2729
"""Meta path finder to intercept imports of 'os' and return our proxy."""
2830
def find_spec(self, fullname, path, target=None):

easybuild/tools/environment.py

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,8 @@
5050
_contextes = {'': {}}
5151
_curr_context = ''
5252

53-
def set_context(context_name, context = {}):
53+
54+
def set_context(context_name, context=None):
5455
"""
5556
Set context for tracking environment changes.
5657
"""
@@ -63,6 +64,7 @@ def set_context(context_name, context = {}):
6364
context = {}
6465
_contextes[context_name] = context
6566

67+
6668
def get_context():
6769
"""
6870
Return current context for tracking environment changes.
@@ -95,7 +97,8 @@ def get_changes():
9597
"""
9698
return get_context()
9799

98-
def apply_context(context = None):
100+
101+
def apply_context(context=None):
99102
"""Return the current environment with the changes tracked in the context applied.
100103
101104
Args:
@@ -127,8 +130,10 @@ def with_environment(copy_current=False):
127130
# Get a key that does not exist in _contextes
128131
base = '_context_'
129132
cnt = 0
130-
while (context := f"{base}{cnt}") in _contextes:
133+
context = f"{base}{cnt}"
134+
while context in _contextes:
131135
cnt += 1
136+
context = f"{base}{cnt}"
132137

133138
prev_context = _curr_context
134139
kwargs = {}

0 commit comments

Comments
 (0)