Skip to content

Commit

Permalink
Use colored > 1.5
Browse files Browse the repository at this point in the history
Now we are using python >= 3.9
  • Loading branch information
tbaudier committed Sep 18, 2024
1 parent 76f2cca commit 0159719
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 18 deletions.
6 changes: 1 addition & 5 deletions core/opengate_core/testsDataSetup.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,7 @@
from pathlib import Path
from .g4DataSetup import *

try:
color_error = colored.fg("red") + colored.attr("bold")
except AttributeError:
# new syntax in colored>=1.5
color_error = colored.fore("red") + colored.style("bold")
color_error = colored.fore("red") + colored.style("bold")


# Check and download opengate tests data if not present:
Expand Down
2 changes: 1 addition & 1 deletion core/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -184,5 +184,5 @@ def build_extension(self, ext):
"License :: OSI Approved :: Apache Software License",
"Operating System :: OS Independent",
),
install_requires=["wget", "colored", "requests"],
install_requires=["wget", "colored>1.5", "requests"],
)
4 changes: 2 additions & 2 deletions opengate/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
print(
colored.stylize(
f"Importing opengate (thread " f"{threading.get_native_id()}) ... ",
colored.fg("dark_gray"),
colored.fore("dark_gray"),
),
end="",
flush=True,
Expand Down Expand Up @@ -54,4 +54,4 @@
from opengate.utility import g4_units


print(colored.stylize("done", colored.fg("dark_gray")))
print(colored.stylize("done", colored.fore("dark_gray")))
12 changes: 3 additions & 9 deletions opengate/exception.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,15 +25,9 @@ class GateImplementationError(Exception):
"""


try:
color_error = colored.fg("red") + colored.attr("bold")
color_warning = colored.fg("orange_1")
color_ok = colored.fg("green")
except AttributeError:
# new syntax in colored>=1.5
color_error = colored.fore("red") + colored.style("bold")
color_warning = colored.fore("orange_1")
color_ok = colored.fore("green")
color_error = colored.fore("red") + colored.style("bold")
color_warning = colored.fore("orange_1")
color_ok = colored.fore("green")


def fatal(s):
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

setup(
install_requires=[
"colored",
"colored>1.5",
"opengate_core==" + version,
"gatetools",
"click",
Expand Down

0 comments on commit 0159719

Please sign in to comment.