Skip to content

Commit c930116

Browse files
committed
Fix a few typos and inefficient dict useage
1 parent 9369c42 commit c930116

5 files changed

Lines changed: 16 additions & 22 deletions

File tree

scorep/__main__.py

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ def _err_exit(msg):
1111

1212

1313
def scorep_main(argv=None):
14-
# print(sys.flags)
1514
if argv is None:
1615
argv = sys.argv
1716

@@ -61,10 +60,9 @@ def scorep_main(argv=None):
6160
if len(prog_argv) == 0:
6261
_err_exit("Did not find a script to run")
6362

64-
if ("SCOREP_PYTHON_BINDINGS_INITALISED" not in os.environ) or (
65-
os.environ["SCOREP_PYTHON_BINDINGS_INITALISED"] != "true"):
63+
if os.environ.get("SCOREP_PYTHON_BINDINGS_INITIALISED") != "true":
6664
scorep.subsystem.init_environment(scorep_config, keep_files)
67-
os.environ["SCOREP_PYTHON_BINDINGS_INITALISED"] = "true"
65+
os.environ["SCOREP_PYTHON_BINDINGS_INITIALISED"] = "true"
6866
"""
6967
python -m starts the module as skript. i.e. sys.argv will loke like:
7068
['/home/gocht/Dokumente/code/scorep_python/scorep.py', '--mpi', 'mpi_test.py']
@@ -80,7 +78,7 @@ def scorep_main(argv=None):
8078

8179
os.execve(sys.executable, new_args, os.environ)
8280
else:
83-
scorep.subsystem.reset_pereload()
81+
scorep.subsystem.reset_preload()
8482

8583
# everything is ready
8684
sys.argv = prog_argv

scorep/instrumenter.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ def unregister():
4747
"""
4848
Disables the python-tracing.
4949
Disabling the python-tracing is more efficient than disable_recording,
50-
as python does not longer call the tracing module.
50+
as python does no longer call the tracing module.
5151
However, all the other things that are traced by Score-P will still be recorded.
5252
Please call register() to enable tracing again.
5353
"""
@@ -61,7 +61,7 @@ class enable():
6161
with enable(region_name=None):
6262
do stuff
6363
```
64-
This overides --no-instrumenter (--nopython leagacy)
64+
This overides --noinstrumenter (--nopython legacy)
6565
If a region name is given, the region the contextmanager is active will be marked in the trace or profile
6666
"""
6767

@@ -103,7 +103,7 @@ class disable():
103103
with disable():
104104
do stuff
105105
```
106-
This overides --no-instrumenter (--nopython leagacy)
106+
This overides --noinstrumenter (--nopython legacy)
107107
If a region name is given, the region the contextmanager is active will be marked in the trace or profile
108108
"""
109109

scorep/subsystem.py

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@ def generate_subsystem_lib_name():
1818

1919
def generate_ld_preload(scorep_config):
2020
"""
21-
This functions generate a string that needs to be passed to $LD_PRELOAD.
22-
After this sting is passed, the tracing needs to be restarted with this $LD_PRELOAD in env.
21+
This functions generates a string that needs to be passed to $LD_PRELOAD.
22+
After this string is passed, the tracing needs to be restarted with this $LD_PRELOAD in env.
2323
2424
@return ld_preload string which needs to be passed to LD_PRELOAD
2525
"""
@@ -103,15 +103,12 @@ def init_environment(scorep_config=[], keep_files=False):
103103
"""
104104
Set the inital needed environmet variables, to get everythin up an running.
105105
As a few variables interact with LD env vars, the programms needs to be restarted after this.
106-
The function set the env var `SCOREP_PYTHON_BINDINGS_INITALISED` to true, once it is done with
107-
initalising.
108106
109107
@param scorep_config configuration flags for score-p
110108
@param keep_files whether to keep the generated files, or not.
111109
"""
112110

113-
if ("LD_PRELOAD" in os.environ) and (
114-
"libscorep" in os.environ["LD_PRELOAD"]):
111+
if "libscorep" in os.environ.get("LD_PRELOAD", ""):
115112
raise RuntimeError(
116113
"Score-P is already loaded. This should not happen at this point")
117114

@@ -132,7 +129,7 @@ def init_environment(scorep_config=[], keep_files=False):
132129
os.environ["LD_PRELOAD"] = preload_str
133130

134131

135-
def reset_pereload():
132+
def reset_preload():
136133
"""
137134
resets the environment variable `LD_PRELOAD` to the value before init_environment was called.
138135
"""
@@ -152,6 +149,5 @@ def clean_up(keep_files=True):
152149
if keep_files:
153150
return
154151
else:
155-
if ("SCOREP_PYTHON_BINDINGS_TEMP_DIR" in os.environ) and (
156-
os.environ["SCOREP_PYTHON_BINDINGS_TEMP_DIR"] != ""):
152+
if os.environ.get("SCOREP_PYTHON_BINDINGS_TEMP_DIR"):
157153
shutil.rmtree(os.environ["SCOREP_PYTHON_BINDINGS_TEMP_DIR"])

scorep/user.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
def region_begin(name, file_name=None, line_number=None):
99
"""
1010
Begin of an User region. If file_name or line_number is None, both will
11-
bet determined automatically
11+
be determined automatically
1212
@param name name of the user region
1313
@param file_name file name of the user region
1414
@param line_number line number of the user region
@@ -131,7 +131,7 @@ def __exit__(self, exc_type, exc_value, traceback):
131131
def rewind_begin(name, file_name=None, line_number=None):
132132
"""
133133
Begin of an User region. If file_name or line_number is None, both will
134-
bet determined automatically
134+
be determined automatically
135135
@param name name of the user region
136136
@param file_name file name of the user region
137137
@param line_number line number of the user region
@@ -162,7 +162,7 @@ def rewind_end(name, value):
162162
def oa_region_begin(name, file_name=None, line_number=None):
163163
"""
164164
Begin of an Online Access region. If file_name or line_number is None, both will
165-
bet determined automatically
165+
be determined automatically
166166
@param name name of the user region
167167
@param file_name file name of the user region
168168
@param line_number line number of the user region

src/methods.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,7 @@ extern "C"
151151
Py_RETURN_NONE;
152152
}
153153

154-
static PyObject* get_expiriment_dir_name(PyObject* self, PyObject* args)
154+
static PyObject* get_experiment_dir_name(PyObject* self, PyObject* args)
155155
{
156156

157157
return PyUnicode_FromString(SCOREP_GetExperimentDirName());
@@ -169,7 +169,7 @@ extern "C"
169169
{ "parameter_int", parameter_int, METH_VARARGS, "User parameter int." },
170170
{ "parameter_uint", parameter_uint, METH_VARARGS, "User parameter uint." },
171171
{ "parameter_string", parameter_string, METH_VARARGS, "User parameter string." },
172-
{ "get_expiriment_dir_name", get_expiriment_dir_name, METH_VARARGS,
172+
{ "get_experiment_dir_name", get_experiment_dir_name, METH_VARARGS,
173173
"Get the Score-P experiment dir." },
174174
{ NULL, NULL, 0, NULL } /* Sentinel */
175175
};

0 commit comments

Comments
 (0)