Skip to content

Commit

Permalink
Silence all other warnings
Browse files Browse the repository at this point in the history
Commands used:
```
ruff format
ruff check --add-noqa
ruff format  # 331 files left unchanged
ruff check  # All checks passed!
```
  • Loading branch information
ioannis-vm committed Aug 15, 2024
1 parent d2f6897 commit 1dadbab
Show file tree
Hide file tree
Showing 331 changed files with 17,874 additions and 17,726 deletions.
2 changes: 1 addition & 1 deletion build.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/env python
#!/usr/bin/env python # noqa: EXE001, D100

from bincrafters import build_template_default

Expand Down
26 changes: 13 additions & 13 deletions conanfile.py
Original file line number Diff line number Diff line change
@@ -1,30 +1,30 @@
import os
import os # noqa: D100

from conans import CMake, ConanFile


class simCenterBackendApps(ConanFile):
class simCenterBackendApps(ConanFile): # noqa: D101
name = 'SimCenterBackendApplications'
version = '1.2.2'
description = 'Backend applications for SimCenter software'
license = 'BSD 3-Clause'
author = 'Michael Gardner [email protected]'
url = 'https://github.com/NHERI-SimCenter/SimCenterBackendApplications'
settings = {
settings = { # noqa: RUF012
'os': None,
'build_type': None,
'compiler': None,
'arch': ['x86_64', 'armv8'],
}
options = {'shared': [True, False]}
default_options = {
options = {'shared': [True, False]} # noqa: RUF012
default_options = { # noqa: RUF012
'mkl-static:threaded': False,
'ipp-static:simcenter_backend': True,
'libcurl:with_ssl': 'openssl',
}
generators = 'cmake'
build_policy = 'missing'
requires = [
requires = [ # noqa: RUF012
'jansson/2.13.1',
'zlib/1.2.11',
'libcurl/8.1.1',
Expand All @@ -40,30 +40,30 @@ class simCenterBackendApps(ConanFile):
_build_subfolder = 'build_subfolder'
# Set short paths for Windows
short_paths = True
scm = {
scm = { # noqa: RUF012
'type': 'git', # Use "type": "svn", if local repo is managed using SVN
'subfolder': _source_subfolder,
'url': 'auto',
'revision': 'auto',
}

def configure(self):
def configure(self): # noqa: D102
self.options.shared = False

def configure_cmake(self):
def configure_cmake(self): # noqa: D102
cmake = CMake(self)
cmake.configure(source_folder=self._source_subfolder)
return cmake

def build(self):
def build(self): # noqa: D102
cmake = self.configure_cmake()
cmake.build()

def package(self):
def package(self): # noqa: D102
self.copy(pattern='LICENSE', dst='licenses', src=self._source_subfolder)
cmake = self.configure_cmake()
cmake.install()
self.copy('*', dst='bin', src=self._source_subfolder + '/applications')

def package_info(self):
self.env_info.PATH.append(os.path.join(self.package_folder, 'bin'))
def package_info(self): # noqa: D102
self.env_info.PATH.append(os.path.join(self.package_folder, 'bin')) # noqa: PTH118
34 changes: 17 additions & 17 deletions modules/Workflow/AggregateResults.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#
# # noqa: INP001, D100
# Copyright (c) 2018 Leland Stanford Junior University
# Copyright (c) 2018 The Regents of the University of California
#
Expand Down Expand Up @@ -46,14 +46,14 @@
import pandas as pd


def log_msg(msg):
print(
'{} {}'.format(datetime.utcnow().strftime('%Y-%m-%dT%H:%M:%S:%fZ')[:-4], msg)
def log_msg(msg): # noqa: D103
print( # noqa: T201
'{} {}'.format(datetime.utcnow().strftime('%Y-%m-%dT%H:%M:%S:%fZ')[:-4], msg) # noqa: DTZ003
)


def main(threads=1):
headers = dict(
def main(threads=1): # noqa: C901, D103
headers = dict( # noqa: C408
IM=[0, 1, 2, 3],
BIM=[
0,
Expand Down Expand Up @@ -85,13 +85,13 @@ def read_csv_np(file, header):
data[data == ''] = np.nan

tuples = [tuple(h) for h in res[:first_row].T[1:]]
MI = pd.MultiIndex.from_tuples(tuples, names=res[:first_row].T[0])
MI = pd.MultiIndex.from_tuples(tuples, names=res[:first_row].T[0]) # noqa: N806

df = pd.DataFrame(
df = pd.DataFrame( # noqa: PD901
data, columns=MI, index=res[first_row:].T[0], dtype=float
)

return df
return df # noqa: RET504

@delayed
def read_csv_files_np(file_list, header):
Expand All @@ -106,7 +106,7 @@ def read_csv_files_np(file_list, header):
for res_type in ['IM', 'BIM', 'EDP', 'DM', 'DV']:
log_msg(f'Loading {res_type} files...')

files = glob.glob(f'./results/{res_type}/*/{res_type}_*.csv')
files = glob.glob(f'./results/{res_type}/*/{res_type}_*.csv') # noqa: PTH207
# files = files[:1000]

if len(files) > 0:
Expand All @@ -115,7 +115,7 @@ def read_csv_files_np(file_list, header):
chunk = math.ceil(file_count / threads)
df_list = []

print(f'Creating threads for {file_count} files...')
print(f'Creating threads for {file_count} files...') # noqa: T201

for t_i in range(threads):
# print(t_i)
Expand Down Expand Up @@ -152,7 +152,7 @@ def read_csv_files_np(file_list, header):
log_msg('Concatenating all files')
df_all = pd.concat(df_list, axis=0, sort=False)

df_all.sort_index(axis=0, inplace=True)
df_all.sort_index(axis=0, inplace=True) # noqa: PD002

# save the results
log_msg('Saving results')
Expand All @@ -168,7 +168,7 @@ def read_csv_files_np(file_list, header):
# df_all.to_csv('{}.csv'.format(res_type))

else:
print(f'No {res_type} files found')
print(f'No {res_type} files found') # noqa: T201

if use_dask:
log_msg('Closing cluster...')
Expand All @@ -178,7 +178,7 @@ def read_csv_files_np(file_list, header):
# aggregate the realizations files
log_msg('Aggregating individual realizations...')

files = glob.glob(
files = glob.glob( # noqa: PTH207
'./results/{}/*/{}_*.hdf'.format('realizations', 'realizations')
)

Expand All @@ -199,7 +199,7 @@ def read_csv_files_np(file_list, header):

df_all.index = df_all.index.astype(np.int32)

df_all.sort_index(axis=0, inplace=True)
df_all.sort_index(axis=0, inplace=True) # noqa: PD002

try:
df_all.astype(np.float32).to_hdf(
Expand All @@ -210,7 +210,7 @@ def read_csv_files_np(file_list, header):
complevel=1,
complib='blosc:blosclz',
)
except:
except: # noqa: E722
df_all.to_hdf(
'realizations.hdf',
key,
Expand All @@ -228,7 +228,7 @@ def read_csv_files_np(file_list, header):
if __name__ == '__main__':
# Defining the command line arguments

workflowArgParser = argparse.ArgumentParser('Aggregate the results from rWHALE.')
workflowArgParser = argparse.ArgumentParser('Aggregate the results from rWHALE.') # noqa: N816

workflowArgParser.add_argument(
'-threads',
Expand Down
Loading

0 comments on commit 1dadbab

Please sign in to comment.