Skip to content

Commit 573f5e5

Browse files
Clear screen (#225)
* feat : clear_screen function added * fix : restart mode updated * doc : CHANGELOG.md updated * fix : autopep8 * fix : bandit skips updated * fix : bandit skips updated * fix : tests updated
1 parent 1bf9050 commit 573f5e5

File tree

5 files changed

+19
-2
lines changed

5 files changed

+19
-2
lines changed

.github/workflows/test.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ jobs:
5555
- name: Other tests
5656
run: |
5757
python -m vulture opem/ otherfile/ setup.py --min-confidence 65 --exclude=__init__.py --sort-by-size
58-
python -m bandit -r opem
58+
python -m bandit -r opem -s B605,B607
5959
python -m pydocstyle -v
6060
if: matrix.python-version == env.TEST_PYTHON_VERSION && matrix.os == env.TEST_OS
6161
- name: Upload coverage to Codecov

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,14 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
77
## [Unreleased]
88
### Added
99
- `SECURITY.md`
10+
- `clear_screen` function
1011
### Changed
1112
- Test system modified
1213
- `README.md` modified
1314
- Logo updated
1415
- Exit message updated
1516
- Python 3.5 support dropped
17+
- Restart mode updated
1618
## [1.4] - 2024-03-16
1719
### Added
1820
- `feature_request.yml` template

opem/Functions.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,18 @@
1212
import sys
1313

1414

15+
def clear_screen():
16+
"""
17+
Clear screen function.
18+
19+
:return: None
20+
"""
21+
if sys.platform == "win32":
22+
os.system('cls')
23+
else:
24+
os.system('clear')
25+
26+
1527
def integrate(y_vals, h):
1628
"""
1729
Calculate integral with Simpson's Rule.

opem/__main__.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
from opem.Dynamic.Chakraborty import Dynamic_Analysis as Chakraborty_Analysis
1313
from art import tprint
1414
from opem.Params import Version, Description_Menu, Description_Links, Vectors, Mode_Menu, Exit_Message
15-
from opem.Functions import check_update, description_print, description_control
15+
from opem.Functions import check_update, description_print, description_control, clear_screen
1616

1717

1818
def main():
@@ -77,6 +77,8 @@ def main():
7777
"Press [R] to restart OPEM or any other key to exit.")
7878
if INPUTINDEX.upper() != "R":
7979
EXITFLAG = True
80+
else:
81+
clear_screen()
8082

8183

8284
if __name__ == "__main__":

test/test_Functions.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,7 @@
7474
...
7575
Website : http://www.ecsim.site/opem
7676
###########
77+
>>> clear_screen()
7778
>>> file1 = CSV_Init(OutputParamsKeys=["1","2","3"], OutputParams={"1":"1", "2":"2", "3":"3"}, Title="CSV_Test", Name="CSV_Test", Folder=os.path.join("CSV_Folder1", "CSV_Folder2"))
7879
>>> file2 = CSV_Init(OutputParamsKeys=["1","2","3"], OutputParams={"1":"1", "2":"2", "3":"3"}, Title="CSV_Test", Name="CSV_Test2", Folder=os.path.join("CSV_Folder1", "CSV_Folder2"))
7980
>>> file1.close()

0 commit comments

Comments
 (0)