Skip to content

Commit 756e367

Browse files
committed
lint
1 parent e8cdba4 commit 756e367

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
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: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@
5050
_contextes = {'': {}}
5151
_curr_context = ''
5252

53-
def set_context(context_name, context = {}):
53+
def set_context(context_name, context = None):
5454
"""
5555
Set context for tracking environment changes.
5656
"""
@@ -63,6 +63,7 @@ def set_context(context_name, context = {}):
6363
context = {}
6464
_contextes[context_name] = context
6565

66+
6667
def get_context():
6768
"""
6869
Return current context for tracking environment changes.
@@ -95,6 +96,7 @@ def get_changes():
9596
"""
9697
return get_context()
9798

99+
98100
def apply_context(context = None):
99101
"""Return the current environment with the changes tracked in the context applied.
100102
@@ -127,8 +129,10 @@ def with_environment(copy_current=False):
127129
# Get a key that does not exist in _contextes
128130
base = '_context_'
129131
cnt = 0
130-
while (context := f"{base}{cnt}") in _contextes:
132+
context = f"{base}{cnt}"
133+
while context in _contextes:
131134
cnt += 1
135+
context = f"{base}{cnt}"
132136

133137
prev_context = _curr_context
134138
kwargs = {}

0 commit comments

Comments
 (0)