Skip to content

Commit 28b6af4

Browse files
authored
Merge pull request #254 from HPC-SimTools/pep8-naming-and-formatting
get all ruff pep8-naming (N) tests passing
2 parents 560d76e + 3182a4e commit 28b6af4

170 files changed

Lines changed: 5354 additions & 3033 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎.github/workflows/conda_env/environment_static_analysis.yml‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@ name: ips_static_analysis
22
channels:
33
- conda-forge
44
dependencies:
5-
- python=3.9
6-
- ruff=0.9.4
5+
- python=3.10
6+
- ruff=0.16.0
77
#- flake8=5.0.4
88
#- pylint=2.15.3
99
#- bandit=1.7.4

‎.gitignore‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ www/
1111
log
1212
resource_usage
1313
work/
14+
ENSEMBLES
1415

1516
# Byte-compiled / optimized / DLL files
1617
__pycache__/

‎components/drivers/hello/hello_worker_task_pool.py‎

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,10 @@
88
from time import asctime, sleep
99

1010

11-
def myFun(*args):
12-
print(f"{asctime()} : Running myFUN {args}")
11+
def my_fun(*args):
12+
print(f"{asctime()} : Running my_fun {args}")
1313
sleep(int(args[0]))
14-
print(f"{asctime()} : Finished myFUN {args}")
14+
print(f"{asctime()} : Finished my_fun {args}")
1515
return 0
1616

1717

@@ -46,10 +46,10 @@ def step(self, timeStamp=0.0):
4646
logfile=f"task_{i}.log",
4747
task_env=task_env)
4848
self.services.add_task('pool', 'method_'+str(i), 1,
49-
cwd, copy.copy(self).myMethod, str(duration[i]),
49+
cwd, copy.copy(self).my_method, str(duration[i]),
5050
task_env=task_env)
5151
self.services.add_task('pool', 'function_' + str(i), 1,
52-
cwd, myFun, str(duration[i]),
52+
cwd, my_fun, str(duration[i]),
5353
task_env=task_env)
5454

5555
ret_val = self.services.submit_tasks('pool', use_dask=True, dask_nodes=1, dask_ppw=10)
@@ -79,10 +79,10 @@ def step(self, timeStamp=0.0):
7979

8080
return
8181

82-
def myMethod(self, *args):
83-
print(f"{asctime()} : Running myMethod {args} self.BIN_PATH = {self.BIN_PATH}")
82+
def my_method(self, *args):
83+
print(f"{asctime()} : Running my_method {args} self.BIN_PATH = {self.BIN_PATH}")
8484
sleep(int(args[0]))
85-
print(f"{asctime()} : Finished myMethod {args} self.BIN_PATH = {self.BIN_PATH}")
85+
print(f"{asctime()} : Finished my_method {args} self.BIN_PATH = {self.BIN_PATH}")
8686
return 0
8787

8888
def finalize(self, timeStamp=0.0):

‎doc/development.rst‎

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -104,29 +104,29 @@ and the output will look like
104104
ipsframework/__init__.py 11 0 100%
105105
ipsframework/cca_es_spec.py 62 10 84%
106106
ipsframework/component.py 105 19 82%
107-
ipsframework/componentRegistry.py 105 25 76%
108-
ipsframework/configurationManager.py 510 103 80%
107+
ipsframework/component_registry.py 105 25 76%
108+
ipsframework/configuration_manager.py 510 103 80%
109109
ipsframework/convert_log_function.py 29 1 97%
110-
ipsframework/dataManager.py 72 15 79%
110+
ipsframework/data_manager.py 72 15 79%
111111
ipsframework/debug.py 3 0 100%
112-
ipsframework/eventService.py 137 53 61%
113-
ipsframework/eventServiceProxy.py 118 49 58%
112+
ipsframework/event_service.py 137 53 61%
113+
ipsframework/event_service_proxy.py 118 49 58%
114114
ipsframework/ips.py 360 51 86%
115-
ipsframework/ipsExceptions.py 61 2 97%
116-
ipsframework/ipsLogging.py 92 8 91%
115+
ipsframework/ips_exceptions.py 61 2 97%
116+
ipsframework/ips_logging.py 92 8 91%
117117
ipsframework/ips_es_spec.py 43 7 84%
118118
ipsframework/ipsutil.py 73 26 64%
119119
ipsframework/messages.py 58 0 100%
120120
ipsframework/node_structure.py 193 31 84%
121121
ipsframework/platformspec.py 18 4 78%
122-
ipsframework/portalBridge.py 205 36 82%
123-
ipsframework/resourceHelper.py 304 59 81%
124-
ipsframework/resourceManager.py 340 69 80%
125-
ipsframework/runspaceInitComponent.py 88 31 65%
126-
ipsframework/sendPost.py 41 2 95%
122+
ipsframework/portal_bridge.py 205 36 82%
123+
ipsframework/resource_helper.py 304 59 81%
124+
ipsframework/resource_manager.py 340 69 80%
125+
ipsframework/runspace_init_component.py 88 31 65%
126+
ipsframework/send_post.py 41 2 95%
127127
ipsframework/services.py 1200 234 80%
128-
ipsframework/taskManager.py 322 74 77%
129-
ipsframework/topicManager.py 59 5 92%
128+
ipsframework/task_manager.py 322 74 77%
129+
ipsframework/topic_manager.py 59 5 92%
130130
-----------------------------------------------------------
131131
TOTAL 4609 914 80%
132132

‎doc/examples/dask/dask_worker.py‎

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33
from ipsframework import Component
44

55

6-
def myFun(*args):
7-
print(f"myFun({args[0]})")
6+
def my_fun(*args):
7+
print(f"my_fun({args[0]})")
88
sleep(float(args[0]))
99
return 0
1010

@@ -16,8 +16,8 @@ def step(self, timestamp=0.0):
1616

1717
duration = 0.5
1818
self.services.add_task('pool', 'binary', 1, cwd, self.EXECUTABLE, duration)
19-
self.services.add_task('pool', 'function', 1, cwd, myFun, duration)
20-
self.services.add_task('pool', 'method', 1, cwd, copy.copy(self).myMethod, duration)
19+
self.services.add_task('pool', 'function', 1, cwd, my_fun, duration)
20+
self.services.add_task('pool', 'method', 1, cwd, copy.copy(self).my_method, duration)
2121

2222
ret_val = self.services.submit_tasks('pool',
2323
use_dask=True,
@@ -26,7 +26,7 @@ def step(self, timestamp=0.0):
2626
exit_status = self.services.get_finished_tasks('pool')
2727
print('exit_status = ', exit_status)
2828

29-
def myMethod(self, *args):
30-
print(f"myMethod({args[0]})")
29+
def my_method(self, *args):
30+
print(f"my_method({args[0]})")
3131
sleep(float(args[0]))
3232
return 0

‎doc/examples/dask/simulation_log.json‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
"code": "DASK_WORKER__DaskWorker",
99
"eventtype": "IPS_LAUNCH_DASK_TASK",
1010
"walltime": "2.33",
11-
"comment": "task_name = function, Target = myFun(0.5)",
11+
"comment": "task_name = function, Target = my_fun(0.5)",
1212
}
1313
{
1414
"code": "DASK_WORKER__DaskWorker",

‎doc/examples/ensembles/a_comp.py‎

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
1-
#!/usr/bin/env python3
21
""" Component wrapper for the ensemble example for `a_sim`. """
32
from ipsframework import Component
4-
from ipsframework.resourceHelper import get_platform_info
3+
from ipsframework.resource_helper import get_platform_info
54

6-
class a_comp(Component):
5+
class AComp(Component):
76
def __init__(self, services, config):
87
super().__init__(services, config)
98
print('Created %s' % (self.__class__))
@@ -17,4 +16,3 @@ def step(self, timestamp=0.0):
1716

1817
run_env = get_platform_info()
1918
self.services.info(run_env)
20-

‎doc/examples/ensembles/another_comp.py‎

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
1-
#!/usr/bin/env python3
21
""" Component wrapper for the ensemble example for `another_sim`. """
32
from ipsframework import Component
4-
from ipsframework.resourceHelper import get_platform_info
3+
from ipsframework.resource_helper import get_platform_info
54

65

7-
class another_comp(Component):
6+
class AnotherComp(Component):
87
def __init__(self, services, config):
98
super().__init__(services, config)
109
print('Created %s' % (self.__class__))
@@ -17,4 +16,4 @@ def step(self, timestamp=0.0):
1716
print(f'another_comp parameters: D={self.D}, B={self.B}, F={self.F}')
1817

1918
run_env = get_platform_info()
20-
self.services.info(run_env)
19+
self.services.info(run_env)

‎doc/examples/ensembles/driver.config‎

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ SIMULATION_MODE = NORMAL
1717
BIN_PATH = $SRC_DIR/IPS-framework/doc/examples/ensembles/
1818
CLASS = driver
1919
SUB_CLASS =
20-
NAME = ensemble_driver
20+
NAME = EnsembleDriver
2121
SCRIPT = ${BIN_PATH}/driver.py
2222
NPROC = 1
2323
# Ensures we can find this file for run_ensembles call.
@@ -26,5 +26,3 @@ SIMULATION_MODE = NORMAL
2626
INPUT_FILES = template.config
2727
OUTPUT_FILES =
2828
RESTART_FILES =
29-
30-

‎doc/examples/ensembles/driver.py‎

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,20 @@
1-
#!/usr/bin/env python3
21
"""
3-
Example driver for the ensembles example.
2+
Example Driver for the ensembles example.
43
54
Please note that run_ensemble can be run from any IPS component, not
6-
just a driver. The driver is used here for simplicity.
5+
just a Driver. The Driver is used here for simplicity.
76
"""
87
import os
98
from pathlib import Path
109

1110
from ipsframework import Component
1211

1312

14-
class ensemble_driver(Component):
13+
class EnsembleDriver(Component):
1514

1615
def __init__(self, services, config):
1716
super().__init__(services, config)
18-
print('Creating driver')
17+
print('Creating Driver')
1918

2019
def init(self, timeStamp=0.0):
2120
return
@@ -51,7 +50,7 @@ def step(self, timestamp=0.0, **keywords):
5150
# variable values. `mapping` is a data struct that associates the
5251
# specific simulation to a given run directory so that the user can
5352
# easily find output for a specific run. Note that "template.config"
54-
# is in INPUT_FILE for the driver component so that it is copied to the run.
53+
# is in INPUT_FILE for the Driver component so that it is copied to the run.
5554
# But, of course, you could also use a full path to the file, instead.
5655
mapping = self.services.run_ensemble('template.config', variables,
5756
'/tmp/IPS', name="EXAMPLE_",
@@ -62,4 +61,3 @@ def step(self, timestamp=0.0, **keywords):
6261

6362
def finalize(self, timeStamp=0.0):
6463
return
65-

0 commit comments

Comments
 (0)