From ed487c862a48fb481da0eae11ef7313d8b0658bc Mon Sep 17 00:00:00 2001 From: pyup-bot Date: Mon, 17 Jun 2019 21:55:08 +0430 Subject: [PATCH 01/95] Update psutil from 5.6.2 to 5.6.3 --- dev-requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dev-requirements.txt b/dev-requirements.txt index 3034045..2d810e2 100644 --- a/dev-requirements.txt +++ b/dev-requirements.txt @@ -1,4 +1,4 @@ -psutil==5.6.2 +psutil==5.6.3 requests==2.22.0 setuptools==41.0.1 vulture==1.0 From 3fe1af6b52aa35db8164b04c1686e255059bf057 Mon Sep 17 00:00:00 2001 From: pyup-bot Date: Mon, 17 Jun 2019 21:55:09 +0430 Subject: [PATCH 02/95] Update bandit from 1.6.0 to 1.6.1 --- dev-requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dev-requirements.txt b/dev-requirements.txt index 2d810e2..570f6af 100644 --- a/dev-requirements.txt +++ b/dev-requirements.txt @@ -2,7 +2,7 @@ psutil==5.6.3 requests==2.22.0 setuptools==41.0.1 vulture==1.0 -bandit==1.6.0 +bandit==1.6.1 pydocstyle==3.0.0 art==3.6 From 2ce8e01d4517b67d05007b37c7f49c81f680b023 Mon Sep 17 00:00:00 2001 From: pyup-bot Date: Tue, 2 Jul 2019 01:02:47 +0430 Subject: [PATCH 03/95] Update bandit from 1.6.1 to 1.6.2 --- dev-requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dev-requirements.txt b/dev-requirements.txt index 570f6af..b38f572 100644 --- a/dev-requirements.txt +++ b/dev-requirements.txt @@ -2,7 +2,7 @@ psutil==5.6.3 requests==2.22.0 setuptools==41.0.1 vulture==1.0 -bandit==1.6.1 +bandit==1.6.2 pydocstyle==3.0.0 art==3.6 From 50fc9ef94e4d920bdab004bad8f199b24afc521b Mon Sep 17 00:00:00 2001 From: pyup-bot Date: Tue, 2 Jul 2019 01:02:49 +0430 Subject: [PATCH 04/95] Update art from 3.6 to 3.7 --- dev-requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dev-requirements.txt b/dev-requirements.txt index b38f572..37956c6 100644 --- a/dev-requirements.txt +++ b/dev-requirements.txt @@ -4,5 +4,5 @@ setuptools==41.0.1 vulture==1.0 bandit==1.6.2 pydocstyle==3.0.0 -art==3.6 +art==3.7 From 516e6ceed14fb51761c8b7ac64cc60e60172d162 Mon Sep 17 00:00:00 2001 From: sepandhaghighi Date: Wed, 31 Jul 2019 13:29:54 +0430 Subject: [PATCH 05/95] fix : dev-requirements.txt updated --- dev-requirements.txt | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/dev-requirements.txt b/dev-requirements.txt index 37956c6..0ec2357 100644 --- a/dev-requirements.txt +++ b/dev-requirements.txt @@ -1,8 +1,9 @@ psutil==5.6.3 requests==2.22.0 -setuptools==41.0.1 -vulture==1.0 -bandit==1.6.2 -pydocstyle==3.0.0 art==3.7 +setuptools>=40.8.0 +vulture>=1.0 +bandit>=1.5.1 +pydocstyle>=3.0.0 + From 38b7c9c55a80eec2f2e32aaae5134c95833969a2 Mon Sep 17 00:00:00 2001 From: sepandhaghighi Date: Wed, 31 Jul 2019 13:30:44 +0430 Subject: [PATCH 06/95] fix : .pyup.yml removed --- .pyup.yml | 5 ----- 1 file changed, 5 deletions(-) delete mode 100644 .pyup.yml diff --git a/.pyup.yml b/.pyup.yml deleted file mode 100644 index cc61a4b..0000000 --- a/.pyup.yml +++ /dev/null @@ -1,5 +0,0 @@ -update: all - -branch: dev - -schedule: "every week" \ No newline at end of file From 84d6ff8df6e78ee0a029f5415a9a843b524560d0 Mon Sep 17 00:00:00 2001 From: sepandhaghighi Date: Wed, 31 Jul 2019 13:32:06 +0430 Subject: [PATCH 07/95] doc : FUNDING.yml added --- .github/FUNDING.yml | 1 + 1 file changed, 1 insertion(+) create mode 100644 .github/FUNDING.yml diff --git a/.github/FUNDING.yml b/.github/FUNDING.yml new file mode 100644 index 0000000..30a905f --- /dev/null +++ b/.github/FUNDING.yml @@ -0,0 +1 @@ +custom: http://www.orangetool.ir/donate.html \ No newline at end of file From 5107ff10a45907dc81c41cbfb3ac620db2d266f6 Mon Sep 17 00:00:00 2001 From: "dependabot-preview[bot]" <27856297+dependabot-preview[bot]@users.noreply.github.com> Date: Wed, 31 Jul 2019 09:12:15 +0000 Subject: [PATCH 08/95] Bump art from 3.7 to 3.8 Bumps [art](https://github.com/sepandhaghighi/art) from 3.7 to 3.8. - [Release notes](https://github.com/sepandhaghighi/art/releases) - [Changelog](https://github.com/sepandhaghighi/art/blob/master/CHANGELOG.md) - [Commits](https://github.com/sepandhaghighi/art/compare/v3.7...v3.8) Signed-off-by: dependabot-preview[bot] --- dev-requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dev-requirements.txt b/dev-requirements.txt index 0ec2357..dbcab5f 100644 --- a/dev-requirements.txt +++ b/dev-requirements.txt @@ -1,6 +1,6 @@ psutil==5.6.3 requests==2.22.0 -art==3.7 +art==3.8 setuptools>=40.8.0 vulture>=1.0 bandit>=1.5.1 From d3db2b02ad232e60552e8fc4ebe3a8413e0eb7b5 Mon Sep 17 00:00:00 2001 From: sepandhaghighi Date: Wed, 31 Jul 2019 13:49:25 +0430 Subject: [PATCH 09/95] doc : CHANGELOG updated --- CHANGELOG.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index a9e5360..43885c1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,10 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html). ## [Unreleased] +### Added +- `FUNDING.yml` +### Changed +- `dev-requirements.txt` modified ## [0.35] - 2019-06-01 ### Added - `version_check.py` From 37739d2a1aae9b10680c8fbda0763aa162cf5ac6 Mon Sep 17 00:00:00 2001 From: "dependabot-preview[bot]" <27856297+dependabot-preview[bot]@users.noreply.github.com> Date: Mon, 26 Aug 2019 08:05:45 +0000 Subject: [PATCH 10/95] Bump art from 3.8 to 3.9 Bumps [art](https://github.com/sepandhaghighi/art) from 3.8 to 3.9. - [Release notes](https://github.com/sepandhaghighi/art/releases) - [Changelog](https://github.com/sepandhaghighi/art/blob/master/CHANGELOG.md) - [Commits](https://github.com/sepandhaghighi/art/compare/v3.8...v3.9) Signed-off-by: dependabot-preview[bot] --- dev-requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dev-requirements.txt b/dev-requirements.txt index dbcab5f..dfd1c4c 100644 --- a/dev-requirements.txt +++ b/dev-requirements.txt @@ -1,6 +1,6 @@ psutil==5.6.3 requests==2.22.0 -art==3.8 +art==3.9 setuptools>=40.8.0 vulture>=1.0 bandit>=1.5.1 From 9ee9961dfe455fa0c1a8cf926f3d5960d65796cb Mon Sep 17 00:00:00 2001 From: "dependabot-preview[bot]" <27856297+dependabot-preview[bot]@users.noreply.github.com> Date: Mon, 16 Sep 2019 08:13:06 +0000 Subject: [PATCH 11/95] Bump art from 3.9 to 4.0 Bumps [art](https://github.com/sepandhaghighi/art) from 3.9 to 4.0. - [Release notes](https://github.com/sepandhaghighi/art/releases) - [Changelog](https://github.com/sepandhaghighi/art/blob/master/CHANGELOG.md) - [Commits](https://github.com/sepandhaghighi/art/compare/v3.9...v4.0) Signed-off-by: dependabot-preview[bot] --- dev-requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dev-requirements.txt b/dev-requirements.txt index dfd1c4c..4a33615 100644 --- a/dev-requirements.txt +++ b/dev-requirements.txt @@ -1,6 +1,6 @@ psutil==5.6.3 requests==2.22.0 -art==3.9 +art==4.0 setuptools>=40.8.0 vulture>=1.0 bandit>=1.5.1 From 5de1cdb7ac7f74b5359aa83694a754336f1bb135 Mon Sep 17 00:00:00 2001 From: "dependabot-preview[bot]" <27856297+dependabot-preview[bot]@users.noreply.github.com> Date: Mon, 30 Sep 2019 10:42:21 +0000 Subject: [PATCH 12/95] Bump art from 4.0 to 4.1 Bumps [art](https://github.com/sepandhaghighi/art) from 4.0 to 4.1. - [Release notes](https://github.com/sepandhaghighi/art/releases) - [Changelog](https://github.com/sepandhaghighi/art/blob/master/CHANGELOG.md) - [Commits](https://github.com/sepandhaghighi/art/compare/v4.0...v4.1) Signed-off-by: dependabot-preview[bot] --- dev-requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dev-requirements.txt b/dev-requirements.txt index 4a33615..f3123ad 100644 --- a/dev-requirements.txt +++ b/dev-requirements.txt @@ -1,6 +1,6 @@ psutil==5.6.3 requests==2.22.0 -art==4.0 +art==4.1 setuptools>=40.8.0 vulture>=1.0 bandit>=1.5.1 From 430764bfc998d1e105fa0d30ee312f154a135647 Mon Sep 17 00:00:00 2001 From: "dependabot-preview[bot]" <27856297+dependabot-preview[bot]@users.noreply.github.com> Date: Mon, 4 Nov 2019 13:40:14 +0000 Subject: [PATCH 13/95] Bump psutil from 5.6.3 to 5.6.4 Bumps [psutil](https://github.com/giampaolo/psutil) from 5.6.3 to 5.6.4. - [Release notes](https://github.com/giampaolo/psutil/releases) - [Changelog](https://github.com/giampaolo/psutil/blob/master/HISTORY.rst) - [Commits](https://github.com/giampaolo/psutil/compare/release-5.6.3...release-5.6.4) Signed-off-by: dependabot-preview[bot] --- dev-requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dev-requirements.txt b/dev-requirements.txt index f3123ad..27a5394 100644 --- a/dev-requirements.txt +++ b/dev-requirements.txt @@ -1,4 +1,4 @@ -psutil==5.6.3 +psutil==5.6.4 requests==2.22.0 art==4.1 setuptools>=40.8.0 From 8e473541f644b2ca0b8da9ff38131a3a3dfc0470 Mon Sep 17 00:00:00 2001 From: "dependabot-preview[bot]" <27856297+dependabot-preview[bot]@users.noreply.github.com> Date: Mon, 4 Nov 2019 14:20:24 +0000 Subject: [PATCH 14/95] Bump art from 4.1 to 4.2 Bumps [art](https://github.com/sepandhaghighi/art) from 4.1 to 4.2. - [Release notes](https://github.com/sepandhaghighi/art/releases) - [Changelog](https://github.com/sepandhaghighi/art/blob/master/CHANGELOG.md) - [Commits](https://github.com/sepandhaghighi/art/compare/v4.1...v4.2) Signed-off-by: dependabot-preview[bot] --- dev-requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dev-requirements.txt b/dev-requirements.txt index 27a5394..db7d797 100644 --- a/dev-requirements.txt +++ b/dev-requirements.txt @@ -1,6 +1,6 @@ psutil==5.6.4 requests==2.22.0 -art==4.1 +art==4.2 setuptools>=40.8.0 vulture>=1.0 bandit>=1.5.1 From 00a19285c63a3a9856127b72e5fe1773d8f9dd23 Mon Sep 17 00:00:00 2001 From: "dependabot-preview[bot]" <27856297+dependabot-preview[bot]@users.noreply.github.com> Date: Mon, 11 Nov 2019 09:58:46 +0000 Subject: [PATCH 15/95] Bump psutil from 5.6.4 to 5.6.5 Bumps [psutil](https://github.com/giampaolo/psutil) from 5.6.4 to 5.6.5. - [Release notes](https://github.com/giampaolo/psutil/releases) - [Changelog](https://github.com/giampaolo/psutil/blob/master/HISTORY.rst) - [Commits](https://github.com/giampaolo/psutil/compare/release-5.6.4...release-5.6.5) Signed-off-by: dependabot-preview[bot] --- dev-requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dev-requirements.txt b/dev-requirements.txt index db7d797..0ff7d1f 100644 --- a/dev-requirements.txt +++ b/dev-requirements.txt @@ -1,4 +1,4 @@ -psutil==5.6.4 +psutil==5.6.5 requests==2.22.0 art==4.2 setuptools>=40.8.0 From 526b074060b2ea537182d66b25a5da9e90468225 Mon Sep 17 00:00:00 2001 From: sepandhaghighi Date: Sat, 30 Nov 2019 00:48:45 +0330 Subject: [PATCH 16/95] fix : minor edit in vulture test call --- test.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test.sh b/test.sh index 9c118ee..fff9210 100644 --- a/test.sh +++ b/test.sh @@ -3,7 +3,7 @@ python version_check.py if [ "$TRAVIS_PYTHON_VERSION" = '3.6' ] then - python -m vulture --min-confidence 80 --exclude=orangetool,build,.eggs --sort-by-size . + python -m vulture --min-confidence 60 --sort-by-size orangetool setup.py version_check.py python -m bandit -r orangetool -s B607,B603,B404,B311 python -m pydocstyle --match-dir=orangetool fi \ No newline at end of file From 744f083b31b33398820eed9b34ae593a5d3e099e Mon Sep 17 00:00:00 2001 From: sepandhaghighi Date: Sat, 30 Nov 2019 00:50:16 +0330 Subject: [PATCH 17/95] fix : minor edit in vulture test call --- test.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test.sh b/test.sh index fff9210..7a6f73b 100644 --- a/test.sh +++ b/test.sh @@ -3,7 +3,7 @@ python version_check.py if [ "$TRAVIS_PYTHON_VERSION" = '3.6' ] then - python -m vulture --min-confidence 60 --sort-by-size orangetool setup.py version_check.py + python -m vulture --min-confidence 65 --sort-by-size orangetool setup.py version_check.py python -m bandit -r orangetool -s B607,B603,B404,B311 python -m pydocstyle --match-dir=orangetool fi \ No newline at end of file From 8e5d75922ee5c6aa462987fff968f186207a04a3 Mon Sep 17 00:00:00 2001 From: sepandhaghighi Date: Sat, 30 Nov 2019 01:04:48 +0330 Subject: [PATCH 18/95] fix : travis config updated --- .travis.yml | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/.travis.yml b/.travis.yml index 7852c3c..d3e9f33 100644 --- a/.travis.yml +++ b/.travis.yml @@ -13,6 +13,15 @@ matrix: python: 3.4 - os: linux python: 2.7 + - os: linux + python: 3.7-dev + dist: xenial + - os: linux + python: 3.8-dev + dist: xenial + - os: linux + python: nightly + dist: xenial allow_failures: - os: linux python: 3.4 From 153d41593414b8dc3ae371b694d9925533c6f008 Mon Sep 17 00:00:00 2001 From: sepandhaghighi Date: Sat, 30 Nov 2019 01:08:48 +0330 Subject: [PATCH 19/95] doc : CHANGELOG updated --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 43885c1..b51e652 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0. - `FUNDING.yml` ### Changed - `dev-requirements.txt` modified +- Test system modified ## [0.35] - 2019-06-01 ### Added - `version_check.py` From ab8fa3aab633fea4d6a1f266b735ff047345aff8 Mon Sep 17 00:00:00 2001 From: "dependabot-preview[bot]" <27856297+dependabot-preview[bot]@users.noreply.github.com> Date: Mon, 2 Dec 2019 07:16:51 +0000 Subject: [PATCH 20/95] Bump psutil from 5.6.5 to 5.6.7 Bumps [psutil](https://github.com/giampaolo/psutil) from 5.6.5 to 5.6.7. - [Release notes](https://github.com/giampaolo/psutil/releases) - [Changelog](https://github.com/giampaolo/psutil/blob/master/HISTORY.rst) - [Commits](https://github.com/giampaolo/psutil/compare/release-5.6.5...release-5.6.7) Signed-off-by: dependabot-preview[bot] --- dev-requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dev-requirements.txt b/dev-requirements.txt index 0ff7d1f..fe0fb36 100644 --- a/dev-requirements.txt +++ b/dev-requirements.txt @@ -1,4 +1,4 @@ -psutil==5.6.5 +psutil==5.6.7 requests==2.22.0 art==4.2 setuptools>=40.8.0 From abb00b662e591130213216f2d5ed712ce2a30624 Mon Sep 17 00:00:00 2001 From: "dependabot-preview[bot]" <27856297+dependabot-preview[bot]@users.noreply.github.com> Date: Mon, 9 Dec 2019 07:27:43 +0000 Subject: [PATCH 21/95] Bump art from 4.2 to 4.3 Bumps [art](https://github.com/sepandhaghighi/art) from 4.2 to 4.3. - [Release notes](https://github.com/sepandhaghighi/art/releases) - [Changelog](https://github.com/sepandhaghighi/art/blob/master/CHANGELOG.md) - [Commits](https://github.com/sepandhaghighi/art/compare/v4.2...v4.3) Signed-off-by: dependabot-preview[bot] --- dev-requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dev-requirements.txt b/dev-requirements.txt index fe0fb36..6609e8e 100644 --- a/dev-requirements.txt +++ b/dev-requirements.txt @@ -1,6 +1,6 @@ psutil==5.6.7 requests==2.22.0 -art==4.2 +art==4.3 setuptools>=40.8.0 vulture>=1.0 bandit>=1.5.1 From c6403375ef799eaf6f94c15235a87f0b1b33cc56 Mon Sep 17 00:00:00 2001 From: "dependabot-preview[bot]" <27856297+dependabot-preview[bot]@users.noreply.github.com> Date: Mon, 30 Dec 2019 07:39:15 +0000 Subject: [PATCH 22/95] Bump art from 4.3 to 4.4 Bumps [art](https://github.com/sepandhaghighi/art) from 4.3 to 4.4. - [Release notes](https://github.com/sepandhaghighi/art/releases) - [Changelog](https://github.com/sepandhaghighi/art/blob/master/CHANGELOG.md) - [Commits](https://github.com/sepandhaghighi/art/compare/v4.3...v4.4) Signed-off-by: dependabot-preview[bot] --- dev-requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dev-requirements.txt b/dev-requirements.txt index 6609e8e..407f4cf 100644 --- a/dev-requirements.txt +++ b/dev-requirements.txt @@ -1,6 +1,6 @@ psutil==5.6.7 requests==2.22.0 -art==4.3 +art==4.4 setuptools>=40.8.0 vulture>=1.0 bandit>=1.5.1 From a6fa32c36a6febfa362312f1b63bebb27923f67a Mon Sep 17 00:00:00 2001 From: "dependabot-preview[bot]" <27856297+dependabot-preview[bot]@users.noreply.github.com> Date: Mon, 3 Feb 2020 08:07:05 +0000 Subject: [PATCH 23/95] Bump art from 4.4 to 4.5 Bumps [art](https://github.com/sepandhaghighi/art) from 4.4 to 4.5. - [Release notes](https://github.com/sepandhaghighi/art/releases) - [Changelog](https://github.com/sepandhaghighi/art/blob/master/CHANGELOG.md) - [Commits](https://github.com/sepandhaghighi/art/compare/v4.4...v4.5) Signed-off-by: dependabot-preview[bot] --- dev-requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dev-requirements.txt b/dev-requirements.txt index 407f4cf..2f1aa30 100644 --- a/dev-requirements.txt +++ b/dev-requirements.txt @@ -1,6 +1,6 @@ psutil==5.6.7 requests==2.22.0 -art==4.4 +art==4.5 setuptools>=40.8.0 vulture>=1.0 bandit>=1.5.1 From fbd1f474180e361efff0880055c29b9c7ab89d86 Mon Sep 17 00:00:00 2001 From: "dependabot-preview[bot]" <27856297+dependabot-preview[bot]@users.noreply.github.com> Date: Mon, 24 Feb 2020 08:15:21 +0000 Subject: [PATCH 24/95] Bump psutil from 5.6.7 to 5.7.0 Bumps [psutil](https://github.com/giampaolo/psutil) from 5.6.7 to 5.7.0. - [Release notes](https://github.com/giampaolo/psutil/releases) - [Changelog](https://github.com/giampaolo/psutil/blob/master/HISTORY.rst) - [Commits](https://github.com/giampaolo/psutil/compare/release-5.6.7...release-5.7.0) Signed-off-by: dependabot-preview[bot] --- dev-requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dev-requirements.txt b/dev-requirements.txt index 2f1aa30..fa1a592 100644 --- a/dev-requirements.txt +++ b/dev-requirements.txt @@ -1,4 +1,4 @@ -psutil==5.6.7 +psutil==5.7.0 requests==2.22.0 art==4.5 setuptools>=40.8.0 From e6c76ae4509318729b86e8b9974fe295e1f0cd45 Mon Sep 17 00:00:00 2001 From: "dependabot-preview[bot]" <27856297+dependabot-preview[bot]@users.noreply.github.com> Date: Mon, 24 Feb 2020 22:26:13 +0000 Subject: [PATCH 25/95] Bump requests from 2.22.0 to 2.23.0 Bumps [requests](https://github.com/psf/requests) from 2.22.0 to 2.23.0. - [Release notes](https://github.com/psf/requests/releases) - [Changelog](https://github.com/psf/requests/blob/master/HISTORY.md) - [Commits](https://github.com/psf/requests/compare/v2.22.0...v2.23.0) Signed-off-by: dependabot-preview[bot] --- dev-requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dev-requirements.txt b/dev-requirements.txt index fa1a592..639bc1a 100644 --- a/dev-requirements.txt +++ b/dev-requirements.txt @@ -1,5 +1,5 @@ psutil==5.7.0 -requests==2.22.0 +requests==2.23.0 art==4.5 setuptools>=40.8.0 vulture>=1.0 From b4ba52828e8f99f05cadff94a6c9bd174e755308 Mon Sep 17 00:00:00 2001 From: "dependabot-preview[bot]" <27856297+dependabot-preview[bot]@users.noreply.github.com> Date: Mon, 6 Apr 2020 08:54:15 +0000 Subject: [PATCH 26/95] Bump art from 4.5 to 4.6 Bumps [art](https://github.com/sepandhaghighi/art) from 4.5 to 4.6. - [Release notes](https://github.com/sepandhaghighi/art/releases) - [Changelog](https://github.com/sepandhaghighi/art/blob/master/CHANGELOG.md) - [Commits](https://github.com/sepandhaghighi/art/compare/v4.5...v4.6) Signed-off-by: dependabot-preview[bot] --- dev-requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dev-requirements.txt b/dev-requirements.txt index 639bc1a..88163bf 100644 --- a/dev-requirements.txt +++ b/dev-requirements.txt @@ -1,6 +1,6 @@ psutil==5.7.0 requests==2.23.0 -art==4.5 +art==4.6 setuptools>=40.8.0 vulture>=1.0 bandit>=1.5.1 From a825967b5a82316fe8233a62cd489dc9c733ddec Mon Sep 17 00:00:00 2001 From: "dependabot-preview[bot]" <27856297+dependabot-preview[bot]@users.noreply.github.com> Date: Mon, 25 May 2020 09:00:19 +0000 Subject: [PATCH 27/95] Bump art from 4.6 to 4.7 Bumps [art](https://github.com/sepandhaghighi/art) from 4.6 to 4.7. - [Release notes](https://github.com/sepandhaghighi/art/releases) - [Changelog](https://github.com/sepandhaghighi/art/blob/master/CHANGELOG.md) - [Commits](https://github.com/sepandhaghighi/art/compare/v4.6...v4.7) Signed-off-by: dependabot-preview[bot] --- dev-requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dev-requirements.txt b/dev-requirements.txt index 88163bf..3d04e5c 100644 --- a/dev-requirements.txt +++ b/dev-requirements.txt @@ -1,6 +1,6 @@ psutil==5.7.0 requests==2.23.0 -art==4.6 +art==4.7 setuptools>=40.8.0 vulture>=1.0 bandit>=1.5.1 From 9d6283dfcd19d1013b55f622cada7f7deb11ac62 Mon Sep 17 00:00:00 2001 From: "dependabot-preview[bot]" <27856297+dependabot-preview[bot]@users.noreply.github.com> Date: Mon, 22 Jun 2020 09:25:55 +0000 Subject: [PATCH 28/95] Bump requests from 2.23.0 to 2.24.0 Bumps [requests](https://github.com/psf/requests) from 2.23.0 to 2.24.0. - [Release notes](https://github.com/psf/requests/releases) - [Changelog](https://github.com/psf/requests/blob/master/HISTORY.md) - [Commits](https://github.com/psf/requests/compare/v2.23.0...v2.24.0) Signed-off-by: dependabot-preview[bot] --- dev-requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dev-requirements.txt b/dev-requirements.txt index 3d04e5c..15ef1cb 100644 --- a/dev-requirements.txt +++ b/dev-requirements.txt @@ -1,5 +1,5 @@ psutil==5.7.0 -requests==2.23.0 +requests==2.24.0 art==4.7 setuptools>=40.8.0 vulture>=1.0 From 60725c0cc29f36b28ed67bcf79f83d7795d92c8a Mon Sep 17 00:00:00 2001 From: "dependabot-preview[bot]" <27856297+dependabot-preview[bot]@users.noreply.github.com> Date: Mon, 20 Jul 2020 09:09:55 +0000 Subject: [PATCH 29/95] Bump psutil from 5.7.0 to 5.7.2 Bumps [psutil](https://github.com/giampaolo/psutil) from 5.7.0 to 5.7.2. - [Release notes](https://github.com/giampaolo/psutil/releases) - [Changelog](https://github.com/giampaolo/psutil/blob/master/HISTORY.rst) - [Commits](https://github.com/giampaolo/psutil/compare/release-5.7.0...release-5.7.2) Signed-off-by: dependabot-preview[bot] --- dev-requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dev-requirements.txt b/dev-requirements.txt index 15ef1cb..28d70be 100644 --- a/dev-requirements.txt +++ b/dev-requirements.txt @@ -1,4 +1,4 @@ -psutil==5.7.0 +psutil==5.7.2 requests==2.24.0 art==4.7 setuptools>=40.8.0 From b0f700a7b62a2bad525be4e30ebbdd788fc6c436 Mon Sep 17 00:00:00 2001 From: sepandhaghighi Date: Mon, 20 Jul 2020 16:35:12 +0430 Subject: [PATCH 30/95] feat : pythonpublish.yml added --- .github/workflows/pythonpublish.yml | 34 +++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 .github/workflows/pythonpublish.yml diff --git a/.github/workflows/pythonpublish.yml b/.github/workflows/pythonpublish.yml new file mode 100644 index 0000000..2a3bd29 --- /dev/null +++ b/.github/workflows/pythonpublish.yml @@ -0,0 +1,34 @@ +# This workflow will upload a Python Package using Twine when a release is created +# For more information see: https://help.github.com/en/actions/language-and-framework-guides/using-python-with-github-actions#publishing-to-package-registries + +name: Upload Python Package + +on: + push: + # Sequence of patterns matched against refs/tags + tags: + - '*' # Push events to matching v*, i.e. v1.0, v20.15.10 + +jobs: + deploy: + + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v2 + - name: Set up Python + uses: actions/setup-python@v1 + with: + python-version: '3.x' + - name: Install dependencies + run: | + python -m pip install --upgrade pip + pip install setuptools wheel twine + - name: Build and publish + env: + TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }} + TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }} + run: | + python setup.py sdist bdist_wheel + twine upload dist/*.tar.gz + twine upload dist/*.whl From 9baf7750057df71ec5dcf527ec8b99a5ad95e5d1 Mon Sep 17 00:00:00 2001 From: sepandhaghighi Date: Mon, 20 Jul 2020 16:35:55 +0430 Subject: [PATCH 31/95] doc : minor edit in README --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 0317a0f..6ffdfcb 100644 --- a/README.md +++ b/README.md @@ -245,7 +245,7 @@ orangetool.version() # return orangetool version for test #9- check_update -orangetool.check_update # Return True if new version is available +orangetool.check_update() # Return True if new version is available ``` From 7227b1da44e37b8578f68c5023765293c3045f14 Mon Sep 17 00:00:00 2001 From: sepandhaghighi Date: Mon, 20 Jul 2020 16:49:16 +0430 Subject: [PATCH 32/95] feat : hibernate function added --- README.md | 22 +++++++++++++--------- orangetool/orangetool_system.py | 10 ++++++++++ 2 files changed, 23 insertions(+), 9 deletions(-) diff --git a/README.md b/README.md index 6ffdfcb..9d4086a 100644 --- a/README.md +++ b/README.md @@ -214,36 +214,40 @@ orangetool.hdmi_size(1280,720) # this function change hdmi display resolution orangetool.sleep() # put system in sleep mode -#2- halt +#2- hibernate + +orangetool.hibernate() # put system in hibernate mode + +#3- halt orangetool.halt() # poweroff system -#3- restart +#4- restart orangetool.restart() # restart system -#4- wakeup +#5- wakeup orangetool.wakeup(day=1,hour=0,minute=1) # set rtc wakeuptime -#5- get_temp +#6- get_temp temp=orangetool.get_temp() # this function return cpu temperature as string -#6- uptime +#7- uptime time=orangetool.uptime() # this function return uptime of system -#7- idletime +#8- idletime time=orangetool.idletime() # this function return idle of system ( all cores) -#8- version +#9- version orangetool.version() # return orangetool version for test -#9- check_update +#10- check_update orangetool.check_update() # Return True if new version is available @@ -255,7 +259,7 @@ orangetool.check_update() # Return True if new version is available - `local_ip` and `global_ip` originally are available in ipz package [Link](http://github.com/sepandhaghighi/ipz) - RAM functions in this version need psutil package - Running `set_ip` function remotely will freeze your terminal so it's better to set `restart` parameter to True -- Running `halt`,`restart` & `sleep` functions remotely will freeze your terminal +- Running `halt`,`restart`,`hibernate` & `sleep` functions remotely will freeze your terminal - Some of funtions need root access so it's better to run ```sudo -s``` before use this tool diff --git a/orangetool/orangetool_system.py b/orangetool/orangetool_system.py index ae72f4d..2d4b02b 100644 --- a/orangetool/orangetool_system.py +++ b/orangetool/orangetool_system.py @@ -200,6 +200,16 @@ def sleep(DEBUG=False): """ power_control("pm-suspend", DEBUG) +def hibernate(DEBUG=False): + """ + Shortcut for hibernate command (need sudo). + + :param DEBUG: flag for using Debug mode + :type DEBUG:bool + :return: None + """ + power_control("pm-hibernate", DEBUG) + def halt(DEBUG=False): """ From f7fef9d75510877f40f483667cf30942a8ac4b6f Mon Sep 17 00:00:00 2001 From: sepandhaghighi Date: Sat, 14 Nov 2020 21:06:54 +0330 Subject: [PATCH 33/95] doc : CHANGELOG updated --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index b51e652..ec23200 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0. ## [Unreleased] ### Added - `FUNDING.yml` +- `hibernate` function ### Changed - `dev-requirements.txt` modified - Test system modified From 98fab96c62be8d1c4a49f73535609b32e0d63b31 Mon Sep 17 00:00:00 2001 From: "dependabot-preview[bot]" <27856297+dependabot-preview[bot]@users.noreply.github.com> Date: Sun, 15 Nov 2020 21:02:23 +0000 Subject: [PATCH 34/95] Bump art from 4.7 to 4.9 Bumps [art](https://github.com/sepandhaghighi/art) from 4.7 to 4.9. - [Release notes](https://github.com/sepandhaghighi/art/releases) - [Changelog](https://github.com/sepandhaghighi/art/blob/master/CHANGELOG.md) - [Commits](https://github.com/sepandhaghighi/art/compare/v4.7...v4.9) Signed-off-by: dependabot-preview[bot] --- dev-requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dev-requirements.txt b/dev-requirements.txt index 28d70be..7409d10 100644 --- a/dev-requirements.txt +++ b/dev-requirements.txt @@ -1,6 +1,6 @@ psutil==5.7.2 requests==2.24.0 -art==4.7 +art==4.9 setuptools>=40.8.0 vulture>=1.0 bandit>=1.5.1 From 719836b9ea7354957befa6c5b74bdbf5d5e64d68 Mon Sep 17 00:00:00 2001 From: "dependabot-preview[bot]" <27856297+dependabot-preview[bot]@users.noreply.github.com> Date: Sun, 15 Nov 2020 21:13:01 +0000 Subject: [PATCH 35/95] Bump psutil from 5.7.2 to 5.7.3 Bumps [psutil](https://github.com/giampaolo/psutil) from 5.7.2 to 5.7.3. - [Release notes](https://github.com/giampaolo/psutil/releases) - [Changelog](https://github.com/giampaolo/psutil/blob/master/HISTORY.rst) - [Commits](https://github.com/giampaolo/psutil/compare/release-5.7.2...release-5.7.3) Signed-off-by: dependabot-preview[bot] --- dev-requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dev-requirements.txt b/dev-requirements.txt index 7409d10..47f1c94 100644 --- a/dev-requirements.txt +++ b/dev-requirements.txt @@ -1,4 +1,4 @@ -psutil==5.7.2 +psutil==5.7.3 requests==2.24.0 art==4.9 setuptools>=40.8.0 From 1dae49099646dcbd6fb84951358b097d294a1e7c Mon Sep 17 00:00:00 2001 From: "dependabot-preview[bot]" <27856297+dependabot-preview[bot]@users.noreply.github.com> Date: Mon, 16 Nov 2020 07:40:44 +0000 Subject: [PATCH 36/95] Bump requests from 2.24.0 to 2.25.0 Bumps [requests](https://github.com/psf/requests) from 2.24.0 to 2.25.0. - [Release notes](https://github.com/psf/requests/releases) - [Changelog](https://github.com/psf/requests/blob/master/HISTORY.md) - [Commits](https://github.com/psf/requests/compare/v2.24.0...v2.25.0) Signed-off-by: dependabot-preview[bot] --- dev-requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dev-requirements.txt b/dev-requirements.txt index 47f1c94..e34a437 100644 --- a/dev-requirements.txt +++ b/dev-requirements.txt @@ -1,5 +1,5 @@ psutil==5.7.3 -requests==2.24.0 +requests==2.25.0 art==4.9 setuptools>=40.8.0 vulture>=1.0 From 125d4684bd4a538f46fe88f6d1a4d215645d8f29 Mon Sep 17 00:00:00 2001 From: sepandhaghighi Date: Tue, 17 Nov 2020 01:22:29 +0330 Subject: [PATCH 37/95] fix : DEBUG param renamed to debug --- orangetool/orangetool_display.py | 32 ++++++------- orangetool/orangetool_ip.py | 40 ++++++++-------- orangetool/orangetool_ram.py | 8 ++-- orangetool/orangetool_storage.py | 40 ++++++++-------- orangetool/orangetool_system.py | 80 ++++++++++++++++---------------- 5 files changed, 100 insertions(+), 100 deletions(-) diff --git a/orangetool/orangetool_display.py b/orangetool/orangetool_display.py index 5042cd9..e492b02 100644 --- a/orangetool/orangetool_display.py +++ b/orangetool/orangetool_display.py @@ -2,14 +2,14 @@ """Orangetool display functions.""" -def hdmi_controller(command, DEBUG=False): +def hdmi_controller(command, debug=False): """ Control hdmi port. :param command: inpurt command :type command: bool - :param DEBUG: flag for using Debug mode - :type DEBUG: bool + :param debug: flag for using Debug mode + :type debug: bool :return: bool """ try: @@ -21,43 +21,43 @@ def hdmi_controller(command, DEBUG=False): hdmi_control.close() return True except Exception as e: - if DEBUG: + if debug: print(str(e)) return "Error" -def hdmi_on(DEBUG=False): +def hdmi_on(debug=False): """ Turn on hdmi port (need sudo -s). - :param DEBUG: flag for using Debug mode - :type DEBUG:bool + :param debug: flag for using Debug mode + :type debug:bool :return: bool """ - hdmi_controller(True, DEBUG) + hdmi_controller(True, debug) -def hdmi_off(DEBUG=False): +def hdmi_off(debug=False): """ Turn off hdmi port (need sudo -s). - :param DEBUG: flag for using Debug mode - :type DEBUG:bool + :param debug: flag for using Debug mode + :type debug:bool :return: bool """ - hdmi_controller(False, DEBUG) + hdmi_controller(False, debug) -def hdmi_size(v=None, h=None, DEBUG=False): +def hdmi_size(v=None, h=None, debug=False): """ Change hdmi display resolution (need sudo -s) (if call without any argument return current resolution). :param v: vertical line :param h: horizental line - :param DEBUG: flag for using Debug mode + :param debug: flag for using Debug mode :type v : int :type h:int - :type DEBUG:bool + :type debug:bool :return: bool """ try: @@ -71,6 +71,6 @@ def hdmi_size(v=None, h=None, DEBUG=False): hdmi_control.close() return True except Exception as e: - if DEBUG: + if debug: print(str(e)) return "Error" diff --git a/orangetool/orangetool_ip.py b/orangetool/orangetool_ip.py index e872ba1..59b862f 100644 --- a/orangetool/orangetool_ip.py +++ b/orangetool/orangetool_ip.py @@ -36,12 +36,12 @@ def internet(host="8.8.8.8", port=53, timeout=3): return False -def local_ip(DEBUG=False): +def local_ip(debug=False): """ Return local ip of computer in windows by socket module and in unix with hostname command in shell. - :param DEBUG:flag for using Debug Mode - :type DEBUG:bool + :param debug:flag for using Debug Mode + :type debug:bool :return: local ip as string """ try: @@ -62,17 +62,17 @@ def local_ip(DEBUG=False): return "Error" except Exception as e: - if DEBUG: + if debug: print(str(e)) return "Error" -def global_ip(DEBUG=False): +def global_ip(debug=False): """ Return ip with by http://ipinfo.io/ip api. - :param DEBUG:flag for using Debug mode - :type DEBUG:bool + :param debug:flag for using Debug mode + :type debug:bool :return: global ip as string """ try: @@ -82,12 +82,12 @@ def global_ip(DEBUG=False): new_session.close() return ip_list[0] except Exception as e: - if DEBUG: + if debug: print(str(e)) return "Error" -def set_ip(ip, restart=False, device="eth0", DEBUG=False): +def set_ip(ip, restart=False, device="eth0", debug=False): """ Set static ip in interfaces file (need sudo). @@ -97,8 +97,8 @@ def set_ip(ip, restart=False, device="eth0", DEBUG=False): :type device:str :param ip: static ip :type ip :str - :param DEBUG: flag for using Debug mode - :type DEBUG:bool + :param debug: flag for using Debug mode + :type debug:bool :return: True in successful """ static_string = ''' @@ -125,21 +125,21 @@ def set_ip(ip, restart=False, device="eth0", DEBUG=False): restart_func() return True except Exception as e: - if DEBUG: + if debug: print(str(e)) return "Error" -def ping(ip, packet_number=3, DEBUG=False): +def ping(ip, packet_number=3, debug=False): """ Ping ip and return True if this ip is available and False otherwise. :param ip: target ip :param packet_number: number of packet to size - :param DEBUG: flag for using Debug mode + :param debug: flag for using Debug mode :type ip :str :type packet_number:int - :type DEBUG:bool + :type debug:bool :return: a boolean value (True if ip is available and False otherwise) """ try: @@ -155,17 +155,17 @@ def ping(ip, packet_number=3, DEBUG=False): return True return False except Exception as e: - if DEBUG: + if debug: print(str(e)) return "Error" -def mac(DEBUG=False): +def mac(debug=False): """ Return mac addresses of net devices. - :param DEBUG: flag for using Debug mode - :type DEBUG:bool + :param debug: flag for using Debug mode + :type debug:bool :return: return mac addresses as dict with name as keys and mac addresses as values """ try: @@ -178,6 +178,6 @@ def mac(DEBUG=False): mac_addr.close() return dict(zip(dir_list, mac_list)) except Exception as e: - if DEBUG: + if debug: print(str(e)) return "Error" diff --git a/orangetool/orangetool_ram.py b/orangetool/orangetool_ram.py index d08ea3e..6f69a0f 100644 --- a/orangetool/orangetool_ram.py +++ b/orangetool/orangetool_ram.py @@ -75,12 +75,12 @@ def ram_percent(): return str(response[2]) + " %" -def freeup(DEBUG=False): +def freeup(debug=False): """ To free pagecache, dentries and inodes. - :param DEBUG: flag for using Debug mode - :type DEBUG:bool + :param debug: flag for using Debug mode + :type debug:bool :return: Amount of freeuped ram as string and converted by convert_bytes() """ try: @@ -94,6 +94,6 @@ def freeup(DEBUG=False): return convert_bytes(freeuped_ram) return convert_bytes(0) except Exception as e: - if DEBUG: + if debug: print(str(e)) return "Error" diff --git a/orangetool/orangetool_storage.py b/orangetool/orangetool_storage.py index c8cd746..8318ff4 100644 --- a/orangetool/orangetool_storage.py +++ b/orangetool/orangetool_storage.py @@ -6,12 +6,12 @@ import random -def mount_status(device_name, DEBUG=False): +def mount_status(device_name, debug=False): """ Return addresses of mounted memory devices in dev by device name. - :param DEBUG: flag for using Debug mode - :type DEBUG:bool + :param debug: flag for using Debug mode + :type debug:bool :return: list of memory devices """ try: @@ -27,17 +27,17 @@ def mount_status(device_name, DEBUG=False): else: return memory_list except Exception as e: - if DEBUG: + if debug: print(str(e)) return "Error" -def storage_status(DEBUG=False): +def storage_status(debug=False): """ Return all of the inserted memory and their status. - :param DEBUG: flag for using Debug mode - :type DEBUG:bool + :param debug: flag for using Debug mode + :type debug:bool :return: all of the inserted memory and their status as dictionary ( device name as keys and mount status (mounted_addresses as list and u --> unmounted) as values """ try: @@ -51,19 +51,19 @@ def storage_status(DEBUG=False): memory_status.append(mount_status(item)) return dict(zip(memory_items, memory_status)) except Exception as e: - if DEBUG: + if debug: print(str(e)) return "Error" -def unmount(ADDRESS, DEBUG=False): +def unmount(ADDRESS, debug=False): """ Unmount memory devices by addresses. :param ADDRESS: address of that device mount on :type ADDRESS:str - :param DEBUG: flag for using Debug mode - :type DEBUG:bool + :param debug: flag for using Debug mode + :type debug:bool :return: True if device unmount correctly and False other wise """ try: @@ -74,17 +74,17 @@ def unmount(ADDRESS, DEBUG=False): return True return False except Exception as e: - if DEBUG: + if debug: print(str(e)) return "Error" -def unmount_all(DEBUG=False): +def unmount_all(debug=False): """ Unmount all of the mounted devices. - :param DEBUG: flag for using Debug mode - :type DEBUG:bool + :param debug: flag for using Debug mode + :type debug:bool :return: return True if all of the mounted devices unmount correctly """ try: @@ -98,7 +98,7 @@ def unmount_all(DEBUG=False): unmount(j) return True except Exception as e: - if DEBUG: + if debug: print(str(e)) return "Error" @@ -119,16 +119,16 @@ def random_generator(number): return response -def mount(device_name, mount_address=None, DEBUG=False): +def mount(device_name, mount_address=None, debug=False): """ Mount memory devices by addresses. :param device_name: name of device for mounted example = sda1 :param mount_address: address for mounting device example = /mnt/usb , default value is None in this case function generate random number for mount folder name - :param DEBUG: flag for using Debug mode + :param debug: flag for using Debug mode :type device_name:str :type mount_address:str - :type DEBUG:bool + :type debug:bool :return: True if device mount correctly and False other wise """ try: @@ -148,6 +148,6 @@ def mount(device_name, mount_address=None, DEBUG=False): return True return False except Exception as e: - if DEBUG: + if debug: print(str(e)) return "Error" diff --git a/orangetool/orangetool_system.py b/orangetool/orangetool_system.py index 2d4b02b..42849a3 100644 --- a/orangetool/orangetool_system.py +++ b/orangetool/orangetool_system.py @@ -10,12 +10,12 @@ UPDATE_URL = "http://www.orangetool.ir/version" -def check_update(DEBUG=False): +def check_update(debug=False): """ Check orangetool site for new version. - :param DEBUG: flag for using Debug mode - :type DEBUG:bool + :param debug: flag for using Debug mode + :type debug:bool :return: True if new version is available """ try: @@ -26,18 +26,18 @@ def check_update(DEBUG=False): print("Update!") return False except Exception as e: - if DEBUG: + if debug: print(str(e)) return "Error" -def get_temp(Zone=0, DEBUG=False): +def get_temp(Zone=0, debug=False): """ Read cpu temperature. - :param DEBUG : flag for using Debug mode + :param debug : flag for using Debug mode :param Zone : thermal Zone Index - :type DEBUG:bool + :type debug:bool :type Zone:int :return: board temp as string in celsius """ @@ -52,7 +52,7 @@ def get_temp(Zone=0, DEBUG=False): # else: # return "Error" except Exception as e: - if DEBUG: + if debug: print(str(e)) return "Error" @@ -89,12 +89,12 @@ def time_convert(input_string): zero_insert(str(input_minute)) + " minutes, " + zero_insert(str(input_sec)) + " seconds" -def uptime(DEBUG=False): +def uptime(debug=False): """ Return system uptime. - :param DEBUG: flag for using Debug mode - :type DEBUG:bool + :param debug: flag for using Debug mode + :type debug:bool :return: system uptime as string """ try: @@ -102,17 +102,17 @@ def uptime(DEBUG=False): response = command.read() return time_convert(response[:-1].split(" ")[0]) except Exception as e: - if DEBUG: + if debug: print(str(e)) return "Error" -def idletime(DEBUG=False): +def idletime(debug=False): """ Return system idletime. - :param DEBUG: flag for using Debug mode - :type DEBUG:bool + :param debug: flag for using Debug mode + :type debug:bool :return: system idle as string """ try: @@ -120,7 +120,7 @@ def idletime(DEBUG=False): response = command.read() return time_convert(response[:-1].split(" ")[1]) except Exception as e: - if DEBUG: + if debug: print(str(e)) return "Error" @@ -135,18 +135,18 @@ def version(): tprint("v"+VERSION,font="bulbhead") -def wakeup(day=0, hour=0, minute=0, DEBUG=False): +def wakeup(day=0, hour=0, minute=0, debug=False): """ Set wakeup time for kernel RTC (need sudo). :param day: days for wakeup :param hour: hout for wakeup :param minute: minute for wakeup - :param DEBUG: flag for using Debug mode + :param debug: flag for using Debug mode :type day:int :type hour:int :type minute:int - :type DEBUG:bool + :type debug:bool :return: bool """ try: @@ -160,19 +160,19 @@ def wakeup(day=0, hour=0, minute=0, DEBUG=False): file.close() return True except Exception as e: - if DEBUG: + if debug: print(str(e)) return "Error" -def power_control(command, DEBUG=False): +def power_control(command, debug=False): """ Control different power options. :param command: input command :type command: str - :param DEBUG: flag for using Debug mode - :type DEBUG: bool + :param debug: flag for using Debug mode + :type debug: bool :return: None """ try: @@ -185,49 +185,49 @@ def power_control(command, DEBUG=False): if len(response[1]) > 0: raise Exception('Root Error') except Exception as e: - if DEBUG: + if debug: print(str(e)) return "Error" -def sleep(DEBUG=False): +def sleep(debug=False): """ Shortcut for sleep command (need sudo). - :param DEBUG: flag for using Debug mode - :type DEBUG:bool + :param debug: flag for using Debug mode + :type debug:bool :return: None """ - power_control("pm-suspend", DEBUG) + power_control("pm-suspend", debug) -def hibernate(DEBUG=False): +def hibernate(debug=False): """ Shortcut for hibernate command (need sudo). - :param DEBUG: flag for using Debug mode - :type DEBUG:bool + :param debug: flag for using Debug mode + :type debug:bool :return: None """ - power_control("pm-hibernate", DEBUG) + power_control("pm-hibernate", debug) -def halt(DEBUG=False): +def halt(debug=False): """ Shortcut for poweroff (need sudo). - :param DEBUG: flag for using Debug mode - :type DEBUG:bool + :param debug: flag for using Debug mode + :type debug:bool :return: None """ - power_control("poweroff", DEBUG) + power_control("poweroff", debug) -def restart(DEBUG=False): +def restart(debug=False): """ Shortcut for reboot (need sudo). - :param DEBUG: flag for using Debug mode - :type DEBUG:bool + :param debug: flag for using Debug mode + :type debug:bool :return: None """ - power_control("reboot", DEBUG) + power_control("reboot", debug) From b54c2f0f3ff74b92b3d0d330645d9472d225aa89 Mon Sep 17 00:00:00 2001 From: sepandhaghighi Date: Tue, 17 Nov 2020 01:24:11 +0330 Subject: [PATCH 38/95] fix : __version__ added --- orangetool/__init__.py | 25 ++----------------------- 1 file changed, 2 insertions(+), 23 deletions(-) diff --git a/orangetool/__init__.py b/orangetool/__init__.py index 30253fa..84619cb 100644 --- a/orangetool/__init__.py +++ b/orangetool/__init__.py @@ -1,31 +1,10 @@ # -*- coding: utf-8 -*- """Orangetool modules.""" -""" -MIT License - -Copyright (c) 2017 Moduland Co - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. -""" from .orangetool_display import * from .orangetool_ip import * from .orangetool_system import * from .orangetool_ram import * from .orangetool_storage import * + +__version__ = VERSION From 3d079159b9f7c88969c321abac70278e95391664 Mon Sep 17 00:00:00 2001 From: sepandhaghighi Date: Tue, 17 Nov 2020 01:24:55 +0330 Subject: [PATCH 39/95] doc : CHANGELOG updated --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index ec23200..513e4ca 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,6 +11,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0. ### Changed - `dev-requirements.txt` modified - Test system modified +- `DEBUG` parameter renamed to `debug` ## [0.35] - 2019-06-01 ### Added - `version_check.py` From 9bd6c7646903b5d9838b61f0dbd41a3ddd4ae5c0 Mon Sep 17 00:00:00 2001 From: sepandhaghighi Date: Tue, 17 Nov 2020 01:27:22 +0330 Subject: [PATCH 40/95] fix : minor edit in setup.py --- setup.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/setup.py b/setup.py index 53371e4..f73dab4 100644 --- a/setup.py +++ b/setup.py @@ -48,6 +48,8 @@ def read_description(): 'Programming Language :: Python :: 3.5', 'Programming Language :: Python :: 3.6', 'Programming Language :: Python :: 3.7', + 'Programming Language :: Python :: 3.8', + 'Programming Language :: Python :: 3.9', 'Topic :: Scientific/Engineering', ], install_requires=get_requires(), From fb6a7fbf95e5c5a6015e27c728a5f1dc3c381c74 Mon Sep 17 00:00:00 2001 From: sepandhaghighi Date: Tue, 17 Nov 2020 15:19:52 +0330 Subject: [PATCH 41/95] doc : CHANGELOG updated --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 513e4ca..7250c5b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0. ## [Unreleased] ### Added - `FUNDING.yml` +- `__version__` variable - `hibernate` function ### Changed - `dev-requirements.txt` modified From b1085a0837f7fe7f5ce5948ee3f6687525a7878c Mon Sep 17 00:00:00 2001 From: sepandhaghighi Date: Wed, 18 Nov 2020 02:00:50 +0330 Subject: [PATCH 42/95] doc : docstrings updated --- orangetool/orangetool_display.py | 8 ++++---- orangetool/orangetool_ip.py | 10 +++++----- orangetool/orangetool_ram.py | 2 +- orangetool/orangetool_storage.py | 10 +++++----- orangetool/orangetool_system.py | 20 ++++++++++---------- 5 files changed, 25 insertions(+), 25 deletions(-) diff --git a/orangetool/orangetool_display.py b/orangetool/orangetool_display.py index e492b02..21703d2 100644 --- a/orangetool/orangetool_display.py +++ b/orangetool/orangetool_display.py @@ -8,7 +8,7 @@ def hdmi_controller(command, debug=False): :param command: inpurt command :type command: bool - :param debug: flag for using Debug mode + :param debug: flag for using debug mode :type debug: bool :return: bool """ @@ -30,7 +30,7 @@ def hdmi_on(debug=False): """ Turn on hdmi port (need sudo -s). - :param debug: flag for using Debug mode + :param debug: flag for using debug mode :type debug:bool :return: bool """ @@ -41,7 +41,7 @@ def hdmi_off(debug=False): """ Turn off hdmi port (need sudo -s). - :param debug: flag for using Debug mode + :param debug: flag for using debug mode :type debug:bool :return: bool """ @@ -54,7 +54,7 @@ def hdmi_size(v=None, h=None, debug=False): :param v: vertical line :param h: horizental line - :param debug: flag for using Debug mode + :param debug: flag for using debug mode :type v : int :type h:int :type debug:bool diff --git a/orangetool/orangetool_ip.py b/orangetool/orangetool_ip.py index 59b862f..fae4700 100644 --- a/orangetool/orangetool_ip.py +++ b/orangetool/orangetool_ip.py @@ -40,7 +40,7 @@ def local_ip(debug=False): """ Return local ip of computer in windows by socket module and in unix with hostname command in shell. - :param debug:flag for using Debug Mode + :param debug:flag for using debug Mode :type debug:bool :return: local ip as string """ @@ -71,7 +71,7 @@ def global_ip(debug=False): """ Return ip with by http://ipinfo.io/ip api. - :param debug:flag for using Debug mode + :param debug:flag for using debug mode :type debug:bool :return: global ip as string """ @@ -97,7 +97,7 @@ def set_ip(ip, restart=False, device="eth0", debug=False): :type device:str :param ip: static ip :type ip :str - :param debug: flag for using Debug mode + :param debug: flag for using debug mode :type debug:bool :return: True in successful """ @@ -136,7 +136,7 @@ def ping(ip, packet_number=3, debug=False): :param ip: target ip :param packet_number: number of packet to size - :param debug: flag for using Debug mode + :param debug: flag for using debug mode :type ip :str :type packet_number:int :type debug:bool @@ -164,7 +164,7 @@ def mac(debug=False): """ Return mac addresses of net devices. - :param debug: flag for using Debug mode + :param debug: flag for using debug mode :type debug:bool :return: return mac addresses as dict with name as keys and mac addresses as values """ diff --git a/orangetool/orangetool_ram.py b/orangetool/orangetool_ram.py index 6f69a0f..05f3598 100644 --- a/orangetool/orangetool_ram.py +++ b/orangetool/orangetool_ram.py @@ -79,7 +79,7 @@ def freeup(debug=False): """ To free pagecache, dentries and inodes. - :param debug: flag for using Debug mode + :param debug: flag for using debug mode :type debug:bool :return: Amount of freeuped ram as string and converted by convert_bytes() """ diff --git a/orangetool/orangetool_storage.py b/orangetool/orangetool_storage.py index 8318ff4..dc7b0e0 100644 --- a/orangetool/orangetool_storage.py +++ b/orangetool/orangetool_storage.py @@ -10,7 +10,7 @@ def mount_status(device_name, debug=False): """ Return addresses of mounted memory devices in dev by device name. - :param debug: flag for using Debug mode + :param debug: flag for using debug mode :type debug:bool :return: list of memory devices """ @@ -36,7 +36,7 @@ def storage_status(debug=False): """ Return all of the inserted memory and their status. - :param debug: flag for using Debug mode + :param debug: flag for using debug mode :type debug:bool :return: all of the inserted memory and their status as dictionary ( device name as keys and mount status (mounted_addresses as list and u --> unmounted) as values """ @@ -62,7 +62,7 @@ def unmount(ADDRESS, debug=False): :param ADDRESS: address of that device mount on :type ADDRESS:str - :param debug: flag for using Debug mode + :param debug: flag for using debug mode :type debug:bool :return: True if device unmount correctly and False other wise """ @@ -83,7 +83,7 @@ def unmount_all(debug=False): """ Unmount all of the mounted devices. - :param debug: flag for using Debug mode + :param debug: flag for using debug mode :type debug:bool :return: return True if all of the mounted devices unmount correctly """ @@ -125,7 +125,7 @@ def mount(device_name, mount_address=None, debug=False): :param device_name: name of device for mounted example = sda1 :param mount_address: address for mounting device example = /mnt/usb , default value is None in this case function generate random number for mount folder name - :param debug: flag for using Debug mode + :param debug: flag for using debug mode :type device_name:str :type mount_address:str :type debug:bool diff --git a/orangetool/orangetool_system.py b/orangetool/orangetool_system.py index 42849a3..9d844cb 100644 --- a/orangetool/orangetool_system.py +++ b/orangetool/orangetool_system.py @@ -14,7 +14,7 @@ def check_update(debug=False): """ Check orangetool site for new version. - :param debug: flag for using Debug mode + :param debug: flag for using debug mode :type debug:bool :return: True if new version is available """ @@ -35,7 +35,7 @@ def get_temp(Zone=0, debug=False): """ Read cpu temperature. - :param debug : flag for using Debug mode + :param debug : flag for using debug mode :param Zone : thermal Zone Index :type debug:bool :type Zone:int @@ -93,7 +93,7 @@ def uptime(debug=False): """ Return system uptime. - :param debug: flag for using Debug mode + :param debug: flag for using debug mode :type debug:bool :return: system uptime as string """ @@ -111,7 +111,7 @@ def idletime(debug=False): """ Return system idletime. - :param debug: flag for using Debug mode + :param debug: flag for using debug mode :type debug:bool :return: system idle as string """ @@ -142,7 +142,7 @@ def wakeup(day=0, hour=0, minute=0, debug=False): :param day: days for wakeup :param hour: hout for wakeup :param minute: minute for wakeup - :param debug: flag for using Debug mode + :param debug: flag for using debug mode :type day:int :type hour:int :type minute:int @@ -171,7 +171,7 @@ def power_control(command, debug=False): :param command: input command :type command: str - :param debug: flag for using Debug mode + :param debug: flag for using debug mode :type debug: bool :return: None """ @@ -194,7 +194,7 @@ def sleep(debug=False): """ Shortcut for sleep command (need sudo). - :param debug: flag for using Debug mode + :param debug: flag for using debug mode :type debug:bool :return: None """ @@ -204,7 +204,7 @@ def hibernate(debug=False): """ Shortcut for hibernate command (need sudo). - :param debug: flag for using Debug mode + :param debug: flag for using debug mode :type debug:bool :return: None """ @@ -215,7 +215,7 @@ def halt(debug=False): """ Shortcut for poweroff (need sudo). - :param debug: flag for using Debug mode + :param debug: flag for using debug mode :type debug:bool :return: None """ @@ -226,7 +226,7 @@ def restart(debug=False): """ Shortcut for reboot (need sudo). - :param debug: flag for using Debug mode + :param debug: flag for using debug mode :type debug:bool :return: None """ From 33ca44c91756b4c5b49f6ab79d58106619284525 Mon Sep 17 00:00:00 2001 From: sepandhaghighi Date: Fri, 20 Nov 2020 14:00:40 +0330 Subject: [PATCH 43/95] fix : VERSION renamed to ORANGETOOL_VERSION --- orangetool/orangetool_system.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/orangetool/orangetool_system.py b/orangetool/orangetool_system.py index 9d844cb..285be4e 100644 --- a/orangetool/orangetool_system.py +++ b/orangetool/orangetool_system.py @@ -6,7 +6,7 @@ from art import tprint ip_pattern = r"(?:[0-9]{1,3}\.){3}[0-9]{1,3}" api_1 = "http://ipinfo.io/ip" -VERSION = "0.35" +ORANGETOOL_VERSION = "0.35" UPDATE_URL = "http://www.orangetool.ir/version" @@ -20,7 +20,7 @@ def check_update(debug=False): """ try: new_version = requests.get(UPDATE_URL).text - if float(new_version) > float(VERSION): + if float(new_version) > float(ORANGETOOL_VERSION): print("New Version (" + new_version + ") Of Orangetool Is Available") return True print("Update!") @@ -132,7 +132,7 @@ def version(): :return: return orangetool-version number as string """ tprint("orangetool", font="bulbhead") - tprint("v"+VERSION,font="bulbhead") + tprint("v"+ORANGETOOL_VERSION,font="bulbhead") def wakeup(day=0, hour=0, minute=0, debug=False): From 192f6ff9215bc786b6724ef240a1b3999584bd8b Mon Sep 17 00:00:00 2001 From: sepandhaghighi Date: Fri, 20 Nov 2020 14:04:54 +0330 Subject: [PATCH 44/95] fix : variables uppercased --- orangetool/orangetool_ip.py | 12 ++++++------ orangetool/orangetool_system.py | 3 +-- 2 files changed, 7 insertions(+), 8 deletions(-) diff --git a/orangetool/orangetool_ip.py b/orangetool/orangetool_ip.py index fae4700..1a70160 100644 --- a/orangetool/orangetool_ip.py +++ b/orangetool/orangetool_ip.py @@ -7,8 +7,8 @@ import requests import re import platform -ip_pattern = r"(?:[0-9]{1,3}\.){3}[0-9]{1,3}" -api_1 = "http://ipinfo.io/ip" +IP_PATTERN = r"(?:[0-9]{1,3}\.){3}[0-9]{1,3}" +GLOBAL_IP_API_1 = "http://ipinfo.io/ip" def internet(host="8.8.8.8", port=53, timeout=3): @@ -77,8 +77,8 @@ def global_ip(debug=False): """ try: new_session = requests.session() - response = new_session.get(api_1) - ip_list = re.findall(ip_pattern, response.text) + response = new_session.get(GLOBAL_IP_API_1) + ip_list = re.findall(IP_PATTERN, response.text) new_session.close() return ip_list[0] except Exception as e: @@ -111,7 +111,7 @@ def set_ip(ip, restart=False, device="eth0", debug=False): dns-nameservers 8.8.8.8 8.8.4.4 ''' try: - if bool(re.match(ip_pattern, ip)) == False or ip.find( + if bool(re.match(IP_PATTERN, ip)) == False or ip.find( "192.168.") == -1 or device not in mac().keys(): raise Exception("IP Formation Error") static_string = static_string.replace("ip", ip) @@ -143,7 +143,7 @@ def ping(ip, packet_number=3, debug=False): :return: a boolean value (True if ip is available and False otherwise) """ try: - if re.match(ip_pattern, ip) == False: + if re.match(IP_PATTERN, ip) == False: raise Exception("IP Formation Error") output = str(list(sub.Popen(["ping", ip, diff --git a/orangetool/orangetool_system.py b/orangetool/orangetool_system.py index 285be4e..0fb9eed 100644 --- a/orangetool/orangetool_system.py +++ b/orangetool/orangetool_system.py @@ -4,8 +4,7 @@ import time import requests from art import tprint -ip_pattern = r"(?:[0-9]{1,3}\.){3}[0-9]{1,3}" -api_1 = "http://ipinfo.io/ip" + ORANGETOOL_VERSION = "0.35" UPDATE_URL = "http://www.orangetool.ir/version" From f57eb447367aeab9ea64a78556c2b69373a28c6a Mon Sep 17 00:00:00 2001 From: sepandhaghighi Date: Fri, 20 Nov 2020 14:05:44 +0330 Subject: [PATCH 45/95] fix : minor edit in __init__ --- orangetool/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/orangetool/__init__.py b/orangetool/__init__.py index 84619cb..b6416d5 100644 --- a/orangetool/__init__.py +++ b/orangetool/__init__.py @@ -7,4 +7,4 @@ from .orangetool_ram import * from .orangetool_storage import * -__version__ = VERSION +__version__ = ORANGETOOL_VERSION From 846dfe69009f906494bd1276dd29d3f81e3180f2 Mon Sep 17 00:00:00 2001 From: "dependabot-preview[bot]" <27856297+dependabot-preview[bot]@users.noreply.github.com> Date: Sat, 28 Nov 2020 17:49:50 +0000 Subject: [PATCH 46/95] Bump art from 4.9 to 5.0 Bumps [art](https://github.com/sepandhaghighi/art) from 4.9 to 5.0. - [Release notes](https://github.com/sepandhaghighi/art/releases) - [Changelog](https://github.com/sepandhaghighi/art/blob/master/CHANGELOG.md) - [Commits](https://github.com/sepandhaghighi/art/compare/v4.9...v5.0) Signed-off-by: dependabot-preview[bot] --- dev-requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dev-requirements.txt b/dev-requirements.txt index e34a437..c7de35d 100644 --- a/dev-requirements.txt +++ b/dev-requirements.txt @@ -1,6 +1,6 @@ psutil==5.7.3 requests==2.25.0 -art==4.9 +art==5.0 setuptools>=40.8.0 vulture>=1.0 bandit>=1.5.1 From 31f365f79be6215edc67757c96f116e149df820b Mon Sep 17 00:00:00 2001 From: sepandhaghighi Date: Tue, 1 Dec 2020 01:05:31 +0330 Subject: [PATCH 47/95] feat : usb_control, usb_on and usb_off functions added #36 --- orangetool/orangetool_system.py | 44 +++++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) diff --git a/orangetool/orangetool_system.py b/orangetool/orangetool_system.py index 0fb9eed..0fcfd2c 100644 --- a/orangetool/orangetool_system.py +++ b/orangetool/orangetool_system.py @@ -230,3 +230,47 @@ def restart(debug=False): :return: None """ power_control("reboot", debug) + +def usb_control(code, debug=False): + """ + Control different usb options. + + :param code: permission code + :type code: str + :param debug: flag for using debug mode + :type debug: bool + :return: None + """ + try: + command = sub.Popen( + "chmod {0} /media/".format(code), + stderr=sub.PIPE, + stdout=sub.PIPE, + stdin=sub.PIPE) + response = list(command.communicate()) + if len(response[1]) > 0: + raise Exception('Root Error') + except Exception as e: + if debug: + print(str(e)) + return "Error" + +def usb_on(debug=False): + """ + Shortcut for enable usb (need sudo). + + :param debug: flag for using debug mode + :type debug:bool + :return: None + """ + usb_control("777",debug) + +def usb_off(debug=False): + """ + Shortcut for disable usb (need sudo). + + :param debug: flag for using debug mode + :type debug:bool + :return: None + """ + usb_control("000", debug) From f398a2cd34383ec2d983272bd4031a5a63b279da Mon Sep 17 00:00:00 2001 From: sepandhaghighi Date: Tue, 1 Dec 2020 01:07:52 +0330 Subject: [PATCH 48/95] fix : new functions moved to orangetool_storage.py #36 --- orangetool/orangetool_storage.py | 44 ++++++++++++++++++++++++++++++++ orangetool/orangetool_system.py | 43 ------------------------------- 2 files changed, 44 insertions(+), 43 deletions(-) diff --git a/orangetool/orangetool_storage.py b/orangetool/orangetool_storage.py index dc7b0e0..6af3ebd 100644 --- a/orangetool/orangetool_storage.py +++ b/orangetool/orangetool_storage.py @@ -151,3 +151,47 @@ def mount(device_name, mount_address=None, debug=False): if debug: print(str(e)) return "Error" + +def usb_control(code, debug=False): + """ + Control different usb options. + + :param code: permission code + :type code: str + :param debug: flag for using debug mode + :type debug: bool + :return: None + """ + try: + command = sub.Popen( + "chmod {0} /media/".format(code), + stderr=sub.PIPE, + stdout=sub.PIPE, + stdin=sub.PIPE) + response = list(command.communicate()) + if len(response[1]) > 0: + raise Exception('Root Error') + except Exception as e: + if debug: + print(str(e)) + return "Error" + +def usb_on(debug=False): + """ + Shortcut for enable usb (need sudo). + + :param debug: flag for using debug mode + :type debug:bool + :return: None + """ + usb_control("777",debug) + +def usb_off(debug=False): + """ + Shortcut for disable usb (need sudo). + + :param debug: flag for using debug mode + :type debug:bool + :return: None + """ + usb_control("000", debug) \ No newline at end of file diff --git a/orangetool/orangetool_system.py b/orangetool/orangetool_system.py index 0fcfd2c..83c4166 100644 --- a/orangetool/orangetool_system.py +++ b/orangetool/orangetool_system.py @@ -231,46 +231,3 @@ def restart(debug=False): """ power_control("reboot", debug) -def usb_control(code, debug=False): - """ - Control different usb options. - - :param code: permission code - :type code: str - :param debug: flag for using debug mode - :type debug: bool - :return: None - """ - try: - command = sub.Popen( - "chmod {0} /media/".format(code), - stderr=sub.PIPE, - stdout=sub.PIPE, - stdin=sub.PIPE) - response = list(command.communicate()) - if len(response[1]) > 0: - raise Exception('Root Error') - except Exception as e: - if debug: - print(str(e)) - return "Error" - -def usb_on(debug=False): - """ - Shortcut for enable usb (need sudo). - - :param debug: flag for using debug mode - :type debug:bool - :return: None - """ - usb_control("777",debug) - -def usb_off(debug=False): - """ - Shortcut for disable usb (need sudo). - - :param debug: flag for using debug mode - :type debug:bool - :return: None - """ - usb_control("000", debug) From 0e249ae7e2357b7757b254eb6dbcb001433eb29a Mon Sep 17 00:00:00 2001 From: sepandhaghighi Date: Tue, 1 Dec 2020 01:09:56 +0330 Subject: [PATCH 49/95] doc : README updated #36 --- README.md | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/README.md b/README.md index 9d4086a..471f05c 100644 --- a/README.md +++ b/README.md @@ -188,6 +188,14 @@ orangetool.unmount_all() #This function unmount all of the mounted devices orangetool.mount("sda1","/mnt/usb1") # This function mount input device in input addresses +#6- usb_on + +orangetool.usb_on() # This function enable USB + +#7- usb_off + +orangetool.usb_off() # This function disable USB + ``` ### Display Functions From d37fe1a77f08d80c35f6e0aea1283ddb1742f6a1 Mon Sep 17 00:00:00 2001 From: sepandhaghighi Date: Tue, 1 Dec 2020 01:11:40 +0330 Subject: [PATCH 50/95] doc : CHANGELOG updated #36 --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 7250c5b..c08e41e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0. - `FUNDING.yml` - `__version__` variable - `hibernate` function +- `usb_control`, `usb_on` and `usb_off` functions ### Changed - `dev-requirements.txt` modified - Test system modified From 17ac6456c2c361eb6b5a95e2ec5c1ef89cc76356 Mon Sep 17 00:00:00 2001 From: sepandhaghighi Date: Tue, 1 Dec 2020 01:12:00 +0330 Subject: [PATCH 51/95] fix : autopep8 #36 --- orangetool/orangetool_storage.py | 7 +++++-- orangetool/orangetool_system.py | 4 ++-- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/orangetool/orangetool_storage.py b/orangetool/orangetool_storage.py index 6af3ebd..dc4c201 100644 --- a/orangetool/orangetool_storage.py +++ b/orangetool/orangetool_storage.py @@ -152,6 +152,7 @@ def mount(device_name, mount_address=None, debug=False): print(str(e)) return "Error" + def usb_control(code, debug=False): """ Control different usb options. @@ -176,6 +177,7 @@ def usb_control(code, debug=False): print(str(e)) return "Error" + def usb_on(debug=False): """ Shortcut for enable usb (need sudo). @@ -184,7 +186,8 @@ def usb_on(debug=False): :type debug:bool :return: None """ - usb_control("777",debug) + usb_control("777", debug) + def usb_off(debug=False): """ @@ -194,4 +197,4 @@ def usb_off(debug=False): :type debug:bool :return: None """ - usb_control("000", debug) \ No newline at end of file + usb_control("000", debug) diff --git a/orangetool/orangetool_system.py b/orangetool/orangetool_system.py index 83c4166..c19425c 100644 --- a/orangetool/orangetool_system.py +++ b/orangetool/orangetool_system.py @@ -131,7 +131,7 @@ def version(): :return: return orangetool-version number as string """ tprint("orangetool", font="bulbhead") - tprint("v"+ORANGETOOL_VERSION,font="bulbhead") + tprint("v" + ORANGETOOL_VERSION, font="bulbhead") def wakeup(day=0, hour=0, minute=0, debug=False): @@ -199,6 +199,7 @@ def sleep(debug=False): """ power_control("pm-suspend", debug) + def hibernate(debug=False): """ Shortcut for hibernate command (need sudo). @@ -230,4 +231,3 @@ def restart(debug=False): :return: None """ power_control("reboot", debug) - From 70ebe98fe9b3d900ed72c9ca70b8d1dc9463e1e6 Mon Sep 17 00:00:00 2001 From: sepandhaghighi Date: Thu, 3 Dec 2020 03:09:14 +0330 Subject: [PATCH 52/95] fix : minor edit in usb_control function #36 --- orangetool/orangetool_storage.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/orangetool/orangetool_storage.py b/orangetool/orangetool_storage.py index dc4c201..8ffdef6 100644 --- a/orangetool/orangetool_storage.py +++ b/orangetool/orangetool_storage.py @@ -165,7 +165,7 @@ def usb_control(code, debug=False): """ try: command = sub.Popen( - "chmod {0} /media/".format(code), + ["chmod", code ,"/media/"], stderr=sub.PIPE, stdout=sub.PIPE, stdin=sub.PIPE) From efc96b15196289a2342350e2e910ad57961b6c1c Mon Sep 17 00:00:00 2001 From: sepandhaghighi Date: Thu, 3 Dec 2020 19:43:03 +0330 Subject: [PATCH 53/95] fix : minor edit in usb_control function #36 --- orangetool/orangetool_storage.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/orangetool/orangetool_storage.py b/orangetool/orangetool_storage.py index 8ffdef6..a53353b 100644 --- a/orangetool/orangetool_storage.py +++ b/orangetool/orangetool_storage.py @@ -165,7 +165,7 @@ def usb_control(code, debug=False): """ try: command = sub.Popen( - ["chmod", code ,"/media/"], + ["chmod", "-R", code,"/media/"], stderr=sub.PIPE, stdout=sub.PIPE, stdin=sub.PIPE) From ae937639b4fb40f68da59be4665018e4924195ee Mon Sep 17 00:00:00 2001 From: "dependabot-preview[bot]" <27856297+dependabot-preview[bot]@users.noreply.github.com> Date: Mon, 7 Dec 2020 07:21:55 +0000 Subject: [PATCH 54/95] Bump art from 5.0 to 5.1 Bumps [art](https://github.com/sepandhaghighi/art) from 5.0 to 5.1. - [Release notes](https://github.com/sepandhaghighi/art/releases) - [Changelog](https://github.com/sepandhaghighi/art/blob/master/CHANGELOG.md) - [Commits](https://github.com/sepandhaghighi/art/compare/v5.0...v5.1) Signed-off-by: dependabot-preview[bot] --- dev-requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dev-requirements.txt b/dev-requirements.txt index c7de35d..83ae268 100644 --- a/dev-requirements.txt +++ b/dev-requirements.txt @@ -1,6 +1,6 @@ psutil==5.7.3 requests==2.25.0 -art==5.0 +art==5.1 setuptools>=40.8.0 vulture>=1.0 bandit>=1.5.1 From 6b0fdaa5cb291d54b921c2c0dc06bd175a05b17b Mon Sep 17 00:00:00 2001 From: sepandhaghighi Date: Mon, 7 Dec 2020 18:21:51 +0330 Subject: [PATCH 55/95] doc : minor edits in docstrings --- orangetool/orangetool_display.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/orangetool/orangetool_display.py b/orangetool/orangetool_display.py index 21703d2..ce912c0 100644 --- a/orangetool/orangetool_display.py +++ b/orangetool/orangetool_display.py @@ -6,7 +6,7 @@ def hdmi_controller(command, debug=False): """ Control hdmi port. - :param command: inpurt command + :param command: input command :type command: bool :param debug: flag for using debug mode :type debug: bool @@ -53,7 +53,7 @@ def hdmi_size(v=None, h=None, debug=False): Change hdmi display resolution (need sudo -s) (if call without any argument return current resolution). :param v: vertical line - :param h: horizental line + :param h: horizontal line :param debug: flag for using debug mode :type v : int :type h:int From 5e9631c0555dc475f3a8c0e7fcf810d00f63af59 Mon Sep 17 00:00:00 2001 From: sepandhaghighi Date: Mon, 7 Dec 2020 18:25:31 +0330 Subject: [PATCH 56/95] fix : ADDRESS parameter renamed to address --- orangetool/orangetool_storage.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/orangetool/orangetool_storage.py b/orangetool/orangetool_storage.py index a53353b..4077236 100644 --- a/orangetool/orangetool_storage.py +++ b/orangetool/orangetool_storage.py @@ -56,18 +56,18 @@ def storage_status(debug=False): return "Error" -def unmount(ADDRESS, debug=False): +def unmount(address, debug=False): """ Unmount memory devices by addresses. - :param ADDRESS: address of that device mount on - :type ADDRESS:str + :param address: address of that device mount on + :type address:str :param debug: flag for using debug mode :type debug:bool :return: True if device unmount correctly and False other wise """ try: - command = sub.Popen(["umount", ADDRESS], + command = sub.Popen(["umount", address], stdout=sub.PIPE, stderr=sub.PIPE) output = list(command.communicate()) if len(output[0]) == 0 and len(output[1]) == 0: From f31652eb23e18aef1007d32bed0b252e1b55f815 Mon Sep 17 00:00:00 2001 From: sepandhaghighi Date: Mon, 7 Dec 2020 18:27:52 +0330 Subject: [PATCH 57/95] fix : Zone parameter renamed to zone --- orangetool/orangetool_system.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/orangetool/orangetool_system.py b/orangetool/orangetool_system.py index c19425c..bb6707f 100644 --- a/orangetool/orangetool_system.py +++ b/orangetool/orangetool_system.py @@ -30,19 +30,19 @@ def check_update(debug=False): return "Error" -def get_temp(Zone=0, debug=False): +def get_temp(zone=0, debug=False): """ Read cpu temperature. :param debug : flag for using debug mode - :param Zone : thermal Zone Index + :param zone : thermal zone index :type debug:bool - :type Zone:int + :type zone:int :return: board temp as string in celsius """ try: - command = open("/sys/class/thermal/thermal_zone" + str(Zone) + "/temp") - # command=sub.Popen(["cat","/sys/class/thermal/thermal_zone"+str(Zone)+"/temp"],stderr=sub.PIPE,stdin=sub.PIPE,stdout=sub.PIPE) + command = open("/sys/class/thermal/thermal_zone" + str(zone) + "/temp") + # command=sub.Popen(["cat","/sys/class/thermal/thermal_zone"+str(zone)+"/temp"],stderr=sub.PIPE,stdin=sub.PIPE,stdout=sub.PIPE) # response=list(command.communicate()) response = command.read() return response[:-1] From 581942136f84c041fccfa32faaecbb2ee878111c Mon Sep 17 00:00:00 2001 From: sepandhaghighi Date: Mon, 7 Dec 2020 18:32:25 +0330 Subject: [PATCH 58/95] fix : params moved to orangetool_params.py --- orangetool/__init__.py | 1 + orangetool/orangetool_ip.py | 4 +--- orangetool/orangetool_params.py | 7 +++++++ orangetool/orangetool_system.py | 4 +--- 4 files changed, 10 insertions(+), 6 deletions(-) create mode 100644 orangetool/orangetool_params.py diff --git a/orangetool/__init__.py b/orangetool/__init__.py index b6416d5..9f14387 100644 --- a/orangetool/__init__.py +++ b/orangetool/__init__.py @@ -6,5 +6,6 @@ from .orangetool_system import * from .orangetool_ram import * from .orangetool_storage import * +from .orangetool_params import ORANGETOOL_VERSION __version__ = ORANGETOOL_VERSION diff --git a/orangetool/orangetool_ip.py b/orangetool/orangetool_ip.py index 1a70160..2d9d338 100644 --- a/orangetool/orangetool_ip.py +++ b/orangetool/orangetool_ip.py @@ -1,15 +1,13 @@ # -*- coding: utf-8 -*- """Orangetool IP functions.""" from .orangetool_system import restart as restart_func +from .orangetool_params import IP_PATTERN, GLOBAL_IP_API_1 import subprocess as sub import socket import os import requests import re import platform -IP_PATTERN = r"(?:[0-9]{1,3}\.){3}[0-9]{1,3}" -GLOBAL_IP_API_1 = "http://ipinfo.io/ip" - def internet(host="8.8.8.8", port=53, timeout=3): """ diff --git a/orangetool/orangetool_params.py b/orangetool/orangetool_params.py new file mode 100644 index 0000000..e8e0cce --- /dev/null +++ b/orangetool/orangetool_params.py @@ -0,0 +1,7 @@ +# -*- coding: utf-8 -*- +"""Orangetool params.""" + +ORANGETOOL_VERSION = "0.35" +UPDATE_URL = "http://www.orangetool.ir/version" +IP_PATTERN = r"(?:[0-9]{1,3}\.){3}[0-9]{1,3}" +GLOBAL_IP_API_1 = "http://ipinfo.io/ip" \ No newline at end of file diff --git a/orangetool/orangetool_system.py b/orangetool/orangetool_system.py index bb6707f..fbef5ae 100644 --- a/orangetool/orangetool_system.py +++ b/orangetool/orangetool_system.py @@ -1,13 +1,11 @@ # -*- coding: utf-8 -*- """Orangetool system functions.""" import subprocess as sub +from .orangetool_params import ORANGETOOL_VERSION, UPDATE_URL import time import requests from art import tprint -ORANGETOOL_VERSION = "0.35" -UPDATE_URL = "http://www.orangetool.ir/version" - def check_update(debug=False): """ From a4a872b80a55592745be9e05fe965f811d4b9a19 Mon Sep 17 00:00:00 2001 From: sepandhaghighi Date: Mon, 7 Dec 2020 18:38:09 +0330 Subject: [PATCH 59/95] fix : error messages updated --- orangetool/orangetool_display.py | 6 +++--- orangetool/orangetool_ip.py | 16 ++++++++-------- orangetool/orangetool_params.py | 3 ++- orangetool/orangetool_ram.py | 4 ++-- orangetool/orangetool_storage.py | 14 +++++++------- orangetool/orangetool_system.py | 16 ++++++++-------- 6 files changed, 30 insertions(+), 29 deletions(-) diff --git a/orangetool/orangetool_display.py b/orangetool/orangetool_display.py index ce912c0..27bae96 100644 --- a/orangetool/orangetool_display.py +++ b/orangetool/orangetool_display.py @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- """Orangetool display functions.""" - +from .orangetool_params import GENERAL_ERROR_MESSAGE def hdmi_controller(command, debug=False): """ @@ -23,7 +23,7 @@ def hdmi_controller(command, debug=False): except Exception as e: if debug: print(str(e)) - return "Error" + return GENERAL_ERROR_MESSAGE def hdmi_on(debug=False): @@ -73,4 +73,4 @@ def hdmi_size(v=None, h=None, debug=False): except Exception as e: if debug: print(str(e)) - return "Error" + return GENERAL_ERROR_MESSAGE diff --git a/orangetool/orangetool_ip.py b/orangetool/orangetool_ip.py index 2d9d338..182b0b9 100644 --- a/orangetool/orangetool_ip.py +++ b/orangetool/orangetool_ip.py @@ -1,7 +1,7 @@ # -*- coding: utf-8 -*- """Orangetool IP functions.""" from .orangetool_system import restart as restart_func -from .orangetool_params import IP_PATTERN, GLOBAL_IP_API_1 +from .orangetool_params import IP_PATTERN, GLOBAL_IP_API_1, GENERAL_ERROR_MESSAGE import subprocess as sub import socket import os @@ -56,13 +56,13 @@ def local_ip(debug=False): response = list(command.communicate()) if len(response[0]) > 0: return str(response[0])[2:-4] - return "Error" - return "Error" + return GENERAL_ERROR_MESSAGE + return GENERAL_ERROR_MESSAGE except Exception as e: if debug: print(str(e)) - return "Error" + return GENERAL_ERROR_MESSAGE def global_ip(debug=False): @@ -82,7 +82,7 @@ def global_ip(debug=False): except Exception as e: if debug: print(str(e)) - return "Error" + return GENERAL_ERROR_MESSAGE def set_ip(ip, restart=False, device="eth0", debug=False): @@ -125,7 +125,7 @@ def set_ip(ip, restart=False, device="eth0", debug=False): except Exception as e: if debug: print(str(e)) - return "Error" + return GENERAL_ERROR_MESSAGE def ping(ip, packet_number=3, debug=False): @@ -155,7 +155,7 @@ def ping(ip, packet_number=3, debug=False): except Exception as e: if debug: print(str(e)) - return "Error" + return GENERAL_ERROR_MESSAGE def mac(debug=False): @@ -178,4 +178,4 @@ def mac(debug=False): except Exception as e: if debug: print(str(e)) - return "Error" + return GENERAL_ERROR_MESSAGE diff --git a/orangetool/orangetool_params.py b/orangetool/orangetool_params.py index e8e0cce..f6b1bef 100644 --- a/orangetool/orangetool_params.py +++ b/orangetool/orangetool_params.py @@ -4,4 +4,5 @@ ORANGETOOL_VERSION = "0.35" UPDATE_URL = "http://www.orangetool.ir/version" IP_PATTERN = r"(?:[0-9]{1,3}\.){3}[0-9]{1,3}" -GLOBAL_IP_API_1 = "http://ipinfo.io/ip" \ No newline at end of file +GLOBAL_IP_API_1 = "http://ipinfo.io/ip" +GENERAL_ERROR_MESSAGE = "Error" \ No newline at end of file diff --git a/orangetool/orangetool_ram.py b/orangetool/orangetool_ram.py index 05f3598..4a579c4 100644 --- a/orangetool/orangetool_ram.py +++ b/orangetool/orangetool_ram.py @@ -1,7 +1,7 @@ # -*- coding: utf-8 -*- """Orangetool RAM functions.""" import psutil - +from .orangetool_params import GENERAL_ERROR_MESSAGE def convert_bytes(num): """ @@ -96,4 +96,4 @@ def freeup(debug=False): except Exception as e: if debug: print(str(e)) - return "Error" + return GENERAL_ERROR_MESSAGE diff --git a/orangetool/orangetool_storage.py b/orangetool/orangetool_storage.py index 4077236..ab25095 100644 --- a/orangetool/orangetool_storage.py +++ b/orangetool/orangetool_storage.py @@ -4,7 +4,7 @@ import os import string import random - +from .orangetool_params import GENERAL_ERROR_MESSAGE def mount_status(device_name, debug=False): """ @@ -29,7 +29,7 @@ def mount_status(device_name, debug=False): except Exception as e: if debug: print(str(e)) - return "Error" + return GENERAL_ERROR_MESSAGE def storage_status(debug=False): @@ -53,7 +53,7 @@ def storage_status(debug=False): except Exception as e: if debug: print(str(e)) - return "Error" + return GENERAL_ERROR_MESSAGE def unmount(address, debug=False): @@ -76,7 +76,7 @@ def unmount(address, debug=False): except Exception as e: if debug: print(str(e)) - return "Error" + return GENERAL_ERROR_MESSAGE def unmount_all(debug=False): @@ -100,7 +100,7 @@ def unmount_all(debug=False): except Exception as e: if debug: print(str(e)) - return "Error" + return GENERAL_ERROR_MESSAGE def random_generator(number): @@ -150,7 +150,7 @@ def mount(device_name, mount_address=None, debug=False): except Exception as e: if debug: print(str(e)) - return "Error" + return GENERAL_ERROR_MESSAGE def usb_control(code, debug=False): @@ -175,7 +175,7 @@ def usb_control(code, debug=False): except Exception as e: if debug: print(str(e)) - return "Error" + return GENERAL_ERROR_MESSAGE def usb_on(debug=False): diff --git a/orangetool/orangetool_system.py b/orangetool/orangetool_system.py index fbef5ae..336782e 100644 --- a/orangetool/orangetool_system.py +++ b/orangetool/orangetool_system.py @@ -1,7 +1,7 @@ # -*- coding: utf-8 -*- """Orangetool system functions.""" import subprocess as sub -from .orangetool_params import ORANGETOOL_VERSION, UPDATE_URL +from .orangetool_params import ORANGETOOL_VERSION, UPDATE_URL, GENERAL_ERROR_MESSAGE import time import requests from art import tprint @@ -25,7 +25,7 @@ def check_update(debug=False): except Exception as e: if debug: print(str(e)) - return "Error" + return GENERAL_ERROR_MESSAGE def get_temp(zone=0, debug=False): @@ -47,11 +47,11 @@ def get_temp(zone=0, debug=False): # if len(response[0])!=0: # return str(response[0])[2:-3] # else: - # return "Error" + # return GENERAL_ERROR_MESSAGE except Exception as e: if debug: print(str(e)) - return "Error" + return GENERAL_ERROR_MESSAGE def zero_insert(input_string): @@ -101,7 +101,7 @@ def uptime(debug=False): except Exception as e: if debug: print(str(e)) - return "Error" + return GENERAL_ERROR_MESSAGE def idletime(debug=False): @@ -119,7 +119,7 @@ def idletime(debug=False): except Exception as e: if debug: print(str(e)) - return "Error" + return GENERAL_ERROR_MESSAGE def version(): @@ -159,7 +159,7 @@ def wakeup(day=0, hour=0, minute=0, debug=False): except Exception as e: if debug: print(str(e)) - return "Error" + return GENERAL_ERROR_MESSAGE def power_control(command, debug=False): @@ -184,7 +184,7 @@ def power_control(command, debug=False): except Exception as e: if debug: print(str(e)) - return "Error" + return GENERAL_ERROR_MESSAGE def sleep(debug=False): From d7f578fcd72ce60790c2bdf4bc6dbdaf1be7b0a2 Mon Sep 17 00:00:00 2001 From: sepandhaghighi Date: Mon, 7 Dec 2020 18:41:47 +0330 Subject: [PATCH 60/95] fix : error messages updated --- orangetool/orangetool_params.py | 3 ++- orangetool/orangetool_storage.py | 4 ++-- orangetool/orangetool_system.py | 4 ++-- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/orangetool/orangetool_params.py b/orangetool/orangetool_params.py index f6b1bef..59e02f2 100644 --- a/orangetool/orangetool_params.py +++ b/orangetool/orangetool_params.py @@ -5,4 +5,5 @@ UPDATE_URL = "http://www.orangetool.ir/version" IP_PATTERN = r"(?:[0-9]{1,3}\.){3}[0-9]{1,3}" GLOBAL_IP_API_1 = "http://ipinfo.io/ip" -GENERAL_ERROR_MESSAGE = "Error" \ No newline at end of file +GENERAL_ERROR_MESSAGE = "Error" +ROOT_ERROR_MESSAGE = "Root Error" \ No newline at end of file diff --git a/orangetool/orangetool_storage.py b/orangetool/orangetool_storage.py index ab25095..212c5e0 100644 --- a/orangetool/orangetool_storage.py +++ b/orangetool/orangetool_storage.py @@ -4,7 +4,7 @@ import os import string import random -from .orangetool_params import GENERAL_ERROR_MESSAGE +from .orangetool_params import GENERAL_ERROR_MESSAGE, ROOT_ERROR_MESSAGE def mount_status(device_name, debug=False): """ @@ -171,7 +171,7 @@ def usb_control(code, debug=False): stdin=sub.PIPE) response = list(command.communicate()) if len(response[1]) > 0: - raise Exception('Root Error') + raise Exception(ROOT_ERROR_MESSAGE) except Exception as e: if debug: print(str(e)) diff --git a/orangetool/orangetool_system.py b/orangetool/orangetool_system.py index 336782e..f1204da 100644 --- a/orangetool/orangetool_system.py +++ b/orangetool/orangetool_system.py @@ -1,7 +1,7 @@ # -*- coding: utf-8 -*- """Orangetool system functions.""" import subprocess as sub -from .orangetool_params import ORANGETOOL_VERSION, UPDATE_URL, GENERAL_ERROR_MESSAGE +from .orangetool_params import ORANGETOOL_VERSION, UPDATE_URL, GENERAL_ERROR_MESSAGE, ROOT_ERROR_MESSAGE import time import requests from art import tprint @@ -180,7 +180,7 @@ def power_control(command, debug=False): stdin=sub.PIPE) response = list(command.communicate()) if len(response[1]) > 0: - raise Exception('Root Error') + raise Exception(ROOT_ERROR_MESSAGE) except Exception as e: if debug: print(str(e)) From 536e3bd4d2de6877f558eda16de4650370cdb771 Mon Sep 17 00:00:00 2001 From: sepandhaghighi Date: Mon, 7 Dec 2020 18:43:49 +0330 Subject: [PATCH 61/95] doc : CHANGELOG updated --- CHANGELOG.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index c08e41e..745a902 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -14,6 +14,9 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0. - `dev-requirements.txt` modified - Test system modified - `DEBUG` parameter renamed to `debug` +- All parameters moved to `orangetool_params.py` +- `ADDRESS` parameter renamed to `address` +- `Zone` parameter renamed to `zone` ## [0.35] - 2019-06-01 ### Added - `version_check.py` From f87a9366d7cb8c428d3e65e4d03e8f433fddd859 Mon Sep 17 00:00:00 2001 From: sepandhaghighi Date: Mon, 7 Dec 2020 18:44:57 +0330 Subject: [PATCH 62/95] fix : minor edit in version_check script --- version_check.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/version_check.py b/version_check.py index a2b08e4..b96f593 100644 --- a/version_check.py +++ b/version_check.py @@ -25,7 +25,7 @@ "CHANGELOG.md": CHANGELOG_ITEMS, os.path.join( "orangetool", - "orangetool_system.py"): PARAMS_ITEMS} + "orangetool_params.py"): PARAMS_ITEMS} TEST_NUMBER = len(FILES.keys()) From b4a910e9a7939453d6cd0d679016055f6979bcef Mon Sep 17 00:00:00 2001 From: sepandhaghighi Date: Mon, 7 Dec 2020 18:54:14 +0330 Subject: [PATCH 63/95] doc : docstrings updated --- orangetool/orangetool_display.py | 4 ++-- orangetool/orangetool_ip.py | 12 ++++++------ orangetool/orangetool_ram.py | 4 ++-- orangetool/orangetool_storage.py | 6 ++++-- orangetool/orangetool_system.py | 10 +++++----- 5 files changed, 19 insertions(+), 17 deletions(-) diff --git a/orangetool/orangetool_display.py b/orangetool/orangetool_display.py index 27bae96..eb2f82d 100644 --- a/orangetool/orangetool_display.py +++ b/orangetool/orangetool_display.py @@ -53,10 +53,10 @@ def hdmi_size(v=None, h=None, debug=False): Change hdmi display resolution (need sudo -s) (if call without any argument return current resolution). :param v: vertical line + :type v : int :param h: horizontal line + :type h: int :param debug: flag for using debug mode - :type v : int - :type h:int :type debug:bool :return: bool """ diff --git a/orangetool/orangetool_ip.py b/orangetool/orangetool_ip.py index 182b0b9..c081b0b 100644 --- a/orangetool/orangetool_ip.py +++ b/orangetool/orangetool_ip.py @@ -14,10 +14,10 @@ def internet(host="8.8.8.8", port=53, timeout=3): Check internet connections. :param host: the host that check connection to - :param port: port that check connection with - :param timeout: times that check the connection :type host:str + :param port: port that check connection with :type port:int + :param timeout: times that check the connection :type timeout:int :return bool: True if Connection is Stable >>> internet() # if there is stable internet connection @@ -89,12 +89,12 @@ def set_ip(ip, restart=False, device="eth0", debug=False): """ Set static ip in interfaces file (need sudo). + :param ip: static ip + :type ip :str :param restart : restart flag :type restart : bool :param device: network device name :type device:str - :param ip: static ip - :type ip :str :param debug: flag for using debug mode :type debug:bool :return: True in successful @@ -133,10 +133,10 @@ def ping(ip, packet_number=3, debug=False): Ping ip and return True if this ip is available and False otherwise. :param ip: target ip - :param packet_number: number of packet to size - :param debug: flag for using debug mode :type ip :str + :param packet_number: number of packet to size :type packet_number:int + :param debug: flag for using debug mode :type debug:bool :return: a boolean value (True if ip is available and False otherwise) """ diff --git a/orangetool/orangetool_ram.py b/orangetool/orangetool_ram.py index 4a579c4..3112b66 100644 --- a/orangetool/orangetool_ram.py +++ b/orangetool/orangetool_ram.py @@ -69,7 +69,7 @@ def ram_percent(): """ Return available ram percentage. - :return: availabe ram percentage as string with % + :return: available ram percentage as string with % """ response = list(psutil.virtual_memory()) return str(response[2]) + " %" @@ -81,7 +81,7 @@ def freeup(debug=False): :param debug: flag for using debug mode :type debug:bool - :return: Amount of freeuped ram as string and converted by convert_bytes() + :return: amount of freeuped ram as string and converted by convert_bytes() """ try: RAM_before = int(ram_free(convert=False)) diff --git a/orangetool/orangetool_storage.py b/orangetool/orangetool_storage.py index 212c5e0..5146e35 100644 --- a/orangetool/orangetool_storage.py +++ b/orangetool/orangetool_storage.py @@ -10,6 +10,8 @@ def mount_status(device_name, debug=False): """ Return addresses of mounted memory devices in dev by device name. + :param device_name: name of device + :type device_name: str :param debug: flag for using debug mode :type debug:bool :return: list of memory devices @@ -124,10 +126,10 @@ def mount(device_name, mount_address=None, debug=False): Mount memory devices by addresses. :param device_name: name of device for mounted example = sda1 - :param mount_address: address for mounting device example = /mnt/usb , default value is None in this case function generate random number for mount folder name - :param debug: flag for using debug mode :type device_name:str + :param mount_address: address for mounting device example = /mnt/usb , default value is None in this case function generate random number for mount folder name :type mount_address:str + :param debug: flag for using debug mode :type debug:bool :return: True if device mount correctly and False other wise """ diff --git a/orangetool/orangetool_system.py b/orangetool/orangetool_system.py index f1204da..41bda45 100644 --- a/orangetool/orangetool_system.py +++ b/orangetool/orangetool_system.py @@ -32,10 +32,10 @@ def get_temp(zone=0, debug=False): """ Read cpu temperature. - :param debug : flag for using debug mode :param zone : thermal zone index - :type debug:bool :type zone:int + :param debug : flag for using debug mode + :type debug:bool :return: board temp as string in celsius """ try: @@ -137,12 +137,12 @@ def wakeup(day=0, hour=0, minute=0, debug=False): Set wakeup time for kernel RTC (need sudo). :param day: days for wakeup - :param hour: hout for wakeup - :param minute: minute for wakeup - :param debug: flag for using debug mode :type day:int + :param hour: hour for wakeup :type hour:int + :param minute: minute for wakeup :type minute:int + :param debug: flag for using debug mode :type debug:bool :return: bool """ From 6bb1768f23b43abb9b028406af311a32e3a66e39 Mon Sep 17 00:00:00 2001 From: sepandhaghighi Date: Mon, 7 Dec 2020 18:54:48 +0330 Subject: [PATCH 64/95] doc : CHANGELOG updated --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 745a902..21e8b0b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -17,6 +17,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0. - All parameters moved to `orangetool_params.py` - `ADDRESS` parameter renamed to `address` - `Zone` parameter renamed to `zone` +- Docstrings updated ## [0.35] - 2019-06-01 ### Added - `version_check.py` From b1a783f229cf8df1561ef4a78b7a9352adbbd90d Mon Sep 17 00:00:00 2001 From: sepandhaghighi Date: Mon, 7 Dec 2020 18:55:12 +0330 Subject: [PATCH 65/95] fix : autopep8 --- orangetool/orangetool_display.py | 1 + orangetool/orangetool_ip.py | 1 + orangetool/orangetool_params.py | 2 +- orangetool/orangetool_ram.py | 1 + orangetool/orangetool_storage.py | 3 ++- 5 files changed, 6 insertions(+), 2 deletions(-) diff --git a/orangetool/orangetool_display.py b/orangetool/orangetool_display.py index eb2f82d..932235b 100644 --- a/orangetool/orangetool_display.py +++ b/orangetool/orangetool_display.py @@ -2,6 +2,7 @@ """Orangetool display functions.""" from .orangetool_params import GENERAL_ERROR_MESSAGE + def hdmi_controller(command, debug=False): """ Control hdmi port. diff --git a/orangetool/orangetool_ip.py b/orangetool/orangetool_ip.py index c081b0b..97315bf 100644 --- a/orangetool/orangetool_ip.py +++ b/orangetool/orangetool_ip.py @@ -9,6 +9,7 @@ import re import platform + def internet(host="8.8.8.8", port=53, timeout=3): """ Check internet connections. diff --git a/orangetool/orangetool_params.py b/orangetool/orangetool_params.py index 59e02f2..03fc8e7 100644 --- a/orangetool/orangetool_params.py +++ b/orangetool/orangetool_params.py @@ -6,4 +6,4 @@ IP_PATTERN = r"(?:[0-9]{1,3}\.){3}[0-9]{1,3}" GLOBAL_IP_API_1 = "http://ipinfo.io/ip" GENERAL_ERROR_MESSAGE = "Error" -ROOT_ERROR_MESSAGE = "Root Error" \ No newline at end of file +ROOT_ERROR_MESSAGE = "Root Error" diff --git a/orangetool/orangetool_ram.py b/orangetool/orangetool_ram.py index 3112b66..663f460 100644 --- a/orangetool/orangetool_ram.py +++ b/orangetool/orangetool_ram.py @@ -3,6 +3,7 @@ import psutil from .orangetool_params import GENERAL_ERROR_MESSAGE + def convert_bytes(num): """ Convert num to idiomatic byte unit. diff --git a/orangetool/orangetool_storage.py b/orangetool/orangetool_storage.py index 5146e35..a0948c3 100644 --- a/orangetool/orangetool_storage.py +++ b/orangetool/orangetool_storage.py @@ -6,6 +6,7 @@ import random from .orangetool_params import GENERAL_ERROR_MESSAGE, ROOT_ERROR_MESSAGE + def mount_status(device_name, debug=False): """ Return addresses of mounted memory devices in dev by device name. @@ -167,7 +168,7 @@ def usb_control(code, debug=False): """ try: command = sub.Popen( - ["chmod", "-R", code,"/media/"], + ["chmod", "-R", code, "/media/"], stderr=sub.PIPE, stdout=sub.PIPE, stdin=sub.PIPE) From d4fd9b76475b13ceb4939cd887520b37b28b0a02 Mon Sep 17 00:00:00 2001 From: sepandhaghighi Date: Mon, 7 Dec 2020 18:58:08 +0330 Subject: [PATCH 66/95] fix : minor edit in test.sh --- test.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test.sh b/test.sh index 7a6f73b..317e187 100644 --- a/test.sh +++ b/test.sh @@ -3,7 +3,7 @@ python version_check.py if [ "$TRAVIS_PYTHON_VERSION" = '3.6' ] then - python -m vulture --min-confidence 65 --sort-by-size orangetool setup.py version_check.py + python -m vulture orangetool/ setup.py version_check.py --min-confidence 65 --sort-by-size python -m bandit -r orangetool -s B607,B603,B404,B311 - python -m pydocstyle --match-dir=orangetool + python -m pydocstyle -v --match-dir=orangetool fi \ No newline at end of file From 1c2e0db60481b84c37695851a75ce5d08945a2fe Mon Sep 17 00:00:00 2001 From: sepandhaghighi Date: Mon, 7 Dec 2020 22:40:06 +0330 Subject: [PATCH 67/95] doc : docstrings updated --- orangetool/orangetool_system.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/orangetool/orangetool_system.py b/orangetool/orangetool_system.py index 41bda45..252a7b9 100644 --- a/orangetool/orangetool_system.py +++ b/orangetool/orangetool_system.py @@ -69,7 +69,7 @@ def zero_insert(input_string): def time_convert(input_string): """ - Convert input_string from uptime from sec to DD,HH,MM,SS Format. + Convert input_string from sec to DD,HH,MM,SS Format. :param input_string: input time string in sec :type input_string:str From 378afc194f28c9a612050902584fa1fd6f9c2414 Mon Sep 17 00:00:00 2001 From: sepandhaghighi Date: Mon, 7 Dec 2020 22:45:27 +0330 Subject: [PATCH 68/95] fix : uptime and idletime functions updated --- orangetool/orangetool_system.py | 33 ++++++++++++++++++++------------- 1 file changed, 20 insertions(+), 13 deletions(-) diff --git a/orangetool/orangetool_system.py b/orangetool/orangetool_system.py index 252a7b9..72e1b79 100644 --- a/orangetool/orangetool_system.py +++ b/orangetool/orangetool_system.py @@ -85,24 +85,38 @@ def time_convert(input_string): return zero_insert(str(input_day)) + " days, " + zero_insert(str(input_hour)) + " hour, " + \ zero_insert(str(input_minute)) + " minutes, " + zero_insert(str(input_sec)) + " seconds" - -def uptime(debug=False): +def time_control(mode="uptime",debug=False): """ - Return system uptime. + Return system time. + :param mode: time mode (uptime / idle) + :type mode: str :param debug: flag for using debug mode :type debug:bool - :return: system uptime as string + :return: system time as string """ + index = 0 + if mode in ["idle","idletime"]: + index = 1 try: command = open("/proc/uptime") response = command.read() - return time_convert(response[:-1].split(" ")[0]) + return time_convert(response[:-1].split(" ")[index]) except Exception as e: if debug: print(str(e)) return GENERAL_ERROR_MESSAGE +def uptime(debug=False): + """ + Return system uptime. + + :param debug: flag for using debug mode + :type debug:bool + :return: system uptime as string + """ + time_control(mode="uptime",debug=debug) + def idletime(debug=False): """ @@ -112,14 +126,7 @@ def idletime(debug=False): :type debug:bool :return: system idle as string """ - try: - command = open("/proc/uptime") - response = command.read() - return time_convert(response[:-1].split(" ")[1]) - except Exception as e: - if debug: - print(str(e)) - return GENERAL_ERROR_MESSAGE + time_control(mode="idle", debug=debug) def version(): From 8aa9fd9063033d2ab0fa70ff644d412669f1a14f Mon Sep 17 00:00:00 2001 From: sepandhaghighi Date: Mon, 7 Dec 2020 22:46:14 +0330 Subject: [PATCH 69/95] doc : CHANGELOG updated --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 21e8b0b..f57aecb 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -17,6 +17,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0. - All parameters moved to `orangetool_params.py` - `ADDRESS` parameter renamed to `address` - `Zone` parameter renamed to `zone` +- `uptime` and `idletime` functions updated - Docstrings updated ## [0.35] - 2019-06-01 ### Added From 19c1421f26efac323a1e4f8e66f3b5d7b9dfda91 Mon Sep 17 00:00:00 2001 From: sepandhaghighi Date: Mon, 7 Dec 2020 22:51:33 +0330 Subject: [PATCH 70/95] fix : __init__ file updated --- orangetool/__init__.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/orangetool/__init__.py b/orangetool/__init__.py index 9f14387..c407463 100644 --- a/orangetool/__init__.py +++ b/orangetool/__init__.py @@ -1,11 +1,11 @@ # -*- coding: utf-8 -*- """Orangetool modules.""" -from .orangetool_display import * -from .orangetool_ip import * -from .orangetool_system import * -from .orangetool_ram import * -from .orangetool_storage import * +from .orangetool_display import hdmi_on, hdmi_off, hdmi_size +from .orangetool_ip import internet, local_ip, global_ip, set_ip, ping, mac +from .orangetool_system import check_update, get_temp, uptime, idletime, wakeup, version, sleep, hibernate, halt, restart +from .orangetool_ram import ram_total, ram_used, ram_free, ram_percent, freeup +from .orangetool_storage import mount_status, storage_status, unmount, unmount_all, mount, usb_on, usb_off from .orangetool_params import ORANGETOOL_VERSION __version__ = ORANGETOOL_VERSION From 7fc5d13a24ce5adae9f17fc01bff09b5c0a51886 Mon Sep 17 00:00:00 2001 From: sepandhaghighi Date: Mon, 7 Dec 2020 22:58:24 +0330 Subject: [PATCH 71/95] fix : some functions moved to orangetool_utils.py --- orangetool/orangetool_ram.py | 22 +--------- orangetool/orangetool_storage.py | 19 +-------- orangetool/orangetool_system.py | 33 +-------------- orangetool/orangetool_utils.py | 69 ++++++++++++++++++++++++++++++++ 4 files changed, 72 insertions(+), 71 deletions(-) create mode 100644 orangetool/orangetool_utils.py diff --git a/orangetool/orangetool_ram.py b/orangetool/orangetool_ram.py index 663f460..c92eabb 100644 --- a/orangetool/orangetool_ram.py +++ b/orangetool/orangetool_ram.py @@ -2,27 +2,7 @@ """Orangetool RAM functions.""" import psutil from .orangetool_params import GENERAL_ERROR_MESSAGE - - -def convert_bytes(num): - """ - Convert num to idiomatic byte unit. - - :param num: the input number. - :type num:int - :return: str - >>> convert_bytes(200) - '200.0 bytes' - >>> convert_bytes(6000) - '5.9 KB' - >>> convert_bytes(80000) - '78.1 KB' - """ - for x in ['bytes', 'KB', 'MB', 'GB', 'TB']: - if num < 1024.0: - return "%3.1f %s" % (num, x) - num /= 1024.0 - +from .orangetool_utils import convert_bytes def ram_total(convert=True): """ diff --git a/orangetool/orangetool_storage.py b/orangetool/orangetool_storage.py index a0948c3..2c976d1 100644 --- a/orangetool/orangetool_storage.py +++ b/orangetool/orangetool_storage.py @@ -3,8 +3,8 @@ import subprocess as sub import os import string -import random from .orangetool_params import GENERAL_ERROR_MESSAGE, ROOT_ERROR_MESSAGE +from .orangetool_utils import random_generator def mount_status(device_name, debug=False): @@ -105,23 +105,6 @@ def unmount_all(debug=False): print(str(e)) return GENERAL_ERROR_MESSAGE - -def random_generator(number): - """ - Generate random number. - - :param number: random number digits - :type number: int - :return: random number as str - """ - response = "" - i = 0 - while(i < number): - i += 1 - response += str(random.randint(0, 9)) - return response - - def mount(device_name, mount_address=None, debug=False): """ Mount memory devices by addresses. diff --git a/orangetool/orangetool_system.py b/orangetool/orangetool_system.py index 72e1b79..d26661b 100644 --- a/orangetool/orangetool_system.py +++ b/orangetool/orangetool_system.py @@ -2,6 +2,7 @@ """Orangetool system functions.""" import subprocess as sub from .orangetool_params import ORANGETOOL_VERSION, UPDATE_URL, GENERAL_ERROR_MESSAGE, ROOT_ERROR_MESSAGE +from .orangetool_utils import time_convert import time import requests from art import tprint @@ -53,38 +54,6 @@ def get_temp(zone=0, debug=False): print(str(e)) return GENERAL_ERROR_MESSAGE - -def zero_insert(input_string): - """ - Get a string as input if input is one digit add a zero. - - :param input_string: input digit az string - :type input_string:str - :return: modified output as str - """ - if len(input_string) == 1: - return "0" + input_string - return input_string - - -def time_convert(input_string): - """ - Convert input_string from sec to DD,HH,MM,SS Format. - - :param input_string: input time string in sec - :type input_string:str - :return: converted time as string - """ - input_sec = float(input_string) - input_minute = input_sec // 60 - input_sec = int(input_sec - input_minute * 60) - input_hour = input_minute // 60 - input_minute = int(input_minute - input_hour * 60) - input_day = int(input_hour // 24) - input_hour = int(input_hour - input_day * 24) - return zero_insert(str(input_day)) + " days, " + zero_insert(str(input_hour)) + " hour, " + \ - zero_insert(str(input_minute)) + " minutes, " + zero_insert(str(input_sec)) + " seconds" - def time_control(mode="uptime",debug=False): """ Return system time. diff --git a/orangetool/orangetool_utils.py b/orangetool/orangetool_utils.py new file mode 100644 index 0000000..3f5e1f5 --- /dev/null +++ b/orangetool/orangetool_utils.py @@ -0,0 +1,69 @@ +# -*- coding: utf-8 -*- +"""Orangetool utils.""" +import random + +def zero_insert(input_string): + """ + Get a string as input if input is one digit add a zero. + + :param input_string: input digit az string + :type input_string:str + :return: modified output as str + """ + if len(input_string) == 1: + return "0" + input_string + return input_string + + +def time_convert(input_string): + """ + Convert input_string from sec to DD,HH,MM,SS Format. + + :param input_string: input time string in sec + :type input_string:str + :return: converted time as string + """ + input_sec = float(input_string) + input_minute = input_sec // 60 + input_sec = int(input_sec - input_minute * 60) + input_hour = input_minute // 60 + input_minute = int(input_minute - input_hour * 60) + input_day = int(input_hour // 24) + input_hour = int(input_hour - input_day * 24) + return zero_insert(str(input_day)) + " days, " + zero_insert(str(input_hour)) + " hour, " + \ + zero_insert(str(input_minute)) + " minutes, " + zero_insert(str(input_sec)) + " seconds" + + +def random_generator(number): + """ + Generate random number. + + :param number: random number digits + :type number: int + :return: random number as str + """ + response = "" + i = 0 + while(i < number): + i += 1 + response += str(random.randint(0, 9)) + return response + +def convert_bytes(num): + """ + Convert num to idiomatic byte unit. + + :param num: the input number. + :type num:int + :return: str + >>> convert_bytes(200) + '200.0 bytes' + >>> convert_bytes(6000) + '5.9 KB' + >>> convert_bytes(80000) + '78.1 KB' + """ + for x in ['bytes', 'KB', 'MB', 'GB', 'TB']: + if num < 1024.0: + return "%3.1f %s" % (num, x) + num /= 1024.0 From 4e7ff3032bbd82ad2ddcacb07980111926ef67d9 Mon Sep 17 00:00:00 2001 From: sepandhaghighi Date: Mon, 7 Dec 2020 23:03:01 +0330 Subject: [PATCH 72/95] doc : CHANGELOG updated --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index f57aecb..74c1be8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -15,6 +15,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0. - Test system modified - `DEBUG` parameter renamed to `debug` - All parameters moved to `orangetool_params.py` +- Some functions moved to `orangetool_utils.py` - `ADDRESS` parameter renamed to `address` - `Zone` parameter renamed to `zone` - `uptime` and `idletime` functions updated From b7c59855ffc6339be753e05ec8d3f1ee90aeffee Mon Sep 17 00:00:00 2001 From: sepandhaghighi Date: Mon, 7 Dec 2020 23:06:46 +0330 Subject: [PATCH 73/95] fix : orangetool_test.py added --- orangetool/orangetool_test.py | 6 ++++++ test.sh | 1 + 2 files changed, 7 insertions(+) create mode 100644 orangetool/orangetool_test.py diff --git a/orangetool/orangetool_test.py b/orangetool/orangetool_test.py new file mode 100644 index 0000000..8f50494 --- /dev/null +++ b/orangetool/orangetool_test.py @@ -0,0 +1,6 @@ +# -*- coding: utf-8 -*- +"""Orangetool test.""" +from orangetool import * + +if __name__ == "__main__": + version() \ No newline at end of file diff --git a/test.sh b/test.sh index 317e187..b4c11d0 100644 --- a/test.sh +++ b/test.sh @@ -1,6 +1,7 @@ set -e set -x python version_check.py + python orangetool/orangetool_test.py if [ "$TRAVIS_PYTHON_VERSION" = '3.6' ] then python -m vulture orangetool/ setup.py version_check.py --min-confidence 65 --sort-by-size From 2af6d5db0f09925ec0884a81ef2eb9443f44783c Mon Sep 17 00:00:00 2001 From: sepandhaghighi Date: Tue, 8 Dec 2020 23:08:40 +0330 Subject: [PATCH 74/95] feat : __main__.py added #43 --- orangetool/__main__.py | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 orangetool/__main__.py diff --git a/orangetool/__main__.py b/orangetool/__main__.py new file mode 100644 index 0000000..d78587c --- /dev/null +++ b/orangetool/__main__.py @@ -0,0 +1,7 @@ +# -*- coding: utf-8 -*- +"""Orangetool main.""" + +from .orangetool_system import version + +if __name__ == "__main__": + version() From 293e69f86350c54e2db9b96e12525bb48e1f4681 Mon Sep 17 00:00:00 2001 From: sepandhaghighi Date: Tue, 8 Dec 2020 23:09:39 +0330 Subject: [PATCH 75/95] doc : CHANGELOG updated #43 --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 74c1be8..8076220 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0. ## [Unreleased] ### Added - `FUNDING.yml` +- `__main__.py` - `__version__` variable - `hibernate` function - `usb_control`, `usb_on` and `usb_off` functions From 79c42860590fab44a15860d38506ef3bd809705b Mon Sep 17 00:00:00 2001 From: sepandhaghighi Date: Tue, 8 Dec 2020 23:10:02 +0330 Subject: [PATCH 76/95] fix : .gitignore added --- .gitignore | 100 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 100 insertions(+) create mode 100644 .gitignore diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..b811a9e --- /dev/null +++ b/.gitignore @@ -0,0 +1,100 @@ +# Created by .ignore support plugin (hsz.mobi) +### Python template +# Byte-compiled / optimized / DLL files +__pycache__/ +*.py[cod] +*$py.class + +# C extensions +*.so + +# Distribution / packaging +.Python +env/ +build/ +develop-eggs/ +dist/ +downloads/ +eggs/ +.eggs/ +lib/ +lib64/ +parts/ +sdist/ +var/ +*.egg-info/ +.installed.cfg +*.egg + +# PyInstaller +# Usually these files are written by a python script from a template +# before PyInstaller builds the exe, so as to inject date/other infos into it. +*.manifest +*.spec + +# Installer logs +pip-log.txt +pip-delete-this-directory.txt + +# Unit test / coverage reports +htmlcov/ +.tox/ +.coverage +.coverage.* +.cache +nosetests.xml +coverage.xml +*,cover +.hypothesis/ + +# Translations +*.mo +*.pot + +# Django stuff: +*.log +local_settings.py + +# Flask stuff: +instance/ +.webassets-cache + +# Scrapy stuff: +.scrapy + +# Sphinx documentation +docs/_build/ + +# PyBuilder +target/ + +# Jupyter Notebook +.ipynb_checkpoints + +# pyenv +.python-version + +# celery beat schedule file +celerybeat-schedule + +# dotenv +.env + +# virtualenv +.venv/ +venv/ +ENV/ + +# Spyder project settings +.spyderproject + +# Rope project settings +.ropeproject +### Example user template template +### Example user template + +# IntelliJ project files +.idea +*.iml +out +gen From 14bd339f40ec4b33ca9fe63c66384b222d3c0d21 Mon Sep 17 00:00:00 2001 From: sepandhaghighi Date: Tue, 8 Dec 2020 23:11:00 +0330 Subject: [PATCH 77/95] doc : minor edit in README --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 471f05c..c2e01f7 100644 --- a/README.md +++ b/README.md @@ -128,7 +128,7 @@ ip_status=orangetool.ping(ip_address) #this function check ip and return True if #5- set_ip -set_ip("192.168.1.46","eth0") #this function set static ip for system +orangetool.set_ip("192.168.1.46","eth0") #this function set static ip for system #6- mac From 16139b0567a4f210356f216529da2deb1ea087cc Mon Sep 17 00:00:00 2001 From: sepandhaghighi Date: Tue, 8 Dec 2020 23:12:18 +0330 Subject: [PATCH 78/95] fix : test.sh updated #43 --- .travis.yml | 1 + test.sh | 1 + 2 files changed, 2 insertions(+) diff --git a/.travis.yml b/.travis.yml index d3e9f33..fb26b41 100644 --- a/.travis.yml +++ b/.travis.yml @@ -30,6 +30,7 @@ matrix: install: - pip install -r requirements.txt - python setup.py install + - python -m orangetool before_script: - pip install --upgrade --upgrade-strategy=only-if-needed -r dev-requirements.txt - chmod +x test.sh diff --git a/test.sh b/test.sh index b4c11d0..6eb5baa 100644 --- a/test.sh +++ b/test.sh @@ -2,6 +2,7 @@ set -x python version_check.py python orangetool/orangetool_test.py + python -m orangetool if [ "$TRAVIS_PYTHON_VERSION" = '3.6' ] then python -m vulture orangetool/ setup.py version_check.py --min-confidence 65 --sort-by-size From 785b4637a60155cb06ee6576dcc3187a2d97cfd3 Mon Sep 17 00:00:00 2001 From: sepandhaghighi Date: Thu, 10 Dec 2020 13:45:03 +0330 Subject: [PATCH 79/95] fix : minor edit in version_check script --- version_check.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/version_check.py b/version_check.py index b96f593..2bad875 100644 --- a/version_check.py +++ b/version_check.py @@ -18,7 +18,7 @@ "## [{0}]", "https://github.com/Moduland/Orangetool/compare/v{0}...dev", "[{0}]:"] -PARAMS_ITEMS = ['VERSION = "{0}"'] +PARAMS_ITEMS = ['ORANGETOOL_VERSION = "{0}"'] FILES = { "setup.py": SETUP_ITEMS, "README.md": README_ITEMS, From 1a300826bb18c4a6a65b0ea13a9edd036c5c97a2 Mon Sep 17 00:00:00 2001 From: sepandhaghighi Date: Thu, 10 Dec 2020 13:47:30 +0330 Subject: [PATCH 80/95] fix : minor bug fixed in mount_status function --- orangetool/orangetool_storage.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/orangetool/orangetool_storage.py b/orangetool/orangetool_storage.py index 2c976d1..9b83685 100644 --- a/orangetool/orangetool_storage.py +++ b/orangetool/orangetool_storage.py @@ -27,8 +27,7 @@ def mount_status(device_name, debug=False): memory_list.append(temp[1]) if len(memory_list) == 0: return "u" - else: - return memory_list + return memory_list except Exception as e: if debug: print(str(e)) From ebb76c0027b4471312f6b1ac568250bfc4d8ce8f Mon Sep 17 00:00:00 2001 From: sepandhaghighi Date: Thu, 10 Dec 2020 13:48:35 +0330 Subject: [PATCH 81/95] fix : minor edit in local_ip function --- orangetool/orangetool_ip.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/orangetool/orangetool_ip.py b/orangetool/orangetool_ip.py index 97315bf..048bf8e 100644 --- a/orangetool/orangetool_ip.py +++ b/orangetool/orangetool_ip.py @@ -47,7 +47,7 @@ def local_ip(debug=False): ip = socket.gethostbyname(socket.gethostname()) if ip != "127.0.0.1": return ip - elif platform.system() != "Windows": + if platform.system() != "Windows": command = sub.Popen(["hostname", "-I"], stdout=sub.PIPE, From dc8afd510aca9d2ffde0cf86f96de2097c19d3c7 Mon Sep 17 00:00:00 2001 From: sepandhaghighi Date: Thu, 10 Dec 2020 13:50:09 +0330 Subject: [PATCH 82/95] fix : minor edit in set_ip function --- orangetool/orangetool_ip.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/orangetool/orangetool_ip.py b/orangetool/orangetool_ip.py index 048bf8e..9272011 100644 --- a/orangetool/orangetool_ip.py +++ b/orangetool/orangetool_ip.py @@ -110,7 +110,7 @@ def set_ip(ip, restart=False, device="eth0", debug=False): dns-nameservers 8.8.8.8 8.8.4.4 ''' try: - if bool(re.match(IP_PATTERN, ip)) == False or ip.find( + if not bool(re.match(IP_PATTERN, ip)) or ip.find( "192.168.") == -1 or device not in mac().keys(): raise Exception("IP Formation Error") static_string = static_string.replace("ip", ip) @@ -142,7 +142,7 @@ def ping(ip, packet_number=3, debug=False): :return: a boolean value (True if ip is available and False otherwise) """ try: - if re.match(IP_PATTERN, ip) == False: + if not re.match(IP_PATTERN, ip): raise Exception("IP Formation Error") output = str(list(sub.Popen(["ping", ip, From ed5385d913cb6a32e7010435c1448c4a71986a00 Mon Sep 17 00:00:00 2001 From: sepandhaghighi Date: Thu, 10 Dec 2020 13:51:00 +0330 Subject: [PATCH 83/95] doc : CHANGELOG updated --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 8076220..d550cec 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -21,6 +21,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0. - `Zone` parameter renamed to `zone` - `uptime` and `idletime` functions updated - Docstrings updated +- `README.md` modified ## [0.35] - 2019-06-01 ### Added - `version_check.py` From 9fce3bfbe3109b96ab9e5bf650e36d6bed3c281a Mon Sep 17 00:00:00 2001 From: sepandhaghighi Date: Thu, 10 Dec 2020 13:59:02 +0330 Subject: [PATCH 84/95] doc : email updated --- .github/CODE_OF_CONDUCT.md | 2 +- README.md | 2 +- setup.py | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/CODE_OF_CONDUCT.md b/.github/CODE_OF_CONDUCT.md index 307932b..350d795 100644 --- a/.github/CODE_OF_CONDUCT.md +++ b/.github/CODE_OF_CONDUCT.md @@ -55,7 +55,7 @@ further defined and clarified by project maintainers. ## Enforcement Instances of abusive, harassing, or otherwise unacceptable behavior may be -reported by contacting the project team at info@moduland.ir. All +reported by contacting the project team at info@orangetool.ir. All complaints will be reviewed and investigated and will result in a response that is deemed necessary and appropriate to the circumstances. The project team is obligated to maintain confidentiality with regard to the reporter of an incident. diff --git a/README.md b/README.md index c2e01f7..c2366a4 100644 --- a/README.md +++ b/README.md @@ -275,7 +275,7 @@ orangetool.check_update() # Return True if new version is available ## Issues & Bug Reports Just fill an issue and describe it. We'll check it ASAP! -or send an email to [info@moduland.ir](mailto:info@moduland.ir "info@moduland.ir"). +or send an email to [info@orangetool.ir](mailto:info@orangetool.ir "info@orangetool.ir"). ## Dependencies diff --git a/setup.py b/setup.py index f73dab4..a758098 100644 --- a/setup.py +++ b/setup.py @@ -34,7 +34,7 @@ def read_description(): long_description=read_description(), long_description_content_type='text/markdown', author='Moduland Co', - author_email='info@moduland.ir', + author_email='info@orangetool.ir', url='https://github.com/Moduland/Orangetool', download_url='https://github.com/Moduland/Orangetool/tarball/v0.35', keywords="orangepi raspberrypi embedded-systems python", From e77b4e7be9409b9f89ee11273eab74f7295c3063 Mon Sep 17 00:00:00 2001 From: sepandhaghighi Date: Thu, 10 Dec 2020 14:02:15 +0330 Subject: [PATCH 85/95] del : FUNDING.yml removed --- .github/FUNDING.yml | 1 - CHANGELOG.md | 1 - 2 files changed, 2 deletions(-) delete mode 100644 .github/FUNDING.yml diff --git a/.github/FUNDING.yml b/.github/FUNDING.yml deleted file mode 100644 index 30a905f..0000000 --- a/.github/FUNDING.yml +++ /dev/null @@ -1 +0,0 @@ -custom: http://www.orangetool.ir/donate.html \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index d550cec..ca247ab 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,7 +6,6 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0. ## [Unreleased] ### Added -- `FUNDING.yml` - `__main__.py` - `__version__` variable - `hibernate` function From 00290857ec2970c6aaf319b12ee6f780e09c632a Mon Sep 17 00:00:00 2001 From: sepandhaghighi Date: Thu, 10 Dec 2020 14:05:59 +0330 Subject: [PATCH 86/95] fix : minor edit in orangetool_test --- orangetool/orangetool_test.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/orangetool/orangetool_test.py b/orangetool/orangetool_test.py index 8f50494..c5ac927 100644 --- a/orangetool/orangetool_test.py +++ b/orangetool/orangetool_test.py @@ -1,6 +1,7 @@ # -*- coding: utf-8 -*- """Orangetool test.""" -from orangetool import * +from orangetool import version, check_update if __name__ == "__main__": - version() \ No newline at end of file + version() + check_update() \ No newline at end of file From 20a55a50c1363dbaf60cd6df4173db299575e14f Mon Sep 17 00:00:00 2001 From: sepandhaghighi Date: Thu, 10 Dec 2020 14:08:10 +0330 Subject: [PATCH 87/95] doc : codebeat badge added to README --- README.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index c2366a4..acf1680 100644 --- a/README.md +++ b/README.md @@ -71,7 +71,8 @@ Tested on [Lubuntu](http://lubuntu.me/) - + +
Code Qualitycodebeat badge CodeFactor
From 56c141acd04b74e63f5f795e6532071193d40883 Mon Sep 17 00:00:00 2001 From: sepandhaghighi Date: Sun, 20 Dec 2020 07:30:33 +0330 Subject: [PATCH 88/95] rel : migrate to version 0.45 --- CHANGELOG.md | 4 +++- README.md | 4 ++-- orangetool/orangetool_params.py | 2 +- setup.py | 4 ++-- version_check.py | 2 +- 5 files changed, 9 insertions(+), 7 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index ca247ab..cd0a71a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,7 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html). ## [Unreleased] +## [0.45] - 2020-12-22 ### Added - `__main__.py` - `__version__` variable @@ -80,7 +81,8 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0. ### Added - Some useful scripts for Orangepi/Raspberrypi boards -[Unreleased]: https://github.com/Moduland/Orangetool/compare/v0.35...dev +[Unreleased]: https://github.com/Moduland/Orangetool/compare/v0.45...dev +[0.45]: https://github.com/Moduland/Orangetool/compare/v0.35...v0.45 [0.35]: https://github.com/Moduland/Orangetool/compare/v0.25...v0.35 [0.25]: https://github.com/Moduland/Orangetool/compare/v0.24...v0.25 [0.24]: https://github.com/Moduland/Orangetool/compare/v0.23...v0.24 diff --git a/README.md b/README.md index acf1680..dc96afd 100644 --- a/README.md +++ b/README.md @@ -84,13 +84,13 @@ By [Moduland Co](http://www.moduland.ir) ## Installation ### Source Code -- Download [Version 0.35](https://github.com/moduland/Orangetool/archive/v0.35.zip) or [Latest Source ](https://github.com/Moduland/Orangetool/archive/dev.zip) +- Download [Version 0.45](https://github.com/moduland/Orangetool/archive/v0.45.zip) or [Latest Source ](https://github.com/Moduland/Orangetool/archive/dev.zip) - `pip3 install -r requirements.txt` or `pip install -r requirements.txt` (Need root access) - `python3 setup.py install` or `python setup.py install` ### PyPI - Check [Python Packaging User Guide](https://packaging.python.org/installing/) -- `pip3 install orangetool==0.35` or `pip install orangetool==0.35` (Need root access) +- `pip3 install orangetool==0.45` or `pip install orangetool==0.45` (Need root access)
diff --git a/orangetool/orangetool_params.py b/orangetool/orangetool_params.py index 03fc8e7..e6dd0aa 100644 --- a/orangetool/orangetool_params.py +++ b/orangetool/orangetool_params.py @@ -1,7 +1,7 @@ # -*- coding: utf-8 -*- """Orangetool params.""" -ORANGETOOL_VERSION = "0.35" +ORANGETOOL_VERSION = "0.45" UPDATE_URL = "http://www.orangetool.ir/version" IP_PATTERN = r"(?:[0-9]{1,3}\.){3}[0-9]{1,3}" GLOBAL_IP_API_1 = "http://ipinfo.io/ip" diff --git a/setup.py b/setup.py index a758098..d2e45f1 100644 --- a/setup.py +++ b/setup.py @@ -29,14 +29,14 @@ def read_description(): setup( name='orangetool', packages=['orangetool'], - version='0.35', + version='0.45', description='Some useful script for Orangepi/Raspberrypi boards', long_description=read_description(), long_description_content_type='text/markdown', author='Moduland Co', author_email='info@orangetool.ir', url='https://github.com/Moduland/Orangetool', - download_url='https://github.com/Moduland/Orangetool/tarball/v0.35', + download_url='https://github.com/Moduland/Orangetool/tarball/v0.45', keywords="orangepi raspberrypi embedded-systems python", classifiers=[ 'Development Status :: 4 - Beta', diff --git a/version_check.py b/version_check.py index 2bad875..a270b78 100644 --- a/version_check.py +++ b/version_check.py @@ -4,7 +4,7 @@ import sys import codecs Failed = 0 -VERSION = "0.35" +VERSION = "0.45" SETUP_ITEMS = [ From 8f5d09e9352366c256d3727d824b30de6efbb4ab Mon Sep 17 00:00:00 2001 From: sepandhaghighi Date: Sun, 20 Dec 2020 07:39:27 +0330 Subject: [PATCH 89/95] doc : CHANGELOG updated --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index cd0a71a..10ab71f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,7 +5,7 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html). ## [Unreleased] -## [0.45] - 2020-12-22 +## [0.45] - 2020-12-23 ### Added - `__main__.py` - `__version__` variable From 911ea857942242ea2772977a3366f845cb62da6e Mon Sep 17 00:00:00 2001 From: "dependabot-preview[bot]" <27856297+dependabot-preview[bot]@users.noreply.github.com> Date: Mon, 21 Dec 2020 07:21:31 +0000 Subject: [PATCH 90/95] Bump psutil from 5.7.3 to 5.8.0 Bumps [psutil](https://github.com/giampaolo/psutil) from 5.7.3 to 5.8.0. - [Release notes](https://github.com/giampaolo/psutil/releases) - [Changelog](https://github.com/giampaolo/psutil/blob/master/HISTORY.rst) - [Commits](https://github.com/giampaolo/psutil/compare/release-5.7.3...release-5.8.0) Signed-off-by: dependabot-preview[bot] --- dev-requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dev-requirements.txt b/dev-requirements.txt index 83ae268..32de179 100644 --- a/dev-requirements.txt +++ b/dev-requirements.txt @@ -1,4 +1,4 @@ -psutil==5.7.3 +psutil==5.8.0 requests==2.25.0 art==5.1 setuptools>=40.8.0 From 48392c3863394ad9ade8e2a12b42b4ce86eee5ea Mon Sep 17 00:00:00 2001 From: "dependabot-preview[bot]" <27856297+dependabot-preview[bot]@users.noreply.github.com> Date: Mon, 21 Dec 2020 12:20:44 +0000 Subject: [PATCH 91/95] Bump requests from 2.25.0 to 2.25.1 Bumps [requests](https://github.com/psf/requests) from 2.25.0 to 2.25.1. - [Release notes](https://github.com/psf/requests/releases) - [Changelog](https://github.com/psf/requests/blob/master/HISTORY.md) - [Commits](https://github.com/psf/requests/compare/v2.25.0...v2.25.1) Signed-off-by: dependabot-preview[bot] --- dev-requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dev-requirements.txt b/dev-requirements.txt index 32de179..9be8ca1 100644 --- a/dev-requirements.txt +++ b/dev-requirements.txt @@ -1,5 +1,5 @@ psutil==5.8.0 -requests==2.25.0 +requests==2.25.1 art==5.1 setuptools>=40.8.0 vulture>=1.0 From fb23400dcb811d471daa67d7ee354bb9e168116c Mon Sep 17 00:00:00 2001 From: sepandhaghighi Date: Wed, 23 Dec 2020 20:16:56 +0330 Subject: [PATCH 92/95] doc : CHANGELOG updated --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 10ab71f..bc08445 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,7 +5,7 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html). ## [Unreleased] -## [0.45] - 2020-12-23 +## [0.45] - 2020-12-24 ### Added - `__main__.py` - `__version__` variable From 797b9dc20570697aef9d9133af9d00b282409cb1 Mon Sep 17 00:00:00 2001 From: sepandhaghighi Date: Fri, 25 Dec 2020 12:36:23 +0330 Subject: [PATCH 93/95] fix : minor edit in uptime and idletime functions --- orangetool/orangetool_system.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/orangetool/orangetool_system.py b/orangetool/orangetool_system.py index d26661b..f193353 100644 --- a/orangetool/orangetool_system.py +++ b/orangetool/orangetool_system.py @@ -84,7 +84,7 @@ def uptime(debug=False): :type debug:bool :return: system uptime as string """ - time_control(mode="uptime",debug=debug) + return time_control(mode="uptime",debug=debug) def idletime(debug=False): @@ -95,7 +95,7 @@ def idletime(debug=False): :type debug:bool :return: system idle as string """ - time_control(mode="idle", debug=debug) + return time_control(mode="idle", debug=debug) def version(): From c2f41366481d332936bd3b2a2814e2134aad3d94 Mon Sep 17 00:00:00 2001 From: sepandhaghighi Date: Fri, 25 Dec 2020 12:36:56 +0330 Subject: [PATCH 94/95] doc : CHANGELOG updated --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index bc08445..db6d39f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,7 +5,7 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html). ## [Unreleased] -## [0.45] - 2020-12-24 +## [0.45] - 2020-12-25 ### Added - `__main__.py` - `__version__` variable From b49adbe127d7954bf51452dade9ff1988a609b2b Mon Sep 17 00:00:00 2001 From: sepandhaghighi Date: Sat, 26 Dec 2020 03:09:44 +0330 Subject: [PATCH 95/95] doc : CHANGELOG updated --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index db6d39f..aade720 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,7 +5,7 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html). ## [Unreleased] -## [0.45] - 2020-12-25 +## [0.45] - 2020-12-26 ### Added - `__main__.py` - `__version__` variable