Skip to content

Commit

Permalink
Fix pylint issues
Browse files Browse the repository at this point in the history
Signed-off-by: David Galiffi <David.Galiffi@amd.com>
  • Loading branch information
dgaliffiAMD committed Aug 2, 2024
1 parent 0888be2 commit c93c622
Showing 1 changed file with 18 additions and 10 deletions.
28 changes: 18 additions & 10 deletions src/omniperf
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
#!/usr/bin/env python3

"""Main entry point for omniperf"""

##############################################################################bl
# MIT License
#
Expand Down Expand Up @@ -40,7 +42,8 @@ except ImportError as e:


def verify_deps_version(localVer, desiredVer, operator):
"""Check package version strings with simple operators used in companion requirements.txt file"""
"""Check package version strings with simple operators used in companion
requirements.txt file"""
if operator == "==":
return localVer == desiredVer
elif operator == ">=":
Expand All @@ -56,8 +59,10 @@ def verify_deps_version(localVer, desiredVer, operator):


def verify_deps():
"""Utility to read library dependencies from requirements.txt and endeavor to load them within current execution environment.
Used in top-level omniperf to provide error messages if necessary dependencies are not available."""
"""Utility to read library dependencies from requirements.txt and endeavor
to load them within current execution environment.
Used in top-level omniperf to provide error messages if necessary
dependencies are not available."""

# Check which version of python is being used
if sys.version_info[0] < 3 or sys.version_info[1] < 8:
Expand All @@ -71,7 +76,7 @@ def verify_deps():
for location in depsLocation:
checkFile = os.path.join(bindir, location)
if os.path.exists(checkFile):
with open(checkFile, "r") as file_in:
with open(checkFile, "r", encoding="utf-8") as file_in:
dependencies = file_in.read().splitlines()

error = False
Expand All @@ -91,8 +96,8 @@ def verify_deps():
except metadata.PackageNotFoundError:
error = True
print(
"[ERROR] The '%s' package was not found in the current execution environment."
% dependency
f"[ERROR] The '{dependency}' package was not found "
"in the current execution environment."
)

# check version requirement
Expand All @@ -102,24 +107,27 @@ def verify_deps():
localVersion, desiredVersion, operator
):
print(
"[ERROR] the '%s' distribution does not meet version requirements to use omniperf."
% dependency
f"[ERROR] the '{dependency}' distribution does "
"not meet version requirements to use omniperf."
)
print(" --> version installed :", localVersion)
error = True

if error:
print("")
print(
"Please verify all of the python dependencies called out in the requirements file"
"Please verify all of the python dependencies called out "
"in the requirements file"
)
print("are installed locally prior to running omniperf.")
print("")
print("See: %s" % checkFile)
print(f"See: {checkFile}")
sys.exit(1)
return


def main():
'''Main function for omniperf'''

# verify required python dependencies
verify_deps()
Expand Down

0 comments on commit c93c622

Please sign in to comment.